aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/cx88/cx88-input.c2
-rw-r--r--drivers/media/video/ir-kbd-i2c.c50
2 files changed, 39 insertions, 13 deletions
diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c
index ddfae9f80ade..5915dbabd608 100644
--- a/drivers/media/video/cx88/cx88-input.c
+++ b/drivers/media/video/cx88/cx88-input.c
@@ -218,7 +218,6 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
218 case CX88_BOARD_HAUPPAUGE_NOVASE2_S1: 218 case CX88_BOARD_HAUPPAUGE_NOVASE2_S1:
219 case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1: 219 case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1:
220 case CX88_BOARD_HAUPPAUGE_HVR1100: 220 case CX88_BOARD_HAUPPAUGE_HVR1100:
221 case CX88_BOARD_HAUPPAUGE_HVR1300:
222 case CX88_BOARD_HAUPPAUGE_HVR3000: 221 case CX88_BOARD_HAUPPAUGE_HVR3000:
223 ir_codes = ir_codes_hauppauge_new; 222 ir_codes = ir_codes_hauppauge_new;
224 ir_type = IR_TYPE_RC5; 223 ir_type = IR_TYPE_RC5;
@@ -438,7 +437,6 @@ void cx88_ir_irq(struct cx88_core *core)
438 case CX88_BOARD_HAUPPAUGE_NOVASE2_S1: 437 case CX88_BOARD_HAUPPAUGE_NOVASE2_S1:
439 case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1: 438 case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1:
440 case CX88_BOARD_HAUPPAUGE_HVR1100: 439 case CX88_BOARD_HAUPPAUGE_HVR1100:
441 case CX88_BOARD_HAUPPAUGE_HVR1300:
442 case CX88_BOARD_HAUPPAUGE_HVR3000: 440 case CX88_BOARD_HAUPPAUGE_HVR3000:
443 ircode = ir_decode_biphase(ir->samples, ir->scount, 5, 7); 441 ircode = ir_decode_biphase(ir->samples, ir->scount, 5, 7);
444 ir_dprintk("biphase decoded: %x\n", ircode); 442 ir_dprintk("biphase decoded: %x\n", ircode);
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c
index cd84d060b8e1..2d709e064679 100644
--- a/drivers/media/video/ir-kbd-i2c.c
+++ b/drivers/media/video/ir-kbd-i2c.c
@@ -37,6 +37,7 @@
37#include <linux/errno.h> 37#include <linux/errno.h>
38#include <linux/slab.h> 38#include <linux/slab.h>
39#include <linux/i2c.h> 39#include <linux/i2c.h>
40#include <linux/i2c-id.h>
40#include <linux/workqueue.h> 41#include <linux/workqueue.h>
41#include <asm/semaphore.h> 42#include <asm/semaphore.h>
42 43
@@ -60,21 +61,22 @@ MODULE_PARM_DESC(hauppauge, "Specify Hauppauge remote: 0=black, 1=grey (defaults
60 61
61/* ----------------------------------------------------------------------- */ 62/* ----------------------------------------------------------------------- */
62 63
63static int get_key_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) 64static int get_key_haup_common(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw,
65 int size, int offset)
64{ 66{
65 unsigned char buf[3]; 67 unsigned char buf[6];
66 int start, range, toggle, dev, code; 68 int start, range, toggle, dev, code;
67 69
68 /* poll IR chip */ 70 /* poll IR chip */
69 if (3 != i2c_master_recv(&ir->c,buf,3)) 71 if (size != i2c_master_recv(&ir->c,buf,size))
70 return -EIO; 72 return -EIO;
71 73
72 /* split rc5 data block ... */ 74 /* split rc5 data block ... */
73 start = (buf[0] >> 7) & 1; 75 start = (buf[offset] >> 7) & 1;
74 range = (buf[0] >> 6) & 1; 76 range = (buf[offset] >> 6) & 1;
75 toggle = (buf[0] >> 5) & 1; 77 toggle = (buf[offset] >> 5) & 1;
76 dev = buf[0] & 0x1f; 78 dev = buf[offset] & 0x1f;
77 code = (buf[1] >> 2) & 0x3f; 79 code = (buf[offset+1] >> 2) & 0x3f;
78 80
79 /* rc5 has two start bits 81 /* rc5 has two start bits
80 * the first bit must be one 82 * the first bit must be one
@@ -96,6 +98,16 @@ static int get_key_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
96 return 1; 98 return 1;
97} 99}
98 100
101static inline int get_key_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
102{
103 return get_key_haup_common (ir, ir_key, ir_raw, 3, 0);
104}
105
106static inline int get_key_haup_xvr(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
107{
108 return get_key_haup_common (ir, ir_key, ir_raw, 6, 3);
109}
110
99static int get_key_pixelview(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) 111static int get_key_pixelview(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
100{ 112{
101 unsigned char b; 113 unsigned char b;
@@ -355,9 +367,21 @@ static int ir_attach(struct i2c_adapter *adap, int addr,
355 case 0x7a: 367 case 0x7a:
356 case 0x47: 368 case 0x47:
357 case 0x71: 369 case 0x71:
358 /* Handled by saa7134-input */ 370 if (adap->id == I2C_HW_B_CX2388x) {
359 name = "SAA713x remote"; 371 /* Handled by cx88-input */
360 ir_type = IR_TYPE_OTHER; 372 name = "CX2388x remote";
373 ir_type = IR_TYPE_RC5;
374 ir->get_key = get_key_haup_xvr;
375 if (hauppauge == 1) {
376 ir_codes = ir_codes_hauppauge_new;
377 } else {
378 ir_codes = ir_codes_rc5_tv;
379 }
380 } else {
381 /* Handled by saa7134-input */
382 name = "SAA713x remote";
383 ir_type = IR_TYPE_OTHER;
384 }
361 break; 385 break;
362 default: 386 default:
363 /* shouldn't happen */ 387 /* shouldn't happen */
@@ -451,6 +475,7 @@ static int ir_probe(struct i2c_adapter *adap)
451 static const int probe_bttv[] = { 0x1a, 0x18, 0x4b, 0x64, 0x30, -1}; 475 static const int probe_bttv[] = { 0x1a, 0x18, 0x4b, 0x64, 0x30, -1};
452 static const int probe_saa7134[] = { 0x7a, 0x47, 0x71, -1 }; 476 static const int probe_saa7134[] = { 0x7a, 0x47, 0x71, -1 };
453 static const int probe_em28XX[] = { 0x30, 0x47, -1 }; 477 static const int probe_em28XX[] = { 0x30, 0x47, -1 };
478 static const int probe_cx88[] = { 0x18, 0x71, -1 };
454 const int *probe = NULL; 479 const int *probe = NULL;
455 struct i2c_client c; 480 struct i2c_client c;
456 unsigned char buf; 481 unsigned char buf;
@@ -469,6 +494,9 @@ static int ir_probe(struct i2c_adapter *adap)
469 case I2C_HW_B_EM28XX: 494 case I2C_HW_B_EM28XX:
470 probe = probe_em28XX; 495 probe = probe_em28XX;
471 break; 496 break;
497 case I2C_HW_B_CX2388x:
498 probe = probe_cx88;
499 break;
472 } 500 }
473 if (NULL == probe) 501 if (NULL == probe)
474 return 0; 502 return 0;