aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/em28xx
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2011-07-09 18:36:11 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-07-27 16:55:49 -0400
commitbbc70e647b04dc3df1c879089a4f6b633c1952c9 (patch)
treefbf94190c9310f0f319898736c5918d76c6b76ec /drivers/media/video/em28xx
parente4f4f8758b4c3702761e46f24ee99e34823a0f28 (diff)
[media] em28xx-i2c: Add a read after I2C write
All I2C logs we got for em28xx does that. With Terratec H5, at 400MHz speed, it seems that this is required, to avoid having troubles at the I2C bus. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/em28xx')
-rw-r--r--drivers/media/video/em28xx/em28xx-i2c.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c
index 548d2df391ca..36f5a9bc8b76 100644
--- a/drivers/media/video/em28xx/em28xx-i2c.c
+++ b/drivers/media/video/em28xx/em28xx-i2c.c
@@ -181,16 +181,25 @@ static int em2800_i2c_recv_bytes(struct em28xx *dev, unsigned char addr,
181 181
182/* 182/*
183 * em28xx_i2c_send_bytes() 183 * em28xx_i2c_send_bytes()
184 * untested for more than 4 bytes
185 */ 184 */
186static int em28xx_i2c_send_bytes(void *data, unsigned char addr, char *buf, 185static int em28xx_i2c_send_bytes(void *data, unsigned char addr, char *buf,
187 short len, int stop) 186 short len, int stop)
188{ 187{
189 int wrcount = 0; 188 int wrcount = 0;
190 struct em28xx *dev = (struct em28xx *)data; 189 struct em28xx *dev = (struct em28xx *)data;
190 int write_timeout, ret;
191 191
192 wrcount = dev->em28xx_write_regs_req(dev, stop ? 2 : 3, addr, buf, len); 192 wrcount = dev->em28xx_write_regs_req(dev, stop ? 2 : 3, addr, buf, len);
193 193
194 /* Seems to be required after a write */
195 for (write_timeout = EM2800_I2C_WRITE_TIMEOUT; write_timeout > 0;
196 write_timeout -= 5) {
197 ret = dev->em28xx_read_reg(dev, 0x05);
198 if (!ret)
199 break;
200 msleep(5);
201 }
202
194 return wrcount; 203 return wrcount;
195} 204}
196 205