diff mbox series

[05/11] media: atomisp-ov2680: Move ov2680_init_registers() call to power_up()

Message ID 20211107171549.267583-6-hdegoede@redhat.com (mailing list archive)
State New, archived
Headers show
Series media: atomisp-ov2680: Cleanups and exposure + gain fixes | expand

Commit Message

Hans de Goede Nov. 7, 2021, 5:15 p.m. UTC
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(-)
diff mbox series

Patch

diff --git a/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c b/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c
index b6927f9be022..83608ba4e70a 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c
@@ -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);