summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/saa7134
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2009-05-27 15:32:23 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-05-27 15:32:23 -0300
commit9c9fd460173573929daf32f42a502283a9aaae26 (patch)
treea6b7c0cc7cbb0789f837508394263ccaf1df31ca /linux/drivers/media/video/saa7134
parentfa6bf06d0bc8a417de4d20da09191a12baf5b6a4 (diff)
downloadmediapointer-dvb-s2-9c9fd460173573929daf32f42a502283a9aaae26.tar.gz
mediapointer-dvb-s2-9c9fd460173573929daf32f42a502283a9aaae26.tar.bz2
Building system: Restore compilation with kernels older than 2.6.29
From: Mauro Carvalho Chehab <mchehab@redhat.com> Mostly due to ir-kdb-i2c, but also due to two new drivers, compilation with kernels older than 2.6.29 were broken. This quick and dirty changeset, generated semi-automatically, restaures backport to the subsystem by adding lots of #ifs. It is possible to write a much more small changeset that would restore backport without adding so many ifs, but, due to the lack of time, this will also solve it. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'linux/drivers/media/video/saa7134')
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-i2c.c2
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-input.c99
-rw-r--r--linux/drivers/media/video/saa7134/saa7134.h4
3 files changed, 105 insertions, 0 deletions
diff --git a/linux/drivers/media/video/saa7134/saa7134-i2c.c b/linux/drivers/media/video/saa7134/saa7134-i2c.c
index a8185693f..f6cf7c1be 100644
--- a/linux/drivers/media/video/saa7134/saa7134-i2c.c
+++ b/linux/drivers/media/video/saa7134/saa7134-i2c.c
@@ -416,9 +416,11 @@ int saa7134_i2c_register(struct saa7134_dev *dev)
saa7134_i2c_eeprom(dev,dev->eedata,sizeof(dev->eedata));
if (i2c_scan)
do_i2c_scan(dev->name,&dev->i2c_client);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30)
/* Instantiate the IR receiver device, if present */
saa7134_probe_i2c_ir(dev);
+#endif
return 0;
}
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)
diff --git a/linux/drivers/media/video/saa7134/saa7134.h b/linux/drivers/media/video/saa7134/saa7134.h
index be6763dde..385bc26bd 100644
--- a/linux/drivers/media/video/saa7134/saa7134.h
+++ b/linux/drivers/media/video/saa7134/saa7134.h
@@ -804,7 +804,11 @@ void saa7134_irq_oss_done(struct saa7134_dev *dev, unsigned long status);
int saa7134_input_init1(struct saa7134_dev *dev);
void saa7134_input_fini(struct saa7134_dev *dev);
void saa7134_input_irq(struct saa7134_dev *dev);
+#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
void saa7134_ir_start(struct saa7134_dev *dev, struct card_ir *ir);
void saa7134_ir_stop(struct saa7134_dev *dev);