V4L/DVB (8643): Switch Hauppauge HVR1400 and HVR1500 to common cx23885 tuner callback

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Monday, October 13, 2008 - 3:01 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=90a71b...
Commit:     90a71b1c1ab003dd4524afca44c2ad2519f4420c
Parent:     0fbbff33fcab605b1a5c53a20c302aad24b082ef
Author:     Steven Toth <stoth@hauppauge.com>
AuthorDate: Mon Aug 4 21:38:46 2008 -0300
Committer:  Mauro Carvalho Chehab <mchehab@redhat.com>
CommitDate: Sun Oct 12 09:36:49 2008 -0200

    V4L/DVB (8643): Switch Hauppauge HVR1400 and HVR1500 to common cx23885 tuner callback
    
    The Hauppauge HVR1400 and HVR1500 can now use the common cx23885 tuner
    callback.
    
    Signed-off-by: Steven Toth <stoth@hauppauge.com>
    Signed-off-by: Anton Blanchard <anton@samba.org>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
---
 drivers/media/video/cx23885/cx23885-cards.c |   16 ++++++++++++-
 drivers/media/video/cx23885/cx23885-dvb.c   |   34 +-------------------------
 drivers/media/video/cx23885/cx23885.h       |    1 +
 3 files changed, 18 insertions(+), 33 deletions(-)

diff --git a/drivers/media/video/cx23885/cx23885-cards.c b/drivers/media/video/cx23885/cx23885-cards.c
index e5e688e..93ad7f8 100644
--- a/drivers/media/video/cx23885/cx23885-cards.c
+++ b/drivers/media/video/cx23885/cx23885-cards.c
@@ -26,6 +26,7 @@
 #include <media/cx25840.h>
 
 #include "cx23885.h"
+#include "tuner-xc2028.h"
 
 /* ------------------------------------------------------------------ */
 /* board config info                                                  */
@@ -331,8 +332,10 @@ static int cx23885_tuner_callback(struct cx23885_dev *dev, int port,
 	}
 
 	switch(dev->board) {
+	case CX23885_BOARD_HAUPPAUGE_HVR1400:
+	case CX23885_BOARD_HAUPPAUGE_HVR1500:
 	case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
-		/* Tuner Reset Command from xc5000 */
+		/* Tuner Reset Command */
 		if (command == 0)
 			bitmask = 0x04;
 		break;
@@ -367,6 +370,17 @@ int cx23885_xc5000_tuner_callback(void *priv, int command, int arg)
 	return cx23885_tuner_callback(dev, bus->nr, command, arg);
 }
 
+int cx23885_xc3028_tuner_callback(void *priv, int command, int arg)
+{
+	struct cx23885_tsport *port = priv;
+	struct cx23885_dev *dev = port->dev;
+
+	if (command == XC2028_RESET_CLK)
+		return 0;
+
+	return cx23885_tuner_callback(dev, port->nr, command, arg);
+}
+
 void cx23885_gpio_setup(struct cx23885_dev *dev)
 {
 	switch(dev->board) {
diff --git a/drivers/media/video/cx23885/cx23885-dvb.c b/drivers/media/video/cx23885/cx23885-dvb.c
index bfe49df..4567005 100644
--- a/drivers/media/video/cx23885/cx23885-dvb.c
+++ b/drivers/media/video/cx23885/cx23885-dvb.c
@@ -303,36 +303,6 @@ static struct dib7000p_config hauppauge_hvr1400_dib7000_config = {
 	.output_mode = OUTMODE_MPEG2_SERIAL,
 };
 
-static int cx23885_hvr1500_xc3028_callback(void *ptr, int command, int arg)
-{
-	struct cx23885_tsport *port = ptr;
-	struct cx23885_dev *dev = port->dev;
-
-	switch (command) {
-	case XC2028_TUNER_RESET:
-		/* Send the tuner in then out of reset */
-		/* GPIO-2 xc3028 tuner */
-		dprintk(1, "%s: XC2028_TUNER_RESET %d\n", __func__, arg);
-
-		cx_set(GP0_IO, 0x00040000);
-		cx_clear(GP0_IO, 0x00000004);
-		msleep(5);
-
-		cx_set(GP0_IO, 0x00040004);
-		msleep(5);
-		break;
-	case XC2028_RESET_CLK:
-		dprintk(1, "%s: XC2028_RESET_CLK %d\n", __func__, arg);
-		break;
-	default:
-		dprintk(1, "%s: unknown command %d, arg %d\n", __func__,
-			command, arg);
-		return -EINVAL;
-	}
-
-	return 0;
-}
-
 static int dvb_register(struct cx23885_tsport *port)
 {
 	struct cx23885_dev *dev = port->dev;
@@ -426,7 +396,7 @@ static int dvb_register(struct cx23885_tsport *port)
 			struct xc2028_config cfg = {
 				.i2c_adap  = &i2c_bus->i2c_adap,
 				.i2c_addr  = 0x61,
-				.callback  = cx23885_hvr1500_xc3028_callback,
+				.callback  = cx23885_xc3028_tuner_callback,
 			};
 			static struct xc2028_ctrl ctl = {
 				.fname       = "xc3028-v27.fw",
@@ -465,7 +435,7 @@ static int dvb_register(struct cx23885_tsport *port)
 			struct xc2028_config cfg = {
 				.i2c_adap  = &dev->i2c_bus[1].i2c_adap,
 				.i2c_addr  = 0x64,
-				.callback  = cx23885_hvr1500_xc3028_callback,
+				.callback  = cx23885_xc3028_tuner_callback,
 			};
 			static struct xc2028_ctrl ctl = {
 				.fname   = "xc3028L-v36.fw",
diff --git a/drivers/media/video/cx23885/cx23885.h b/drivers/media/video/cx23885/cx23885.h
index c3478b2..64827fb 100644
--- a/drivers/media/video/cx23885/cx23885.h
+++ b/drivers/media/video/cx23885/cx23885.h
@@ -410,6 +410,7 @@ extern struct cx23885_subid cx23885_subids[];
 extern const unsigned int cx23885_idcount;
 
 extern int cx23885_xc5000_tuner_callback(void *priv, int command, int arg);
+extern int cx23885_xc3028_tuner_callback(void *priv, int command, int arg);
 extern void cx23885_card_list(struct cx23885_dev *dev);
 extern int  cx23885_ir_init(struct cx23885_dev *dev);
 extern void cx23885_gpio_setup(struct cx23885_dev *dev);
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
V4L/DVB (8643): Switch Hauppauge HVR1400 and HVR1500 to co ..., Linux Kernel Mailing ..., (Mon Oct 13, 3:01 pm)