diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-04-03 17:51:50 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-05-19 11:56:55 -0400 |
commit | 2f16f6315f583964732bc23c873d4024281d763c (patch) | |
tree | a20f719a7d4aef15a24f55f4c6e1aaaa90c8a8b7 /drivers/media/video/saa7134 | |
parent | 13c24497086418010bf4f76378bcae241d7f59cd (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')
-rw-r--r-- | drivers/media/video/saa7134/saa7134-input.c | 9 |
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 a51ba83fb6c4..867f027c3feb 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) | |||
658 | break; | 658 | break; |
659 | case SAA7134_BOARD_AVERMEDIA_M135A: | 659 | case SAA7134_BOARD_AVERMEDIA_M135A: |
660 | ir_codes = RC_MAP_AVERMEDIA_M135A_RM_JX; | 660 | ir_codes = RC_MAP_AVERMEDIA_M135A_RM_JX; |
661 | mask_keydown = 0x0040000; | 661 | mask_keydown = 0x0040000; /* Enable GPIO18 line on both edges */ |
662 | mask_keyup = 0x0040000; | ||
662 | mask_keycode = 0xffff; | 663 | mask_keycode = 0xffff; |
663 | raw_decode = 1; | 664 | raw_decode = 1; |
664 | break; | 665 | break; |
@@ -1014,13 +1015,13 @@ static int saa7134_raw_decode_irq(struct saa7134_dev *dev) | |||
1014 | { | 1015 | { |
1015 | struct card_ir *ir = dev->remote; | 1016 | struct card_ir *ir = dev->remote; |
1016 | unsigned long timeout; | 1017 | unsigned long timeout; |
1017 | int pulse; | 1018 | int space; |
1018 | 1019 | ||
1019 | /* Generate initial event */ | 1020 | /* Generate initial event */ |
1020 | saa_clearb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); | 1021 | saa_clearb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); |
1021 | saa_setb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); | 1022 | saa_setb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); |
1022 | pulse = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2) & ir->mask_keydown; | 1023 | space = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2) & ir->mask_keydown; |
1023 | ir_raw_event_store(dev->remote->dev, pulse ? IR_PULSE : IR_SPACE); | 1024 | ir_raw_event_store(dev->remote->dev, space ? IR_SPACE : IR_PULSE); |
1024 | 1025 | ||
1025 | 1026 | ||
1026 | /* | 1027 | /* |