diff options
Diffstat (limited to 'linux/drivers/media/video/saa7134/saa7134-input.c')
-rw-r--r-- | linux/drivers/media/video/saa7134/saa7134-input.c | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/linux/drivers/media/video/saa7134/saa7134-input.c b/linux/drivers/media/video/saa7134/saa7134-input.c index 36913d22b..b54bfd645 100644 --- a/linux/drivers/media/video/saa7134/saa7134-input.c +++ b/linux/drivers/media/video/saa7134/saa7134-input.c @@ -59,8 +59,13 @@ MODULE_PARM_DESC(disable_other_ir, "disable full codes of " #define dprintk(fmt, arg...) if (ir_debug) \ printk(KERN_DEBUG "%s/ir: " fmt, dev->name , ## arg) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30) +#define i2cdprintk(fmt, arg...) if (ir_debug) \ + printk(KERN_DEBUG "%s/ir: " fmt, ir->c.name , ## arg) +#else #define i2cdprintk(fmt, arg...) if (ir_debug) \ printk(KERN_DEBUG "%s/ir: " fmt, ir->name , ## arg) +#endif /* Helper functions for RC5 and NEC decoding at GPIO16 or GPIO18 */ static int saa7134_rc5_irq(struct saa7134_dev *dev); @@ -134,10 +139,18 @@ static int get_key_msi_tvanywhere_plus(struct IR_i2c *ir, u32 *ir_key, int gpio; /* <dev> is needed to access GPIO. Used by the saa_readl macro. */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30) + struct saa7134_dev *dev = ir->c.adapter->algo_data; +#else struct saa7134_dev *dev = ir->c->adapter->algo_data; +#endif if (dev == NULL) { dprintk("get_key_msi_tvanywhere_plus: " +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30) + "gir->c.adapter->algo_data is NULL!\n"); +#else "gir->c->adapter->algo_data is NULL!\n"); +#endif return -EIO; } @@ -156,7 +169,11 @@ static int get_key_msi_tvanywhere_plus(struct IR_i2c *ir, u32 *ir_key, /* GPIO says there is a button press. Get it. */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30) + if (1 != i2c_master_recv(&ir->c, &b, 1)) { +#else if (1 != i2c_master_recv(ir->c, &b, 1)) { +#endif i2cdprintk("read error\n"); return -EIO; } @@ -179,7 +196,11 @@ static int get_key_purpletv(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) unsigned char b; /* poll IR chip */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30) + if (1 != i2c_master_recv(&ir->c,&b,1)) { +#else if (1 != i2c_master_recv(ir->c, &b, 1)) { +#endif i2cdprintk("read error\n"); return -EIO; } @@ -202,7 +223,11 @@ static int get_key_hvr1110(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) unsigned char buf[5], cod4, code3, code4; /* poll IR chip */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30) + if (5 != i2c_master_recv(&ir->c,buf,5)) +#else if (5 != i2c_master_recv(ir->c, buf, 5)) +#endif return -EIO; cod4 = buf[4]; @@ -224,7 +249,11 @@ static int get_key_beholdm6xx(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) unsigned char data[12]; u32 gpio; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30) + struct saa7134_dev *dev = ir->c.adapter->algo_data; +#else struct saa7134_dev *dev = ir->c->adapter->algo_data; +#endif /* rising SAA7134_GPIO_GPRESCAN reads the status */ saa_clearb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); @@ -235,9 +264,17 @@ static int get_key_beholdm6xx(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) if (0x400000 & ~gpio) return 0; /* No button press */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30) + ir->c.addr = 0x5a >> 1; +#else ir->c->addr = 0x5a >> 1; +#endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30) + if (12 != i2c_master_recv(&ir->c, data, 12)) { +#else if (12 != i2c_master_recv(ir->c, data, 12)) { +#endif i2cdprintk("read error\n"); return -EIO; } @@ -267,7 +304,11 @@ static int get_key_pinnacle(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw, unsigned int start = 0,parity = 0,code = 0; /* poll IR chip */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30) + if (4 != i2c_master_recv(&ir->c, b, 4)) { +#else if (4 != i2c_master_recv(ir->c, b, 4)) { +#endif i2cdprintk("read error\n"); return -EIO; } @@ -686,8 +727,13 @@ void saa7134_input_fini(struct saa7134_dev *dev) dev->remote = NULL; } +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30) +void saa7134_set_i2c_ir(struct saa7134_dev *dev, struct IR_i2c *ir) +#else void saa7134_probe_i2c_ir(struct saa7134_dev *dev) +#endif { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30) struct i2c_board_info info; struct IR_i2c_init_data init_data; const unsigned short addr_list[] = { @@ -704,33 +750,66 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) int rc; +#endif if (disable_ir) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30) + dprintk("Found supported i2c remote, but IR has been disabled\n"); + ir->get_key=NULL; +#else dprintk("IR has been disabled, not probing for i2c remote\n"); +#endif return; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30) memset(&info, 0, sizeof(struct i2c_board_info)); memset(&init_data, 0, sizeof(struct IR_i2c_init_data)); strlcpy(info.type, "ir_video", I2C_NAME_SIZE); +#endif switch (dev->board) { case SAA7134_BOARD_PINNACLE_PCTV_110i: case SAA7134_BOARD_PINNACLE_PCTV_310i: +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30) + snprintf(ir->c.name, sizeof(ir->c.name), "Pinnacle PCTV"); +#else init_data.name = "Pinnacle PCTV"; +#endif if (pinnacle_remote == 0) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30) + ir->get_key = get_key_pinnacle_color; + ir->ir_codes = ir_codes_pinnacle_color; +#else init_data.get_key = get_key_pinnacle_color; init_data.ir_codes = ir_codes_pinnacle_color; +#endif } else { +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30) + ir->get_key = get_key_pinnacle_grey; + ir->ir_codes = ir_codes_pinnacle_grey; +#else init_data.get_key = get_key_pinnacle_grey; init_data.ir_codes = ir_codes_pinnacle_grey; +#endif } break; case SAA7134_BOARD_UPMOST_PURPLE_TV: +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30) + snprintf(ir->c.name, sizeof(ir->c.name), "Purple TV"); + ir->get_key = get_key_purpletv; + ir->ir_codes = ir_codes_purpletv; +#else init_data.name = "Purple TV"; init_data.get_key = get_key_purpletv; init_data.ir_codes = ir_codes_purpletv; +#endif break; case SAA7134_BOARD_MSI_TVATANYWHERE_PLUS: +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30) + snprintf(ir->c.name, sizeof(ir->c.name), "MSI TV@nywhere Plus"); + ir->get_key = get_key_msi_tvanywhere_plus; + ir->ir_codes = ir_codes_msi_tvanywhere_plus; +#else init_data.name = "MSI TV@nywhere Plus"; init_data.get_key = get_key_msi_tvanywhere_plus; init_data.ir_codes = ir_codes_msi_tvanywhere_plus; @@ -743,11 +822,18 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) dprintk(KERN_DEBUG "probe 0x%02x @ %s: %s\n", msg_msi.addr, dev->i2c_adap.name, (1 == rc) ? "yes" : "no"); +#endif break; case SAA7134_BOARD_HAUPPAUGE_HVR1110: +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30) + snprintf(ir->c.name, sizeof(ir->c.name), "HVR 1110"); + ir->get_key = get_key_hvr1110; + ir->ir_codes = ir_codes_hauppauge_new; +#else init_data.name = "HVR 1110"; init_data.get_key = get_key_hvr1110; init_data.ir_codes = ir_codes_hauppauge_new; +#endif break; case SAA7134_BOARD_BEHOLD_607FM_MK3: case SAA7134_BOARD_BEHOLD_607FM_MK5: @@ -761,16 +847,28 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) case SAA7134_BOARD_BEHOLD_M63: case SAA7134_BOARD_BEHOLD_M6_EXTRA: case SAA7134_BOARD_BEHOLD_H6: +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30) + snprintf(ir->c.name, sizeof(ir->c.name), "BeholdTV"); + ir->get_key = get_key_beholdm6xx; + ir->ir_codes = ir_codes_behold; +#else init_data.name = "BeholdTV"; init_data.get_key = get_key_beholdm6xx; init_data.ir_codes = ir_codes_behold; +#endif break; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30) + default: + dprintk("Shouldn't get here: Unknown board %x for I2C IR?\n",dev->board); +#else case SAA7134_BOARD_AVERMEDIA_CARDBUS_501: case SAA7134_BOARD_AVERMEDIA_CARDBUS_506: info.addr = 0x40; +#endif break; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30) if (init_data.name) info.platform_data = &init_data; /* No need to probe if address is known */ @@ -781,6 +879,7 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) /* Address not known, fallback to probing */ i2c_new_probed_device(&dev->i2c_adap, &info, addr_list); +#endif } static int saa7134_rc5_irq(struct saa7134_dev *dev) |