diff options
author | Igor M. Liplianin <liplianin@me.by> | 2010-01-17 09:15:06 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-02-26 13:10:41 -0500 |
commit | ed7c847aef137a5e1f5de0eac0ad2c03e183839d (patch) | |
tree | 72dc47ab157867f474f7096e8a125a15e413d7e6 /drivers/media/dvb/dm1105/dm1105.c | |
parent | 8f50a3ee726b682f7481d29883d768bbd027788a (diff) |
V4L/DVB: dm1105: connect splitted else-if statements
Signed-off-by: Igor M. Liplianin <liplianin@me.by>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/dm1105/dm1105.c')
-rw-r--r-- | drivers/media/dvb/dm1105/dm1105.c | 66 |
1 files changed, 32 insertions, 34 deletions
diff --git a/drivers/media/dvb/dm1105/dm1105.c b/drivers/media/dvb/dm1105/dm1105.c index 033e1f356742..cc6577c4c12b 100644 --- a/drivers/media/dvb/dm1105/dm1105.c +++ b/drivers/media/dvb/dm1105/dm1105.c | |||
@@ -346,41 +346,19 @@ static int dm1105_i2c_xfer(struct i2c_adapter *i2c_adap, | |||
346 | goto err; | 346 | goto err; |
347 | msgs[i].buf[byte] = rc; | 347 | msgs[i].buf[byte] = rc; |
348 | } | 348 | } |
349 | } else { | 349 | } else if ((msgs[i].buf[0] == 0xf7) && (msgs[i].addr == 0x55)) { |
350 | if ((msgs[i].buf[0] == 0xf7) && (msgs[i].addr == 0x55)) { | 350 | /* prepaired for cx24116 firmware */ |
351 | /* prepaired for cx24116 firmware */ | 351 | /* Write in small blocks */ |
352 | /* Write in small blocks */ | 352 | len = msgs[i].len - 1; |
353 | len = msgs[i].len - 1; | 353 | k = 1; |
354 | k = 1; | 354 | do { |
355 | do { | 355 | outb(msgs[i].addr << 1, dm_io_mem(DM1105_I2CDAT)); |
356 | outb(msgs[i].addr << 1, dm_io_mem(DM1105_I2CDAT)); | 356 | outb(0xf7, dm_io_mem(DM1105_I2CDAT + 1)); |
357 | outb(0xf7, dm_io_mem(DM1105_I2CDAT + 1)); | 357 | for (byte = 0; byte < (len > 48 ? 48 : len); byte++) { |
358 | for (byte = 0; byte < (len > 48 ? 48 : len); byte++) { | 358 | data = msgs[i].buf[k + byte]; |
359 | data = msgs[i].buf[k+byte]; | 359 | outb(data, dm_io_mem(DM1105_I2CDAT + byte + 2)); |
360 | outb(data, dm_io_mem(DM1105_I2CDAT + byte + 2)); | ||
361 | } | ||
362 | outb(0x82 + (len > 48 ? 48 : len), dm_io_mem(DM1105_I2CCTR)); | ||
363 | for (j = 0; j < 25; j++) { | ||
364 | mdelay(10); | ||
365 | status = inb(dm_io_mem(DM1105_I2CSTS)); | ||
366 | if ((status & 0xc0) == 0x40) | ||
367 | break; | ||
368 | } | ||
369 | |||
370 | if (j >= 25) | ||
371 | return -1; | ||
372 | |||
373 | k += 48; | ||
374 | len -= 48; | ||
375 | } while (len > 0); | ||
376 | } else { | ||
377 | /* write bytes */ | ||
378 | outb(msgs[i].addr<<1, dm_io_mem(DM1105_I2CDAT)); | ||
379 | for (byte = 0; byte < msgs[i].len; byte++) { | ||
380 | data = msgs[i].buf[byte]; | ||
381 | outb(data, dm_io_mem(DM1105_I2CDAT + byte + 1)); | ||
382 | } | 360 | } |
383 | outb(0x81 + msgs[i].len, dm_io_mem(DM1105_I2CCTR)); | 361 | outb(0x82 + (len > 48 ? 48 : len), dm_io_mem(DM1105_I2CCTR)); |
384 | for (j = 0; j < 25; j++) { | 362 | for (j = 0; j < 25; j++) { |
385 | mdelay(10); | 363 | mdelay(10); |
386 | status = inb(dm_io_mem(DM1105_I2CSTS)); | 364 | status = inb(dm_io_mem(DM1105_I2CSTS)); |
@@ -390,7 +368,27 @@ static int dm1105_i2c_xfer(struct i2c_adapter *i2c_adap, | |||
390 | 368 | ||
391 | if (j >= 25) | 369 | if (j >= 25) |
392 | return -1; | 370 | return -1; |
371 | |||
372 | k += 48; | ||
373 | len -= 48; | ||
374 | } while (len > 0); | ||
375 | } else { | ||
376 | /* write bytes */ | ||
377 | outb(msgs[i].addr<<1, dm_io_mem(DM1105_I2CDAT)); | ||
378 | for (byte = 0; byte < msgs[i].len; byte++) { | ||
379 | data = msgs[i].buf[byte]; | ||
380 | outb(data, dm_io_mem(DM1105_I2CDAT + byte + 1)); | ||
381 | } | ||
382 | outb(0x81 + msgs[i].len, dm_io_mem(DM1105_I2CCTR)); | ||
383 | for (j = 0; j < 25; j++) { | ||
384 | mdelay(10); | ||
385 | status = inb(dm_io_mem(DM1105_I2CSTS)); | ||
386 | if ((status & 0xc0) == 0x40) | ||
387 | break; | ||
393 | } | 388 | } |
389 | |||
390 | if (j >= 25) | ||
391 | return -1; | ||
394 | } | 392 | } |
395 | } | 393 | } |
396 | return num; | 394 | return num; |