summaryrefslogtreecommitdiffstats
path: root/drivers/media/video/saa7134/saa7134-input.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2010-04-03 18:51:50 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-05-19 12:56:55 -0300
commit2f16f6315f583964732bc23c873d4024281d763c (patch)
treea20f719a7d4aef15a24f55f4c6e1aaaa90c8a8b7 /drivers/media/video/saa7134/saa7134-input.c
parent13c24497086418010bf4f76378bcae241d7f59cd (diff)
V4L/DVB: ir-nec-decoder: Reimplement the entire decoder
Thanks to Andy Walls <awalls@md.metrocast.net> for pointing me his code, that gave me some ideas to better implement it. After some work with saa7134 bits, I found a way to catch both IRQ edge pulses. By enabling it, the NEC decoder can now take both pulse and spaces into account, making it more precise. Instead of the old strategy of handling the events all at once, this code implements a state machine. Due to that, it handles individual pulse or space events, validating them against the protocol, producing a much more reliable decoding. With the new implementation, the protocol trailer bits are properly handled, making possible for the repeat key to work. Also, the code is now capable of handling both NEC and NEC extended IR devices. With NEC, it produces a 16 bits code, while with NEC extended, a 24 bits code is returned. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/saa7134/saa7134-input.c')
-rw-r--r--drivers/media/video/saa7134/saa7134-input.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c
index a51ba83fb6c..867f027c3fe 100644
--- a/drivers/media/video/saa7134/saa7134-input.c
+++ b/drivers/media/video/saa7134/saa7134-input.c
@@ -658,7 +658,8 @@ int saa7134_input_init1(struct saa7134_dev *dev)
break;
case SAA7134_BOARD_AVERMEDIA_M135A:
ir_codes = RC_MAP_AVERMEDIA_M135A_RM_JX;
- mask_keydown = 0x0040000;
+ mask_keydown = 0x0040000; /* Enable GPIO18 line on both edges */
+ mask_keyup = 0x0040000;
mask_keycode = 0xffff;
raw_decode = 1;
break;
@@ -1014,13 +1015,13 @@ static int saa7134_raw_decode_irq(struct saa7134_dev *dev)
{
struct card_ir *ir = dev->remote;
unsigned long timeout;
- int pulse;
+ int space;
/* Generate initial event */
saa_clearb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN);
saa_setb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN);
- pulse = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2) & ir->mask_keydown;
- ir_raw_event_store(dev->remote->dev, pulse ? IR_PULSE : IR_SPACE);
+ space = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2) & ir->mask_keydown;
+ ir_raw_event_store(dev->remote->dev, space ? IR_SPACE : IR_PULSE);
/*