From: Thorsten Schmelzer Date: Tue, 25 Nov 2025 14:29:55 +0000 (+0100) Subject: media: adv7180: add support for ancillary devices X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=57b96d4a23c7088127fbd228750bd0b6a1686169;p=thirdparty%2Fkernel%2Flinux.git media: adv7180: add support for ancillary devices Depending on other devices on the i2c bus, using a non-default address for the CSI and VPP devices may be necessary. Replace calls to i2c_new_dummy_device with i2c_new_ancillary_device, which can directly use an i2c address from the device tree. Program the actual addresses of the sub-devices when configuring the chip. Signed-off-by: Thorsten Schmelzer Signed-off-by: Michael Tretter Signed-off-by: Hans Verkuil --- diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c index 378f4e6af12cb..4152f2049a6d8 100644 --- a/drivers/media/i2c/adv7180.c +++ b/drivers/media/i2c/adv7180.c @@ -1066,13 +1066,13 @@ static int adv7180_select_input(struct adv7180_state *state, unsigned int input) static int adv7182_init(struct adv7180_state *state) { - if (state->chip_info->flags & ADV7180_FLAG_MIPI_CSI2) + if (state->csi_client) adv7180_write(state, ADV7180_REG_CSI_SLAVE_ADDR, - ADV7180_DEFAULT_CSI_I2C_ADDR << 1); + state->csi_client->addr << 1); - if (state->chip_info->flags & ADV7180_FLAG_I2P) + if (state->vpp_client) adv7180_write(state, ADV7180_REG_VPP_SLAVE_ADDR, - ADV7180_DEFAULT_VPP_I2C_ADDR << 1); + state->vpp_client->addr << 1); if (state->chip_info->flags & ADV7180_FLAG_V2) { /* ADI recommended writes for improved video quality */ @@ -1443,15 +1443,17 @@ static int adv7180_probe(struct i2c_client *client) state->force_bt656_4 = true; if (state->chip_info->flags & ADV7180_FLAG_MIPI_CSI2) { - state->csi_client = i2c_new_dummy_device(client->adapter, - ADV7180_DEFAULT_CSI_I2C_ADDR); + state->csi_client = + i2c_new_ancillary_device(client, "csi", + ADV7180_DEFAULT_CSI_I2C_ADDR); if (IS_ERR(state->csi_client)) return PTR_ERR(state->csi_client); } if (state->chip_info->flags & ADV7180_FLAG_I2P) { - state->vpp_client = i2c_new_dummy_device(client->adapter, - ADV7180_DEFAULT_VPP_I2C_ADDR); + state->vpp_client = + i2c_new_ancillary_device(client, "vpp", + ADV7180_DEFAULT_VPP_I2C_ADDR); if (IS_ERR(state->vpp_client)) { ret = PTR_ERR(state->vpp_client); goto err_unregister_csi_client;