aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/IR
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2010-04-03 19:33:00 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-05-19 11:56:56 -0400
commit67780d6a2347d03b640f22295f8df7f00fbc829f (patch)
treeaa5180185366e5c17c12d2673d06ebef13d2cf51 /drivers/media/IR
parent2f16f6315f583964732bc23c873d4024281d763c (diff)
V4L/DVB: ir-nec-decoder: Cleanups
Remove dead code and properly name a few constants Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/IR')
-rw-r--r--drivers/media/IR/ir-nec-decoder.c40
1 files changed, 8 insertions, 32 deletions
diff --git a/drivers/media/IR/ir-nec-decoder.c b/drivers/media/IR/ir-nec-decoder.c
index 33b260f517f5..087211c5496a 100644
--- a/drivers/media/IR/ir-nec-decoder.c
+++ b/drivers/media/IR/ir-nec-decoder.c
@@ -14,38 +14,14 @@
14 14
15#include <media/ir-core.h> 15#include <media/ir-core.h>
16 16
17#define NEC_NBITS 32
17#define NEC_UNIT 559979 /* ns */ 18#define NEC_UNIT 559979 /* ns */
18#define NEC_HEADER_MARK (16 * NEC_UNIT) 19#define NEC_HEADER_MARK (16 * NEC_UNIT)
19#define NEC_HEADER_SPACE (8 * NEC_UNIT) 20#define NEC_HEADER_SPACE (8 * NEC_UNIT)
20#define NEC_REPEAT_SPACE (4 * NEC_UNIT) 21#define NEC_REPEAT_SPACE (4 * NEC_UNIT)
21#define NEC_MARK (NEC_UNIT) 22#define NEC_MARK (NEC_UNIT)
22#define NEC_0_SYMBOL (NEC_UNIT) 23#define NEC_0_SPACE (NEC_UNIT)
23#define NEC_1_SYMBOL (3 * NEC_UNIT) 24#define NEC_1_SPACE (3 * NEC_UNIT)
24
25/* Start time: 4.5 ms + 560 us of the next pulse */
26#define MIN_START_TIME (3900000 + 560000)
27#define MAX_START_TIME (5100000 + 560000)
28
29/* Bit 1 time: 2.25ms us */
30#define MIN_BIT1_TIME 2050000
31#define MAX_BIT1_TIME 2450000
32
33/* Bit 0 time: 1.12ms us */
34#define MIN_BIT0_TIME 920000
35#define MAX_BIT0_TIME 1320000
36
37/* Total IR code is 110 ms, including the 9 ms for the start pulse */
38#define MAX_NEC_TIME 4000000
39
40/* Total IR code is 110 ms, including the 9 ms for the start pulse */
41#define MIN_REPEAT_TIME 99000000
42#define MAX_REPEAT_TIME 112000000
43
44/* Repeat time: 2.25ms us */
45#define MIN_REPEAT_START_TIME 2050000
46#define MAX_REPEAT_START_TIME 3000000
47
48#define REPEAT_TIME 240 /* ms */
49 25
50/* Used to register nec_decoder clients */ 26/* Used to register nec_decoder clients */
51static LIST_HEAD(decoder_list); 27static LIST_HEAD(decoder_list);
@@ -223,11 +199,11 @@ static int handle_event(struct input_dev *input_dev,
223 if (last_bit) 199 if (last_bit)
224 goto err; 200 goto err;
225 201
226 if ((ev->delta.tv_nsec >= NEC_0_SYMBOL - NEC_UNIT / 2) && 202 if ((ev->delta.tv_nsec >= NEC_0_SPACE - NEC_UNIT / 2) &&
227 (ev->delta.tv_nsec < NEC_0_SYMBOL + NEC_UNIT / 2)) 203 (ev->delta.tv_nsec < NEC_0_SPACE + NEC_UNIT / 2))
228 bit = 0; 204 bit = 0;
229 else if ((ev->delta.tv_nsec >= NEC_1_SYMBOL - NEC_UNIT / 2) && 205 else if ((ev->delta.tv_nsec >= NEC_1_SPACE - NEC_UNIT / 2) &&
230 (ev->delta.tv_nsec < NEC_1_SYMBOL + NEC_UNIT / 2)) 206 (ev->delta.tv_nsec < NEC_1_SPACE + NEC_UNIT / 2))
231 bit = 1; 207 bit = 1;
232 else { 208 else {
233 IR_dprintk(1, "Decode failed at %d-th bit (%s) @%luus\n", 209 IR_dprintk(1, "Decode failed at %d-th bit (%s) @%luus\n",
@@ -256,7 +232,7 @@ static int handle_event(struct input_dev *input_dev,
256 data->nec_code.not_command |= 1 << (shift - 24); 232 data->nec_code.not_command |= 1 << (shift - 24);
257 } 233 }
258 } 234 }
259 if (++data->count == 32) { 235 if (++data->count == NEC_NBITS) {
260 u32 scancode; 236 u32 scancode;
261 /* 237 /*
262 * Fixme: may need to accept Extended NEC protocol? 238 * Fixme: may need to accept Extended NEC protocol?