Lines Matching refs:ir

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