Lines Matching refs:ir
42 struct bttv_ir *ir = btv->remote; in ir_handle_key() local
47 if (ir->polling) { in ir_handle_key()
48 if (ir->last_gpio == gpio) in ir_handle_key()
50 ir->last_gpio = gpio; in ir_handle_key()
54 data = ir_extract_bits(gpio, ir->mask_keycode); in ir_handle_key()
57 ir->polling ? "poll" : "irq", in ir_handle_key()
58 (gpio & ir->mask_keydown) ? " down" : "", in ir_handle_key()
59 (gpio & ir->mask_keyup) ? " up" : ""); in ir_handle_key()
61 if ((ir->mask_keydown && (gpio & ir->mask_keydown)) || in ir_handle_key()
62 (ir->mask_keyup && !(gpio & ir->mask_keyup))) { in ir_handle_key()
63 rc_keydown_notimeout(ir->dev, RC_PROTO_UNKNOWN, data, 0); in ir_handle_key()
68 rc_keydown_notimeout(ir->dev, RC_PROTO_UNKNOWN, data, in ir_handle_key()
71 rc_keyup(ir->dev); in ir_handle_key()
77 struct bttv_ir *ir = btv->remote; in ir_enltv_handle_key() local
84 data = ir_extract_bits(gpio, ir->mask_keycode); in ir_enltv_handle_key()
87 keyup = (gpio & ir->mask_keyup) ? 1UL << 31 : 0; in ir_enltv_handle_key()
89 if ((ir->last_gpio & 0x7f) != data) { in ir_enltv_handle_key()
92 (gpio & ir->mask_keyup) ? " up" : "up/down"); in ir_enltv_handle_key()
94 rc_keydown_notimeout(ir->dev, RC_PROTO_UNKNOWN, data, 0); in ir_enltv_handle_key()
96 rc_keyup(ir->dev); in ir_enltv_handle_key()
98 if ((ir->last_gpio & 1UL << 31) == keyup) in ir_enltv_handle_key()
103 (gpio & ir->mask_keyup) ? " up" : "down"); in ir_enltv_handle_key()
106 rc_keyup(ir->dev); in ir_enltv_handle_key()
108 rc_keydown_notimeout(ir->dev, RC_PROTO_UNKNOWN, data, in ir_enltv_handle_key()
112 ir->last_gpio = data | keyup; in ir_enltv_handle_key()
119 struct bttv_ir *ir = btv->remote; in bttv_input_irq() local
121 if (ir->rc5_gpio) in bttv_input_irq()
123 else if (!ir->polling) in bttv_input_irq()
129 struct bttv_ir *ir = from_timer(ir, t, timer); in bttv_input_timer() local
130 struct bttv *btv = ir->btv; in bttv_input_timer()
136 mod_timer(&ir->timer, jiffies + msecs_to_jiffies(ir->polling)); in bttv_input_timer()
185 struct bttv_ir *ir = from_timer(ir, t, timer); in bttv_rc5_timer_end() local
193 gap = ktime_to_us(ktime_sub(tv, ir->base_time)); in bttv_rc5_timer_end()
199 ir->active = false; in bttv_rc5_timer_end()
207 if (ir->last_bit < 20) { in bttv_rc5_timer_end()
209 dprintk("short code: %x\n", ir->code); in bttv_rc5_timer_end()
213 ir->code = (ir->code << ir->shift_by) | 1; in bttv_rc5_timer_end()
214 rc5 = bttv_rc5_decode(ir->code); in bttv_rc5_timer_end()
231 rc_keydown(ir->dev, RC_PROTO_RC5, scancode, toggle); in bttv_rc5_timer_end()
237 struct bttv_ir *ir = btv->remote; in bttv_rc5_irq() local
250 gap = ktime_to_us(ktime_sub(tv, ir->base_time)); in bttv_rc5_irq()
264 if (ir->active) { in bttv_rc5_irq()
267 if (ir->last_bit < 28) { in bttv_rc5_irq()
268 ir->last_bit = (gap - ir_rc5_remote_gap / 2) / in bttv_rc5_irq()
270 ir->code |= 1 << ir->last_bit; in bttv_rc5_irq()
274 ir->active = true; in bttv_rc5_irq()
275 ir->code = 0; in bttv_rc5_irq()
276 ir->base_time = tv; in bttv_rc5_irq()
277 ir->last_bit = 0; in bttv_rc5_irq()
279 mod_timer(&ir->timer, current_jiffies + msecs_to_jiffies(30)); in bttv_rc5_irq()
290 static void bttv_ir_start(struct bttv_ir *ir) in bttv_ir_start() argument
292 if (ir->polling) { in bttv_ir_start()
293 timer_setup(&ir->timer, bttv_input_timer, 0); in bttv_ir_start()
294 ir->timer.expires = jiffies + msecs_to_jiffies(1000); in bttv_ir_start()
295 add_timer(&ir->timer); in bttv_ir_start()
296 } else if (ir->rc5_gpio) { in bttv_ir_start()
298 timer_setup(&ir->timer, bttv_rc5_timer_end, 0); in bttv_ir_start()
299 ir->shift_by = 1; in bttv_ir_start()
300 ir->rc5_remote_gap = ir_rc5_remote_gap; in bttv_ir_start()
323 static int get_key_pv951(struct IR_i2c *ir, enum rc_proto *protocol, in get_key_pv951() argument
330 rc = i2c_master_recv(ir->c, &b, 1); in get_key_pv951()
411 struct bttv_ir *ir; in bttv_input_init() local
419 ir = kzalloc(sizeof(*ir),GFP_KERNEL); in bttv_input_init()
421 if (!ir || !rc) in bttv_input_init()
430 ir->mask_keycode = 0xf88000; in bttv_input_init()
431 ir->mask_keydown = 0x010000; in bttv_input_init()
432 ir->polling = 50; // ms in bttv_input_init()
438 ir->mask_keycode = 0x0f00c0; in bttv_input_init()
439 ir->mask_keydown = 0x000020; in bttv_input_init()
440 ir->polling = 50; // ms in bttv_input_init()
445 ir->mask_keycode = 0x003e00; in bttv_input_init()
446 ir->mask_keyup = 0x010000; in bttv_input_init()
447 ir->polling = 50; // ms in bttv_input_init()
453 ir->mask_keycode = 0x001f00; in bttv_input_init()
454 ir->mask_keyup = 0x008000; in bttv_input_init()
455 ir->polling = 50; // ms in bttv_input_init()
460 ir->mask_keycode = 0x1f8; in bttv_input_init()
465 ir->mask_keycode = 0x0008e000; in bttv_input_init()
466 ir->mask_keydown = 0x00200000; in bttv_input_init()
470 ir->mask_keycode = 0x001f00; in bttv_input_init()
471 ir->mask_keyup = 0x008000; in bttv_input_init()
472 ir->polling = 50; // ms in bttv_input_init()
479 ir->mask_keycode = 0x001F00; in bttv_input_init()
480 ir->mask_keyup = 0x006000; in bttv_input_init()
481 ir->polling = 50; // ms in bttv_input_init()
485 ir->rc5_gpio = true; in bttv_input_init()
489 ir->mask_keycode = 0x001F00; in bttv_input_init()
490 ir->mask_keyup = 0x004000; in bttv_input_init()
491 ir->polling = 50; /* ms */ in bttv_input_init()
495 ir->mask_keycode = 0x001f00; in bttv_input_init()
496 ir->mask_keyup = 0x006000; in bttv_input_init()
497 ir->polling = 50; /* ms */ in bttv_input_init()
501 ir->mask_keycode = 0x00fd00; in bttv_input_init()
502 ir->mask_keyup = 0x000080; in bttv_input_init()
503 ir->polling = 1; /* ms */ in bttv_input_init()
504 ir->last_gpio = ir_extract_bits(bttv_gpio_read(&btv->c), in bttv_input_init()
505 ir->mask_keycode); in bttv_input_init()
515 if (ir->rc5_gpio) { in bttv_input_init()
524 bttv_gpio_inout(&btv->c, ir->mask_keycode | ir->mask_keydown, 0); in bttv_input_init()
528 ir->dev = rc; in bttv_input_init()
529 ir->btv = btv; in bttv_input_init()
531 snprintf(ir->name, sizeof(ir->name), "bttv IR (card=%d)", in bttv_input_init()
533 snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", in bttv_input_init()
536 rc->device_name = ir->name; in bttv_input_init()
537 rc->input_phys = ir->phys; in bttv_input_init()
551 btv->remote = ir; in bttv_input_init()
552 bttv_ir_start(ir); in bttv_input_init()
566 kfree(ir); in bttv_input_init()