aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2010-12-30 06:02:51 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-12-30 09:17:06 -0500
commit1c0eb0ffb0d541bf05a4b422a629fa5986799313 (patch)
tree82ba3769d075e2e08c61949c74832f90e54c021e /drivers/media
parentb22374544b981b82f7319a02e6b718fc796e9cfa (diff)
[media] cx88: Add RC logic for Leadtek PVR 2000
Currently, lirc-i2c has a decoding logic for Leadtek Remote Control. Move it to cx88, as we intend to remove lirc-i2c. For now, initialize LIRC remote keytable with RC_MAP_EMPTY, as we don't know its keymap yet. It would be nice to later check if is there any file on LIRC userspace with that keytable. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/cx88/cx88-input.c49
1 files changed, 48 insertions, 1 deletions
diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c
index 4a3bf5476c71..06f7d1d00944 100644
--- a/drivers/media/video/cx88/cx88-input.c
+++ b/drivers/media/video/cx88/cx88-input.c
@@ -68,6 +68,9 @@ MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]");
68#define ir_dprintk(fmt, arg...) if (ir_debug) \ 68#define ir_dprintk(fmt, arg...) if (ir_debug) \
69 printk(KERN_DEBUG "%s IR: " fmt , ir->core->name , ##arg) 69 printk(KERN_DEBUG "%s IR: " fmt , ir->core->name , ##arg)
70 70
71#define dprintk(fmt, arg...) if (ir_debug) \
72 printk(KERN_DEBUG "cx88 IR: " fmt , ##arg)
73
71/* ---------------------------------------------------------------------- */ 74/* ---------------------------------------------------------------------- */
72 75
73static void cx88_ir_handle_key(struct cx88_IR *ir) 76static void cx88_ir_handle_key(struct cx88_IR *ir)
@@ -527,13 +530,47 @@ void cx88_ir_irq(struct cx88_core *core)
527 ir_raw_event_handle(ir->dev); 530 ir_raw_event_handle(ir->dev);
528} 531}
529 532
533static int get_key_pvr2000(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
534{
535 int flags, code;
536
537 /* poll IR chip */
538 flags = i2c_smbus_read_byte_data(ir->c, 0x10);
539 if (flags < 0) {
540 dprintk("read error\n");
541 return 0;
542 }
543 /* key pressed ? */
544 if (0 == (flags & 0x80))
545 return 0;
546
547 /* read actual key code */
548 code = i2c_smbus_read_byte_data(ir->c, 0x00);
549 if (code < 0) {
550 dprintk("read error\n");
551 return 0;
552 }
553
554 dprintk("IR Key/Flags: (0x%02x/0x%02x)\n",
555 code & 0xff, flags & 0xff);
556
557 *ir_key = code & 0xff;
558 *ir_raw = code;
559 return 1;
560}
561
530void cx88_i2c_init_ir(struct cx88_core *core) 562void cx88_i2c_init_ir(struct cx88_core *core)
531{ 563{
532 struct i2c_board_info info; 564 struct i2c_board_info info;
533 const unsigned short addr_list[] = { 565 const unsigned short default_addr_list[] = {
534 0x18, 0x6b, 0x71, 566 0x18, 0x6b, 0x71,
535 I2C_CLIENT_END 567 I2C_CLIENT_END
536 }; 568 };
569 const unsigned short pvr2000_addr_list[] = {
570 0x18, 0x1a,
571 I2C_CLIENT_END
572 };
573 const unsigned short *addr_list = default_addr_list;
537 const unsigned short *addrp; 574 const unsigned short *addrp;
538 /* Instantiate the IR receiver device, if present */ 575 /* Instantiate the IR receiver device, if present */
539 if (0 != core->i2c_rc) 576 if (0 != core->i2c_rc)
@@ -542,6 +579,16 @@ void cx88_i2c_init_ir(struct cx88_core *core)
542 memset(&info, 0, sizeof(struct i2c_board_info)); 579 memset(&info, 0, sizeof(struct i2c_board_info));
543 strlcpy(info.type, "ir_video", I2C_NAME_SIZE); 580 strlcpy(info.type, "ir_video", I2C_NAME_SIZE);
544 581
582 switch (core->boardnr) {
583 case CX88_BOARD_LEADTEK_PVR2000:
584 addr_list = pvr2000_addr_list;
585 core->init_data.name = "cx88 Leadtek PVR 2000 remote";
586 core->init_data.type = RC_TYPE_UNKNOWN;
587 core->init_data.get_key = get_key_pvr2000;
588 core->init_data.ir_codes = RC_MAP_EMPTY;
589 break;
590 }
591
545 /* 592 /*
546 * We can't call i2c_new_probed_device() because it uses 593 * We can't call i2c_new_probed_device() because it uses
547 * quick writes for probing and at least some RC receiver 594 * quick writes for probing and at least some RC receiver