V4L/DVB (4864): TDA826x I2C read with 2 messages
authorPatrick Boettcher <pb@linuxtv.org>
Tue, 21 Nov 2006 08:35:10 +0000 (05:35 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Sun, 10 Dec 2006 11:05:02 +0000 (09:05 -0200)
Added a dump I2C message to the TDA826x-driver to fix I2C read for
identification with ttusb2-driver.

Signed-off-by: Patrick Boettcher <pb@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/dvb/frontends/tda826x.c

index 4f01d7b47cd5ead2c47b44140843ed7997b5e76e..79f971dc52b6d3bbe4a65b67df3f87744a975135 100644 (file)
@@ -132,18 +132,21 @@ struct dvb_frontend *tda826x_attach(struct dvb_frontend *fe, int addr, struct i2
 {
        struct tda826x_priv *priv = NULL;
        u8 b1 [] = { 0, 0 };
-       struct i2c_msg msg = { .addr = addr, .flags = I2C_M_RD, .buf = b1, .len = 2 };
+       struct i2c_msg msg[2] = {
+               { .addr = addr, .flags = 0,        .buf = NULL, .len = 0 },
+               { .addr = addr, .flags = I2C_M_RD, .buf = b1, .len = 2 }
+       };
        int ret;
 
        dprintk("%s:\n", __FUNCTION__);
 
        if (fe->ops.i2c_gate_ctrl)
                fe->ops.i2c_gate_ctrl(fe, 1);
-       ret = i2c_transfer (i2c, &msg, 1);
+       ret = i2c_transfer (i2c, msg, 2);
        if (fe->ops.i2c_gate_ctrl)
                fe->ops.i2c_gate_ctrl(fe, 0);
 
-       if (ret != 1)
+       if (ret != 2)
                return NULL;
        if (!(b1[1] & 0x80))
                return NULL;