summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/au0828
diff options
context:
space:
mode:
authorDevin Heitmueller <dheitmueller@linuxtv.org>2009-03-11 02:00:56 -0400
committerDevin Heitmueller <dheitmueller@linuxtv.org>2009-03-11 02:00:56 -0400
commit410e73da32e723f9ec79be9d6940568dec36c828 (patch)
treee37ea764ddad8c9076bfb5696a5310e62eab79f0 /linux/drivers/media/video/au0828
parent5f01441f863dd75318eba7d46e33689605a7b68a (diff)
downloadmediapointer-dvb-s2-410e73da32e723f9ec79be9d6940568dec36c828.tar.gz
mediapointer-dvb-s2-410e73da32e723f9ec79be9d6940568dec36c828.tar.bz2
au0828: fix i2c enumeration bug
From: Devin Heitmueller <dheitmueller@linuxtv.org> There was a bug where enumerating the i2c for devices would result in false positives. The root of the issue was the scanning was using SMBUS_QUICK messages, which are zero length write requests (which our i2c adapter implementation didn't handle). Because we never strobed any bytes onto the bus, the status register would still contain the value from the previous request. Thanks to Michael Krufky <mkrufky@linuxtv.org> and Steven Toth <stoth@linuxtv.org> for providing sample hardware, engineering level support, and testing. Priority: normal Signed-off-by: Devin Heitmueller <dheitmueller@linuxtv.org> Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Diffstat (limited to 'linux/drivers/media/video/au0828')
-rw-r--r--linux/drivers/media/video/au0828/au0828-i2c.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/linux/drivers/media/video/au0828/au0828-i2c.c b/linux/drivers/media/video/au0828/au0828-i2c.c
index 243e98b1d..bf0906b52 100644
--- a/linux/drivers/media/video/au0828/au0828-i2c.c
+++ b/linux/drivers/media/video/au0828/au0828-i2c.c
@@ -157,6 +157,24 @@ static int i2c_sendbytes(struct i2c_adapter *i2c_adap,
dprintk(4, "SEND: %02x\n", msg->addr);
+ /* Deal with i2c_scan */
+ if (msg->len == 0) {
+ /* The analog tuner detection code makes use of the SMBUS_QUICK
+ message (which involves a zero length i2c write). To avoid
+ checking the status register when we didn't strobe out any
+ actual bytes to the bus, just do a read check. This is
+ consistent with how I saw i2c device checking done in the
+ USB trace of the Windows driver */
+ au0828_write(dev, REG_200, 0x20);
+ if (!i2c_wait_done(i2c_adap))
+ return -EIO;
+
+ if (i2c_wait_read_ack(i2c_adap))
+ return -EIO;
+
+ return 0;
+ }
+
for (i = 0; i < msg->len;) {
dprintk(4, " %02x\n", msg->buf[i]);