diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c index 4498d14d34291b40699c7d9085d5ec66e8b27123..e98dd2bee1e517f65f0a38adee245df9020fa775 100644 --- a/drivers/media/i2c/adv7180.c +++ b/drivers/media/i2c/adv7180.c @@ -1259,6 +1259,7 @@ static const struct adv7180_chip_info adv7282_m_info = { static int init_device(struct adv7180_state *state) { int ret; + int i; mutex_lock(&state->mutex); @@ -1305,6 +1306,18 @@ static int init_device(struct adv7180_state *state) goto out_unlock; } + /* Select first valid input */ + for (i = 0; i < 32; i++) { + if (BIT(i) & state->chip_info->valid_input_mask) { + ret = state->chip_info->select_input(state, i); + + if (ret == 0) { + state->input = i; + break; + } + } + } + out_unlock: mutex_unlock(&state->mutex);