@@ -472,6 +472,7 @@ struct ds5 {
472472 struct regulator * vcc ;
473473 const struct ds5_variant * variant ;
474474 int is_depth , is_y8 , is_rgb , is_imu ;
475+ bool metadata_enabled ;
475476 int aggregated ;
476477 u16 fw_version ;
477478 u16 fw_build ;
@@ -1718,7 +1719,6 @@ static int ds5_configure(struct ds5 *state)
17181719 fps_addr = DS5_DEPTH_FPS ;
17191720 width_addr = DS5_DEPTH_RES_WIDTH ;
17201721 height_addr = DS5_DEPTH_RES_HEIGHT ;
1721- md_fmt = GMSL_CSI_DT_EMBED ;
17221722 vc_id = 0 ;
17231723 } else if (state -> is_rgb ) {
17241724 sensor = & state -> rgb .sensor ;
@@ -1728,7 +1728,6 @@ static int ds5_configure(struct ds5 *state)
17281728 fps_addr = DS5_RGB_FPS ;
17291729 width_addr = DS5_RGB_RES_WIDTH ;
17301730 height_addr = DS5_RGB_RES_HEIGHT ;
1731- md_fmt = GMSL_CSI_DT_EMBED ;
17321731 vc_id = 1 ;
17331732 } else if (state -> is_y8 ) {
17341733 sensor = & state -> ir .sensor ;
@@ -1738,7 +1737,6 @@ static int ds5_configure(struct ds5 *state)
17381737 fps_addr = DS5_IR_FPS ;
17391738 width_addr = DS5_IR_RES_WIDTH ;
17401739 height_addr = DS5_IR_RES_HEIGHT ;
1741- md_fmt = GMSL_CSI_DT_EMBED ;
17421740 vc_id = 2 ;
17431741 } else if (state -> is_imu ) {
17441742 sensor = & state -> imu .sensor ;
@@ -1748,16 +1746,17 @@ static int ds5_configure(struct ds5 *state)
17481746 fps_addr = DS5_IMU_FPS ;
17491747 width_addr = DS5_IMU_RES_WIDTH ;
17501748 height_addr = DS5_IMU_RES_HEIGHT ;
1751- md_fmt = 0x0 ;
17521749 vc_id = 3 ;
17531750 } else {
17541751 return - EINVAL ;
17551752 }
17561753
1754+ md_fmt = (state -> metadata_enabled ) ? GMSL_CSI_DT_EMBED : 0x00 ;
1755+
17571756#ifdef CONFIG_VIDEO_D4XX_SERDES
17581757 data_type1 = sensor -> config .format -> data_type ;
1758+ data_type2 = md_fmt ;
17591759 is_calib = (state -> is_y8 && (data_type1 == GMSL_CSI_DT_RGB_888 ));
1760- data_type2 = (state -> is_imu || is_calib ) ? 0x00 : md_fmt ;
17611760
17621761 vc_id = state -> g_ctx .dst_vc ;
17631762 if (PIPE_NOT_CONFIGURED == sensor -> pipe_id ||
@@ -5772,6 +5771,7 @@ static int ds5_probe(struct i2c_client *c, const struct i2c_device_id *id)
57725771#ifdef CONFIG_OF
57735772 const char * str ;
57745773 uint32_t override_addr = 0 ;
5774+ struct device_node * mode0_node ;
57755775#endif
57765776 if (!state )
57775777 return - ENOMEM ;
@@ -5847,6 +5847,26 @@ static int ds5_probe(struct i2c_client *c, const struct i2c_device_id *id)
58475847 if (!ret && !strncmp (str , "IMU" , strlen ("IMU" ))) {
58485848 state -> is_imu = 1 ;
58495849 }
5850+
5851+ mode0_node = of_get_child_by_name (state -> client -> dev .of_node , "mode0" );
5852+ if (mode0_node ) {
5853+ ret = of_property_read_string (mode0_node , "embedded_metadata_height" , & str );
5854+ if (!ret && !strncmp (str , "1" , 1 )) {
5855+ state -> metadata_enabled = 1 ;
5856+ } else {
5857+ state -> metadata_enabled = 0 ;
5858+ }
5859+ of_node_put (mode0_node );
5860+ } else {
5861+ dev_err (& state -> client -> dev , "No mode0 provided\n" );
5862+ goto e_regulator ;
5863+ }
5864+
5865+ if (ret < 0 ) {
5866+ dev_err (& state -> client -> dev , "No embedded_metadata_height provided\n" );
5867+ goto e_regulator ;
5868+ }
5869+ dev_dbg (& state -> client -> dev , "metadata_enabled = %d\n" , state -> metadata_enabled );
58505870#else
58515871 state -> is_depth = 1 ;
58525872#endif
0 commit comments