media: adv748x: afe: Select input port when device is reset
authorNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Sun, 22 Nov 2020 16:36:35 +0000 (17:36 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thu, 3 Dec 2020 06:47:23 +0000 (07:47 +0100)
It's not enough to select the AFE input port during probe: it also needs
to be set when the device is reset. Move the port selection to
adv748x_reset() that is called during probe and when the device needs to
be reset.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/i2c/adv748x/adv748x-afe.c
drivers/media/i2c/adv748x/adv748x-core.c
drivers/media/i2c/adv748x/adv748x.h

index dbbb1e4..4052cf6 100644 (file)
@@ -154,7 +154,7 @@ static void adv748x_afe_set_video_standard(struct adv748x_state *state,
                   (sdpstd & 0xf) << ADV748X_SDP_VID_SEL_SHIFT);
 }
 
-static int adv748x_afe_s_input(struct adv748x_afe *afe, unsigned int input)
+int adv748x_afe_s_input(struct adv748x_afe *afe, unsigned int input)
 {
        struct adv748x_state *state = adv748x_afe_to_state(afe);
 
@@ -520,10 +520,6 @@ int adv748x_afe_init(struct adv748x_afe *afe)
                }
        }
 
-       adv748x_afe_s_input(afe, afe->input);
-
-       adv_dbg(state, "AFE Default input set to %d\n", afe->input);
-
        /* Entity pads and sinks are 0-indexed to match the pads */
        for (i = ADV748X_AFE_SINK_AIN0; i <= ADV748X_AFE_SINK_AIN7; i++)
                afe->pads[i].flags = MEDIA_PAD_FL_SINK;
index 00966fe..8676ad2 100644 (file)
@@ -516,6 +516,10 @@ static int adv748x_reset(struct adv748x_state *state)
        if (ret)
                return ret;
 
+       adv748x_afe_s_input(&state->afe, state->afe.input);
+
+       adv_dbg(state, "AFE Default input set to %d\n", state->afe.input);
+
        /* Reset TXA and TXB */
        adv748x_tx_power(&state->txa, 1);
        adv748x_tx_power(&state->txa, 0);
index 1061f42..747947e 100644 (file)
@@ -435,6 +435,7 @@ int adv748x_tx_power(struct adv748x_csi2 *tx, bool on);
 
 int adv748x_afe_init(struct adv748x_afe *afe);
 void adv748x_afe_cleanup(struct adv748x_afe *afe);
+int adv748x_afe_s_input(struct adv748x_afe *afe, unsigned int input);
 
 int adv748x_csi2_init(struct adv748x_state *state, struct adv748x_csi2 *tx);
 void adv748x_csi2_cleanup(struct adv748x_csi2 *tx);