26 #include <linux/hrtimer.h>
27 #include <linux/pci.h>
28 #include <linux/slab.h>
29 #include <linux/module.h>
34 #define MODULE_NAME "cx88xx"
60 static unsigned ir_samplerate = 4;
68 #define ir_dprintk(fmt, arg...) if (ir_debug) \
69 printk(KERN_DEBUG "%s IR: " fmt , ir->core->name , ##arg)
71 #define dprintk(fmt, arg...) if (ir_debug) \
72 printk(KERN_DEBUG "cx88 IR: " fmt , ##arg)
76 static void cx88_ir_handle_key(
struct cx88_IR *
ir)
99 gpio=(gpio & 0x7fd) + (auxgpio & 0xef);
122 ir_dprintk(
"irq gpio=0x%x code=%d | %s%s%s\n",
158 unsigned long missed;
161 cx88_ir_handle_key(ir);
162 missed = hrtimer_forward_now(&ir->
timer,
163 ktime_set(0, ir->
polling * 1000000));
170 static int __cx88_ir_start(
void *
priv)
175 if (!core || !core->
ir)
182 ir->
timer.function = cx88_ir_work;
184 ktime_set(0, ir->
polling * 1000000),
195 static void __cx88_ir_stop(
void *priv)
200 if (!core || !core->
ir)
216 return __cx88_ir_start(core);
224 __cx88_ir_stop(core);
227 static int cx88_ir_open(
struct rc_dev *
rc)
232 return __cx88_ir_start(core);
235 static void cx88_ir_close(
struct rc_dev *
rc)
240 if (!core->
ir->users)
241 __cx88_ir_stop(core);
250 char *ir_codes =
NULL;
253 u32 hardware_mask = 0;
335 hardware_mask = 0x3f;
459 dev->
dev.parent = &pci->
dev;
463 dev->
open = cx88_ir_open;
464 dev->
close = cx88_ir_close;
469 dev->
timeout = 10 * 1000 * 1000;
528 if (samples == 0xff && ir->
dev->idle)
531 init_ir_raw_event(&ev);
532 for (todo = 32; todo > 0; todo -=
bits) {
533 ev.
pulse = samples & 0x80000000 ?
false :
true;
534 bits =
min(todo, 32
U - fls(ev.
pulse ? samples : ~samples));
542 static int get_key_pvr2000(
struct IR_i2c *ir,
u32 *ir_key,
u32 *ir_raw)
553 if (0 == (flags & 0x80))
563 dprintk(
"IR Key/Flags: (0x%02x/0x%02x)\n",
564 code & 0xff, flags & 0xff);
566 *ir_key = code & 0xff;
574 const unsigned short default_addr_list[] = {
578 const unsigned short pvr2000_addr_list[] = {
582 const unsigned short *addr_list = default_addr_list;
583 const unsigned short *addrp;
593 addr_list = pvr2000_addr_list;
594 core->
init_data.name =
"cx88 Leadtek PVR 2000 remote";
596 core->
init_data.get_key = get_key_pvr2000;
612 if (*addrp == 0x71) {
614 core->
init_data.name =
"cx88 Hauppauge XVR remote";