[PATCH 2/4] media: i2c: ov02c10: Make reset gpio logic optional

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The reset gpio is optional. Only trigger the reset logic if the reset gpio
pin is valid.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@xxxxxxxxxx>
---
 drivers/media/i2c/ov02c10.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/media/i2c/ov02c10.c b/drivers/media/i2c/ov02c10.c
index f6542cdf7472..595998e60b22 100644
--- a/drivers/media/i2c/ov02c10.c
+++ b/drivers/media/i2c/ov02c10.c
@@ -664,7 +664,8 @@ static int ov02c10_power_off(struct device *dev)
 	struct v4l2_subdev *sd = dev_get_drvdata(dev);
 	struct ov02c10 *ov02c10 = to_ov02c10(sd);
 
-	gpiod_set_value_cansleep(ov02c10->reset, 1);
+	if (ov02c10->reset)
+		gpiod_set_value_cansleep(ov02c10->reset, 1);
 
 	regulator_bulk_disable(ARRAY_SIZE(ov02c10_supply_names),
 			       ov02c10->supplies);
@@ -694,8 +695,10 @@ static int ov02c10_power_on(struct device *dev)
 		return ret;
 	}
 
-	gpiod_set_value_cansleep(ov02c10->reset, 0);
-	usleep_range(1500, 1800);
+	if (ov02c10->reset) {
+		gpiod_set_value_cansleep(ov02c10->reset, 0);
+		usleep_range(1500, 1800);
+	}
 
 	return 0;
 }
-- 
2.48.1





[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux