diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-15 15:49:56 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-15 15:49:56 -0500 |
commit | 122804ecb59493fbb4d31b3ba9ac59faaf45276f (patch) | |
tree | cff4d8a158c412e4a8d3abc8d91bb0eb52b01c9a /drivers/media/rc | |
parent | 16008d641670571ff4cd750b416c7caf2d89f467 (diff) | |
parent | 126400033940afb658123517a2e80eb68259fbd7 (diff) |
Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (655 commits)
[media] revert patch: HDIC HD29L2 DMB-TH USB2.0 reference design driver
mb86a20s: Add a few more register settings at the init seq
mb86a20s: Group registers into the same line
[media] [PATCH] don't reset the delivery system on DTV_CLEAR
[media] [BUG] it913x-fe fix typo error making SNR levels unstable
[media] cx23885: Query the CX25840 during enum_input for status
[media] cx25840: Add support for g_input_status
[media] rc-videomate-m1f.c Rename to match remote controler name
[media] drivers: media: au0828: Fix dependency for VIDEO_AU0828
[media] convert drivers/media/* to use module_platform_driver()
[media] drivers: video: cx231xx: Fix dependency for VIDEO_CX231XX_DVB
[media] Exynos4 JPEG codec v4l2 driver
[media] doc: v4l: selection: choose pixels as units for selection rectangles
[media] v4l: s5p-tv: mixer: fix setup of VP scaling
[media] v4l: s5p-tv: mixer: add support for selection API
[media] v4l: emulate old crop API using extended crop/compose API
[media] doc: v4l: add documentation for selection API
[media] doc: v4l: add binary images for selection API
[media] v4l: add support for selection api
[media] hd29l2: fix review findings
...
Diffstat (limited to 'drivers/media/rc')
-rw-r--r-- | drivers/media/rc/Kconfig | 10 | ||||
-rw-r--r-- | drivers/media/rc/Makefile | 1 | ||||
-rw-r--r-- | drivers/media/rc/ir-nec-decoder.c | 4 | ||||
-rw-r--r-- | drivers/media/rc/ir-raw.c | 1 | ||||
-rw-r--r-- | drivers/media/rc/ir-rc6-decoder.c | 67 | ||||
-rw-r--r-- | drivers/media/rc/ir-sanyo-decoder.c | 205 | ||||
-rw-r--r-- | drivers/media/rc/keymaps/rc-hauppauge.c | 51 | ||||
-rw-r--r-- | drivers/media/rc/keymaps/rc-videomate-m1f.c | 24 | ||||
-rw-r--r-- | drivers/media/rc/rc-core-priv.h | 12 | ||||
-rw-r--r-- | drivers/media/rc/rc-main.c | 1 | ||||
-rw-r--r-- | drivers/media/rc/redrat3.c | 52 |
11 files changed, 354 insertions, 74 deletions
diff --git a/drivers/media/rc/Kconfig b/drivers/media/rc/Kconfig index aeb7f43dfb65..4df4affeea5f 100644 --- a/drivers/media/rc/Kconfig +++ b/drivers/media/rc/Kconfig | |||
@@ -87,6 +87,16 @@ config IR_RC5_SZ_DECODER | |||
87 | uses an IR protocol that is almost standard RC-5, but not quite, | 87 | uses an IR protocol that is almost standard RC-5, but not quite, |
88 | as it uses an additional bit). | 88 | as it uses an additional bit). |
89 | 89 | ||
90 | config IR_SANYO_DECODER | ||
91 | tristate "Enable IR raw decoder for the Sanyo protocol" | ||
92 | depends on RC_CORE | ||
93 | default y | ||
94 | |||
95 | ---help--- | ||
96 | Enable this option if you have an infrared remote control which | ||
97 | uses the Sanyo protocol (Sanyo, Aiwa, Chinon remotes), | ||
98 | and you need software decoding support. | ||
99 | |||
90 | config IR_MCE_KBD_DECODER | 100 | config IR_MCE_KBD_DECODER |
91 | tristate "Enable IR raw decoder for the MCE keyboard/mouse protocol" | 101 | tristate "Enable IR raw decoder for the MCE keyboard/mouse protocol" |
92 | depends on RC_CORE | 102 | depends on RC_CORE |
diff --git a/drivers/media/rc/Makefile b/drivers/media/rc/Makefile index 2156e786b557..fb3dee2dd845 100644 --- a/drivers/media/rc/Makefile +++ b/drivers/media/rc/Makefile | |||
@@ -10,6 +10,7 @@ obj-$(CONFIG_IR_RC6_DECODER) += ir-rc6-decoder.o | |||
10 | obj-$(CONFIG_IR_JVC_DECODER) += ir-jvc-decoder.o | 10 | obj-$(CONFIG_IR_JVC_DECODER) += ir-jvc-decoder.o |
11 | obj-$(CONFIG_IR_SONY_DECODER) += ir-sony-decoder.o | 11 | obj-$(CONFIG_IR_SONY_DECODER) += ir-sony-decoder.o |
12 | obj-$(CONFIG_IR_RC5_SZ_DECODER) += ir-rc5-sz-decoder.o | 12 | obj-$(CONFIG_IR_RC5_SZ_DECODER) += ir-rc5-sz-decoder.o |
13 | obj-$(CONFIG_IR_SANYO_DECODER) += ir-sanyo-decoder.o | ||
13 | obj-$(CONFIG_IR_MCE_KBD_DECODER) += ir-mce_kbd-decoder.o | 14 | obj-$(CONFIG_IR_MCE_KBD_DECODER) += ir-mce_kbd-decoder.o |
14 | obj-$(CONFIG_IR_LIRC_CODEC) += ir-lirc-codec.o | 15 | obj-$(CONFIG_IR_LIRC_CODEC) += ir-lirc-codec.o |
15 | 16 | ||
diff --git a/drivers/media/rc/ir-nec-decoder.c b/drivers/media/rc/ir-nec-decoder.c index 17f8db00435a..3c9431a9f62d 100644 --- a/drivers/media/rc/ir-nec-decoder.c +++ b/drivers/media/rc/ir-nec-decoder.c | |||
@@ -194,8 +194,8 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev) | |||
194 | return 0; | 194 | return 0; |
195 | } | 195 | } |
196 | 196 | ||
197 | IR_dprintk(1, "NEC decode failed at state %d (%uus %s)\n", | 197 | IR_dprintk(1, "NEC decode failed at count %d state %d (%uus %s)\n", |
198 | data->state, TO_US(ev.duration), TO_STR(ev.pulse)); | 198 | data->count, data->state, TO_US(ev.duration), TO_STR(ev.pulse)); |
199 | data->state = STATE_INACTIVE; | 199 | data->state = STATE_INACTIVE; |
200 | return -EINVAL; | 200 | return -EINVAL; |
201 | } | 201 | } |
diff --git a/drivers/media/rc/ir-raw.c b/drivers/media/rc/ir-raw.c index 2e5cd3100b64..95e630998aaf 100644 --- a/drivers/media/rc/ir-raw.c +++ b/drivers/media/rc/ir-raw.c | |||
@@ -357,6 +357,7 @@ static void init_decoders(struct work_struct *work) | |||
357 | load_rc6_decode(); | 357 | load_rc6_decode(); |
358 | load_jvc_decode(); | 358 | load_jvc_decode(); |
359 | load_sony_decode(); | 359 | load_sony_decode(); |
360 | load_sanyo_decode(); | ||
360 | load_mce_kbd_decode(); | 361 | load_mce_kbd_decode(); |
361 | load_lirc_codec(); | 362 | load_lirc_codec(); |
362 | 363 | ||
diff --git a/drivers/media/rc/ir-rc6-decoder.c b/drivers/media/rc/ir-rc6-decoder.c index 140fb67e2f89..4cfdd7fa4bbd 100644 --- a/drivers/media/rc/ir-rc6-decoder.c +++ b/drivers/media/rc/ir-rc6-decoder.c | |||
@@ -18,24 +18,31 @@ | |||
18 | /* | 18 | /* |
19 | * This decoder currently supports: | 19 | * This decoder currently supports: |
20 | * RC6-0-16 (standard toggle bit in header) | 20 | * RC6-0-16 (standard toggle bit in header) |
21 | * RC6-6A-20 (no toggle bit) | ||
21 | * RC6-6A-24 (no toggle bit) | 22 | * RC6-6A-24 (no toggle bit) |
22 | * RC6-6A-32 (MCE version with toggle bit in body) | 23 | * RC6-6A-32 (MCE version with toggle bit in body) |
23 | */ | 24 | */ |
24 | 25 | ||
25 | #define RC6_UNIT 444444 /* us */ | 26 | #define RC6_UNIT 444444 /* nanosecs */ |
26 | #define RC6_HEADER_NBITS 4 /* not including toggle bit */ | 27 | #define RC6_HEADER_NBITS 4 /* not including toggle bit */ |
27 | #define RC6_0_NBITS 16 | 28 | #define RC6_0_NBITS 16 |
28 | #define RC6_6A_SMALL_NBITS 24 | 29 | #define RC6_6A_32_NBITS 32 |
29 | #define RC6_6A_LARGE_NBITS 32 | 30 | #define RC6_6A_NBITS 128 /* Variable 8..128 */ |
30 | #define RC6_PREFIX_PULSE (6 * RC6_UNIT) | 31 | #define RC6_PREFIX_PULSE (6 * RC6_UNIT) |
31 | #define RC6_PREFIX_SPACE (2 * RC6_UNIT) | 32 | #define RC6_PREFIX_SPACE (2 * RC6_UNIT) |
32 | #define RC6_BIT_START (1 * RC6_UNIT) | 33 | #define RC6_BIT_START (1 * RC6_UNIT) |
33 | #define RC6_BIT_END (1 * RC6_UNIT) | 34 | #define RC6_BIT_END (1 * RC6_UNIT) |
34 | #define RC6_TOGGLE_START (2 * RC6_UNIT) | 35 | #define RC6_TOGGLE_START (2 * RC6_UNIT) |
35 | #define RC6_TOGGLE_END (2 * RC6_UNIT) | 36 | #define RC6_TOGGLE_END (2 * RC6_UNIT) |
37 | #define RC6_SUFFIX_SPACE (6 * RC6_UNIT) | ||
36 | #define RC6_MODE_MASK 0x07 /* for the header bits */ | 38 | #define RC6_MODE_MASK 0x07 /* for the header bits */ |
37 | #define RC6_STARTBIT_MASK 0x08 /* for the header bits */ | 39 | #define RC6_STARTBIT_MASK 0x08 /* for the header bits */ |
38 | #define RC6_6A_MCE_TOGGLE_MASK 0x8000 /* for the body bits */ | 40 | #define RC6_6A_MCE_TOGGLE_MASK 0x8000 /* for the body bits */ |
41 | #define RC6_6A_LCC_MASK 0xffff0000 /* RC6-6A-32 long customer code mask */ | ||
42 | #define RC6_6A_MCE_CC 0x800f0000 /* MCE customer code */ | ||
43 | #ifndef CHAR_BIT | ||
44 | #define CHAR_BIT 8 /* Normally in <limits.h> */ | ||
45 | #endif | ||
39 | 46 | ||
40 | enum rc6_mode { | 47 | enum rc6_mode { |
41 | RC6_MODE_0, | 48 | RC6_MODE_0, |
@@ -125,6 +132,7 @@ again: | |||
125 | break; | 132 | break; |
126 | 133 | ||
127 | data->state = STATE_HEADER_BIT_START; | 134 | data->state = STATE_HEADER_BIT_START; |
135 | data->header = 0; | ||
128 | return 0; | 136 | return 0; |
129 | 137 | ||
130 | case STATE_HEADER_BIT_START: | 138 | case STATE_HEADER_BIT_START: |
@@ -171,20 +179,14 @@ again: | |||
171 | data->state = STATE_BODY_BIT_START; | 179 | data->state = STATE_BODY_BIT_START; |
172 | decrease_duration(&ev, RC6_TOGGLE_END); | 180 | decrease_duration(&ev, RC6_TOGGLE_END); |
173 | data->count = 0; | 181 | data->count = 0; |
182 | data->body = 0; | ||
174 | 183 | ||
175 | switch (rc6_mode(data)) { | 184 | switch (rc6_mode(data)) { |
176 | case RC6_MODE_0: | 185 | case RC6_MODE_0: |
177 | data->wanted_bits = RC6_0_NBITS; | 186 | data->wanted_bits = RC6_0_NBITS; |
178 | break; | 187 | break; |
179 | case RC6_MODE_6A: | 188 | case RC6_MODE_6A: |
180 | /* This might look weird, but we basically | 189 | data->wanted_bits = RC6_6A_NBITS; |
181 | check the value of the first body bit to | ||
182 | determine the number of bits in mode 6A */ | ||
183 | if ((!ev.pulse && !geq_margin(ev.duration, RC6_UNIT, RC6_UNIT / 2)) || | ||
184 | geq_margin(ev.duration, RC6_UNIT, RC6_UNIT / 2)) | ||
185 | data->wanted_bits = RC6_6A_LARGE_NBITS; | ||
186 | else | ||
187 | data->wanted_bits = RC6_6A_SMALL_NBITS; | ||
188 | break; | 190 | break; |
189 | default: | 191 | default: |
190 | IR_dprintk(1, "RC6 unknown mode\n"); | 192 | IR_dprintk(1, "RC6 unknown mode\n"); |
@@ -193,15 +195,21 @@ again: | |||
193 | goto again; | 195 | goto again; |
194 | 196 | ||
195 | case STATE_BODY_BIT_START: | 197 | case STATE_BODY_BIT_START: |
196 | if (!eq_margin(ev.duration, RC6_BIT_START, RC6_UNIT / 2)) | 198 | if (eq_margin(ev.duration, RC6_BIT_START, RC6_UNIT / 2)) { |
197 | break; | 199 | /* Discard LSB's that won't fit in data->body */ |
198 | 200 | if (data->count++ < CHAR_BIT * sizeof data->body) { | |
199 | data->body <<= 1; | 201 | data->body <<= 1; |
200 | if (ev.pulse) | 202 | if (ev.pulse) |
201 | data->body |= 1; | 203 | data->body |= 1; |
202 | data->count++; | 204 | } |
203 | data->state = STATE_BODY_BIT_END; | 205 | data->state = STATE_BODY_BIT_END; |
204 | return 0; | 206 | return 0; |
207 | } else if (RC6_MODE_6A == rc6_mode(data) && !ev.pulse && | ||
208 | geq_margin(ev.duration, RC6_SUFFIX_SPACE, RC6_UNIT / 2)) { | ||
209 | data->state = STATE_FINISHED; | ||
210 | goto again; | ||
211 | } | ||
212 | break; | ||
205 | 213 | ||
206 | case STATE_BODY_BIT_END: | 214 | case STATE_BODY_BIT_END: |
207 | if (!is_transition(&ev, &dev->raw->prev_ev)) | 215 | if (!is_transition(&ev, &dev->raw->prev_ev)) |
@@ -221,20 +229,27 @@ again: | |||
221 | 229 | ||
222 | switch (rc6_mode(data)) { | 230 | switch (rc6_mode(data)) { |
223 | case RC6_MODE_0: | 231 | case RC6_MODE_0: |
224 | scancode = data->body & 0xffff; | 232 | scancode = data->body; |
225 | toggle = data->toggle; | 233 | toggle = data->toggle; |
226 | IR_dprintk(1, "RC6(0) scancode 0x%04x (toggle: %u)\n", | 234 | IR_dprintk(1, "RC6(0) scancode 0x%04x (toggle: %u)\n", |
227 | scancode, toggle); | 235 | scancode, toggle); |
228 | break; | 236 | break; |
229 | case RC6_MODE_6A: | 237 | case RC6_MODE_6A: |
230 | if (data->wanted_bits == RC6_6A_LARGE_NBITS) { | 238 | if (data->count > CHAR_BIT * sizeof data->body) { |
231 | toggle = data->body & RC6_6A_MCE_TOGGLE_MASK ? 1 : 0; | 239 | IR_dprintk(1, "RC6 too many (%u) data bits\n", |
232 | scancode = data->body & ~RC6_6A_MCE_TOGGLE_MASK; | 240 | data->count); |
241 | goto out; | ||
242 | } | ||
243 | |||
244 | scancode = data->body; | ||
245 | if (data->count == RC6_6A_32_NBITS && | ||
246 | (scancode & RC6_6A_LCC_MASK) == RC6_6A_MCE_CC) { | ||
247 | /* MCE RC */ | ||
248 | toggle = (scancode & RC6_6A_MCE_TOGGLE_MASK) ? 1 : 0; | ||
249 | scancode &= ~RC6_6A_MCE_TOGGLE_MASK; | ||
233 | } else { | 250 | } else { |
234 | toggle = 0; | 251 | toggle = 0; |
235 | scancode = data->body & 0xffffff; | ||
236 | } | 252 | } |
237 | |||
238 | IR_dprintk(1, "RC6(6A) scancode 0x%08x (toggle: %u)\n", | 253 | IR_dprintk(1, "RC6(6A) scancode 0x%08x (toggle: %u)\n", |
239 | scancode, toggle); | 254 | scancode, toggle); |
240 | break; | 255 | break; |
diff --git a/drivers/media/rc/ir-sanyo-decoder.c b/drivers/media/rc/ir-sanyo-decoder.c new file mode 100644 index 000000000000..d38fbdd0b25a --- /dev/null +++ b/drivers/media/rc/ir-sanyo-decoder.c | |||
@@ -0,0 +1,205 @@ | |||
1 | /* ir-sanyo-decoder.c - handle SANYO IR Pulse/Space protocol | ||
2 | * | ||
3 | * Copyright (C) 2011 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation version 2 of the License. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * This protocol uses the NEC protocol timings. However, data is formatted as: | ||
15 | * 13 bits Custom Code | ||
16 | * 13 bits NOT(Custom Code) | ||
17 | * 8 bits Key data | ||
18 | * 8 bits NOT(Key data) | ||
19 | * | ||
20 | * According with LIRC, this protocol is used on Sanyo, Aiwa and Chinon | ||
21 | * Information for this protocol is available at the Sanyo LC7461 datasheet. | ||
22 | */ | ||
23 | |||
24 | #include <linux/module.h> | ||
25 | #include <linux/bitrev.h> | ||
26 | #include "rc-core-priv.h" | ||
27 | |||
28 | #define SANYO_NBITS (13+13+8+8) | ||
29 | #define SANYO_UNIT 562500 /* ns */ | ||
30 | #define SANYO_HEADER_PULSE (16 * SANYO_UNIT) | ||
31 | #define SANYO_HEADER_SPACE (8 * SANYO_UNIT) | ||
32 | #define SANYO_BIT_PULSE (1 * SANYO_UNIT) | ||
33 | #define SANYO_BIT_0_SPACE (1 * SANYO_UNIT) | ||
34 | #define SANYO_BIT_1_SPACE (3 * SANYO_UNIT) | ||
35 | #define SANYO_REPEAT_SPACE (150 * SANYO_UNIT) | ||
36 | #define SANYO_TRAILER_PULSE (1 * SANYO_UNIT) | ||
37 | #define SANYO_TRAILER_SPACE (10 * SANYO_UNIT) /* in fact, 42 */ | ||
38 | |||
39 | enum sanyo_state { | ||
40 | STATE_INACTIVE, | ||
41 | STATE_HEADER_SPACE, | ||
42 | STATE_BIT_PULSE, | ||
43 | STATE_BIT_SPACE, | ||
44 | STATE_TRAILER_PULSE, | ||
45 | STATE_TRAILER_SPACE, | ||
46 | }; | ||
47 | |||
48 | /** | ||
49 | * ir_sanyo_decode() - Decode one SANYO pulse or space | ||
50 | * @dev: the struct rc_dev descriptor of the device | ||
51 | * @duration: the struct ir_raw_event descriptor of the pulse/space | ||
52 | * | ||
53 | * This function returns -EINVAL if the pulse violates the state machine | ||
54 | */ | ||
55 | static int ir_sanyo_decode(struct rc_dev *dev, struct ir_raw_event ev) | ||
56 | { | ||
57 | struct sanyo_dec *data = &dev->raw->sanyo; | ||
58 | u32 scancode; | ||
59 | u8 address, not_address, command, not_command; | ||
60 | |||
61 | if (!(dev->raw->enabled_protocols & RC_TYPE_SANYO)) | ||
62 | return 0; | ||
63 | |||
64 | if (!is_timing_event(ev)) { | ||
65 | if (ev.reset) { | ||
66 | IR_dprintk(1, "SANYO event reset received. reset to state 0\n"); | ||
67 | data->state = STATE_INACTIVE; | ||
68 | } | ||
69 | return 0; | ||
70 | } | ||
71 | |||
72 | IR_dprintk(2, "SANYO decode started at state %d (%uus %s)\n", | ||
73 | data->state, TO_US(ev.duration), TO_STR(ev.pulse)); | ||
74 | |||
75 | switch (data->state) { | ||
76 | |||
77 | case STATE_INACTIVE: | ||
78 | if (!ev.pulse) | ||
79 | break; | ||
80 | |||
81 | if (eq_margin(ev.duration, SANYO_HEADER_PULSE, SANYO_UNIT / 2)) { | ||
82 | data->count = 0; | ||
83 | data->state = STATE_HEADER_SPACE; | ||
84 | return 0; | ||
85 | } | ||
86 | break; | ||
87 | |||
88 | |||
89 | case STATE_HEADER_SPACE: | ||
90 | if (ev.pulse) | ||
91 | break; | ||
92 | |||
93 | if (eq_margin(ev.duration, SANYO_HEADER_SPACE, SANYO_UNIT / 2)) { | ||
94 | data->state = STATE_BIT_PULSE; | ||
95 | return 0; | ||
96 | } | ||
97 | |||
98 | break; | ||
99 | |||
100 | case STATE_BIT_PULSE: | ||
101 | if (!ev.pulse) | ||
102 | break; | ||
103 | |||
104 | if (!eq_margin(ev.duration, SANYO_BIT_PULSE, SANYO_UNIT / 2)) | ||
105 | break; | ||
106 | |||
107 | data->state = STATE_BIT_SPACE; | ||
108 | return 0; | ||
109 | |||
110 | case STATE_BIT_SPACE: | ||
111 | if (ev.pulse) | ||
112 | break; | ||
113 | |||
114 | if (!data->count && geq_margin(ev.duration, SANYO_REPEAT_SPACE, SANYO_UNIT / 2)) { | ||
115 | if (!dev->keypressed) { | ||
116 | IR_dprintk(1, "SANYO discarding last key repeat: event after key up\n"); | ||
117 | } else { | ||
118 | rc_repeat(dev); | ||
119 | IR_dprintk(1, "SANYO repeat last key\n"); | ||
120 | data->state = STATE_INACTIVE; | ||
121 | } | ||
122 | return 0; | ||
123 | } | ||
124 | |||
125 | data->bits <<= 1; | ||
126 | if (eq_margin(ev.duration, SANYO_BIT_1_SPACE, SANYO_UNIT / 2)) | ||
127 | data->bits |= 1; | ||
128 | else if (!eq_margin(ev.duration, SANYO_BIT_0_SPACE, SANYO_UNIT / 2)) | ||
129 | break; | ||
130 | data->count++; | ||
131 | |||
132 | if (data->count == SANYO_NBITS) | ||
133 | data->state = STATE_TRAILER_PULSE; | ||
134 | else | ||
135 | data->state = STATE_BIT_PULSE; | ||
136 | |||
137 | return 0; | ||
138 | |||
139 | case STATE_TRAILER_PULSE: | ||
140 | if (!ev.pulse) | ||
141 | break; | ||
142 | |||
143 | if (!eq_margin(ev.duration, SANYO_TRAILER_PULSE, SANYO_UNIT / 2)) | ||
144 | break; | ||
145 | |||
146 | data->state = STATE_TRAILER_SPACE; | ||
147 | return 0; | ||
148 | |||
149 | case STATE_TRAILER_SPACE: | ||
150 | if (ev.pulse) | ||
151 | break; | ||
152 | |||
153 | if (!geq_margin(ev.duration, SANYO_TRAILER_SPACE, SANYO_UNIT / 2)) | ||
154 | break; | ||
155 | |||
156 | address = bitrev16((data->bits >> 29) & 0x1fff) >> 3; | ||
157 | not_address = bitrev16((data->bits >> 16) & 0x1fff) >> 3; | ||
158 | command = bitrev8((data->bits >> 8) & 0xff); | ||
159 | not_command = bitrev8((data->bits >> 0) & 0xff); | ||
160 | |||
161 | if ((command ^ not_command) != 0xff) { | ||
162 | IR_dprintk(1, "SANYO checksum error: received 0x%08Lx\n", | ||
163 | data->bits); | ||
164 | data->state = STATE_INACTIVE; | ||
165 | return 0; | ||
166 | } | ||
167 | |||
168 | scancode = address << 8 | command; | ||
169 | IR_dprintk(1, "SANYO scancode: 0x%06x\n", scancode); | ||
170 | rc_keydown(dev, scancode, 0); | ||
171 | data->state = STATE_INACTIVE; | ||
172 | return 0; | ||
173 | } | ||
174 | |||
175 | IR_dprintk(1, "SANYO decode failed at count %d state %d (%uus %s)\n", | ||
176 | data->count, data->state, TO_US(ev.duration), TO_STR(ev.pulse)); | ||
177 | data->state = STATE_INACTIVE; | ||
178 | return -EINVAL; | ||
179 | } | ||
180 | |||
181 | static struct ir_raw_handler sanyo_handler = { | ||
182 | .protocols = RC_TYPE_SANYO, | ||
183 | .decode = ir_sanyo_decode, | ||
184 | }; | ||
185 | |||
186 | static int __init ir_sanyo_decode_init(void) | ||
187 | { | ||
188 | ir_raw_handler_register(&sanyo_handler); | ||
189 | |||
190 | printk(KERN_INFO "IR SANYO protocol handler initialized\n"); | ||
191 | return 0; | ||
192 | } | ||
193 | |||
194 | static void __exit ir_sanyo_decode_exit(void) | ||
195 | { | ||
196 | ir_raw_handler_unregister(&sanyo_handler); | ||
197 | } | ||
198 | |||
199 | module_init(ir_sanyo_decode_init); | ||
200 | module_exit(ir_sanyo_decode_exit); | ||
201 | |||
202 | MODULE_LICENSE("GPL"); | ||
203 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
204 | MODULE_AUTHOR("Red Hat Inc. (http://www.redhat.com)"); | ||
205 | MODULE_DESCRIPTION("SANYO IR protocol decoder"); | ||
diff --git a/drivers/media/rc/keymaps/rc-hauppauge.c b/drivers/media/rc/keymaps/rc-hauppauge.c index e51c6163378b..929bbbc16393 100644 --- a/drivers/media/rc/keymaps/rc-hauppauge.c +++ b/drivers/media/rc/keymaps/rc-hauppauge.c | |||
@@ -183,6 +183,57 @@ static struct rc_map_table rc5_hauppauge_new[] = { | |||
183 | { 0x1d3f, KEY_HOME }, | 183 | { 0x1d3f, KEY_HOME }, |
184 | 184 | ||
185 | /* | 185 | /* |
186 | * Keycodes for PT# R-005 remote bundled with Haupauge HVR-930C | ||
187 | * Keycodes start with address = 0x1c | ||
188 | */ | ||
189 | { 0x1c3b, KEY_GOTO }, | ||
190 | { 0x1c3d, KEY_POWER }, | ||
191 | |||
192 | { 0x1c14, KEY_UP }, | ||
193 | { 0x1c15, KEY_DOWN }, | ||
194 | { 0x1c16, KEY_LEFT }, | ||
195 | { 0x1c17, KEY_RIGHT }, | ||
196 | { 0x1c25, KEY_OK }, | ||
197 | |||
198 | { 0x1c00, KEY_0 }, | ||
199 | { 0x1c01, KEY_1 }, | ||
200 | { 0x1c02, KEY_2 }, | ||
201 | { 0x1c03, KEY_3 }, | ||
202 | { 0x1c04, KEY_4 }, | ||
203 | { 0x1c05, KEY_5 }, | ||
204 | { 0x1c06, KEY_6 }, | ||
205 | { 0x1c07, KEY_7 }, | ||
206 | { 0x1c08, KEY_8 }, | ||
207 | { 0x1c09, KEY_9 }, | ||
208 | |||
209 | { 0x1c1f, KEY_EXIT }, /* BACK */ | ||
210 | { 0x1c0d, KEY_MENU }, | ||
211 | { 0x1c1c, KEY_TV }, | ||
212 | |||
213 | { 0x1c10, KEY_VOLUMEUP }, | ||
214 | { 0x1c11, KEY_VOLUMEDOWN }, | ||
215 | |||
216 | { 0x1c20, KEY_CHANNELUP }, | ||
217 | { 0x1c21, KEY_CHANNELDOWN }, | ||
218 | |||
219 | { 0x1c0f, KEY_MUTE }, | ||
220 | { 0x1c12, KEY_PREVIOUS }, /* Prev */ | ||
221 | |||
222 | { 0x1c36, KEY_STOP }, | ||
223 | { 0x1c37, KEY_RECORD }, | ||
224 | |||
225 | { 0x1c24, KEY_LAST }, /* <| */ | ||
226 | { 0x1c1e, KEY_NEXT }, /* >| */ | ||
227 | |||
228 | { 0x1c0a, KEY_TEXT }, | ||
229 | { 0x1c0e, KEY_SUBTITLE }, /* CC */ | ||
230 | |||
231 | { 0x1c32, KEY_REWIND }, | ||
232 | { 0x1c30, KEY_PAUSE }, | ||
233 | { 0x1c35, KEY_PLAY }, | ||
234 | { 0x1c34, KEY_FASTFORWARD }, | ||
235 | |||
236 | /* | ||
186 | * Keycodes for the old Black Remote Controller | 237 | * Keycodes for the old Black Remote Controller |
187 | * This one also uses RC-5 protocol | 238 | * This one also uses RC-5 protocol |
188 | * Keycodes start with address = 0x00 | 239 | * Keycodes start with address = 0x00 |
diff --git a/drivers/media/rc/keymaps/rc-videomate-m1f.c b/drivers/media/rc/keymaps/rc-videomate-m1f.c index 3bd1de1f585c..23ee05e53949 100644 --- a/drivers/media/rc/keymaps/rc-videomate-m1f.c +++ b/drivers/media/rc/keymaps/rc-videomate-m1f.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* videomate-m1f.h - Keytable for videomate_m1f Remote Controller | 1 | /* videomate-k100.h - Keytable for videomate_k100 Remote Controller |
2 | * | 2 | * |
3 | * keymap imported from ir-keymaps.c | 3 | * keymap imported from ir-keymaps.c |
4 | * | 4 | * |
@@ -13,7 +13,7 @@ | |||
13 | #include <media/rc-map.h> | 13 | #include <media/rc-map.h> |
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | 15 | ||
16 | static struct rc_map_table videomate_m1f[] = { | 16 | static struct rc_map_table videomate_k100[] = { |
17 | { 0x01, KEY_POWER }, | 17 | { 0x01, KEY_POWER }, |
18 | { 0x31, KEY_TUNER }, | 18 | { 0x31, KEY_TUNER }, |
19 | { 0x33, KEY_VIDEO }, | 19 | { 0x33, KEY_VIDEO }, |
@@ -67,27 +67,27 @@ static struct rc_map_table videomate_m1f[] = { | |||
67 | { 0x18, KEY_TEXT }, | 67 | { 0x18, KEY_TEXT }, |
68 | }; | 68 | }; |
69 | 69 | ||
70 | static struct rc_map_list videomate_m1f_map = { | 70 | static struct rc_map_list videomate_k100_map = { |
71 | .map = { | 71 | .map = { |
72 | .scan = videomate_m1f, | 72 | .scan = videomate_k100, |
73 | .size = ARRAY_SIZE(videomate_m1f), | 73 | .size = ARRAY_SIZE(videomate_k100), |
74 | .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ | 74 | .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ |
75 | .name = RC_MAP_VIDEOMATE_M1F, | 75 | .name = RC_MAP_VIDEOMATE_K100, |
76 | } | 76 | } |
77 | }; | 77 | }; |
78 | 78 | ||
79 | static int __init init_rc_map_videomate_m1f(void) | 79 | static int __init init_rc_map_videomate_k100(void) |
80 | { | 80 | { |
81 | return rc_map_register(&videomate_m1f_map); | 81 | return rc_map_register(&videomate_k100_map); |
82 | } | 82 | } |
83 | 83 | ||
84 | static void __exit exit_rc_map_videomate_m1f(void) | 84 | static void __exit exit_rc_map_videomate_k100(void) |
85 | { | 85 | { |
86 | rc_map_unregister(&videomate_m1f_map); | 86 | rc_map_unregister(&videomate_k100_map); |
87 | } | 87 | } |
88 | 88 | ||
89 | module_init(init_rc_map_videomate_m1f) | 89 | module_init(init_rc_map_videomate_k100) |
90 | module_exit(exit_rc_map_videomate_m1f) | 90 | module_exit(exit_rc_map_videomate_k100) |
91 | 91 | ||
92 | MODULE_LICENSE("GPL"); | 92 | MODULE_LICENSE("GPL"); |
93 | MODULE_AUTHOR("Pavel Osnova <pvosnova@gmail.com>"); | 93 | MODULE_AUTHOR("Pavel Osnova <pvosnova@gmail.com>"); |
diff --git a/drivers/media/rc/rc-core-priv.h b/drivers/media/rc/rc-core-priv.h index c6ca870e8b7e..b72f8580e317 100644 --- a/drivers/media/rc/rc-core-priv.h +++ b/drivers/media/rc/rc-core-priv.h | |||
@@ -84,6 +84,11 @@ struct ir_raw_event_ctrl { | |||
84 | unsigned count; | 84 | unsigned count; |
85 | unsigned wanted_bits; | 85 | unsigned wanted_bits; |
86 | } rc5_sz; | 86 | } rc5_sz; |
87 | struct sanyo_dec { | ||
88 | int state; | ||
89 | unsigned count; | ||
90 | u64 bits; | ||
91 | } sanyo; | ||
87 | struct mce_kbd_dec { | 92 | struct mce_kbd_dec { |
88 | struct input_dev *idev; | 93 | struct input_dev *idev; |
89 | struct timer_list rx_timeout; | 94 | struct timer_list rx_timeout; |
@@ -193,6 +198,13 @@ static inline void load_jvc_decode(void) { } | |||
193 | static inline void load_sony_decode(void) { } | 198 | static inline void load_sony_decode(void) { } |
194 | #endif | 199 | #endif |
195 | 200 | ||
201 | /* from ir-sanyo-decoder.c */ | ||
202 | #ifdef CONFIG_IR_SANYO_DECODER_MODULE | ||
203 | #define load_sanyo_decode() request_module("ir-sanyo-decoder") | ||
204 | #else | ||
205 | static inline void load_sanyo_decode(void) { } | ||
206 | #endif | ||
207 | |||
196 | /* from ir-mce_kbd-decoder.c */ | 208 | /* from ir-mce_kbd-decoder.c */ |
197 | #ifdef CONFIG_IR_MCE_KBD_DECODER_MODULE | 209 | #ifdef CONFIG_IR_MCE_KBD_DECODER_MODULE |
198 | #define load_mce_kbd_decode() request_module("ir-mce_kbd-decoder") | 210 | #define load_mce_kbd_decode() request_module("ir-mce_kbd-decoder") |
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index f5db8b949bc3..f6a930b70c69 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c | |||
@@ -736,6 +736,7 @@ static struct { | |||
736 | { RC_TYPE_JVC, "jvc" }, | 736 | { RC_TYPE_JVC, "jvc" }, |
737 | { RC_TYPE_SONY, "sony" }, | 737 | { RC_TYPE_SONY, "sony" }, |
738 | { RC_TYPE_RC5_SZ, "rc-5-sz" }, | 738 | { RC_TYPE_RC5_SZ, "rc-5-sz" }, |
739 | { RC_TYPE_SANYO, "sanyo" }, | ||
739 | { RC_TYPE_MCE_KBD, "mce_kbd" }, | 740 | { RC_TYPE_MCE_KBD, "mce_kbd" }, |
740 | { RC_TYPE_LIRC, "lirc" }, | 741 | { RC_TYPE_LIRC, "lirc" }, |
741 | { RC_TYPE_OTHER, "other" }, | 742 | { RC_TYPE_OTHER, "other" }, |
diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c index 07322fb75eff..ad95c67a4dba 100644 --- a/drivers/media/rc/redrat3.c +++ b/drivers/media/rc/redrat3.c | |||
@@ -286,12 +286,6 @@ static void redrat3_issue_async(struct redrat3_dev *rr3) | |||
286 | 286 | ||
287 | rr3_ftr(rr3->dev, "Entering %s\n", __func__); | 287 | rr3_ftr(rr3->dev, "Entering %s\n", __func__); |
288 | 288 | ||
289 | if (!rr3->det_enabled) { | ||
290 | dev_warn(rr3->dev, "not issuing async read, " | ||
291 | "detector not enabled\n"); | ||
292 | return; | ||
293 | } | ||
294 | |||
295 | memset(rr3->bulk_in_buf, 0, rr3->ep_in->wMaxPacketSize); | 289 | memset(rr3->bulk_in_buf, 0, rr3->ep_in->wMaxPacketSize); |
296 | res = usb_submit_urb(rr3->read_urb, GFP_ATOMIC); | 290 | res = usb_submit_urb(rr3->read_urb, GFP_ATOMIC); |
297 | if (res) | 291 | if (res) |
@@ -827,6 +821,7 @@ out: | |||
827 | static void redrat3_handle_async(struct urb *urb, struct pt_regs *regs) | 821 | static void redrat3_handle_async(struct urb *urb, struct pt_regs *regs) |
828 | { | 822 | { |
829 | struct redrat3_dev *rr3; | 823 | struct redrat3_dev *rr3; |
824 | int ret; | ||
830 | 825 | ||
831 | if (!urb) | 826 | if (!urb) |
832 | return; | 827 | return; |
@@ -840,15 +835,13 @@ static void redrat3_handle_async(struct urb *urb, struct pt_regs *regs) | |||
840 | 835 | ||
841 | rr3_ftr(rr3->dev, "Entering %s\n", __func__); | 836 | rr3_ftr(rr3->dev, "Entering %s\n", __func__); |
842 | 837 | ||
843 | if (!rr3->det_enabled) { | ||
844 | rr3_dbg(rr3->dev, "received a read callback but detector " | ||
845 | "disabled - ignoring\n"); | ||
846 | return; | ||
847 | } | ||
848 | |||
849 | switch (urb->status) { | 838 | switch (urb->status) { |
850 | case 0: | 839 | case 0: |
851 | redrat3_get_ir_data(rr3, urb->actual_length); | 840 | ret = redrat3_get_ir_data(rr3, urb->actual_length); |
841 | if (!ret) { | ||
842 | /* no error, prepare to read more */ | ||
843 | redrat3_issue_async(rr3); | ||
844 | } | ||
852 | break; | 845 | break; |
853 | 846 | ||
854 | case -ECONNRESET: | 847 | case -ECONNRESET: |
@@ -865,11 +858,6 @@ static void redrat3_handle_async(struct urb *urb, struct pt_regs *regs) | |||
865 | rr3->pkttype = 0; | 858 | rr3->pkttype = 0; |
866 | break; | 859 | break; |
867 | } | 860 | } |
868 | |||
869 | if (!rr3->transmitting) | ||
870 | redrat3_issue_async(rr3); | ||
871 | else | ||
872 | rr3_dbg(rr3->dev, "IR transmit in progress\n"); | ||
873 | } | 861 | } |
874 | 862 | ||
875 | static void redrat3_write_bulk_callback(struct urb *urb, struct pt_regs *regs) | 863 | static void redrat3_write_bulk_callback(struct urb *urb, struct pt_regs *regs) |
@@ -896,21 +884,24 @@ static u16 mod_freq_to_val(unsigned int mod_freq) | |||
896 | return (u16)(65536 - (mult / mod_freq)); | 884 | return (u16)(65536 - (mult / mod_freq)); |
897 | } | 885 | } |
898 | 886 | ||
899 | static int redrat3_set_tx_carrier(struct rc_dev *dev, u32 carrier) | 887 | static int redrat3_set_tx_carrier(struct rc_dev *rcdev, u32 carrier) |
900 | { | 888 | { |
901 | struct redrat3_dev *rr3 = dev->priv; | 889 | struct redrat3_dev *rr3 = rcdev->priv; |
890 | struct device *dev = rr3->dev; | ||
902 | 891 | ||
892 | rr3_dbg(dev, "Setting modulation frequency to %u", carrier); | ||
903 | rr3->carrier = carrier; | 893 | rr3->carrier = carrier; |
904 | 894 | ||
905 | return carrier; | 895 | return carrier; |
906 | } | 896 | } |
907 | 897 | ||
908 | static int redrat3_transmit_ir(struct rc_dev *rcdev, int *txbuf, u32 n) | 898 | static int redrat3_transmit_ir(struct rc_dev *rcdev, unsigned *txbuf, |
899 | unsigned count) | ||
909 | { | 900 | { |
910 | struct redrat3_dev *rr3 = rcdev->priv; | 901 | struct redrat3_dev *rr3 = rcdev->priv; |
911 | struct device *dev = rr3->dev; | 902 | struct device *dev = rr3->dev; |
912 | struct redrat3_signal_header header; | 903 | struct redrat3_signal_header header; |
913 | int i, j, count, ret, ret_len, offset; | 904 | int i, j, ret, ret_len, offset; |
914 | int lencheck, cur_sample_len, pipe; | 905 | int lencheck, cur_sample_len, pipe; |
915 | char *buffer = NULL, *sigdata = NULL; | 906 | char *buffer = NULL, *sigdata = NULL; |
916 | int *sample_lens = NULL; | 907 | int *sample_lens = NULL; |
@@ -928,20 +919,13 @@ static int redrat3_transmit_ir(struct rc_dev *rcdev, int *txbuf, u32 n) | |||
928 | return -EAGAIN; | 919 | return -EAGAIN; |
929 | } | 920 | } |
930 | 921 | ||
931 | count = n / sizeof(int); | ||
932 | if (count > (RR3_DRIVER_MAXLENS * 2)) | 922 | if (count > (RR3_DRIVER_MAXLENS * 2)) |
933 | return -EINVAL; | 923 | return -EINVAL; |
934 | 924 | ||
925 | /* rr3 will disable rc detector on transmit */ | ||
926 | rr3->det_enabled = false; | ||
935 | rr3->transmitting = true; | 927 | rr3->transmitting = true; |
936 | 928 | ||
937 | redrat3_disable_detector(rr3); | ||
938 | |||
939 | if (rr3->det_enabled) { | ||
940 | dev_err(dev, "%s: cannot tx while rx is enabled\n", __func__); | ||
941 | ret = -EIO; | ||
942 | goto out; | ||
943 | } | ||
944 | |||
945 | sample_lens = kzalloc(sizeof(int) * RR3_DRIVER_MAXLENS, GFP_KERNEL); | 929 | sample_lens = kzalloc(sizeof(int) * RR3_DRIVER_MAXLENS, GFP_KERNEL); |
946 | if (!sample_lens) { | 930 | if (!sample_lens) { |
947 | ret = -ENOMEM; | 931 | ret = -ENOMEM; |
@@ -1055,7 +1039,7 @@ static int redrat3_transmit_ir(struct rc_dev *rcdev, int *txbuf, u32 n) | |||
1055 | if (ret < 0) | 1039 | if (ret < 0) |
1056 | dev_err(dev, "Error: control msg send failed, rc %d\n", ret); | 1040 | dev_err(dev, "Error: control msg send failed, rc %d\n", ret); |
1057 | else | 1041 | else |
1058 | ret = n; | 1042 | ret = count; |
1059 | 1043 | ||
1060 | out: | 1044 | out: |
1061 | kfree(sample_lens); | 1045 | kfree(sample_lens); |
@@ -1063,8 +1047,8 @@ out: | |||
1063 | kfree(sigdata); | 1047 | kfree(sigdata); |
1064 | 1048 | ||
1065 | rr3->transmitting = false; | 1049 | rr3->transmitting = false; |
1066 | 1050 | /* rr3 re-enables rc detector because it was enabled before */ | |
1067 | redrat3_enable_detector(rr3); | 1051 | rr3->det_enabled = true; |
1068 | 1052 | ||
1069 | return ret; | 1053 | return ret; |
1070 | } | 1054 | } |