@@ -744,9 +744,15 @@ static int power_up(struct v4l2_subdev *sd)
/* according to DS, 20ms is needed between PWDN and i2c access */
msleep(20);
+ ret = ov2680_init_registers(sd);
+ if (ret)
+ goto fail_init_registers;
+
dev->power_on = true;
return 0;
+fail_init_registers:
+ dev->platform_data->flisclk_ctrl(sd, 0);
fail_clk:
gpio_ctrl(sd, 0);
fail_power:
@@ -807,8 +813,6 @@ static int ov2680_s_power(struct v4l2_subdev *sd, int on)
ret = power_down(sd);
} else {
ret = power_up(sd);
- if (!ret)
- ret = ov2680_init_registers(sd);
}
mutex_unlock(&dev->input_lock);
Move ov2680_init_registers() call to power_up(), so that we also init the registers on code-paths which do not call ov2680_s_power() like running camorama. Signed-off-by: Hans de Goede <hdegoede@redhat.com> --- Note we should really look into makeing sure that s_power() is always called when it should and remove the power_up() call from ov2680_set_fmt() when that is done. Even then we still need the power_on bool though since power_down() gets called on every runtime-suspend, even if power_up() was never called. --- drivers/staging/media/atomisp/i2c/atomisp-ov2680.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)