@@ -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;
}
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@linaro.org> --- drivers/media/i2c/ov02c10.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)