Lines Matching full:ir

50 MODULE_PARM_DESC(ir_samplerate, "IR samplerate in kHz, 1 - 20, default 4");
53 module_param(ir_debug, int, 0644); /* debug level [IR] */
54 MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]");
58 printk(KERN_DEBUG "%s IR: " fmt, ir->core->name, ##arg);\
63 printk(KERN_DEBUG "cx88 IR: " fmt, ##arg); \
68 static void cx88_ir_handle_key(struct cx88_IR *ir) in cx88_ir_handle_key() argument
70 struct cx88_core *core = ir->core; in cx88_ir_handle_key()
74 gpio = cx_read(ir->gpio_addr); in cx88_ir_handle_key()
107 if (ir->polling) { in cx88_ir_handle_key()
108 if (ir->last_gpio == auxgpio) in cx88_ir_handle_key()
110 ir->last_gpio = auxgpio; in cx88_ir_handle_key()
114 data = ir_extract_bits(gpio, ir->mask_keycode); in cx88_ir_handle_key()
117 ir->polling ? "poll" : "irq", in cx88_ir_handle_key()
118 (gpio & ir->mask_keydown) ? " down" : "", in cx88_ir_handle_key()
119 (gpio & ir->mask_keyup) ? " up" : ""); in cx88_ir_handle_key()
121 if (ir->core->boardnr == CX88_BOARD_NORWOOD_MICRO) { in cx88_ir_handle_key()
126 rc_keydown(ir->dev, RC_PROTO_UNKNOWN, data, 0); in cx88_ir_handle_key()
128 } else if (ir->core->boardnr == CX88_BOARD_PROLINK_PLAYTVPVR || in cx88_ir_handle_key()
129 ir->core->boardnr == CX88_BOARD_PIXELVIEW_PLAYTV_ULTRA_PRO) { in cx88_ir_handle_key()
139 if (0 == (gpio & ir->mask_keyup)) in cx88_ir_handle_key()
140 rc_keydown_notimeout(ir->dev, RC_PROTO_NECX, scancode, in cx88_ir_handle_key()
143 rc_keyup(ir->dev); in cx88_ir_handle_key()
145 } else if (ir->mask_keydown) { in cx88_ir_handle_key()
147 if (gpio & ir->mask_keydown) in cx88_ir_handle_key()
148 rc_keydown_notimeout(ir->dev, RC_PROTO_UNKNOWN, data, in cx88_ir_handle_key()
151 rc_keyup(ir->dev); in cx88_ir_handle_key()
153 } else if (ir->mask_keyup) { in cx88_ir_handle_key()
155 if (0 == (gpio & ir->mask_keyup)) in cx88_ir_handle_key()
156 rc_keydown_notimeout(ir->dev, RC_PROTO_UNKNOWN, data, in cx88_ir_handle_key()
159 rc_keyup(ir->dev); in cx88_ir_handle_key()
163 rc_keydown_notimeout(ir->dev, RC_PROTO_UNKNOWN, data, 0); in cx88_ir_handle_key()
164 rc_keyup(ir->dev); in cx88_ir_handle_key()
171 struct cx88_IR *ir = container_of(timer, struct cx88_IR, timer); in cx88_ir_work() local
173 cx88_ir_handle_key(ir); in cx88_ir_work()
174 missed = hrtimer_forward_now(&ir->timer, in cx88_ir_work()
175 ktime_set(0, ir->polling * 1000000)); in cx88_ir_work()
185 struct cx88_IR *ir; in __cx88_ir_start() local
187 if (!core || !core->ir) in __cx88_ir_start()
190 ir = core->ir; in __cx88_ir_start()
192 if (ir->polling) { in __cx88_ir_start()
193 hrtimer_setup(&ir->timer, cx88_ir_work, CLOCK_MONOTONIC, HRTIMER_MODE_REL); in __cx88_ir_start()
194 hrtimer_start(&ir->timer, in __cx88_ir_start()
195 ktime_set(0, ir->polling * 1000000), in __cx88_ir_start()
198 if (ir->sampling) { in __cx88_ir_start()
209 struct cx88_IR *ir; in __cx88_ir_stop() local
211 if (!core || !core->ir) in __cx88_ir_stop()
214 ir = core->ir; in __cx88_ir_stop()
215 if (ir->sampling) { in __cx88_ir_stop()
220 if (ir->polling) in __cx88_ir_stop()
221 hrtimer_cancel(&ir->timer); in __cx88_ir_stop()
226 if (core->ir->users) in cx88_ir_start()
235 if (core->ir->users) in cx88_ir_stop()
244 core->ir->users++; in cx88_ir_open()
252 core->ir->users--; in cx88_ir_close()
253 if (!core->ir->users) in cx88_ir_close()
261 struct cx88_IR *ir; in cx88_ir_init() local
267 * used with a full-code IR table in cx88_ir_init()
270 ir = kzalloc(sizeof(*ir), GFP_KERNEL); in cx88_ir_init()
272 if (!ir || !dev) in cx88_ir_init()
275 ir->dev = dev; in cx88_ir_init()
283 ir->gpio_addr = MO_GP1_IO; in cx88_ir_init()
284 ir->mask_keycode = 0x1f; in cx88_ir_init()
285 ir->mask_keyup = 0x60; in cx88_ir_init()
286 ir->polling = 50; /* ms */ in cx88_ir_init()
290 ir->sampling = 0xeb04; /* address */ in cx88_ir_init()
304 ir->sampling = 1; in cx88_ir_init()
312 ir->gpio_addr = MO_GP0_IO; in cx88_ir_init()
313 ir->mask_keycode = 0x8f8; in cx88_ir_init()
314 ir->mask_keyup = 0x100; in cx88_ir_init()
315 ir->polling = 50; /* ms */ in cx88_ir_init()
323 ir->gpio_addr = MO_GP0_IO; in cx88_ir_init()
324 ir->mask_keycode = 0x8f8; in cx88_ir_init()
325 ir->mask_keyup = 0x100; in cx88_ir_init()
326 ir->polling = 1; /* ms */ in cx88_ir_init()
330 ir->gpio_addr = MO_GP0_IO; in cx88_ir_init()
331 ir->mask_keycode = 0xfd; in cx88_ir_init()
332 ir->mask_keydown = 0x02; in cx88_ir_init()
333 ir->polling = 5; /* ms */ in cx88_ir_init()
340 * IR's with different address won't work. Still, there are in cx88_ir_init()
341 * other IR's from the same manufacturer that works, like the in cx88_ir_init()
346 ir->gpio_addr = MO_GP1_IO; in cx88_ir_init()
347 ir->mask_keyup = 0x80; in cx88_ir_init()
348 ir->polling = 10; /* ms */ in cx88_ir_init()
354 ir->gpio_addr = MO_GP1_IO; in cx88_ir_init()
355 ir->mask_keycode = 0x3f; in cx88_ir_init()
356 ir->mask_keyup = 0x80; in cx88_ir_init()
357 ir->polling = 1; /* ms */ in cx88_ir_init()
361 ir->gpio_addr = MO_GP1_IO; in cx88_ir_init()
362 ir->mask_keycode = 0x1f; in cx88_ir_init()
363 ir->mask_keyup = 0x60; in cx88_ir_init()
364 ir->polling = 1; /* ms */ in cx88_ir_init()
368 ir->gpio_addr = MO_GP1_IO; in cx88_ir_init()
369 ir->mask_keycode = 0xbf; in cx88_ir_init()
370 ir->mask_keyup = 0x40; in cx88_ir_init()
371 ir->polling = 50; /* ms */ in cx88_ir_init()
375 ir->gpio_addr = MO_GP1_IO; in cx88_ir_init()
376 ir->mask_keycode = 0x1f; in cx88_ir_init()
377 ir->mask_keyup = 0x40; in cx88_ir_init()
378 ir->polling = 1; /* ms */ in cx88_ir_init()
383 ir->gpio_addr = MO_GP2_IO; in cx88_ir_init()
384 ir->mask_keycode = 0xfb; in cx88_ir_init()
385 ir->mask_keydown = 0x02; in cx88_ir_init()
386 ir->polling = 50; /* ms */ in cx88_ir_init()
396 ir->sampling = 0xff00; /* address */ in cx88_ir_init()
402 ir->sampling = 0xff00; /* address */ in cx88_ir_init()
406 ir->sampling = 0xff00; /* address */ in cx88_ir_init()
410 ir->gpio_addr = MO_GP1_IO; in cx88_ir_init()
411 ir->mask_keycode = 0x0e; in cx88_ir_init()
412 ir->mask_keyup = 0x80; in cx88_ir_init()
413 ir->polling = 50; /* ms */ in cx88_ir_init()
417 ir->gpio_addr = MO_GP0_IO; in cx88_ir_init()
418 ir->mask_keycode = 0xfa; in cx88_ir_init()
419 ir->polling = 50; /* ms */ in cx88_ir_init()
423 ir->sampling = 1; in cx88_ir_init()
427 ir->gpio_addr = MO_GP2_IO; in cx88_ir_init()
428 ir->mask_keycode = 0x7e; in cx88_ir_init()
429 ir->polling = 100; /* ms */ in cx88_ir_init()
433 ir->sampling = 0xff00; /* address */ in cx88_ir_init()
447 * the full scancodes, since it allows replacing the IR remote by in cx88_ir_init()
454 if (hardware_mask && !ir->mask_keycode) in cx88_ir_init()
455 ir->mask_keycode = hardware_mask; in cx88_ir_init()
458 snprintf(ir->name, sizeof(ir->name), "cx88 IR (%s)", core->board.name); in cx88_ir_init()
459 snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(pci)); in cx88_ir_init()
461 dev->device_name = ir->name; in cx88_ir_init()
462 dev->input_phys = ir->phys; in cx88_ir_init()
480 if (ir->sampling) { in cx88_ir_init()
487 ir->core = core; in cx88_ir_init()
488 core->ir = ir; in cx88_ir_init()
499 core->ir = NULL; in cx88_ir_init()
500 kfree(ir); in cx88_ir_init()
506 struct cx88_IR *ir = core->ir; in cx88_ir_fini() local
509 if (!ir) in cx88_ir_fini()
513 rc_unregister_device(ir->dev); in cx88_ir_fini()
514 kfree(ir); in cx88_ir_fini()
517 core->ir = NULL; in cx88_ir_fini()
525 struct cx88_IR *ir = core->ir; in cx88_ir_irq() local
530 if (!ir || !ir->sampling) in cx88_ir_irq()
540 if (samples == 0xff && ir->dev->idle) in cx88_ir_irq()
547 ir_raw_event_store_with_filter(ir->dev, &ev); in cx88_ir_irq()
550 ir_raw_event_handle(ir->dev); in cx88_ir_irq()
553 static int get_key_pvr2000(struct IR_i2c *ir, enum rc_proto *protocol, in get_key_pvr2000() argument
558 /* poll IR chip */ in get_key_pvr2000()
559 flags = i2c_smbus_read_byte_data(ir->c, 0x10); in get_key_pvr2000()
569 code = i2c_smbus_read_byte_data(ir->c, 0x00); in get_key_pvr2000()
575 dprintk("IR Key/Flags: (0x%02x/0x%02x)\n", in get_key_pvr2000()
597 /* Instantiate the IR receiver device, if present */ in cx88_i2c_init_ir()
649 MODULE_DESCRIPTION("input driver for cx88 GPIO-based IR remote controls");