aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2009-11-27 19:54:41 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-12-05 15:42:18 -0500
commit4e89217b943cfb26f88f04920d44f2077931f0e7 (patch)
treef615f8fee9a6956892b59010369c78d46ba73b92
parentfa3c39bd17449581eedaa1a0b7c8b67ec20c796e (diff)
V4L/DVB (13531): ir-common: rename the debug routine to allow exporting it
As newer IR common code will be added on other files, we need a global debug var inside the module. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/common/ir-functions.c23
-rw-r--r--include/media/ir-common.h4
2 files changed, 14 insertions, 13 deletions
diff --git a/drivers/media/common/ir-functions.c b/drivers/media/common/ir-functions.c
index fc2d8941459f..b111a0d9409b 100644
--- a/drivers/media/common/ir-functions.c
+++ b/drivers/media/common/ir-functions.c
@@ -34,11 +34,8 @@ static int repeat = 1;
34module_param(repeat, int, 0444); 34module_param(repeat, int, 0444);
35MODULE_PARM_DESC(repeat,"auto-repeat for IR keys (default: on)"); 35MODULE_PARM_DESC(repeat,"auto-repeat for IR keys (default: on)");
36 36
37static int debug; /* debug level (0,1,2) */ 37int media_ir_debug; /* media_ir_debug level (0,1,2) */
38module_param(debug, int, 0644); 38module_param_named(debug, media_ir_debug, int, 0644);
39
40#define dprintk(level, fmt, arg...) if (debug >= level) \
41 printk(KERN_DEBUG fmt , ## arg)
42 39
43/* -------------------------------------------------------------------------- */ 40/* -------------------------------------------------------------------------- */
44 41
@@ -49,7 +46,7 @@ static void ir_input_key_event(struct input_dev *dev, struct ir_input_state *ir)
49 dev->name,ir->ir_key,ir->ir_raw,ir->keypressed); 46 dev->name,ir->ir_key,ir->ir_raw,ir->keypressed);
50 return; 47 return;
51 } 48 }
52 dprintk(1,"%s: key event code=%d down=%d\n", 49 IR_dprintk(1,"%s: key event code=%d down=%d\n",
53 dev->name,ir->keycode,ir->keypressed); 50 dev->name,ir->keycode,ir->keypressed);
54 input_report_key(dev,ir->keycode,ir->keypressed); 51 input_report_key(dev,ir->keycode,ir->keypressed);
55 input_sync(dev); 52 input_sync(dev);
@@ -295,11 +292,11 @@ u32 ir_rc5_decode(unsigned int code)
295 rc5 |= 1; 292 rc5 |= 1;
296 break; 293 break;
297 case 3: 294 case 3:
298 dprintk(1, "ir-common: ir_rc5_decode(%x) bad code\n", org_code); 295 IR_dprintk(1, "ir-common: ir_rc5_decode(%x) bad code\n", org_code);
299 return 0; 296 return 0;
300 } 297 }
301 } 298 }
302 dprintk(1, "ir-common: code=%x, rc5=%x, start=%x, toggle=%x, address=%x, " 299 IR_dprintk(1, "ir-common: code=%x, rc5=%x, start=%x, toggle=%x, address=%x, "
303 "instr=%x\n", rc5, org_code, RC5_START(rc5), 300 "instr=%x\n", rc5, org_code, RC5_START(rc5),
304 RC5_TOGGLE(rc5), RC5_ADDR(rc5), RC5_INSTR(rc5)); 301 RC5_TOGGLE(rc5), RC5_ADDR(rc5), RC5_INSTR(rc5));
305 return rc5; 302 return rc5;
@@ -331,20 +328,20 @@ void ir_rc5_timer_end(unsigned long data)
331 328
332 /* Allow some timer jitter (RC5 is ~24ms anyway so this is ok) */ 329 /* Allow some timer jitter (RC5 is ~24ms anyway so this is ok) */
333 if (gap < 28000) { 330 if (gap < 28000) {
334 dprintk(1, "ir-common: spurious timer_end\n"); 331 IR_dprintk(1, "ir-common: spurious timer_end\n");
335 return; 332 return;
336 } 333 }
337 334
338 if (ir->last_bit < 20) { 335 if (ir->last_bit < 20) {
339 /* ignore spurious codes (caused by light/other remotes) */ 336 /* ignore spurious codes (caused by light/other remotes) */
340 dprintk(1, "ir-common: short code: %x\n", ir->code); 337 IR_dprintk(1, "ir-common: short code: %x\n", ir->code);
341 } else { 338 } else {
342 ir->code = (ir->code << ir->shift_by) | 1; 339 ir->code = (ir->code << ir->shift_by) | 1;
343 rc5 = ir_rc5_decode(ir->code); 340 rc5 = ir_rc5_decode(ir->code);
344 341
345 /* two start bits? */ 342 /* two start bits? */
346 if (RC5_START(rc5) != ir->start) { 343 if (RC5_START(rc5) != ir->start) {
347 dprintk(1, "ir-common: rc5 start bits invalid: %u\n", RC5_START(rc5)); 344 IR_dprintk(1, "ir-common: rc5 start bits invalid: %u\n", RC5_START(rc5));
348 345
349 /* right address? */ 346 /* right address? */
350 } else if (RC5_ADDR(rc5) == ir->addr) { 347 } else if (RC5_ADDR(rc5) == ir->addr) {
@@ -354,7 +351,7 @@ void ir_rc5_timer_end(unsigned long data)
354 /* Good code, decide if repeat/repress */ 351 /* Good code, decide if repeat/repress */
355 if (toggle != RC5_TOGGLE(ir->last_rc5) || 352 if (toggle != RC5_TOGGLE(ir->last_rc5) ||
356 instr != RC5_INSTR(ir->last_rc5)) { 353 instr != RC5_INSTR(ir->last_rc5)) {
357 dprintk(1, "ir-common: instruction %x, toggle %x\n", instr, 354 IR_dprintk(1, "ir-common: instruction %x, toggle %x\n", instr,
358 toggle); 355 toggle);
359 ir_input_nokey(ir->dev, &ir->ir); 356 ir_input_nokey(ir->dev, &ir->ir);
360 ir_input_keydown(ir->dev, &ir->ir, instr, 357 ir_input_keydown(ir->dev, &ir->ir, instr,
@@ -377,7 +374,7 @@ void ir_rc5_timer_keyup(unsigned long data)
377{ 374{
378 struct card_ir *ir = (struct card_ir *)data; 375 struct card_ir *ir = (struct card_ir *)data;
379 376
380 dprintk(1, "ir-common: key released\n"); 377 IR_dprintk(1, "ir-common: key released\n");
381 ir_input_nokey(ir->dev, &ir->ir); 378 ir_input_nokey(ir->dev, &ir->ir);
382} 379}
383EXPORT_SYMBOL_GPL(ir_rc5_timer_keyup); 380EXPORT_SYMBOL_GPL(ir_rc5_timer_keyup);
diff --git a/include/media/ir-common.h b/include/media/ir-common.h
index 5921776929e7..5964145d65e6 100644
--- a/include/media/ir-common.h
+++ b/include/media/ir-common.h
@@ -27,6 +27,10 @@
27#include <linux/workqueue.h> 27#include <linux/workqueue.h>
28#include <linux/interrupt.h> 28#include <linux/interrupt.h>
29 29
30extern int media_ir_debug; /* media_ir_debug level (0,1,2) */
31#define IR_dprintk(level, fmt, arg...) if (media_ir_debug >= level) \
32 printk(KERN_DEBUG fmt , ## arg)
33
30#define IR_TYPE_RC5 1 34#define IR_TYPE_RC5 1
31#define IR_TYPE_PD 2 /* Pulse distance encoded IR */ 35#define IR_TYPE_PD 2 /* Pulse distance encoded IR */
32#define IR_TYPE_OTHER 99 36#define IR_TYPE_OTHER 99