Set the CEC I2C address based on the slave I2C address.
authorLiviu Dudau <Liviu.Dudau@arm.com>
Wed, 13 Aug 2014 13:28:45 +0000 (14:28 +0100)
committerLiviu Dudau <Liviu.Dudau@arm.com>
Wed, 13 Aug 2014 16:34:16 +0000 (17:34 +0100)
The two LSBs of the TDA998x's I2C address are set by pins
on the chip. The associated CEC peripheral's I2C address
is set in the same way, so base the CEC address on that
of the slave's address.

Signed-off-by: Andrew Jackson <Andrew.Jackson@arm.com>
Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
drivers/gpu/drm/i2c/tda998x_drv.c

index 514e509..db5440d 100644 (file)
@@ -1234,6 +1234,7 @@ tda998x_encoder_init(struct i2c_client *client,
        struct device_node *np = client->dev.of_node;
        u32 video;
        int rev_lo, rev_hi, ret;
+       unsigned short cec_addr;
 
        priv = kzalloc(sizeof(*priv), GFP_KERNEL);
        if (!priv)
@@ -1245,9 +1246,9 @@ tda998x_encoder_init(struct i2c_client *client,
 
        priv->current_page = 0xff;
        priv->hdmi = client;
-       priv->cec = i2c_new_dummy(client->adapter, 0x34);
-       if (!priv->cec)
-               priv->cec = i2c_new_dummy(client->adapter, 0x35);
+       /* CEC I2C address is bound to TDA998x I2C address by configuration pins */
+       cec_addr = 0x34 + (client->addr & 3);
+       priv->cec = i2c_new_dummy(client->adapter, cec_addr);
        if (!priv->cec) {
                kfree(priv);
                return -ENODEV;