aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/common/ir-functions.c32
-rw-r--r--drivers/media/common/ir-keytable.c2
-rw-r--r--drivers/media/dvb/dm1105/dm1105.c2
-rw-r--r--drivers/media/dvb/ttpci/budget-ci.c2
-rw-r--r--drivers/media/video/bt8xx/bttv-input.c8
-rw-r--r--drivers/media/video/cx231xx/cx231xx-input.c3
-rw-r--r--drivers/media/video/cx23885/cx23885-input.c3
-rw-r--r--drivers/media/video/cx88/cx88-input.c14
-rw-r--r--drivers/media/video/em28xx/em28xx-input.c3
-rw-r--r--drivers/media/video/ir-kbd-i2c.c2
-rw-r--r--drivers/media/video/saa7134/saa7134-input.c8
-rw-r--r--include/media/ir-common.h5
12 files changed, 29 insertions, 55 deletions
diff --git a/drivers/media/common/ir-functions.c b/drivers/media/common/ir-functions.c
index b111a0d9409b..29885c2893d2 100644
--- a/drivers/media/common/ir-functions.c
+++ b/drivers/media/common/ir-functions.c
@@ -42,8 +42,8 @@ module_param_named(debug, media_ir_debug, int, 0644);
42static void ir_input_key_event(struct input_dev *dev, struct ir_input_state *ir) 42static void ir_input_key_event(struct input_dev *dev, struct ir_input_state *ir)
43{ 43{
44 if (KEY_RESERVED == ir->keycode) { 44 if (KEY_RESERVED == ir->keycode) {
45 printk(KERN_INFO "%s: unknown key: key=0x%02x raw=0x%02x down=%d\n", 45 printk(KERN_INFO "%s: unknown key: key=0x%02x down=%d\n",
46 dev->name,ir->ir_key,ir->ir_raw,ir->keypressed); 46 dev->name, ir->ir_key, ir->keypressed);
47 return; 47 return;
48 } 48 }
49 IR_dprintk(1,"%s: key event code=%d down=%d\n", 49 IR_dprintk(1,"%s: key event code=%d down=%d\n",
@@ -57,28 +57,10 @@ static void ir_input_key_event(struct input_dev *dev, struct ir_input_state *ir)
57void ir_input_init(struct input_dev *dev, struct ir_input_state *ir, 57void ir_input_init(struct input_dev *dev, struct ir_input_state *ir,
58 int ir_type, struct ir_scancode_table *ir_codes) 58 int ir_type, struct ir_scancode_table *ir_codes)
59{ 59{
60 int i;
61
62 ir->ir_type = ir_type; 60 ir->ir_type = ir_type;
63 61
64 memset(ir->ir_codes, 0, sizeof(ir->ir_codes)); 62 ir_set_keycode_table(dev, ir_codes);
65
66 /*
67 * FIXME: This is a temporary workaround to use the new IR tables
68 * with the old approach. Later patches will replace this to a
69 * proper method
70 */
71
72 if (ir_codes)
73 for (i = 0; i < ir_codes->size; i++)
74 if (ir_codes->scan[i].scancode < IR_KEYTAB_SIZE)
75 ir->ir_codes[ir_codes->scan[i].scancode] = ir_codes->scan[i].keycode;
76 63
77 dev->keycode = ir->ir_codes;
78 dev->keycodesize = sizeof(IR_KEYTAB_TYPE);
79 dev->keycodemax = IR_KEYTAB_SIZE;
80 for (i = 0; i < IR_KEYTAB_SIZE; i++)
81 set_bit(ir->ir_codes[i], dev->keybit);
82 clear_bit(0, dev->keybit); 64 clear_bit(0, dev->keybit);
83 65
84 set_bit(EV_KEY, dev->evbit); 66 set_bit(EV_KEY, dev->evbit);
@@ -97,9 +79,9 @@ void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir)
97EXPORT_SYMBOL_GPL(ir_input_nokey); 79EXPORT_SYMBOL_GPL(ir_input_nokey);
98 80
99void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir, 81void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir,
100 u32 ir_key, u32 ir_raw) 82 u32 ir_key)
101{ 83{
102 u32 keycode = IR_KEYCODE(ir->ir_codes, ir_key); 84 u32 keycode = ir_g_keycode_from_table(dev, ir_key);
103 85
104 if (ir->keypressed && ir->keycode != keycode) { 86 if (ir->keypressed && ir->keycode != keycode) {
105 ir->keypressed = 0; 87 ir->keypressed = 0;
@@ -107,7 +89,6 @@ void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir,
107 } 89 }
108 if (!ir->keypressed) { 90 if (!ir->keypressed) {
109 ir->ir_key = ir_key; 91 ir->ir_key = ir_key;
110 ir->ir_raw = ir_raw;
111 ir->keycode = keycode; 92 ir->keycode = keycode;
112 ir->keypressed = 1; 93 ir->keypressed = 1;
113 ir_input_key_event(dev,ir); 94 ir_input_key_event(dev,ir);
@@ -354,8 +335,7 @@ void ir_rc5_timer_end(unsigned long data)
354 IR_dprintk(1, "ir-common: instruction %x, toggle %x\n", instr, 335 IR_dprintk(1, "ir-common: instruction %x, toggle %x\n", instr,
355 toggle); 336 toggle);
356 ir_input_nokey(ir->dev, &ir->ir); 337 ir_input_nokey(ir->dev, &ir->ir);
357 ir_input_keydown(ir->dev, &ir->ir, instr, 338 ir_input_keydown(ir->dev, &ir->ir, instr);
358 instr);
359 } 339 }
360 340
361 /* Set/reset key-up timer */ 341 /* Set/reset key-up timer */
diff --git a/drivers/media/common/ir-keytable.c b/drivers/media/common/ir-keytable.c
index 2de7caeef437..65e352389b2d 100644
--- a/drivers/media/common/ir-keytable.c
+++ b/drivers/media/common/ir-keytable.c
@@ -118,7 +118,6 @@ u32 ir_g_keycode_from_table(struct input_dev *dev, u32 scancode)
118 118
119 return KEY_UNKNOWN; 119 return KEY_UNKNOWN;
120} 120}
121EXPORT_SYMBOL_GPL(ir_g_keycode_from_table);
122 121
123/** 122/**
124 * ir_set_keycode_table() - sets the IR keycode table and add the handlers 123 * ir_set_keycode_table() - sets the IR keycode table and add the handlers
@@ -153,4 +152,3 @@ int ir_set_keycode_table(struct input_dev *input_dev,
153 152
154 return 0; 153 return 0;
155} 154}
156EXPORT_SYMBOL_GPL(ir_set_keycode_table);
diff --git a/drivers/media/dvb/dm1105/dm1105.c b/drivers/media/dvb/dm1105/dm1105.c
index 2d099e271751..4c28632f94c4 100644
--- a/drivers/media/dvb/dm1105/dm1105.c
+++ b/drivers/media/dvb/dm1105/dm1105.c
@@ -510,7 +510,7 @@ static void dm1105_emit_key(struct work_struct *work)
510 510
511 data = (ircom >> 8) & 0x7f; 511 data = (ircom >> 8) & 0x7f;
512 512
513 ir_input_keydown(ir->input_dev, &ir->ir, data, data); 513 ir_input_keydown(ir->input_dev, &ir->ir, data);
514 ir_input_nokey(ir->input_dev, &ir->ir); 514 ir_input_nokey(ir->input_dev, &ir->ir);
515} 515}
516 516
diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c
index 88a0a5670ccf..adc4b954e5ad 100644
--- a/drivers/media/dvb/ttpci/budget-ci.c
+++ b/drivers/media/dvb/ttpci/budget-ci.c
@@ -178,7 +178,7 @@ static void msp430_ir_interrupt(unsigned long data)
178 if (budget_ci->ir.last_raw != raw || !timer_pending(&budget_ci->ir.timer_keyup)) { 178 if (budget_ci->ir.last_raw != raw || !timer_pending(&budget_ci->ir.timer_keyup)) {
179 ir_input_nokey(dev, &budget_ci->ir.state); 179 ir_input_nokey(dev, &budget_ci->ir.state);
180 ir_input_keydown(dev, &budget_ci->ir.state, 180 ir_input_keydown(dev, &budget_ci->ir.state,
181 budget_ci->ir.ir_key, raw); 181 budget_ci->ir.ir_key);
182 budget_ci->ir.last_raw = raw; 182 budget_ci->ir.last_raw = raw;
183 } 183 }
184 184
diff --git a/drivers/media/video/bt8xx/bttv-input.c b/drivers/media/video/bt8xx/bttv-input.c
index ebd51afe8761..62408ccf34c8 100644
--- a/drivers/media/video/bt8xx/bttv-input.c
+++ b/drivers/media/video/bt8xx/bttv-input.c
@@ -73,12 +73,12 @@ static void ir_handle_key(struct bttv *btv)
73 73
74 if ((ir->mask_keydown && (0 != (gpio & ir->mask_keydown))) || 74 if ((ir->mask_keydown && (0 != (gpio & ir->mask_keydown))) ||
75 (ir->mask_keyup && (0 == (gpio & ir->mask_keyup)))) { 75 (ir->mask_keyup && (0 == (gpio & ir->mask_keyup)))) {
76 ir_input_keydown(ir->dev,&ir->ir,data,data); 76 ir_input_keydown(ir->dev, &ir->ir, data);
77 } else { 77 } else {
78 /* HACK: Probably, ir->mask_keydown is missing 78 /* HACK: Probably, ir->mask_keydown is missing
79 for this board */ 79 for this board */
80 if (btv->c.type == BTTV_BOARD_WINFAST2000) 80 if (btv->c.type == BTTV_BOARD_WINFAST2000)
81 ir_input_keydown(ir->dev, &ir->ir, data, data); 81 ir_input_keydown(ir->dev, &ir->ir, data);
82 82
83 ir_input_nokey(ir->dev,&ir->ir); 83 ir_input_nokey(ir->dev,&ir->ir);
84 } 84 }
@@ -104,7 +104,7 @@ static void ir_enltv_handle_key(struct bttv *btv)
104 gpio, data, 104 gpio, data,
105 (gpio & ir->mask_keyup) ? " up" : "up/down"); 105 (gpio & ir->mask_keyup) ? " up" : "up/down");
106 106
107 ir_input_keydown(ir->dev, &ir->ir, data, data); 107 ir_input_keydown(ir->dev, &ir->ir, data);
108 if (keyup) 108 if (keyup)
109 ir_input_nokey(ir->dev, &ir->ir); 109 ir_input_nokey(ir->dev, &ir->ir);
110 } else { 110 } else {
@@ -118,7 +118,7 @@ static void ir_enltv_handle_key(struct bttv *btv)
118 if (keyup) 118 if (keyup)
119 ir_input_nokey(ir->dev, &ir->ir); 119 ir_input_nokey(ir->dev, &ir->ir);
120 else 120 else
121 ir_input_keydown(ir->dev, &ir->ir, data, data); 121 ir_input_keydown(ir->dev, &ir->ir, data);
122 } 122 }
123 123
124 ir->last_gpio = data | keyup; 124 ir->last_gpio = data | keyup;
diff --git a/drivers/media/video/cx231xx/cx231xx-input.c b/drivers/media/video/cx231xx/cx231xx-input.c
index 48f22fa38e6c..58dd39bc6787 100644
--- a/drivers/media/video/cx231xx/cx231xx-input.c
+++ b/drivers/media/video/cx231xx/cx231xx-input.c
@@ -126,8 +126,7 @@ static void cx231xx_ir_handle_key(struct cx231xx_IR *ir)
126 126
127 if (do_sendkey) { 127 if (do_sendkey) {
128 dprintk("sending keypress\n"); 128 dprintk("sending keypress\n");
129 ir_input_keydown(ir->input, &ir->ir, poll_result.rc_data[0], 129 ir_input_keydown(ir->input, &ir->ir, poll_result.rc_data[0]);
130 poll_result.rc_data[0]);
131 ir_input_nokey(ir->input, &ir->ir); 130 ir_input_nokey(ir->input, &ir->ir);
132 } 131 }
133 132
diff --git a/drivers/media/video/cx23885/cx23885-input.c b/drivers/media/video/cx23885/cx23885-input.c
index f000ed787d4e..fea882d1fbcb 100644
--- a/drivers/media/video/cx23885/cx23885-input.c
+++ b/drivers/media/video/cx23885/cx23885-input.c
@@ -94,8 +94,7 @@ static void cx23885_input_process_raw_rc5(struct cx23885_dev *dev)
94 RC5_START(ir_input->last_rc5) == 0) { 94 RC5_START(ir_input->last_rc5) == 0) {
95 /* This keypress is differnet: not an auto repeat */ 95 /* This keypress is differnet: not an auto repeat */
96 ir_input_nokey(ir_input->dev, &ir_input->ir); 96 ir_input_nokey(ir_input->dev, &ir_input->ir);
97 ir_input_keydown(ir_input->dev, &ir_input->ir, 97 ir_input_keydown(ir_input->dev, &ir_input->ir, command);
98 command, ir_input->code);
99 } 98 }
100 ir_input->last_rc5 = rc5; 99 ir_input->last_rc5 = rc5;
101 100
diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c
index 47c03019357d..7b2066415d7e 100644
--- a/drivers/media/video/cx88/cx88-input.c
+++ b/drivers/media/video/cx88/cx88-input.c
@@ -118,13 +118,13 @@ static void cx88_ir_handle_key(struct cx88_IR *ir)
118 118
119 data = (data << 4) | ((gpio_key & 0xf0) >> 4); 119 data = (data << 4) | ((gpio_key & 0xf0) >> 4);
120 120
121 ir_input_keydown(ir->input, &ir->ir, data, data); 121 ir_input_keydown(ir->input, &ir->ir, data);
122 ir_input_nokey(ir->input, &ir->ir); 122 ir_input_nokey(ir->input, &ir->ir);
123 123
124 } else if (ir->mask_keydown) { 124 } else if (ir->mask_keydown) {
125 /* bit set on keydown */ 125 /* bit set on keydown */
126 if (gpio & ir->mask_keydown) { 126 if (gpio & ir->mask_keydown) {
127 ir_input_keydown(ir->input, &ir->ir, data, data); 127 ir_input_keydown(ir->input, &ir->ir, data);
128 } else { 128 } else {
129 ir_input_nokey(ir->input, &ir->ir); 129 ir_input_nokey(ir->input, &ir->ir);
130 } 130 }
@@ -132,14 +132,14 @@ static void cx88_ir_handle_key(struct cx88_IR *ir)
132 } else if (ir->mask_keyup) { 132 } else if (ir->mask_keyup) {
133 /* bit cleared on keydown */ 133 /* bit cleared on keydown */
134 if (0 == (gpio & ir->mask_keyup)) { 134 if (0 == (gpio & ir->mask_keyup)) {
135 ir_input_keydown(ir->input, &ir->ir, data, data); 135 ir_input_keydown(ir->input, &ir->ir, data);
136 } else { 136 } else {
137 ir_input_nokey(ir->input, &ir->ir); 137 ir_input_nokey(ir->input, &ir->ir);
138 } 138 }
139 139
140 } else { 140 } else {
141 /* can't distinguish keydown/up :-/ */ 141 /* can't distinguish keydown/up :-/ */
142 ir_input_keydown(ir->input, &ir->ir, data, data); 142 ir_input_keydown(ir->input, &ir->ir, data);
143 ir_input_nokey(ir->input, &ir->ir); 143 ir_input_nokey(ir->input, &ir->ir);
144 } 144 }
145} 145}
@@ -487,7 +487,7 @@ void cx88_ir_irq(struct cx88_core *core)
487 487
488 ir_dprintk("Key Code: %x\n", (ircode >> 16) & 0x7f); 488 ir_dprintk("Key Code: %x\n", (ircode >> 16) & 0x7f);
489 489
490 ir_input_keydown(ir->input, &ir->ir, (ircode >> 16) & 0x7f, (ircode >> 16) & 0xff); 490 ir_input_keydown(ir->input, &ir->ir, (ircode >> 16) & 0x7f);
491 ir->release = jiffies + msecs_to_jiffies(120); 491 ir->release = jiffies + msecs_to_jiffies(120);
492 break; 492 break;
493 case CX88_BOARD_HAUPPAUGE: 493 case CX88_BOARD_HAUPPAUGE:
@@ -524,7 +524,7 @@ void cx88_ir_irq(struct cx88_core *core)
524 if ( dev != 0x1e && dev != 0x1f ) 524 if ( dev != 0x1e && dev != 0x1f )
525 /* not a hauppauge remote */ 525 /* not a hauppauge remote */
526 break; 526 break;
527 ir_input_keydown(ir->input, &ir->ir, code, ircode); 527 ir_input_keydown(ir->input, &ir->ir, code);
528 ir->release = jiffies + msecs_to_jiffies(120); 528 ir->release = jiffies + msecs_to_jiffies(120);
529 break; 529 break;
530 case CX88_BOARD_PINNACLE_PCTV_HD_800i: 530 case CX88_BOARD_PINNACLE_PCTV_HD_800i:
@@ -532,7 +532,7 @@ void cx88_ir_irq(struct cx88_core *core)
532 ir_dprintk("biphase decoded: %x\n", ircode); 532 ir_dprintk("biphase decoded: %x\n", ircode);
533 if ((ircode & 0xfffff000) != 0x3000) 533 if ((ircode & 0xfffff000) != 0x3000)
534 break; 534 break;
535 ir_input_keydown(ir->input, &ir->ir, ircode & 0x3f, ircode); 535 ir_input_keydown(ir->input, &ir->ir, ircode & 0x3f);
536 ir->release = jiffies + msecs_to_jiffies(120); 536 ir->release = jiffies + msecs_to_jiffies(120);
537 break; 537 break;
538 } 538 }
diff --git a/drivers/media/video/em28xx/em28xx-input.c b/drivers/media/video/em28xx/em28xx-input.c
index 7a0fe3816e3d..990ee04bbd5e 100644
--- a/drivers/media/video/em28xx/em28xx-input.c
+++ b/drivers/media/video/em28xx/em28xx-input.c
@@ -282,8 +282,7 @@ static void em28xx_ir_handle_key(struct em28xx_IR *ir)
282 282
283 if (do_sendkey) { 283 if (do_sendkey) {
284 dprintk("sending keypress\n"); 284 dprintk("sending keypress\n");
285 ir_input_keydown(ir->input, &ir->ir, poll_result.rc_data[0], 285 ir_input_keydown(ir->input, &ir->ir, poll_result.rc_data[0]);
286 poll_result.rc_data[0]);
287 ir_input_nokey(ir->input, &ir->ir); 286 ir_input_nokey(ir->input, &ir->ir);
288 } 287 }
289 288
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c
index aec36660987d..9c6d0ae58b1f 100644
--- a/drivers/media/video/ir-kbd-i2c.c
+++ b/drivers/media/video/ir-kbd-i2c.c
@@ -275,7 +275,7 @@ static void ir_key_poll(struct IR_i2c *ir)
275 if (0 == rc) { 275 if (0 == rc) {
276 ir_input_nokey(ir->input, &ir->ir); 276 ir_input_nokey(ir->input, &ir->ir);
277 } else { 277 } else {
278 ir_input_keydown(ir->input, &ir->ir, ir_key, ir_raw); 278 ir_input_keydown(ir->input, &ir->ir, ir_key);
279 } 279 }
280} 280}
281 281
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c
index f658f2513992..439f3d54d009 100644
--- a/drivers/media/video/saa7134/saa7134-input.c
+++ b/drivers/media/video/saa7134/saa7134-input.c
@@ -102,14 +102,14 @@ static int build_key(struct saa7134_dev *dev)
102 if (data == ir->mask_keycode) 102 if (data == ir->mask_keycode)
103 ir_input_nokey(ir->dev, &ir->ir); 103 ir_input_nokey(ir->dev, &ir->ir);
104 else 104 else
105 ir_input_keydown(ir->dev, &ir->ir, data, data); 105 ir_input_keydown(ir->dev, &ir->ir, data);
106 return 0; 106 return 0;
107 } 107 }
108 108
109 if (ir->polling) { 109 if (ir->polling) {
110 if ((ir->mask_keydown && (0 != (gpio & ir->mask_keydown))) || 110 if ((ir->mask_keydown && (0 != (gpio & ir->mask_keydown))) ||
111 (ir->mask_keyup && (0 == (gpio & ir->mask_keyup)))) { 111 (ir->mask_keyup && (0 == (gpio & ir->mask_keyup)))) {
112 ir_input_keydown(ir->dev, &ir->ir, data, data); 112 ir_input_keydown(ir->dev, &ir->ir, data);
113 } else { 113 } else {
114 ir_input_nokey(ir->dev, &ir->ir); 114 ir_input_nokey(ir->dev, &ir->ir);
115 } 115 }
@@ -117,7 +117,7 @@ static int build_key(struct saa7134_dev *dev)
117 else { /* IRQ driven mode - handle key press and release in one go */ 117 else { /* IRQ driven mode - handle key press and release in one go */
118 if ((ir->mask_keydown && (0 != (gpio & ir->mask_keydown))) || 118 if ((ir->mask_keydown && (0 != (gpio & ir->mask_keydown))) ||
119 (ir->mask_keyup && (0 == (gpio & ir->mask_keyup)))) { 119 (ir->mask_keyup && (0 == (gpio & ir->mask_keyup)))) {
120 ir_input_keydown(ir->dev, &ir->ir, data, data); 120 ir_input_keydown(ir->dev, &ir->ir, data);
121 ir_input_nokey(ir->dev, &ir->ir); 121 ir_input_nokey(ir->dev, &ir->ir);
122 } 122 }
123 } 123 }
@@ -938,7 +938,7 @@ static void nec_task(unsigned long data)
938 dprintk("scancode = 0x%02x (code = 0x%02x, notcode= 0x%02x)\n", 938 dprintk("scancode = 0x%02x (code = 0x%02x, notcode= 0x%02x)\n",
939 ir->code, ircode, not_code); 939 ir->code, ircode, not_code);
940 940
941 ir_input_keydown(ir->dev, &ir->ir, ir->code, ir->code); 941 ir_input_keydown(ir->dev, &ir->ir, ir->code);
942 } else 942 } else
943 dprintk("Repeat last key\n"); 943 dprintk("Repeat last key\n");
944 944
diff --git a/include/media/ir-common.h b/include/media/ir-common.h
index 805f1e09770f..262347b61506 100644
--- a/include/media/ir-common.h
+++ b/include/media/ir-common.h
@@ -62,8 +62,7 @@ struct ir_input_state {
62 IR_KEYTAB_TYPE ir_codes[IR_KEYTAB_SIZE]; 62 IR_KEYTAB_TYPE ir_codes[IR_KEYTAB_SIZE];
63 63
64 /* key info */ 64 /* key info */
65 u32 ir_raw; /* raw data */ 65 u32 ir_key; /* ir scancode */
66 u32 ir_key; /* ir key code */
67 u32 keycode; /* linux key code */ 66 u32 keycode; /* linux key code */
68 int keypressed; /* current state */ 67 int keypressed; /* current state */
69}; 68};
@@ -112,7 +111,7 @@ void ir_input_init(struct input_dev *dev, struct ir_input_state *ir,
112 int ir_type, struct ir_scancode_table *ir_codes); 111 int ir_type, struct ir_scancode_table *ir_codes);
113void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir); 112void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir);
114void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir, 113void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir,
115 u32 ir_key, u32 ir_raw); 114 u32 ir_key);
116u32 ir_extract_bits(u32 data, u32 mask); 115u32 ir_extract_bits(u32 data, u32 mask);
117int ir_dump_samples(u32 *samples, int count); 116int ir_dump_samples(u32 *samples, int count);
118int ir_decode_biphase(u32 *samples, int count, int low, int high); 117int ir_decode_biphase(u32 *samples, int count, int low, int high);