diff options
author | Brian Rogers <brian_rogers@comcast.net> | 2008-10-13 07:37:06 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-10-13 07:57:34 -0400 |
commit | ba340b40a5f65261731583f67d7ec8cafbf5cfaa (patch) | |
tree | b62243ecb18ccf1d38b60e5919e8ab7eeaa7d6f4 /drivers/media/video/ir-kbd-i2c.c | |
parent | fa405d7094489828014315a34f0c21fba30be38c (diff) |
V4L/DVB (9168): Add support for MSI TV@nywhere Plus remote
The IR controller has a couple quirks. It won't respond until some other
device on the bus is probed. To work around that, probe 0x50 first.
Then, since it won't respond to a zero-byte read, probe with a one-byte
read.
Signed-off-by: Brian Rogers <brian_rogers@comcast.net>
[mchehab.redhat.com: Fix merge conflicts and remove an unused var]
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/ir-kbd-i2c.c')
-rw-r--r-- | drivers/media/video/ir-kbd-i2c.c | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index 703195a5ad4e..efe849981ab7 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c | |||
@@ -12,6 +12,10 @@ | |||
12 | * Markus Rechberger <mrechberger@gmail.com> | 12 | * Markus Rechberger <mrechberger@gmail.com> |
13 | * modified for DViCO Fusion HDTV 5 RT GOLD by | 13 | * modified for DViCO Fusion HDTV 5 RT GOLD by |
14 | * Chaogui Zhang <czhang1974@gmail.com> | 14 | * Chaogui Zhang <czhang1974@gmail.com> |
15 | * modified for MSI TV@nywhere Plus by | ||
16 | * Henry Wong <henry@stuffedcow.net> | ||
17 | * Mark Schultz <n9xmj@yahoo.com> | ||
18 | * Brian Rogers <brian_rogers@comcast.net> | ||
15 | * | 19 | * |
16 | * This program is free software; you can redistribute it and/or modify | 20 | * This program is free software; you can redistribute it and/or modify |
17 | * it under the terms of the GNU General Public License as published by | 21 | * it under the terms of the GNU General Public License as published by |
@@ -242,9 +246,15 @@ static void ir_timer(unsigned long data) | |||
242 | static void ir_work(struct work_struct *work) | 246 | static void ir_work(struct work_struct *work) |
243 | { | 247 | { |
244 | struct IR_i2c *ir = container_of(work, struct IR_i2c, work); | 248 | struct IR_i2c *ir = container_of(work, struct IR_i2c, work); |
249 | int polling_interval = 100; | ||
250 | |||
251 | /* MSI TV@nywhere Plus requires more frequent polling | ||
252 | otherwise it will miss some keypresses */ | ||
253 | if (ir->c.adapter->id == I2C_HW_SAA7134 && ir->c.addr == 0x30) | ||
254 | polling_interval = 50; | ||
245 | 255 | ||
246 | ir_key_poll(ir); | 256 | ir_key_poll(ir); |
247 | mod_timer(&ir->timer, jiffies + msecs_to_jiffies(100)); | 257 | mod_timer(&ir->timer, jiffies + msecs_to_jiffies(polling_interval)); |
248 | } | 258 | } |
249 | 259 | ||
250 | /* ----------------------------------------------------------------------- */ | 260 | /* ----------------------------------------------------------------------- */ |
@@ -483,9 +493,37 @@ static int ir_probe(struct i2c_adapter *adap) | |||
483 | (1 == rc) ? "yes" : "no"); | 493 | (1 == rc) ? "yes" : "no"); |
484 | if (1 == rc) { | 494 | if (1 == rc) { |
485 | ir_attach(adap, probe[i], 0, 0); | 495 | ir_attach(adap, probe[i], 0, 0); |
486 | break; | 496 | return 0; |
487 | } | 497 | } |
488 | } | 498 | } |
499 | |||
500 | /* Special case for MSI TV@nywhere Plus remote */ | ||
501 | if (adap->id == I2C_HW_SAA7134) { | ||
502 | u8 temp; | ||
503 | |||
504 | /* MSI TV@nywhere Plus controller doesn't seem to | ||
505 | respond to probes unless we read something from | ||
506 | an existing device. Weird... */ | ||
507 | |||
508 | msg.addr = 0x50; | ||
509 | rc = i2c_transfer(adap, &msg, 1); | ||
510 | dprintk(1, "probe 0x%02x @ %s: %s\n", | ||
511 | msg.addr, adap->name, | ||
512 | (1 == rc) ? "yes" : "no"); | ||
513 | |||
514 | /* Now do the probe. The controller does not respond | ||
515 | to 0-byte reads, so we use a 1-byte read instead. */ | ||
516 | msg.addr = 0x30; | ||
517 | msg.len = 1; | ||
518 | msg.buf = &temp; | ||
519 | rc = i2c_transfer(adap, &msg, 1); | ||
520 | dprintk(1, "probe 0x%02x @ %s: %s\n", | ||
521 | msg.addr, adap->name, | ||
522 | (1 == rc) ? "yes" : "no"); | ||
523 | if (1 == rc) | ||
524 | ir_attach(adap, msg.addr, 0, 0); | ||
525 | } | ||
526 | |||
489 | return 0; | 527 | return 0; |
490 | } | 528 | } |
491 | 529 | ||