Skip to contentSkip to conversation

media: i2c: tweak Kconfig dependencies

PATCH In review Akinobu Mita 3 participants 8 messages Feb 8, 2019 – Feb 9, 2019 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover media: i2c: tweak Kconfig dependencies

This patch series improves Kconfig dependencies for some camera sensor drivers.

Akinobu Mita (4):
media: ov2640: add VIDEO_V4L2_SUBDEV_API dependency
media: mt9m111: add VIDEO_V4L2_SUBDEV_API dependency
media: i2c: add missing MEDIA_CAMERA_SUPPORT
media: i2c: remove redundant MEDIA_CONTROLLER dependency

 drivers/media/i2c/Kconfig        | 18 +++++++++---------
 drivers/media/i2c/et8ek8/Kconfig |  1 +
 drivers/media/i2c/mt9m111.c      | 13 +------------
 drivers/media/i2c/ov2640.c       | 12 ++----------
 4 files changed, 13 insertions(+), 31 deletions(-)
Cc Marco Felsch <[email protected]>
Cc Sakari Ailus <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/4 media: ov2640: add VIDEO_V4L2_SUBDEV_API dependency

This driver currently supports MC and V4L2 sub-device uAPI, so add related dependency and remove unneeded ifdefs.

Just adding VIDEO_V4L2_SUBDEV_API dependency is enough, because VIDEO_V4L2_SUBDEV_API depends on MEDIA_CONTROLLER.

Cc Sakari Ailus <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
---
 drivers/media/i2c/Kconfig  |  2 +-
 drivers/media/i2c/ov2640.c | 12 ++----------
 2 files changed, 3 insertions(+), 11 deletions(-)
drivers/media/i2c/Kconfig +1 -1
index be8166d..12d7e52 100644
@@ -652,7 +652,7 @@ config VIDEO_IMX355
 
 config VIDEO_OV2640
 	tristate "OmniVision OV2640 sensor support"
-	depends on VIDEO_V4L2 && I2C
+	depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
 	depends on MEDIA_CAMERA_SUPPORT
 	help
 	  This is a Video4Linux2 sensor driver for the OmniVision
drivers/media/i2c/ov2640.c +2 -10
index 83031cf..22782e62 100644
@@ -298,9 +298,7 @@ struct ov2640_win_size {
 
 struct ov2640_priv {
 	struct v4l2_subdev		subdev;
-#if defined(CONFIG_MEDIA_CONTROLLER)
 	struct media_pad pad;
-#endif
 	struct v4l2_ctrl_handler	hdl;
 	u32	cfmt_code;
 	struct clk			*clk;
@@ -927,13 +925,9 @@ static int ov2640_get_fmt(struct v4l2_subdev *sd,
 		return -EINVAL;
 
 	if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
-#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
 		mf = v4l2_subdev_get_try_format(sd, cfg, 0);
 		format->format = *mf;
 		return 0;
-#else
-		return -ENOTTY;
-#endif
 	}
 
 	mf->width	= priv->win->width;
@@ -1010,7 +1004,6 @@ static int ov2640_set_fmt(struct v4l2_subdev *sd,
 static int ov2640_init_cfg(struct v4l2_subdev *sd,
 			   struct v4l2_subdev_pad_config *cfg)
 {
-#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
 	struct v4l2_mbus_framefmt *try_fmt =
 		v4l2_subdev_get_try_format(sd, cfg, 0);
 	const struct ov2640_win_size *win =
@@ -1024,7 +1017,7 @@ static int ov2640_init_cfg(struct v4l2_subdev *sd,
 	try_fmt->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT;
 	try_fmt->quantization = V4L2_QUANTIZATION_DEFAULT;
 	try_fmt->xfer_func = V4L2_XFER_FUNC_DEFAULT;
-#endif
+
 	return 0;
 }
 
@@ -1245,13 +1238,12 @@ static int ov2640_probe(struct i2c_client *client,
 		ret = priv->hdl.error;
 		goto err_hdl;
 	}
-#if defined(CONFIG_MEDIA_CONTROLLER)
+
 	priv->pad.flags = MEDIA_PAD_FL_SOURCE;
 	priv->subdev.entity.function = MEDIA_ENT_F_CAM_SENSOR;
 	ret = media_entity_pads_init(&priv->subdev.entity, 1, &priv->pad);
 	if (ret < 0)
 		goto err_hdl;
-#endif
 
 	ret = ov2640_video_probe(client);
 	if (ret < 0)
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/4 media: mt9m111: add VIDEO_V4L2_SUBDEV_API dependency

In reply to Akinobu Mita

This driver currently supports MC and V4L2 sub-device uAPI, so add related dependency and remove unneeded ifdefs.

Just adding VIDEO_V4L2_SUBDEV_API dependency is enough, because VIDEO_V4L2_SUBDEV_API depends on MEDIA_CONTROLLER.

Cc Enrico Scholz <[email protected]>
Cc Michael Grzeschik <[email protected]>
Cc Marco Felsch <[email protected]>
Cc Sakari Ailus <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
---
 drivers/media/i2c/Kconfig   |  2 +-
 drivers/media/i2c/mt9m111.c | 13 +------------
 2 files changed, 2 insertions(+), 13 deletions(-)
drivers/media/i2c/Kconfig +1 -1
index 12d7e52..71c7433 100644
@@ -876,7 +876,7 @@ config VIDEO_MT9M032
 
 config VIDEO_MT9M111
 	tristate "mt9m111, mt9m112 and mt9m131 support"
-	depends on I2C && VIDEO_V4L2
+	depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
 	select V4L2_FWNODE
 	help
 	  This driver supports MT9M111, MT9M112 and MT9M131 cameras from
drivers/media/i2c/mt9m111.c +1 -12
index 5168bb5..55e2f46 100644
@@ -246,9 +246,7 @@ struct mt9m111 {
 	bool is_streaming;
 	/* user point of view - 0: falling 1: rising edge */
 	unsigned int pclk_sample:1;
-#ifdef CONFIG_MEDIA_CONTROLLER
 	struct media_pad pad;
-#endif
 };
 
 static const struct mt9m111_mode_info mt9m111_mode_data[MT9M111_NUM_MODES] = {
@@ -529,13 +527,9 @@ static int mt9m111_get_fmt(struct v4l2_subdev *sd,
 		return -EINVAL;
 
 	if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
-#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
 		mf = v4l2_subdev_get_try_format(sd, cfg, format->pad);
 		format->format = *mf;
 		return 0;
-#else
-		return -ENOTTY;
-#endif
 	}
 
 	mf->width	= mt9m111->width;
@@ -1109,7 +1103,6 @@ static int mt9m111_s_stream(struct v4l2_subdev *sd, int enable)
 static int mt9m111_init_cfg(struct v4l2_subdev *sd,
 			    struct v4l2_subdev_pad_config *cfg)
 {
-#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
 	struct v4l2_mbus_framefmt *format =
 		v4l2_subdev_get_try_format(sd, cfg, 0);
 
@@ -1121,7 +1114,7 @@ static int mt9m111_init_cfg(struct v4l2_subdev *sd,
 	format->ycbcr_enc	= V4L2_YCBCR_ENC_DEFAULT;
 	format->quantization	= V4L2_QUANTIZATION_DEFAULT;
 	format->xfer_func	= V4L2_XFER_FUNC_DEFAULT;
-#endif
+
 	return 0;
 }
 
@@ -1293,13 +1286,11 @@ static int mt9m111_probe(struct i2c_client *client,
 		goto out_clkput;
 	}
 
-#ifdef CONFIG_MEDIA_CONTROLLER
 	mt9m111->pad.flags = MEDIA_PAD_FL_SOURCE;
 	mt9m111->subdev.entity.function = MEDIA_ENT_F_CAM_SENSOR;
 	ret = media_entity_pads_init(&mt9m111->subdev.entity, 1, &mt9m111->pad);
 	if (ret < 0)
 		goto out_hdlfree;
-#endif
 
 	mt9m111->current_mode = &mt9m111_mode_data[MT9M111_MODE_SXGA_15FPS];
 	mt9m111->frame_interval.numerator = 1;
@@ -1328,10 +1319,8 @@ static int mt9m111_probe(struct i2c_client *client,
 	return 0;
 
 out_entityclean:
-#ifdef CONFIG_MEDIA_CONTROLLER
 	media_entity_cleanup(&mt9m111->subdev.entity);
 out_hdlfree:
-#endif
 	v4l2_ctrl_handler_free(&mt9m111->hdl);
 out_clkput:
 	v4l2_clk_put(mt9m111->clk);
Signature · 1 line
2.7.4

A message that is not in the archive (sent off-list or not yet received): 201902090047.fTZ02W0h%[email protected]

#4 lore raw

Re: [PATCH 2/4] media: mt9m111: add VIDEO_V4L2_SUBDEV_API dependency

2019年2月9日(土) 1:20 kbuild test robot <[email protected]>:

Quoted 5 lines

Hi Akinobu,

I love your patch! Yet something to improve:

Quoted 8 lines

[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on next-20190208]
[cannot apply to v5.0-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Akinobu-Mita/media-i2c-tweak-Kconfig-dependencies/20190208-233718
base:   git://linuxtv.org/media_tree.git master
config: i386-randconfig-x019-201905 (attached as .config)

Ah, SOC_CAMERA_MT9M111 implicitly selects VIDEO_MT9M111 and in this case, VIDEO_V4L2_SUBDEV_API is not required.

This build error can be fixed by removing SOC_CAMERA_MT9M111 from drivers/media/i2c/soc_camera/Kconfig.

maintainer
#5 lore raw

Re: [PATCH 2/4] media: mt9m111: add VIDEO_V4L2_SUBDEV_API dependency

Quoted 15 lines · Akinobu Mita

2019年2月9日(土) 1:20 kbuild test robot <[email protected]>:

Quoted 5 lines

Hi Akinobu,

I love your patch! Yet something to improve:

Quoted 8 lines

[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on next-20190208]
[cannot apply to v5.0-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Akinobu-Mita/media-i2c-tweak-Kconfig-dependencies/20190208-233718
base:   git://linuxtv.org/media_tree.git master
config: i386-randconfig-x019-201905 (attached as .config)
Quoted 5 lines

Ah, SOC_CAMERA_MT9M111 implicitly selects VIDEO_MT9M111 and in this case, VIDEO_V4L2_SUBDEV_API is not required.

This build error can be fixed by removing SOC_CAMERA_MT9M111 from drivers/media/i2c/soc_camera/Kconfig.

Ah, thanks, I was wondering what this could have been about. :-) I'll send a patch.

Signature · 2 lines
Sakari Ailus
[email protected]
#6 lore raw

Re: [PATCH 2/4] media: mt9m111: add VIDEO_V4L2_SUBDEV_API dependency

In reply to Akinobu Mita
I love your patch! Yet something to improve:

Hi Akinobu,

I love your patch! Yet something to improve:

[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on next-20190208]
[cannot apply to v5.0-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Akinobu-Mita/media-i2c-tweak-Kconfig-dependencies/20190208-233718
base:   git://linuxtv.org/media_tree.git master
config: i386-randconfig-x0-02100114 (attached as .config)
compiler: gcc-5 (Debian 5.5.0-3) 5.4.1 20171010
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All error/warnings (new ones prefixed by >>):

drivers/media/i2c/mt9m111.c: In function 'mt9m111_get_fmt':

>> drivers/media/i2c/mt9m111.c:530:8: error: implicit declaration of function 'v4l2_subdev_get_try_format' [-Werror=implicit-function-declaration]
      mf = v4l2_subdev_get_try_format(sd, cfg, format->pad);
           ^
>> drivers/media/i2c/mt9m111.c:530:6: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
      mf = v4l2_subdev_get_try_format(sd, cfg, format->pad);
         ^
   drivers/media/i2c/mt9m111.c: In function 'mt9m111_init_cfg':
>> drivers/media/i2c/mt9m111.c:1107:3: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
      v4l2_subdev_get_try_format(sd, cfg, 0);
      ^
   drivers/media/i2c/mt9m111.c: In function 'mt9m111_probe':
   drivers/media/i2c/mt9m111.c:1290:17: error: 'struct v4l2_subdev' has no member named 'entity'
     mt9m111->subdev.entity.function = MEDIA_ENT_F_CAM_SENSOR;
                    ^
   drivers/media/i2c/mt9m111.c:1291:47: error: 'struct v4l2_subdev' has no member named 'entity'
     ret = media_entity_pads_init(&mt9m111->subdev.entity, 1, &mt9m111->pad);
                                                  ^

cc1: some warnings being treated as errors

vim +/v4l2_subdev_get_try_format +530 drivers/media/i2c/mt9m111.c

6a6c8786 drivers/media/video/mt9m111.c          Guennadi Liakhovetski 2009-08-25  518  
da298c6d drivers/media/i2c/soc_camera/mt9m111.c Hans Verkuil          2015-04-09  519  static int mt9m111_get_fmt(struct v4l2_subdev *sd,
da298c6d drivers/media/i2c/soc_camera/mt9m111.c Hans Verkuil          2015-04-09  520  		struct v4l2_subdev_pad_config *cfg,
da298c6d drivers/media/i2c/soc_camera/mt9m111.c Hans Verkuil          2015-04-09  521  		struct v4l2_subdev_format *format)
6a6c8786 drivers/media/video/mt9m111.c          Guennadi Liakhovetski 2009-08-25  522  {
da298c6d drivers/media/i2c/soc_camera/mt9m111.c Hans Verkuil          2015-04-09  523  	struct v4l2_mbus_framefmt *mf = &format->format;
2768cbbb drivers/media/video/mt9m111.c          Guennadi Liakhovetski 2011-06-07  524  	struct mt9m111 *mt9m111 = container_of(sd, struct mt9m111, subdev);
6a6c8786 drivers/media/video/mt9m111.c          Guennadi Liakhovetski 2009-08-25  525  
da298c6d drivers/media/i2c/soc_camera/mt9m111.c Hans Verkuil          2015-04-09  526  	if (format->pad)
da298c6d drivers/media/i2c/soc_camera/mt9m111.c Hans Verkuil          2015-04-09  527  		return -EINVAL;
da298c6d drivers/media/i2c/soc_camera/mt9m111.c Hans Verkuil          2015-04-09  528  
49410d3a drivers/media/i2c/mt9m111.c            Akinobu Mita          2019-01-15  529  	if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
49410d3a drivers/media/i2c/mt9m111.c            Akinobu Mita          2019-01-15 @530  		mf = v4l2_subdev_get_try_format(sd, cfg, format->pad);
49410d3a drivers/media/i2c/mt9m111.c            Akinobu Mita          2019-01-15  531  		format->format = *mf;
49410d3a drivers/media/i2c/mt9m111.c            Akinobu Mita          2019-01-15  532  		return 0;
49410d3a drivers/media/i2c/mt9m111.c            Akinobu Mita          2019-01-15  533  	}
49410d3a drivers/media/i2c/mt9m111.c            Akinobu Mita          2019-01-15  534  
da673e60 drivers/media/video/mt9m111.c          Guennadi Liakhovetski 2011-11-04  535  	mf->width	= mt9m111->width;
da673e60 drivers/media/video/mt9m111.c          Guennadi Liakhovetski 2011-11-04  536  	mf->height	= mt9m111->height;
760697be drivers/media/video/mt9m111.c          Guennadi Liakhovetski 2009-12-11  537  	mf->code	= mt9m111->fmt->code;
01f5a394 drivers/media/video/mt9m111.c          Michael Grzeschik     2010-08-03  538  	mf->colorspace	= mt9m111->fmt->colorspace;
760697be drivers/media/video/mt9m111.c          Guennadi Liakhovetski 2009-12-11  539  	mf->field	= V4L2_FIELD_NONE;
2e1566ab drivers/media/i2c/mt9m111.c            Akinobu Mita          2019-01-15  540  	mf->ycbcr_enc	= V4L2_YCBCR_ENC_DEFAULT;
2e1566ab drivers/media/i2c/mt9m111.c            Akinobu Mita          2019-01-15  541  	mf->quantization	= V4L2_QUANTIZATION_DEFAULT;
2e1566ab drivers/media/i2c/mt9m111.c            Akinobu Mita          2019-01-15  542  	mf->xfer_func	= V4L2_XFER_FUNC_DEFAULT;
6a6c8786 drivers/media/video/mt9m111.c          Guennadi Liakhovetski 2009-08-25  543  
6a6c8786 drivers/media/video/mt9m111.c          Guennadi Liakhovetski 2009-08-25  544  	return 0;
6a6c8786 drivers/media/video/mt9m111.c          Guennadi Liakhovetski 2009-08-25  545  }
6a6c8786 drivers/media/video/mt9m111.c          Guennadi Liakhovetski 2009-08-25  546  

:::::: The code at line 530 was first introduced by commit
:::::: 49410d3abf4492d8be1e6ce6e8ece0e16407f22d media: mt9m111: make SUBDEV_G_FMT ioctl work with SUBDEV_FORMAT_TRY

:::::: TO: Akinobu Mita <[email protected]> :::::: CC: Mauro Carvalho Chehab <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#7 lore raw

PATCH 3/4 media: i2c: add missing MEDIA_CAMERA_SUPPORT

In reply to Akinobu Mita

The camera sensor drivers should depend on MEDIA_CAMERA_SUPPORT so that we don't see unnecessary menu options.

Cc Sakari Ailus <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
---
 drivers/media/i2c/Kconfig        | 4 ++++
 drivers/media/i2c/et8ek8/Kconfig | 1 +
 2 files changed, 5 insertions(+)
drivers/media/i2c/Kconfig +4 -0
index 71c7433..73eeb17 100644
@@ -823,6 +823,7 @@ config VIDEO_OV7740
 config VIDEO_OV9650
 	tristate "OmniVision OV9650/OV9652 sensor support"
 	depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
+	depends on MEDIA_CAMERA_SUPPORT
 	select REGMAP_SCCB
 	---help---
 	  This is a V4L2 sensor driver for the Omnivision
@@ -877,6 +878,7 @@ config VIDEO_MT9M032
 config VIDEO_MT9M111
 	tristate "mt9m111, mt9m112 and mt9m131 support"
 	depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
+	depends on MEDIA_CAMERA_SUPPORT
 	select V4L2_FWNODE
 	help
 	  This driver supports MT9M111, MT9M112 and MT9M131 cameras from
@@ -986,6 +988,7 @@ config VIDEO_S5K6A3
 config VIDEO_S5K4ECGX
 	tristate "Samsung S5K4ECGX sensor support"
 	depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
+	depends on MEDIA_CAMERA_SUPPORT
 	select CRC32
 	---help---
 	  This is a V4L2 sensor driver for Samsung S5K4ECGX 5M
@@ -994,6 +997,7 @@ config VIDEO_S5K4ECGX
 config VIDEO_S5K5BAF
 	tristate "Samsung S5K5BAF sensor support"
 	depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
+	depends on MEDIA_CAMERA_SUPPORT
 	select V4L2_FWNODE
 	---help---
 	  This is a V4L2 sensor driver for Samsung S5K5BAF 2M
drivers/media/i2c/et8ek8/Kconfig +1 -0
index 9fe409e..14b6732 100644
@@ -1,6 +1,7 @@
 config VIDEO_ET8EK8
 	tristate "ET8EK8 camera sensor support"
 	depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
+	depends on MEDIA_CAMERA_SUPPORT
 	select V4L2_FWNODE
 	---help---
 	  This is a driver for the Toshiba ET8EK8 5 MP camera sensor.
Signature · 1 line
2.7.4
#8 lore raw

PATCH 4/4 media: i2c: remove redundant MEDIA_CONTROLLER dependency

In reply to Akinobu Mita

VIDEO_V4L2_SUBDEV_API depends on MEDIA_CONTROLLER, so depending on both two is redundant.

Cc Sakari Ailus <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
---
 drivers/media/i2c/Kconfig | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/media/i2c/Kconfig +3 -7
index 73eeb17..32f7011 100644
@@ -329,8 +329,7 @@ config VIDEO_AD5820
 
 config VIDEO_AK7375
 	tristate "AK7375 lens voice coil support"
-	depends on I2C && VIDEO_V4L2 && MEDIA_CONTROLLER
-	depends on VIDEO_V4L2_SUBDEV_API
+	depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
 	help
 	  This is a driver for the AK7375 camera lens voice coil.
 	  AK7375 is a 12 bit DAC with 120mA output current sink
@@ -339,8 +338,7 @@ config VIDEO_AK7375
 
 config VIDEO_DW9714
 	tristate "DW9714 lens voice coil support"
-	depends on I2C && VIDEO_V4L2 && MEDIA_CONTROLLER
-	depends on VIDEO_V4L2_SUBDEV_API
+	depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
 	---help---
 	  This is a driver for the DW9714 camera lens voice coil.
 	  DW9714 is a 10 bit DAC with 120mA output current sink
@@ -349,8 +347,7 @@ config VIDEO_DW9714
 
 config VIDEO_DW9807_VCM
 	tristate "DW9807 lens voice coil support"
-	depends on I2C && VIDEO_V4L2 && MEDIA_CONTROLLER
-	depends on VIDEO_V4L2_SUBDEV_API
+	depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
 	---help---
 	  This is a driver for the DW9807 camera lens voice coil.
 	  DW9807 is a 10 bit DAC with 100mA output current sink
@@ -747,7 +744,6 @@ config VIDEO_OV5670
 	tristate "OmniVision OV5670 sensor support"
 	depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
 	depends on MEDIA_CAMERA_SUPPORT
-	depends on MEDIA_CONTROLLER
 	select V4L2_FWNODE
 	---help---
 	  This is a Video4Linux2 sensor driver for the OmniVision
Signature · 1 line
2.7.4