diff options
author | Ricardo Cerqueira <devnull@localhost> | 2006-01-08 01:20:04 +0000 |
---|---|---|
committer | Ricardo Cerqueira <devnull@localhost> | 2006-01-08 01:20:04 +0000 |
commit | 3c0895a37511816c7ded2787e119e016705ff160 (patch) | |
tree | 0d8f7a4b3978164bb0e05b11646ca1e7eb7f6de2 /linux/drivers/media | |
parent | 5cac981da5fdce6e96e8664cc06adbabc38cad03 (diff) | |
download | mediapointer-dvb-s2-3c0895a37511816c7ded2787e119e016705ff160.tar.gz mediapointer-dvb-s2-3c0895a37511816c7ded2787e119e016705ff160.tar.bz2 |
SAA7134: GPIO IRQ improvements
From: Peter Missel <peter.missel@onlinehome.de>
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>
Diffstat (limited to 'linux/drivers/media')
-rw-r--r-- | linux/drivers/media/video/saa7134/saa7134-core.c | 64 | ||||
-rw-r--r-- | linux/drivers/media/video/saa7134/saa7134-input.c | 78 |
2 files changed, 111 insertions, 31 deletions
diff --git a/linux/drivers/media/video/saa7134/saa7134-core.c b/linux/drivers/media/video/saa7134/saa7134-core.c index ad55775a1..90a80a25e 100644 --- a/linux/drivers/media/video/saa7134/saa7134-core.c +++ b/linux/drivers/media/video/saa7134/saa7134-core.c @@ -1,5 +1,5 @@ /* - * $Id: saa7134-core.c,v 1.60 2006/01/01 17:17:39 mchehab Exp $ + * $Id: saa7134-core.c,v 1.61 2006/01/08 01:20:04 rmcc Exp $ * * device driver for philips saa7134 based TV cards * driver core @@ -606,11 +606,38 @@ static irqreturn_t saa7134_irq(int irq, void *dev_id, struct pt_regs *regs) card_has_mpeg(dev)) saa7134_irq_ts_done(dev,status); - if ((report & (SAA7134_IRQ_REPORT_GPIO16 | - SAA7134_IRQ_REPORT_GPIO18)) && - dev->remote) - saa7134_input_irq(dev); + if (report & SAA7134_IRQ_REPORT_GPIO16) { + switch (dev->has_remote) { + case SAA7134_REMOTE_GPIO: + if (dev->remote->mask_keydown & 0x10000) { + saa7134_input_irq(dev); + } + break; + case SAA7134_REMOTE_I2C: + break; /* FIXME: invoke I2C get_key() */ + + default: /* GPIO16 not used by IR remote */ + break; + } + } + + if (report & SAA7134_IRQ_REPORT_GPIO18) { + switch (dev->has_remote) { + case SAA7134_REMOTE_GPIO: + if ((dev->remote->mask_keydown & 0x40000) || + (dev->remote->mask_keyup & 0x40000)) { + saa7134_input_irq(dev); + } + break; + + case SAA7134_REMOTE_I2C: + break; /* FIXME: invoke I2C get_key() */ + + default: /* GPIO18 not used by IR remote */ + break; + } + } } if (10 == loop) { @@ -620,13 +647,16 @@ static irqreturn_t saa7134_irq(int irq, void *dev_id, struct pt_regs *regs) printk(KERN_WARNING "%s/irq: looping -- " "clearing PE (parity error!) enable bit\n",dev->name); saa_clearl(SAA7134_IRQ2,SAA7134_IRQ2_INTE_PE); - } else if (report & (SAA7134_IRQ_REPORT_GPIO16 | - SAA7134_IRQ_REPORT_GPIO18)) { - /* disable gpio IRQs */ + } else if (report & SAA7134_IRQ_REPORT_GPIO16) { + /* disable gpio16 IRQ */ + printk(KERN_WARNING "%s/irq: looping -- " + "clearing GPIO16 enable bit\n",dev->name); + saa_clearl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO16); + } else if (report & SAA7134_IRQ_REPORT_GPIO18) { + /* disable gpio18 IRQs */ printk(KERN_WARNING "%s/irq: looping -- " - "clearing GPIO enable bits\n",dev->name); - saa_clearl(SAA7134_IRQ2, (SAA7134_IRQ2_INTE_GPIO16 | - SAA7134_IRQ2_INTE_GPIO18)); + "clearing GPIO18 enable bit\n",dev->name); + saa_clearl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO18); } else { /* disable all irqs */ printk(KERN_WARNING "%s/irq: looping -- " @@ -707,10 +737,14 @@ static int saa7134_hwinit2(struct saa7134_dev *dev) SAA7134_IRQ2_INTE_PE | SAA7134_IRQ2_INTE_AR; - if (dev->has_remote == SAA7134_REMOTE_GPIO) - irq2_mask |= (SAA7134_IRQ2_INTE_GPIO18 | - SAA7134_IRQ2_INTE_GPIO18A | - SAA7134_IRQ2_INTE_GPIO16 ); + if (dev->has_remote == SAA7134_REMOTE_GPIO) { + if (dev->remote->mask_keydown & 0x10000) + irq2_mask |= SAA7134_IRQ2_INTE_GPIO16; + else if (dev->remote->mask_keydown & 0x40000) + irq2_mask |= SAA7134_IRQ2_INTE_GPIO18; + else if (dev->remote->mask_keyup & 0x40000) + irq2_mask |= SAA7134_IRQ2_INTE_GPIO18A; + } saa_writel(SAA7134_IRQ1, 0); saa_writel(SAA7134_IRQ2, irq2_mask); diff --git a/linux/drivers/media/video/saa7134/saa7134-input.c b/linux/drivers/media/video/saa7134/saa7134-input.c index e3361ad91..595e73967 100644 --- a/linux/drivers/media/video/saa7134/saa7134-input.c +++ b/linux/drivers/media/video/saa7134/saa7134-input.c @@ -1,5 +1,5 @@ /* - * $Id: saa7134-input.c,v 1.47 2005/12/22 07:44:26 nsh Exp $ + * $Id: saa7134-input.c,v 1.48 2006/01/08 01:20:04 rmcc Exp $ * * handle saa7134 IR remotes via linux kernel input layer. * @@ -58,23 +58,59 @@ static IR_KEYTAB_TYPE flyvideo_codes[IR_KEYTAB_SIZE] = { [ 12 ] = KEY_KP8, [ 13 ] = KEY_KP9, - [ 14 ] = KEY_TUNER, // Air/Cable + [ 14 ] = KEY_MODE, // Air/Cable [ 17 ] = KEY_VIDEO, // Video [ 21 ] = KEY_AUDIO, // Audio - [ 0 ] = KEY_POWER, // Pover + [ 0 ] = KEY_POWER, // Power + [ 24 ] = KEY_TUNER, // AV Source [ 2 ] = KEY_ZOOM, // Fullscreen + [ 26 ] = KEY_LANGUAGE, // Stereo [ 27 ] = KEY_MUTE, // Mute - [ 20 ] = KEY_VOLUMEUP, - [ 23 ] = KEY_VOLUMEDOWN, + [ 20 ] = KEY_VOLUMEUP, // Volume + + [ 23 ] = KEY_VOLUMEDOWN, // Volume - [ 18 ] = KEY_CHANNELUP, // Channel + [ 19 ] = KEY_CHANNELDOWN, // Channel - - [ 6 ] = KEY_AGAIN, // Recal - [ 16 ] = KEY_KPENTER, // Enter + [ 6 ] = KEY_AGAIN, // Recall + [ 16 ] = KEY_ENTER, // Enter +}; -#if 1 /* FIXME */ - [ 26 ] = KEY_F22, // Stereo - [ 24 ] = KEY_EDIT, // AV Source -#endif +static IR_KEYTAB_TYPE flydvb_codes[IR_KEYTAB_SIZE] = { + [ 1 ] = KEY_ZOOM, // Full Screen + [ 0 ] = KEY_POWER, // Power + + [ 3 ] = KEY_KP1, + [ 4 ] = KEY_KP2, + [ 5 ] = KEY_KP3, + [ 7 ] = KEY_KP4, + [ 8 ] = KEY_KP5, + [ 9 ] = KEY_KP6, + [ 11 ] = KEY_KP7, + [ 12 ] = KEY_KP8, + [ 13 ] = KEY_KP9, + [ 6 ] = KEY_AGAIN, // Recall + [ 15 ] = KEY_KP0, + [ 16 ] = KEY_MUTE, // Mute + [ 2 ] = KEY_RADIO, // TV/Radio + [ 27 ] = KEY_LANGUAGE, // SAP (Second Audio Program) + + [ 20 ] = KEY_VOLUMEUP, // VOL+ + [ 23 ] = KEY_VOLUMEDOWN, // VOL- + [ 18 ] = KEY_CHANNELUP, // CH+ + [ 19 ] = KEY_CHANNELDOWN, // CH- + [ 29 ] = KEY_ENTER, // Enter + + [ 26 ] = KEY_MODE, // PIP + [ 24 ] = KEY_TUNER, // Source + + [ 30 ] = KEY_RECORD, // Record/Pause + [ 21 ] = KEY_ANGLE, // Swap (no label on key) + [ 28 ] = KEY_PAUSE, // Timeshift/Pause + [ 25 ] = KEY_BACK, // Rewind << + [ 10 ] = KEY_PLAYPAUSE, // Play/Pause + [ 31 ] = KEY_FORWARD, // Forward >> + [ 22 ] = KEY_PREVIOUS, // Back |<< + [ 17 ] = KEY_STOP, // Stop + [ 14 ] = KEY_NEXT, // End >>| }; static IR_KEYTAB_TYPE cinergy_codes[IR_KEYTAB_SIZE] = { @@ -556,12 +592,22 @@ static int build_key(struct saa7134_dev *dev) dprintk("build_key gpio=0x%x mask=0x%x data=%d\n", gpio, ir->mask_keycode, data); - if ((ir->mask_keydown && (0 != (gpio & ir->mask_keydown))) || - (ir->mask_keyup && (0 == (gpio & ir->mask_keyup)))) { - ir_input_keydown(ir->dev, &ir->ir, data, data); - } else { - ir_input_nokey(ir->dev, &ir->ir); + if (ir->polling) { + if ((ir->mask_keydown && (0 != (gpio & ir->mask_keydown))) || + (ir->mask_keyup && (0 == (gpio & ir->mask_keyup)))) { + ir_input_keydown(ir->dev, &ir->ir, data, data); + } else { + ir_input_nokey(ir->dev, &ir->ir); + } + } + else { /* IRQ driven mode - handle key press and release in one go */ + if ((ir->mask_keydown && (0 != (gpio & ir->mask_keydown))) || + (ir->mask_keyup && (0 == (gpio & ir->mask_keyup)))) { + ir_input_keydown(ir->dev, &ir->ir, data, data); + ir_input_nokey(ir->dev, &ir->ir); + } } + return 0; } |