drm/i2c: tda998x: set the CEC I2C address based on the slave I2C address
authorAndrew Jackson <Andrew.Jackson@arm.com>
Fri, 7 Nov 2014 08:31:25 +0000 (08:31 +0000)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Wed, 21 Jan 2015 14:20:11 +0000 (14:20 +0000)
The I2C address for the TDA9989 and TDA19989 is fixed at 0x34 but the
two LSBs of the TDA19988's address are set by two configuration pins
on the chip.  Irrespective of the chip, the associated CEC peripheral's
I2C address is based upon the main I2C address.

This patch avoids any special handling required to support systems that
contain multiple TDA19988 devices on the same I2C bus.

Signed-off-by: Andrew Jackson <Andrew.Jackson@arm.com>
Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
drivers/gpu/drm/i2c/tda998x_drv.c

index 98f3c4dd7375033440fa358a5ec151e8ac7b60a4..a9041d1a8ff002f332705db5d80082761788ad19 100644 (file)
@@ -1281,6 +1281,7 @@ static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv)
        struct device_node *np = client->dev.of_node;
        u32 video;
        int rev_lo, rev_hi, ret;
+       unsigned short cec_addr;
 
        priv->vip_cntrl_0 = VIP_CNTRL_0_SWAP_A(2) | VIP_CNTRL_0_SWAP_B(3);
        priv->vip_cntrl_1 = VIP_CNTRL_1_SWAP_C(0) | VIP_CNTRL_1_SWAP_D(1);
@@ -1288,7 +1289,9 @@ static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv)
 
        priv->current_page = 0xff;
        priv->hdmi = client;
-       priv->cec = i2c_new_dummy(client->adapter, 0x34);
+       /* CEC I2C address bound to TDA998x I2C addr by configuration pins */
+       cec_addr = 0x34 + (client->addr & 0x03);
+       priv->cec = i2c_new_dummy(client->adapter, cec_addr);
        if (!priv->cec)
                return -ENODEV;