diff options
author | David Härdeman <david@hardeman.nu> | 2014-04-03 20:31:30 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-07-23 21:50:48 -0300 |
commit | 120703f9eb32033f0e39bdc552c0273c8ab45f33 (patch) | |
tree | 427e55aad9dcfcb91e99b98d508e6fb407e8f600 /drivers/media/rc/ir-rc6-decoder.c | |
parent | af3a4a9bbeb00df3e42e77240b4cdac5479812f9 (diff) | |
download | talos-obmc-linux-120703f9eb32033f0e39bdc552c0273c8ab45f33.tar.gz talos-obmc-linux-120703f9eb32033f0e39bdc552c0273c8ab45f33.zip |
[media] rc-core: document the protocol type
Right now the protocol information is not preserved, rc-core gets handed a
scancode but has no idea which protocol it corresponds to.
This patch (which required reading through the source/keymap for all drivers,
not fun) makes the protocol information explicit which is important
documentation and makes it easier to e.g. support multiple protocols with one
decoder (think rc5 and rc-streamzap). The information isn't used yet so there
should be no functional changes.
[m.chehab@samsung.com: rebased, added cxusb and removed bad whitespacing]
Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/rc/ir-rc6-decoder.c')
-rw-r--r-- | drivers/media/rc/ir-rc6-decoder.c | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/drivers/media/rc/ir-rc6-decoder.c b/drivers/media/rc/ir-rc6-decoder.c index cfbd64e3999c..1dc97a7b92a5 100644 --- a/drivers/media/rc/ir-rc6-decoder.c +++ b/drivers/media/rc/ir-rc6-decoder.c @@ -88,6 +88,7 @@ static int ir_rc6_decode(struct rc_dev *dev, struct ir_raw_event ev) struct rc6_dec *data = &dev->raw->rc6; u32 scancode; u8 toggle; + enum rc_type protocol; if (!rc_protocols_enabled(dev, RC_BIT_RC6_0 | RC_BIT_RC6_6A_20 | RC_BIT_RC6_6A_24 | RC_BIT_RC6_6A_32 | @@ -233,9 +234,11 @@ again: case RC6_MODE_0: scancode = data->body; toggle = data->toggle; + protocol = RC_TYPE_RC6_0; IR_dprintk(1, "RC6(0) scancode 0x%04x (toggle: %u)\n", scancode, toggle); break; + case RC6_MODE_6A: if (data->count > CHAR_BIT * sizeof data->body) { IR_dprintk(1, "RC6 too many (%u) data bits\n", @@ -244,23 +247,39 @@ again: } scancode = data->body; - if (data->count == RC6_6A_32_NBITS && - (scancode & RC6_6A_LCC_MASK) == RC6_6A_MCE_CC) { - /* MCE RC */ - toggle = (scancode & RC6_6A_MCE_TOGGLE_MASK) ? 1 : 0; - scancode &= ~RC6_6A_MCE_TOGGLE_MASK; - } else { + switch (data->count) { + case 20: + protocol = RC_TYPE_RC6_6A_20; + toggle = 0; + break; + case 24: + protocol = RC_BIT_RC6_6A_24; toggle = 0; + break; + case 32: + if ((scancode & RC6_6A_LCC_MASK) == RC6_6A_MCE_CC) { + protocol = RC_TYPE_RC6_MCE; + scancode &= ~RC6_6A_MCE_TOGGLE_MASK; + toggle = !!(scancode & RC6_6A_MCE_TOGGLE_MASK); + } else { + protocol = RC_BIT_RC6_6A_32; + toggle = 0; + } + break; + default: + IR_dprintk(1, "RC6(6A) unsupported length\n"); + goto out; } - IR_dprintk(1, "RC6(6A) scancode 0x%08x (toggle: %u)\n", - scancode, toggle); + + IR_dprintk(1, "RC6(6A) proto 0x%04x, scancode 0x%08x (toggle: %u)\n", + protocol, scancode, toggle); break; default: IR_dprintk(1, "RC6 unknown mode\n"); goto out; } - rc_keydown(dev, scancode, toggle); + rc_keydown(dev, protocol, scancode, toggle); data->state = STATE_INACTIVE; return 0; } |