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 | |
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')
-rw-r--r-- | drivers/media/video/ir-kbd-i2c.c | 42 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-cards.c | 1 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-i2c.c | 1 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-input.c | 52 |
4 files changed, 94 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 | ||
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index c9392c4e92fd..ddc5402c5fb0 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c | |||
@@ -5969,6 +5969,7 @@ int saa7134_board_init1(struct saa7134_dev *dev) | |||
5969 | case SAA7134_BOARD_PINNACLE_PCTV_110i: | 5969 | case SAA7134_BOARD_PINNACLE_PCTV_110i: |
5970 | case SAA7134_BOARD_PINNACLE_PCTV_310i: | 5970 | case SAA7134_BOARD_PINNACLE_PCTV_310i: |
5971 | case SAA7134_BOARD_UPMOST_PURPLE_TV: | 5971 | case SAA7134_BOARD_UPMOST_PURPLE_TV: |
5972 | case SAA7134_BOARD_MSI_TVATANYWHERE_PLUS: | ||
5972 | case SAA7134_BOARD_HAUPPAUGE_HVR1110: | 5973 | case SAA7134_BOARD_HAUPPAUGE_HVR1110: |
5973 | case SAA7134_BOARD_BEHOLD_607_9FM: | 5974 | case SAA7134_BOARD_BEHOLD_607_9FM: |
5974 | case SAA7134_BOARD_BEHOLD_M6: | 5975 | case SAA7134_BOARD_BEHOLD_M6: |
diff --git a/drivers/media/video/saa7134/saa7134-i2c.c b/drivers/media/video/saa7134/saa7134-i2c.c index b02965c52476..20c1b33caf7b 100644 --- a/drivers/media/video/saa7134/saa7134-i2c.c +++ b/drivers/media/video/saa7134/saa7134-i2c.c | |||
@@ -337,6 +337,7 @@ static int attach_inform(struct i2c_client *client) | |||
337 | case 0x47: | 337 | case 0x47: |
338 | case 0x71: | 338 | case 0x71: |
339 | case 0x2d: | 339 | case 0x2d: |
340 | case 0x30: | ||
340 | { | 341 | { |
341 | struct IR_i2c *ir = i2c_get_clientdata(client); | 342 | struct IR_i2c *ir = i2c_get_clientdata(client); |
342 | d1printk("%s i2c IR detected (%s).\n", | 343 | d1printk("%s i2c IR detected (%s).\n", |
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index 72a1c67a8c39..c53fd5f9f6b5 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c | |||
@@ -118,6 +118,53 @@ static int build_key(struct saa7134_dev *dev) | |||
118 | 118 | ||
119 | /* --------------------- Chip specific I2C key builders ----------------- */ | 119 | /* --------------------- Chip specific I2C key builders ----------------- */ |
120 | 120 | ||
121 | static int get_key_msi_tvanywhere_plus(struct IR_i2c *ir, u32 *ir_key, | ||
122 | u32 *ir_raw) | ||
123 | { | ||
124 | unsigned char b; | ||
125 | int gpio; | ||
126 | |||
127 | /* <dev> is needed to access GPIO. Used by the saa_readl macro. */ | ||
128 | struct saa7134_dev *dev = ir->c.adapter->algo_data; | ||
129 | if (dev == NULL) { | ||
130 | dprintk("get_key_msi_tvanywhere_plus: " | ||
131 | "gir->c.adapter->algo_data is NULL!\n"); | ||
132 | return -EIO; | ||
133 | } | ||
134 | |||
135 | /* rising SAA7134_GPIO_GPRESCAN reads the status */ | ||
136 | |||
137 | saa_clearb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); | ||
138 | saa_setb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); | ||
139 | |||
140 | gpio = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2); | ||
141 | |||
142 | /* GPIO&0x40 is pulsed low when a button is pressed. Don't do | ||
143 | I2C receive if gpio&0x40 is not low. */ | ||
144 | |||
145 | if (gpio & 0x40) | ||
146 | return 0; /* No button press */ | ||
147 | |||
148 | /* GPIO says there is a button press. Get it. */ | ||
149 | |||
150 | if (1 != i2c_master_recv(&ir->c, &b, 1)) { | ||
151 | i2cdprintk("read error\n"); | ||
152 | return -EIO; | ||
153 | } | ||
154 | |||
155 | /* No button press */ | ||
156 | |||
157 | if (b == 0xff) | ||
158 | return 0; | ||
159 | |||
160 | /* Button pressed */ | ||
161 | |||
162 | dprintk("get_key_msi_tvanywhere_plus: Key = 0x%02X\n", b); | ||
163 | *ir_key = b; | ||
164 | *ir_raw = b; | ||
165 | return 1; | ||
166 | } | ||
167 | |||
121 | static int get_key_purpletv(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) | 168 | static int get_key_purpletv(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) |
122 | { | 169 | { |
123 | unsigned char b; | 170 | unsigned char b; |
@@ -641,6 +688,11 @@ void saa7134_set_i2c_ir(struct saa7134_dev *dev, struct IR_i2c *ir) | |||
641 | ir->get_key = get_key_purpletv; | 688 | ir->get_key = get_key_purpletv; |
642 | ir->ir_codes = ir_codes_purpletv; | 689 | ir->ir_codes = ir_codes_purpletv; |
643 | break; | 690 | break; |
691 | case SAA7134_BOARD_MSI_TVATANYWHERE_PLUS: | ||
692 | snprintf(ir->c.name, sizeof(ir->c.name), "MSI TV@nywhere Plus"); | ||
693 | ir->get_key = get_key_msi_tvanywhere_plus; | ||
694 | ir->ir_codes = ir_codes_msi_tvanywhere_plus; | ||
695 | break; | ||
644 | case SAA7134_BOARD_HAUPPAUGE_HVR1110: | 696 | case SAA7134_BOARD_HAUPPAUGE_HVR1110: |
645 | snprintf(ir->c.name, sizeof(ir->c.name), "HVR 1110"); | 697 | snprintf(ir->c.name, sizeof(ir->c.name), "HVR 1110"); |
646 | ir->get_key = get_key_hvr1110; | 698 | ir->get_key = get_key_hvr1110; |