From b60f8e0b02ee9d9ef582e9df01eb81e5218baf9e Mon Sep 17 00:00:00 2001
From: Mauro Carvalho Chehab <mchehab@redhat.com>
Date: Wed, 13 May 2009 19:48:50 +0000
Subject: ir-kbd-i2c: Switch to the new-style device binding model

From: Jean Delvare <khali@linux-fr.org>

Let card drivers probe for IR receiver devices and instantiate them if
found. Ultimately it would be better if we could stop probing
completely, but I suspect this won't be possible for all card types.

There's certainly room for cleanups. For example, some drivers are
sharing I2C adapter IDs, so they also had to share the list of I2C
addresses being probed for an IR receiver. Now that each driver
explicitly says which addresses should be probed, maybe some addresses
can be dropped from some drivers.

Also, the special cases in saa7134-i2c should probably be handled on a
per-board basis. This would be more efficient and less risky than always
probing extra addresses on all boards. I'll give it a try later.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
---
 linux/drivers/media/video/bt8xx/bttv-i2c.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

(limited to 'linux/drivers/media/video/bt8xx')

diff --git a/linux/drivers/media/video/bt8xx/bttv-i2c.c b/linux/drivers/media/video/bt8xx/bttv-i2c.c
index bf94551c3..31f2f07d9 100644
--- a/linux/drivers/media/video/bt8xx/bttv-i2c.c
+++ b/linux/drivers/media/video/bt8xx/bttv-i2c.c
@@ -405,6 +405,27 @@ int __devinit init_bttv_i2c(struct bttv *btv)
 	}
 	if (0 == btv->i2c_rc && i2c_scan)
 		do_i2c_scan(btv->c.v4l2_dev.name, &btv->i2c_client);
+
+	/* Instantiate the IR receiver device, if present */
+	if (0 == btv->i2c_rc) {
+		struct i2c_board_info info;
+		/* The external IR receiver is at i2c address 0x34 (0x35 for
+		   reads).  Future Hauppauge cards will have an internal
+		   receiver at 0x30 (0x31 for reads).  In theory, both can be
+		   fitted, and Hauppauge suggest an external overrides an
+		   internal.
+
+		   That's why we probe 0x1a (~0x34) first. CB
+		*/
+		const unsigned short addr_list[] = {
+			0x1a, 0x18, 0x4b, 0x64, 0x30,
+			I2C_CLIENT_END
+		};
+
+		memset(&info, 0, sizeof(struct i2c_board_info));
+		strlcpy(info.type, "ir_video", I2C_NAME_SIZE);
+		i2c_new_probed_device(&btv->c.i2c_adap, &info, addr_list);
+	}
 	return btv->i2c_rc;
 }
 
-- 
cgit v1.2.3


From 8e9cc981e8c7b756ee8da597dbd9861e86f53cbf Mon Sep 17 00:00:00 2001
From: Mauro Carvalho Chehab <mchehab@redhat.com>
Date: Mon, 18 May 2009 02:31:55 +0000
Subject: minor have assigned value twice

From: figo.zhang <figo.zhang@kolorific.com>

The variable minor have assigned value twice, the first time is in the
initial "video_device" data struct in those drivers, pls see
saa7134-video.c,line 2503.

 ---

Signed-off-by: Figo.zhang <figo.zhang@kolorific.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
---
 linux/drivers/media/video/bt8xx/bttv-driver.c | 1 -
 1 file changed, 1 deletion(-)

(limited to 'linux/drivers/media/video/bt8xx')

diff --git a/linux/drivers/media/video/bt8xx/bttv-driver.c b/linux/drivers/media/video/bt8xx/bttv-driver.c
index 622807b54..8d2075186 100644
--- a/linux/drivers/media/video/bt8xx/bttv-driver.c
+++ b/linux/drivers/media/video/bt8xx/bttv-driver.c
@@ -4198,7 +4198,6 @@ static struct video_device *vdev_init(struct bttv *btv,
 	if (NULL == vfd)
 		return NULL;
 	*vfd = *template;
-	vfd->minor   = -1;
 	vfd->v4l2_dev = &btv->c.v4l2_dev;
 	vfd->release = video_device_release;
 	vfd->debug   = bttv_debug;
-- 
cgit v1.2.3


From 9c9fd460173573929daf32f42a502283a9aaae26 Mon Sep 17 00:00:00 2001
From: Mauro Carvalho Chehab <mchehab@redhat.com>
Date: Wed, 27 May 2009 15:32:23 -0300
Subject: 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>
---
 linux/drivers/media/video/bt8xx/bttv-i2c.c | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'linux/drivers/media/video/bt8xx')

diff --git a/linux/drivers/media/video/bt8xx/bttv-i2c.c b/linux/drivers/media/video/bt8xx/bttv-i2c.c
index 31f2f07d9..4febaf881 100644
--- a/linux/drivers/media/video/bt8xx/bttv-i2c.c
+++ b/linux/drivers/media/video/bt8xx/bttv-i2c.c
@@ -405,6 +405,7 @@ int __devinit init_bttv_i2c(struct bttv *btv)
 	}
 	if (0 == btv->i2c_rc && i2c_scan)
 		do_i2c_scan(btv->c.v4l2_dev.name, &btv->i2c_client);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30)
 
 	/* Instantiate the IR receiver device, if present */
 	if (0 == btv->i2c_rc) {
@@ -426,6 +427,7 @@ int __devinit init_bttv_i2c(struct bttv *btv)
 		strlcpy(info.type, "ir_video", I2C_NAME_SIZE);
 		i2c_new_probed_device(&btv->c.i2c_adap, &info, addr_list);
 	}
+#endif
 	return btv->i2c_rc;
 }
 
-- 
cgit v1.2.3