diff options
Diffstat (limited to 'drivers/media/video/em28xx/em28xx-i2c.c')
-rw-r--r-- | drivers/media/video/em28xx/em28xx-i2c.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c index 4739fc7e6eb..36f5a9bc8b7 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 | */ |
186 | static int em28xx_i2c_send_bytes(void *data, unsigned char addr, char *buf, | 185 | static 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 | ||
@@ -218,9 +227,7 @@ static int em28xx_i2c_recv_bytes(struct em28xx *dev, unsigned char addr, | |||
218 | */ | 227 | */ |
219 | static int em28xx_i2c_check_for_device(struct em28xx *dev, unsigned char addr) | 228 | static int em28xx_i2c_check_for_device(struct em28xx *dev, unsigned char addr) |
220 | { | 229 | { |
221 | char msg; | ||
222 | int ret; | 230 | int ret; |
223 | msg = addr; | ||
224 | 231 | ||
225 | ret = dev->em28xx_read_reg_req(dev, 2, addr); | 232 | ret = dev->em28xx_read_reg_req(dev, 2, addr); |
226 | if (ret < 0) { | 233 | if (ret < 0) { |
@@ -332,7 +339,9 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned char *eedata, int len) | |||
332 | struct em28xx_eeprom *em_eeprom = (void *)eedata; | 339 | struct em28xx_eeprom *em_eeprom = (void *)eedata; |
333 | int i, err, size = len, block; | 340 | int i, err, size = len, block; |
334 | 341 | ||
335 | if (dev->chip_id == CHIP_ID_EM2874 || dev->chip_id == CHIP_ID_EM28174) { | 342 | if (dev->chip_id == CHIP_ID_EM2874 || |
343 | dev->chip_id == CHIP_ID_EM28174 || | ||
344 | dev->chip_id == CHIP_ID_EM2884) { | ||
336 | /* Empia switched to a 16-bit addressable eeprom in newer | 345 | /* Empia switched to a 16-bit addressable eeprom in newer |
337 | devices. While we could certainly write a routine to read | 346 | devices. While we could certainly write a routine to read |
338 | the eeprom, there is nothing of use in there that cannot be | 347 | the eeprom, there is nothing of use in there that cannot be |