Lines Matching full:ir
3 // handle em28xx IR remotes via linux kernel input layer.
37 MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]");
43 dev_printk(KERN_DEBUG, &ir->dev->intf->dev, \
48 * Polling structure used by em28xx IR's
73 int (*get_key_i2c)(struct i2c_client *ir, enum rc_proto *protocol,
75 int (*get_key)(struct em28xx_IR *ir, struct em28xx_ir_poll_result *r);
79 * I2C IR based get keycodes - should be used with ir-kbd-i2c
88 /* poll IR chip */ in em28xx_get_key_terratec()
119 /* poll IR chip */ in em28xx_get_key_em_haup()
132 * The original Hauppauge Grey IR and another RC5 that uses addr=0x08 in em28xx_get_key_em_haup()
136 * work with the provided RC5 IR. in em28xx_get_key_em_haup()
149 /* poll IR chip */ in em28xx_get_key_pinnacle_usb_grey()
204 static int default_polling_getkey(struct em28xx_IR *ir, in default_polling_getkey() argument
207 struct em28xx *dev = ir->dev; in default_polling_getkey()
227 switch (ir->rc_proto) { in default_polling_getkey()
247 static int em2874_polling_getkey(struct em28xx_IR *ir, in em2874_polling_getkey() argument
250 struct em28xx *dev = ir->dev; in em2874_polling_getkey()
273 switch (ir->rc_proto) { in em2874_polling_getkey()
303 static int em28xx_i2c_ir_handle_key(struct em28xx_IR *ir) in em28xx_i2c_ir_handle_key() argument
309 rc = ir->get_key_i2c(ir->i2c_client, &protocol, &scancode); in em28xx_i2c_ir_handle_key()
311 dprintk("ir->get_key_i2c() failed: %d\n", rc); in em28xx_i2c_ir_handle_key()
318 rc_keydown(ir->rc, protocol, scancode, 0); in em28xx_i2c_ir_handle_key()
323 static void em28xx_ir_handle_key(struct em28xx_IR *ir) in em28xx_ir_handle_key() argument
328 /* read the registers containing the IR status */ in em28xx_ir_handle_key()
329 result = ir->get_key(ir, &poll_result); in em28xx_ir_handle_key()
331 dprintk("ir->get_key() failed: %d\n", result); in em28xx_ir_handle_key()
335 if (unlikely(poll_result.read_count != ir->last_readcount)) { in em28xx_ir_handle_key()
339 if (ir->full_code) in em28xx_ir_handle_key()
340 rc_keydown(ir->rc, in em28xx_ir_handle_key()
345 rc_keydown(ir->rc, in em28xx_ir_handle_key()
350 if (ir->dev->chip_id == CHIP_ID_EM2874 || in em28xx_ir_handle_key()
351 ir->dev->chip_id == CHIP_ID_EM2884) in em28xx_ir_handle_key()
360 ir->last_readcount = 0; in em28xx_ir_handle_key()
362 ir->last_readcount = poll_result.read_count; in em28xx_ir_handle_key()
368 struct em28xx_IR *ir = container_of(work, struct em28xx_IR, work.work); in em28xx_ir_work() local
370 if (ir->i2c_client) /* external i2c device */ in em28xx_ir_work()
371 em28xx_i2c_ir_handle_key(ir); in em28xx_ir_work()
373 em28xx_ir_handle_key(ir); in em28xx_ir_work()
374 schedule_delayed_work(&ir->work, msecs_to_jiffies(ir->polling)); in em28xx_ir_work()
379 struct em28xx_IR *ir = rc->priv; in em28xx_ir_start() local
381 INIT_DELAYED_WORK(&ir->work, em28xx_ir_work); in em28xx_ir_start()
382 schedule_delayed_work(&ir->work, 0); in em28xx_ir_start()
389 struct em28xx_IR *ir = rc->priv; in em28xx_ir_stop() local
391 cancel_delayed_work_sync(&ir->work); in em28xx_ir_stop()
396 struct em28xx_IR *ir = rc_dev->priv; in em2860_ir_change_protocol() local
397 struct em28xx *dev = ir->dev; in em2860_ir_change_protocol()
399 /* Adjust xclk based on IR table for RC5/NEC tables */ in em2860_ir_change_protocol()
402 ir->full_code = 1; in em2860_ir_change_protocol()
406 ir->full_code = 1; in em2860_ir_change_protocol()
411 *rc_proto = ir->rc_proto; in em2860_ir_change_protocol()
417 ir->rc_proto = *rc_proto; in em2860_ir_change_protocol()
424 struct em28xx_IR *ir = rc_dev->priv; in em2874_ir_change_protocol() local
425 struct em28xx *dev = ir->dev; in em2874_ir_change_protocol()
428 /* Adjust xclk and set type based on IR table for RC5/NEC/RC6 tables */ in em2874_ir_change_protocol()
431 ir->full_code = 1; in em2874_ir_change_protocol()
436 ir->full_code = 1; in em2874_ir_change_protocol()
441 ir->full_code = 1; in em2874_ir_change_protocol()
446 *rc_proto = ir->rc_proto; in em2874_ir_change_protocol()
453 ir->rc_proto = *rc_proto; in em2874_ir_change_protocol()
460 struct em28xx_IR *ir = rc_dev->priv; in em28xx_ir_change_protocol() local
461 struct em28xx *dev = ir->dev; in em28xx_ir_change_protocol()
474 dev_err(&ir->dev->intf->dev, in em28xx_ir_change_protocol()
475 "Unrecognized em28xx chip id 0x%02x: IR not supported\n", in em28xx_ir_change_protocol()
485 * Leadtek winfast tv USBII deluxe can find a non working IR-device in em28xx_probe_i2c_ir()
700 struct em28xx_IR *ir; in em28xx_ir_init() local
707 /* Shouldn't initialize IR for this interface */ in em28xx_ir_init()
722 "No i2c IR remote control device found.\n"); in em28xx_ir_init()
736 ir = kzalloc(sizeof(*ir), GFP_KERNEL); in em28xx_ir_init()
737 if (!ir) in em28xx_ir_init()
744 ir->dev = dev; in em28xx_ir_init()
745 dev->ir = ir; in em28xx_ir_init()
746 ir->rc = rc; in em28xx_ir_init()
748 rc->priv = ir; in em28xx_ir_init()
757 ir->get_key_i2c = em28xx_get_key_terratec; in em28xx_ir_init()
761 ir->get_key_i2c = em28xx_get_key_pinnacle_usb_grey; in em28xx_ir_init()
765 ir->get_key_i2c = em28xx_get_key_em_haup; in em28xx_ir_init()
770 ir->get_key_i2c = em28xx_get_key_winfast_usbii_deluxe; in em28xx_ir_init()
777 ir->i2c_client = kzalloc(sizeof(*ir->i2c_client), GFP_KERNEL); in em28xx_ir_init()
778 if (!ir->i2c_client) in em28xx_ir_init()
780 ir->i2c_client->adapter = &ir->dev->i2c_adap[dev->def_i2c_bus]; in em28xx_ir_init()
781 ir->i2c_client->addr = i2c_rc_dev_addr; in em28xx_ir_init()
782 ir->i2c_client->flags = 0; in em28xx_ir_init()
790 ir->get_key = default_polling_getkey; in em28xx_ir_init()
796 ir->get_key = em2874_polling_getkey; in em28xx_ir_init()
816 /* This is how often we ask the chip for IR information */ in em28xx_ir_init()
817 ir->polling = 100; /* ms */ in em28xx_ir_init()
819 usb_make_path(udev, ir->phys, sizeof(ir->phys)); in em28xx_ir_init()
820 strlcat(ir->phys, "/input0", sizeof(ir->phys)); in em28xx_ir_init()
823 rc->input_phys = ir->phys; in em28xx_ir_init()
838 kfree(ir->i2c_client); in em28xx_ir_init()
839 dev->ir = NULL; in em28xx_ir_init()
841 kfree(ir); in em28xx_ir_init()
847 struct em28xx_IR *ir = dev->ir; in em28xx_ir_fini() local
850 /* Shouldn't initialize IR for this interface */ in em28xx_ir_fini()
859 if (!ir) in em28xx_ir_fini()
862 rc_unregister_device(ir->rc); in em28xx_ir_fini()
864 kfree(ir->i2c_client); in em28xx_ir_fini()
867 kfree(ir); in em28xx_ir_fini()
868 dev->ir = NULL; in em28xx_ir_fini()
878 struct em28xx_IR *ir = dev->ir; in em28xx_ir_suspend() local
884 if (ir) in em28xx_ir_suspend()
885 cancel_delayed_work_sync(&ir->work); in em28xx_ir_suspend()
897 struct em28xx_IR *ir = dev->ir; in em28xx_ir_resume() local
907 if (ir) in em28xx_ir_resume()
908 schedule_delayed_work(&ir->work, msecs_to_jiffies(ir->polling)); in em28xx_ir_resume()