On Tue Nov 25 15:29:55 2025 +0100, Thorsten Schmelzer wrote:
> 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 <[email protected]>
> Signed-off-by: Michael Tretter <[email protected]>
> Signed-off-by: Hans Verkuil <[email protected]>

Patch committed.

Thanks,
Hans Verkuil

 drivers/media/i2c/adv7180.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

---

diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
index 378f4e6af12c..4152f2049a6d 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;
_______________________________________________
linuxtv-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to