aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorPeter Missel <peter.missel@onlinehome.de>2006-01-09 15:21:23 -0500
committerMauro Carvalho Chehab <mchehab@brturbo.com.br>2006-01-09 15:21:23 -0500
commit0602fbb2c84ffea1b06ae8e677662074620f01d7 (patch)
tree936ab6e290a69519aa391be81b037c41210987c6 /drivers
parentcab462f716cdd522edc71436482d8734e8258489 (diff)
V4L/DVB (3309): SAA7134: GPIO IRQ improvements
- Saa7134-core.c saa7134_irq(): Separate GPIO16 and GPIO18 handling. Call IR-remote-GPIO handler only if the GPIO IRQ is "owned" by it. Added infrastructure to branch out to a future I2C-IR IRQ handler. saa7134-core.c saa7134_hwinit2(): Enable only the one GPIO pin and edge to trigger an IRQ that is wired as keyup/keydown mask. IRQ will only be generated for an actual key-down event. saa7134-input.c flyvideo_codes[]: Replace numpad keys with normal ones. Put meaning to mystery keys. Change some key definitions to have their functions match their labels better. Fix typos. saa7134-input.c flydvb_codes[]: Added new table for the larger remote that comes with the LifeView FlyDVB series. saa7134-input.c build_key(): In IRQ mode, signal key-down and then key-up straight in one go. Signed-off-by: Ricardo Cerqueira <v4l@cerqueira.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/saa7134/saa7134-core.c62
-rw-r--r--drivers/media/video/saa7134/saa7134-input.c38
2 files changed, 72 insertions, 28 deletions
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c
index d4be1fd20a36..accbc32725cf 100644
--- a/drivers/media/video/saa7134/saa7134-core.c
+++ b/drivers/media/video/saa7134/saa7134-core.c
@@ -539,11 +539,38 @@ static irqreturn_t saa7134_irq(int irq, void *dev_id, struct pt_regs *regs)
539 card_has_mpeg(dev)) 539 card_has_mpeg(dev))
540 saa7134_irq_ts_done(dev,status); 540 saa7134_irq_ts_done(dev,status);
541 541
542 if ((report & (SAA7134_IRQ_REPORT_GPIO16 | 542 if (report & SAA7134_IRQ_REPORT_GPIO16) {
543 SAA7134_IRQ_REPORT_GPIO18)) && 543 switch (dev->has_remote) {
544 dev->remote) 544 case SAA7134_REMOTE_GPIO:
545 saa7134_input_irq(dev); 545 if (dev->remote->mask_keydown & 0x10000) {
546 saa7134_input_irq(dev);
547 }
548 break;
549
550 case SAA7134_REMOTE_I2C:
551 break; /* FIXME: invoke I2C get_key() */
552
553 default: /* GPIO16 not used by IR remote */
554 break;
555 }
556 }
546 557
558 if (report & SAA7134_IRQ_REPORT_GPIO18) {
559 switch (dev->has_remote) {
560 case SAA7134_REMOTE_GPIO:
561 if ((dev->remote->mask_keydown & 0x40000) ||
562 (dev->remote->mask_keyup & 0x40000)) {
563 saa7134_input_irq(dev);
564 }
565 break;
566
567 case SAA7134_REMOTE_I2C:
568 break; /* FIXME: invoke I2C get_key() */
569
570 default: /* GPIO18 not used by IR remote */
571 break;
572 }
573 }
547 } 574 }
548 575
549 if (10 == loop) { 576 if (10 == loop) {
@@ -553,13 +580,16 @@ static irqreturn_t saa7134_irq(int irq, void *dev_id, struct pt_regs *regs)
553 printk(KERN_WARNING "%s/irq: looping -- " 580 printk(KERN_WARNING "%s/irq: looping -- "
554 "clearing PE (parity error!) enable bit\n",dev->name); 581 "clearing PE (parity error!) enable bit\n",dev->name);
555 saa_clearl(SAA7134_IRQ2,SAA7134_IRQ2_INTE_PE); 582 saa_clearl(SAA7134_IRQ2,SAA7134_IRQ2_INTE_PE);
556 } else if (report & (SAA7134_IRQ_REPORT_GPIO16 | 583 } else if (report & SAA7134_IRQ_REPORT_GPIO16) {
557 SAA7134_IRQ_REPORT_GPIO18)) { 584 /* disable gpio16 IRQ */
558 /* disable gpio IRQs */
559 printk(KERN_WARNING "%s/irq: looping -- " 585 printk(KERN_WARNING "%s/irq: looping -- "
560 "clearing GPIO enable bits\n",dev->name); 586 "clearing GPIO16 enable bit\n",dev->name);
561 saa_clearl(SAA7134_IRQ2, (SAA7134_IRQ2_INTE_GPIO16 | 587 saa_clearl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO16);
562 SAA7134_IRQ2_INTE_GPIO18)); 588 } else if (report & SAA7134_IRQ_REPORT_GPIO18) {
589 /* disable gpio18 IRQs */
590 printk(KERN_WARNING "%s/irq: looping -- "
591 "clearing GPIO18 enable bit\n",dev->name);
592 saa_clearl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO18);
563 } else { 593 } else {
564 /* disable all irqs */ 594 /* disable all irqs */
565 printk(KERN_WARNING "%s/irq: looping -- " 595 printk(KERN_WARNING "%s/irq: looping -- "
@@ -640,10 +670,14 @@ static int saa7134_hwinit2(struct saa7134_dev *dev)
640 SAA7134_IRQ2_INTE_PE | 670 SAA7134_IRQ2_INTE_PE |
641 SAA7134_IRQ2_INTE_AR; 671 SAA7134_IRQ2_INTE_AR;
642 672
643 if (dev->has_remote == SAA7134_REMOTE_GPIO) 673 if (dev->has_remote == SAA7134_REMOTE_GPIO) {
644 irq2_mask |= (SAA7134_IRQ2_INTE_GPIO18 | 674 if (dev->remote->mask_keydown & 0x10000)
645 SAA7134_IRQ2_INTE_GPIO18A | 675 irq2_mask |= SAA7134_IRQ2_INTE_GPIO16;
646 SAA7134_IRQ2_INTE_GPIO16 ); 676 else if (dev->remote->mask_keydown & 0x40000)
677 irq2_mask |= SAA7134_IRQ2_INTE_GPIO18;
678 else if (dev->remote->mask_keyup & 0x40000)
679 irq2_mask |= SAA7134_IRQ2_INTE_GPIO18A;
680 }
647 681
648 saa_writel(SAA7134_IRQ1, 0); 682 saa_writel(SAA7134_IRQ1, 0);
649 saa_writel(SAA7134_IRQ2, irq2_mask); 683 saa_writel(SAA7134_IRQ2, irq2_mask);
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c
index 7175abbd2f8c..82d28cbf289f 100644
--- a/drivers/media/video/saa7134/saa7134-input.c
+++ b/drivers/media/video/saa7134/saa7134-input.c
@@ -56,23 +56,23 @@ static IR_KEYTAB_TYPE flyvideo_codes[IR_KEYTAB_SIZE] = {
56 [ 12 ] = KEY_KP8, 56 [ 12 ] = KEY_KP8,
57 [ 13 ] = KEY_KP9, 57 [ 13 ] = KEY_KP9,
58 58
59 [ 14 ] = KEY_TUNER, // Air/Cable 59 [ 14 ] = KEY_MODE, // Air/Cable
60 [ 17 ] = KEY_VIDEO, // Video 60 [ 17 ] = KEY_VIDEO, // Video
61 [ 21 ] = KEY_AUDIO, // Audio 61 [ 21 ] = KEY_AUDIO, // Audio
62 [ 0 ] = KEY_POWER, // Pover 62 [ 0 ] = KEY_POWER, // Power
63 [ 24 ] = KEY_TUNER, // AV Source
63 [ 2 ] = KEY_ZOOM, // Fullscreen 64 [ 2 ] = KEY_ZOOM, // Fullscreen
65 [ 26 ] = KEY_LANGUAGE, // Stereo
64 [ 27 ] = KEY_MUTE, // Mute 66 [ 27 ] = KEY_MUTE, // Mute
65 [ 20 ] = KEY_VOLUMEUP, 67 [ 20 ] = KEY_VOLUMEUP, // Volume +
66 [ 23 ] = KEY_VOLUMEDOWN, 68 [ 23 ] = KEY_VOLUMEDOWN, // Volume -
67 [ 18 ] = KEY_CHANNELUP, // Channel + 69 [ 18 ] = KEY_CHANNELUP, // Channel +
68 [ 19 ] = KEY_CHANNELDOWN, // Channel - 70 [ 19 ] = KEY_CHANNELDOWN, // Channel -
69 [ 6 ] = KEY_AGAIN, // Recal 71 [ 6 ] = KEY_AGAIN, // Recall
70 [ 16 ] = KEY_KPENTER, // Enter 72 [ 16 ] = KEY_ENTER, // Enter
71
72 [ 26 ] = KEY_F22, // Stereo
73 [ 24 ] = KEY_EDIT, // AV Source
74}; 73};
75 74
75
76static IR_KEYTAB_TYPE cinergy_codes[IR_KEYTAB_SIZE] = { 76static IR_KEYTAB_TYPE cinergy_codes[IR_KEYTAB_SIZE] = {
77 [ 0 ] = KEY_KP0, 77 [ 0 ] = KEY_KP0,
78 [ 1 ] = KEY_KP1, 78 [ 1 ] = KEY_KP1,
@@ -543,12 +543,22 @@ static int build_key(struct saa7134_dev *dev)
543 dprintk("build_key gpio=0x%x mask=0x%x data=%d\n", 543 dprintk("build_key gpio=0x%x mask=0x%x data=%d\n",
544 gpio, ir->mask_keycode, data); 544 gpio, ir->mask_keycode, data);
545 545
546 if ((ir->mask_keydown && (0 != (gpio & ir->mask_keydown))) || 546 if (ir->polling) {
547 (ir->mask_keyup && (0 == (gpio & ir->mask_keyup)))) { 547 if ((ir->mask_keydown && (0 != (gpio & ir->mask_keydown))) ||
548 ir_input_keydown(ir->dev, &ir->ir, data, data); 548 (ir->mask_keyup && (0 == (gpio & ir->mask_keyup)))) {
549 } else { 549 ir_input_keydown(ir->dev, &ir->ir, data, data);
550 ir_input_nokey(ir->dev, &ir->ir); 550 } else {
551 ir_input_nokey(ir->dev, &ir->ir);
552 }
553 }
554 else { /* IRQ driven mode - handle key press and release in one go */
555 if ((ir->mask_keydown && (0 != (gpio & ir->mask_keydown))) ||
556 (ir->mask_keyup && (0 == (gpio & ir->mask_keyup)))) {
557 ir_input_keydown(ir->dev, &ir->ir, data, data);
558 ir_input_nokey(ir->dev, &ir->ir);
559 }
551 } 560 }
561
552 return 0; 562 return 0;
553} 563}
554 564