aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2010-10-29 15:08:07 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-12-29 05:16:35 -0500
commit62c6503125389763a74911408d984c5dd09eeb97 (patch)
treea9b419280d25fca5086d82f8992a1d5843da75f1 /drivers/media/video
parent2997137be8eba5bf9c07a24d5fda1f4225f9ca7d (diff)
[media] ir-core: remove remaining users of the ir-functions keyhandlers
This patch removes the remaining usages of the ir_input_nokey() and ir_input_keydown() functions provided by drivers/media/IR/ir-functions.c by using the corresponding functionality in ir-core instead. Signed-off-by: David Härdeman <david@hardeman.nu> Acked-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/bt8xx/bttv-input.c32
-rw-r--r--drivers/media/video/bt8xx/bttvp.h1
-rw-r--r--drivers/media/video/cx88/cx88-input.c11
-rw-r--r--drivers/media/video/ir-kbd-i2c.c3
-rw-r--r--drivers/media/video/saa7134/saa7134-input.c49
5 files changed, 28 insertions, 68 deletions
diff --git a/drivers/media/video/bt8xx/bttv-input.c b/drivers/media/video/bt8xx/bttv-input.c
index 6bf05a7dc5f9..eb71c3ae36de 100644
--- a/drivers/media/video/bt8xx/bttv-input.c
+++ b/drivers/media/video/bt8xx/bttv-input.c
@@ -38,8 +38,6 @@ module_param(repeat_period, int, 0644);
38 38
39static int ir_rc5_remote_gap = 885; 39static int ir_rc5_remote_gap = 885;
40module_param(ir_rc5_remote_gap, int, 0644); 40module_param(ir_rc5_remote_gap, int, 0644);
41static int ir_rc5_key_timeout = 200;
42module_param(ir_rc5_key_timeout, int, 0644);
43 41
44#undef dprintk 42#undef dprintk
45#define dprintk(arg...) do { \ 43#define dprintk(arg...) do { \
@@ -74,18 +72,17 @@ static void ir_handle_key(struct bttv *btv)
74 (gpio & ir->mask_keydown) ? " down" : "", 72 (gpio & ir->mask_keydown) ? " down" : "",
75 (gpio & ir->mask_keyup) ? " up" : ""); 73 (gpio & ir->mask_keyup) ? " up" : "");
76 74
77 if ((ir->mask_keydown && (0 != (gpio & ir->mask_keydown))) || 75 if ((ir->mask_keydown && (gpio & ir->mask_keydown)) ||
78 (ir->mask_keyup && (0 == (gpio & ir->mask_keyup)))) { 76 (ir->mask_keyup && !(gpio & ir->mask_keyup))) {
79 ir_input_keydown(ir->dev, &ir->ir, data); 77 ir_keydown_notimeout(ir->dev, data, 0);
80 } else { 78 } else {
81 /* HACK: Probably, ir->mask_keydown is missing 79 /* HACK: Probably, ir->mask_keydown is missing
82 for this board */ 80 for this board */
83 if (btv->c.type == BTTV_BOARD_WINFAST2000) 81 if (btv->c.type == BTTV_BOARD_WINFAST2000)
84 ir_input_keydown(ir->dev, &ir->ir, data); 82 ir_keydown_notimeout(ir->dev, data, 0);
85 83
86 ir_input_nokey(ir->dev,&ir->ir); 84 ir_keyup(ir->dev);
87 } 85 }
88
89} 86}
90 87
91static void ir_enltv_handle_key(struct bttv *btv) 88static void ir_enltv_handle_key(struct bttv *btv)
@@ -107,9 +104,9 @@ static void ir_enltv_handle_key(struct bttv *btv)
107 gpio, data, 104 gpio, data,
108 (gpio & ir->mask_keyup) ? " up" : "up/down"); 105 (gpio & ir->mask_keyup) ? " up" : "up/down");
109 106
110 ir_input_keydown(ir->dev, &ir->ir, data); 107 ir_keydown_notimeout(ir->dev, data, 0);
111 if (keyup) 108 if (keyup)
112 ir_input_nokey(ir->dev, &ir->ir); 109 ir_keyup(ir->dev);
113 } else { 110 } else {
114 if ((ir->last_gpio & 1 << 31) == keyup) 111 if ((ir->last_gpio & 1 << 31) == keyup)
115 return; 112 return;
@@ -119,9 +116,9 @@ static void ir_enltv_handle_key(struct bttv *btv)
119 (gpio & ir->mask_keyup) ? " up" : "down"); 116 (gpio & ir->mask_keyup) ? " up" : "down");
120 117
121 if (keyup) 118 if (keyup)
122 ir_input_nokey(ir->dev, &ir->ir); 119 ir_keyup(ir->dev);
123 else 120 else
124 ir_input_keydown(ir->dev, &ir->ir, data); 121 ir_keydown_notimeout(ir->dev, data, 0);
125 } 122 }
126 123
127 ir->last_gpio = data | keyup; 124 ir->last_gpio = data | keyup;
@@ -215,14 +212,9 @@ static void bttv_ir_start(struct bttv *btv, struct card_ir *ir)
215 init_timer(&ir->timer_end); 212 init_timer(&ir->timer_end);
216 ir->timer_end.function = ir_rc5_timer_end; 213 ir->timer_end.function = ir_rc5_timer_end;
217 ir->timer_end.data = (unsigned long)ir; 214 ir->timer_end.data = (unsigned long)ir;
218
219 init_timer(&ir->timer_keyup);
220 ir->timer_keyup.function = ir_rc5_timer_keyup;
221 ir->timer_keyup.data = (unsigned long)ir;
222 ir->shift_by = 1; 215 ir->shift_by = 1;
223 ir->start = 3; 216 ir->start = 3;
224 ir->addr = 0x0; 217 ir->addr = 0x0;
225 ir->rc5_key_timeout = ir_rc5_key_timeout;
226 ir->rc5_remote_gap = ir_rc5_remote_gap; 218 ir->rc5_remote_gap = ir_rc5_remote_gap;
227 } 219 }
228} 220}
@@ -290,7 +282,6 @@ void __devinit init_bttv_i2c_ir(struct bttv *btv)
290 btv->init_data.name = "PV951"; 282 btv->init_data.name = "PV951";
291 btv->init_data.get_key = get_key_pv951; 283 btv->init_data.get_key = get_key_pv951;
292 btv->init_data.ir_codes = RC_MAP_PV951; 284 btv->init_data.ir_codes = RC_MAP_PV951;
293 btv->init_data.type = IR_TYPE_OTHER;
294 info.addr = 0x4b; 285 info.addr = 0x4b;
295 break; 286 break;
296 default: 287 default:
@@ -327,7 +318,6 @@ int bttv_input_init(struct bttv *btv)
327 struct card_ir *ir; 318 struct card_ir *ir;
328 char *ir_codes = NULL; 319 char *ir_codes = NULL;
329 struct input_dev *input_dev; 320 struct input_dev *input_dev;
330 u64 ir_type = IR_TYPE_OTHER;
331 int err = -ENOMEM; 321 int err = -ENOMEM;
332 322
333 if (!btv->has_remote) 323 if (!btv->has_remote)
@@ -448,10 +438,6 @@ int bttv_input_init(struct bttv *btv)
448 snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", 438 snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0",
449 pci_name(btv->c.pci)); 439 pci_name(btv->c.pci));
450 440
451 err = ir_input_init(input_dev, &ir->ir, ir_type);
452 if (err < 0)
453 goto err_out_free;
454
455 input_dev->name = ir->name; 441 input_dev->name = ir->name;
456 input_dev->phys = ir->phys; 442 input_dev->phys = ir->phys;
457 input_dev->id.bustype = BUS_PCI; 443 input_dev->id.bustype = BUS_PCI;
diff --git a/drivers/media/video/bt8xx/bttvp.h b/drivers/media/video/bt8xx/bttvp.h
index d1e26a448ed2..157285b434c9 100644
--- a/drivers/media/video/bt8xx/bttvp.h
+++ b/drivers/media/video/bt8xx/bttvp.h
@@ -305,7 +305,6 @@ struct bttv_pll_info {
305/* for gpio-connected remote control */ 305/* for gpio-connected remote control */
306struct bttv_input { 306struct bttv_input {
307 struct input_dev *dev; 307 struct input_dev *dev;
308 struct ir_input_state ir;
309 char name[32]; 308 char name[32];
310 char phys[32]; 309 char phys[32];
311 u32 mask_keycode; 310 u32 mask_keycode;
diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c
index 436ace8196a5..564e3cb29c4d 100644
--- a/drivers/media/video/cx88/cx88-input.c
+++ b/drivers/media/video/cx88/cx88-input.c
@@ -131,16 +131,21 @@ static void cx88_ir_handle_key(struct cx88_IR *ir)
131 } else if (ir->mask_keydown) { 131 } else if (ir->mask_keydown) {
132 /* bit set on keydown */ 132 /* bit set on keydown */
133 if (gpio & ir->mask_keydown) 133 if (gpio & ir->mask_keydown)
134 ir_keydown(ir->input, data, 0); 134 ir_keydown_notimeout(ir->input, data, 0);
135 else
136 ir_keyup(ir->input);
135 137
136 } else if (ir->mask_keyup) { 138 } else if (ir->mask_keyup) {
137 /* bit cleared on keydown */ 139 /* bit cleared on keydown */
138 if (0 == (gpio & ir->mask_keyup)) 140 if (0 == (gpio & ir->mask_keyup))
139 ir_keydown(ir->input, data, 0); 141 ir_keydown_notimeout(ir->input, data, 0);
142 else
143 ir_keyup(ir->input);
140 144
141 } else { 145 } else {
142 /* can't distinguish keydown/up :-/ */ 146 /* can't distinguish keydown/up :-/ */
143 ir_keydown(ir->input, data, 0); 147 ir_keydown_notimeout(ir->input, data, 0);
148 ir_keyup(ir->input);
144 } 149 }
145} 150}
146 151
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c
index ce4a75375909..a78883a6e0e7 100644
--- a/drivers/media/video/ir-kbd-i2c.c
+++ b/drivers/media/video/ir-kbd-i2c.c
@@ -269,7 +269,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
269{ 269{
270 char *ir_codes = NULL; 270 char *ir_codes = NULL;
271 const char *name = NULL; 271 const char *name = NULL;
272 u64 ir_type = 0; 272 u64 ir_type = IR_TYPE_UNKNOWN;
273 struct IR_i2c *ir; 273 struct IR_i2c *ir;
274 struct input_dev *input_dev; 274 struct input_dev *input_dev;
275 struct i2c_adapter *adap = client->adapter; 275 struct i2c_adapter *adap = client->adapter;
@@ -383,7 +383,6 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
383 dev_name(&client->dev)); 383 dev_name(&client->dev));
384 384
385 /* init + register input device */ 385 /* init + register input device */
386 ir->ir_type = ir_type;
387 input_dev->id.bustype = BUS_I2C; 386 input_dev->id.bustype = BUS_I2C;
388 input_dev->name = ir->name; 387 input_dev->name = ir->name;
389 input_dev->phys = ir->phys; 388 input_dev->phys = ir->phys;
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c
index b6c682f0acec..3e37593a328f 100644
--- a/drivers/media/video/saa7134/saa7134-input.c
+++ b/drivers/media/video/saa7134/saa7134-input.c
@@ -44,8 +44,6 @@ MODULE_PARM_DESC(pinnacle_remote, "Specify Pinnacle PCTV remote: 0=coloured, 1=g
44 44
45static int ir_rc5_remote_gap = 885; 45static int ir_rc5_remote_gap = 885;
46module_param(ir_rc5_remote_gap, int, 0644); 46module_param(ir_rc5_remote_gap, int, 0644);
47static int ir_rc5_key_timeout = 115;
48module_param(ir_rc5_key_timeout, int, 0644);
49 47
50static int repeat_delay = 500; 48static int repeat_delay = 500;
51module_param(repeat_delay, int, 0644); 49module_param(repeat_delay, int, 0644);
@@ -70,7 +68,6 @@ static int saa7134_rc5_irq(struct saa7134_dev *dev);
70static int saa7134_nec_irq(struct saa7134_dev *dev); 68static int saa7134_nec_irq(struct saa7134_dev *dev);
71static int saa7134_raw_decode_irq(struct saa7134_dev *dev); 69static int saa7134_raw_decode_irq(struct saa7134_dev *dev);
72static void nec_task(unsigned long data); 70static void nec_task(unsigned long data);
73static void saa7134_nec_timer(unsigned long data);
74 71
75/* -------------------- GPIO generic keycode builder -------------------- */ 72/* -------------------- GPIO generic keycode builder -------------------- */
76 73
@@ -104,25 +101,25 @@ static int build_key(struct saa7134_dev *dev)
104 switch (dev->board) { 101 switch (dev->board) {
105 case SAA7134_BOARD_KWORLD_PLUS_TV_ANALOG: 102 case SAA7134_BOARD_KWORLD_PLUS_TV_ANALOG:
106 if (data == ir->mask_keycode) 103 if (data == ir->mask_keycode)
107 ir_input_nokey(ir->dev, &ir->ir); 104 ir_keyup(ir->dev);
108 else 105 else
109 ir_input_keydown(ir->dev, &ir->ir, data); 106 ir_keydown_notimeout(ir->dev, data, 0);
110 return 0; 107 return 0;
111 } 108 }
112 109
113 if (ir->polling) { 110 if (ir->polling) {
114 if ((ir->mask_keydown && (0 != (gpio & ir->mask_keydown))) || 111 if ((ir->mask_keydown && (0 != (gpio & ir->mask_keydown))) ||
115 (ir->mask_keyup && (0 == (gpio & ir->mask_keyup)))) { 112 (ir->mask_keyup && (0 == (gpio & ir->mask_keyup)))) {
116 ir_input_keydown(ir->dev, &ir->ir, data); 113 ir_keydown_notimeout(ir->dev, data, 0);
117 } else { 114 } else {
118 ir_input_nokey(ir->dev, &ir->ir); 115 ir_keyup(ir->dev);
119 } 116 }
120 } 117 }
121 else { /* IRQ driven mode - handle key press and release in one go */ 118 else { /* IRQ driven mode - handle key press and release in one go */
122 if ((ir->mask_keydown && (0 != (gpio & ir->mask_keydown))) || 119 if ((ir->mask_keydown && (0 != (gpio & ir->mask_keydown))) ||
123 (ir->mask_keyup && (0 == (gpio & ir->mask_keyup)))) { 120 (ir->mask_keyup && (0 == (gpio & ir->mask_keyup)))) {
124 ir_input_keydown(ir->dev, &ir->ir, data); 121 ir_keydown_notimeout(ir->dev, data, 0);
125 ir_input_nokey(ir->dev, &ir->ir); 122 ir_keyup(ir->dev);
126 } 123 }
127 } 124 }
128 125
@@ -465,17 +462,11 @@ static int __saa7134_ir_start(void *priv)
465 init_timer(&ir->timer_end); 462 init_timer(&ir->timer_end);
466 ir->timer_end.function = ir_rc5_timer_end; 463 ir->timer_end.function = ir_rc5_timer_end;
467 ir->timer_end.data = (unsigned long)ir; 464 ir->timer_end.data = (unsigned long)ir;
468 init_timer(&ir->timer_keyup);
469 ir->timer_keyup.function = ir_rc5_timer_keyup;
470 ir->timer_keyup.data = (unsigned long)ir;
471 ir->shift_by = 2; 465 ir->shift_by = 2;
472 ir->start = 0x2; 466 ir->start = 0x2;
473 ir->addr = 0x17; 467 ir->addr = 0x17;
474 ir->rc5_key_timeout = ir_rc5_key_timeout;
475 ir->rc5_remote_gap = ir_rc5_remote_gap; 468 ir->rc5_remote_gap = ir_rc5_remote_gap;
476 } else if (ir->nec_gpio) { 469 } else if (ir->nec_gpio) {
477 setup_timer(&ir->timer_keyup, saa7134_nec_timer,
478 (unsigned long)dev);
479 tasklet_init(&ir->tlet, nec_task, (unsigned long)dev); 470 tasklet_init(&ir->tlet, nec_task, (unsigned long)dev);
480 } else if (ir->raw_decode) { 471 } else if (ir->raw_decode) {
481 /* set timer_end for code completion */ 472 /* set timer_end for code completion */
@@ -596,7 +587,6 @@ int saa7134_input_init1(struct saa7134_dev *dev)
596 int nec_gpio = 0; 587 int nec_gpio = 0;
597 int raw_decode = 0; 588 int raw_decode = 0;
598 int allow_protocol_change = 0; 589 int allow_protocol_change = 0;
599 u64 ir_type = IR_TYPE_OTHER;
600 int err; 590 int err;
601 591
602 if (dev->has_remote != SAA7134_REMOTE_GPIO) 592 if (dev->has_remote != SAA7134_REMOTE_GPIO)
@@ -871,10 +861,6 @@ int saa7134_input_init1(struct saa7134_dev *dev)
871 ir->props.change_protocol = saa7134_ir_change_protocol; 861 ir->props.change_protocol = saa7134_ir_change_protocol;
872 } 862 }
873 863
874 err = ir_input_init(input_dev, &ir->ir, ir_type);
875 if (err < 0)
876 goto err_out_free;
877
878 input_dev->name = ir->name; 864 input_dev->name = ir->name;
879 input_dev->phys = ir->phys; 865 input_dev->phys = ir->phys;
880 input_dev->id.bustype = BUS_PCI; 866 input_dev->id.bustype = BUS_PCI;
@@ -1092,20 +1078,6 @@ static int saa7134_rc5_irq(struct saa7134_dev *dev)
1092 return 1; 1078 return 1;
1093} 1079}
1094 1080
1095/* On NEC protocol, One has 2.25 ms, and zero has 1.125 ms
1096 The first pulse (start) has 9 + 4.5 ms
1097 */
1098
1099static void saa7134_nec_timer(unsigned long data)
1100{
1101 struct saa7134_dev *dev = (struct saa7134_dev *) data;
1102 struct card_ir *ir = dev->remote;
1103
1104 dprintk("Cancel key repeat\n");
1105
1106 ir_input_nokey(ir->dev, &ir->ir);
1107}
1108
1109static void nec_task(unsigned long data) 1081static void nec_task(unsigned long data)
1110{ 1082{
1111 struct saa7134_dev *dev = (struct saa7134_dev *) data; 1083 struct saa7134_dev *dev = (struct saa7134_dev *) data;
@@ -1194,12 +1166,11 @@ static void nec_task(unsigned long data)
1194 dprintk("scancode = 0x%02x (code = 0x%02x, notcode= 0x%02x)\n", 1166 dprintk("scancode = 0x%02x (code = 0x%02x, notcode= 0x%02x)\n",
1195 ir->code, ircode, not_code); 1167 ir->code, ircode, not_code);
1196 1168
1197 ir_input_keydown(ir->dev, &ir->ir, ir->code); 1169 ir_keydown(ir->dev, ir->code, 0);
1198 } else 1170 } else {
1199 dprintk("Repeat last key\n"); 1171 dprintk("Repeat last key\n");
1200 1172 ir_repeat(ir->dev);
1201 /* Keep repeating the last key */ 1173 }
1202 mod_timer(&ir->timer_keyup, jiffies + msecs_to_jiffies(150));
1203 1174
1204 saa_setl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO18_P); 1175 saa_setl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO18_P);
1205} 1176}