All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [media] ov2640: make GPIOLIB an optional dependency
@ 2017-04-19 11:49 Mauro Carvalho Chehab
  2017-04-19 13:23 ` Pavel Machek
  0 siblings, 1 reply; 13+ messages in thread
From: Mauro Carvalho Chehab @ 2017-04-19 11:49 UTC (permalink / raw)
  Cc: Mauro Carvalho Chehab, Linux Media Mailing List,
	Mauro Carvalho Chehab, Hans Verkuil, Sakari Ailus, Pavel Machek,
	Pali Rohár, Ramiro Oliveira, Todor Tomov, Robert Jarzmik,
	Steve Longerbeam, Guennadi Liakhovetski, Hugues Fruchet,
	Bhumika Goyal

As warned by kbuild test robot:
	warning: (VIDEO_EM28XX_V4L2) selects VIDEO_OV2640 which has unmet direct dependencies (MEDIA_SUPPORT && VIDEO_V4L2 && I2C && GPIOLIB && MEDIA_CAMERA_SUPPORT)

The em28xx driver can use ov2640, but it doesn't depend
(or use) the GPIOLIB in order to power off/on the sensor.

So, as we want to allow both usages with and without
GPIOLIB, make its dependency optional.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
---
 drivers/media/i2c/Kconfig  | 2 +-
 drivers/media/i2c/ov2640.c | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index 40bb4bdc51da..fd181c99ce11 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -519,7 +519,7 @@ config VIDEO_SMIAPP_PLL
 
 config VIDEO_OV2640
 	tristate "OmniVision OV2640 sensor support"
-	depends on VIDEO_V4L2 && I2C && GPIOLIB
+	depends on VIDEO_V4L2 && I2C
 	depends on MEDIA_CAMERA_SUPPORT
 	help
 	  This is a Video4Linux2 sensor-level driver for the OmniVision
diff --git a/drivers/media/i2c/ov2640.c b/drivers/media/i2c/ov2640.c
index d55ca37dc12f..9c00ed3543f8 100644
--- a/drivers/media/i2c/ov2640.c
+++ b/drivers/media/i2c/ov2640.c
@@ -743,13 +743,16 @@ static int ov2640_s_power(struct v4l2_subdev *sd, int on)
 	struct i2c_client *client = v4l2_get_subdevdata(sd);
 	struct ov2640_priv *priv = to_ov2640(client);
 
-	gpiod_direction_output(priv->pwdn_gpio, !on);
+#ifdef CONFIG_GPIOLIB
+	if (priv->pwdn_gpio)
+		gpiod_direction_output(priv->pwdn_gpio, !on);
 	if (on && priv->resetb_gpio) {
 		/* Active the resetb pin to perform a reset pulse */
 		gpiod_direction_output(priv->resetb_gpio, 1);
 		usleep_range(3000, 5000);
 		gpiod_direction_output(priv->resetb_gpio, 0);
 	}
+#endif
 	return 0;
 }
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2017-06-19 10:48 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-19 11:49 [PATCH] [media] ov2640: make GPIOLIB an optional dependency Mauro Carvalho Chehab
2017-04-19 13:23 ` Pavel Machek
2017-04-19 14:03   ` Mauro Carvalho Chehab
2017-04-21  6:33     ` Pavel Machek
2017-04-21 14:39       ` Mauro Carvalho Chehab
2017-04-24 14:44         ` Sakari Ailus
2017-04-24 15:50           ` Mauro Carvalho Chehab
2017-04-24 17:38             ` Sakari Ailus
2017-04-24 17:50               ` Sakari Ailus
2017-04-25  2:05               ` Mauro Carvalho Chehab
2017-04-25  8:57                 ` Sakari Ailus
2017-06-19  9:50       ` Hans Verkuil
2017-06-19 10:48         ` Pavel Machek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.