diff options
author | Devin Heitmueller <dheitmueller@linuxtv.org> | 2009-03-11 02:00:56 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:43:26 -0400 |
commit | dc8685b565d6526aca6aaefb80059d115c124821 (patch) | |
tree | 0e56cb018f4ace06cd7948b7ff2705e7deb22c52 /drivers/media/video/au0828 | |
parent | 5a5a4e16fa19fa3789398e8c707168b7da718b64 (diff) |
V4L/DVB (11074): au0828: fix i2c enumeration bug
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.
Signed-off-by: Devin Heitmueller <dheitmueller@linuxtv.org>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/au0828')
-rw-r--r-- | drivers/media/video/au0828/au0828-i2c.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/media/video/au0828/au0828-i2c.c b/drivers/media/video/au0828/au0828-i2c.c index ee3e3040d54c..d57a38f5c738 100644 --- a/drivers/media/video/au0828/au0828-i2c.c +++ b/drivers/media/video/au0828/au0828-i2c.c | |||
@@ -156,6 +156,24 @@ static int i2c_sendbytes(struct i2c_adapter *i2c_adap, | |||
156 | 156 | ||
157 | dprintk(4, "SEND: %02x\n", msg->addr); | 157 | dprintk(4, "SEND: %02x\n", msg->addr); |
158 | 158 | ||
159 | /* Deal with i2c_scan */ | ||
160 | if (msg->len == 0) { | ||
161 | /* The analog tuner detection code makes use of the SMBUS_QUICK | ||
162 | message (which involves a zero length i2c write). To avoid | ||
163 | checking the status register when we didn't strobe out any | ||
164 | actual bytes to the bus, just do a read check. This is | ||
165 | consistent with how I saw i2c device checking done in the | ||
166 | USB trace of the Windows driver */ | ||
167 | au0828_write(dev, REG_200, 0x20); | ||
168 | if (!i2c_wait_done(i2c_adap)) | ||
169 | return -EIO; | ||
170 | |||
171 | if (i2c_wait_read_ack(i2c_adap)) | ||
172 | return -EIO; | ||
173 | |||
174 | return 0; | ||
175 | } | ||
176 | |||
159 | for (i = 0; i < msg->len;) { | 177 | for (i = 0; i < msg->len;) { |
160 | 178 | ||
161 | dprintk(4, " %02x\n", msg->buf[i]); | 179 | dprintk(4, " %02x\n", msg->buf[i]); |