From 0602fbb2c84ffea1b06ae8e677662074620f01d7 Mon Sep 17 00:00:00 2001 From: Peter Missel Date: Mon, 9 Jan 2006 18:21:23 -0200 Subject: 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 Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/saa7134/saa7134-core.c | 62 +++++++++++++++++++++++------- 1 file changed, 48 insertions(+), 14 deletions(-) (limited to 'drivers/media/video/saa7134/saa7134-core.c') 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) 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) { @@ -553,13 +580,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 GPIO enable bits\n",dev->name); - saa_clearl(SAA7134_IRQ2, (SAA7134_IRQ2_INTE_GPIO16 | - SAA7134_IRQ2_INTE_GPIO18)); + "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 GPIO18 enable bit\n",dev->name); + saa_clearl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO18); } else { /* disable all irqs */ printk(KERN_WARNING "%s/irq: looping -- " @@ -640,10 +670,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); -- cgit v1.2.3