summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/media/i2c/adv7180.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
index bb94b9a7b3c7..998cc56217b3 100644
--- a/drivers/media/i2c/adv7180.c
+++ b/drivers/media/i2c/adv7180.c
@@ -878,6 +878,23 @@ static int init_device(struct adv7180_state *state)
lockdep_assert_held(&state->mutex);
+ ret = adv7180_program_std(state);
+ if (ret)
+ return ret;
+
+ adv7180_set_field_mode(state);
+
+ __v4l2_ctrl_handler_setup(&state->ctrl_hdl);
+
+ return ret;
+}
+
+static int adv7180_reset_device(struct adv7180_state *state)
+{
+ int ret;
+
+ lockdep_assert_held(&state->mutex);
+
adv7180_set_power_pin(state, true);
adv7180_set_reset_pin(state, false);
@@ -895,14 +912,10 @@ static int init_device(struct adv7180_state *state)
if (ret)
return ret;
- ret = adv7180_program_std(state);
+ ret = init_device(state);
if (ret)
return ret;
- adv7180_set_field_mode(state);
-
- __v4l2_ctrl_handler_setup(&state->ctrl_hdl);
-
/* register for interrupts */
if (state->irq > 0) {
/* config the Interrupt pin to be active low */
@@ -1487,7 +1500,7 @@ static int adv7180_probe(struct i2c_client *client)
goto err_free_ctrl;
mutex_lock(&state->mutex);
- ret = init_device(state);
+ ret = adv7180_reset_device(state);
mutex_unlock(&state->mutex);
if (ret)
goto err_media_entity_cleanup;
@@ -1573,7 +1586,7 @@ static int adv7180_resume(struct device *dev)
guard(mutex)(&state->mutex);
- ret = init_device(state);
+ ret = adv7180_reset_device(state);
if (ret < 0)
return ret;