]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media: adv7180: add support for ancillary devices
authorThorsten Schmelzer <tschmelzer@topcon.com>
Tue, 25 Nov 2025 14:29:55 +0000 (15:29 +0100)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Tue, 13 Jan 2026 12:10:07 +0000 (13:10 +0100)
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 <tschmelzer@topcon.com>
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
drivers/media/i2c/adv7180.c

index 378f4e6af12cbaed46408989c5aa9d8d9f8e6354..4152f2049a6d879d0cd2001936d958e3c04c8049 100644 (file)
@@ -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;