]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
V4L/DVB (8642): cx23885: Factor out common cx23885 tuner callback
authorSteven Toth <stoth@hauppauge.com>
Tue, 5 Aug 2008 00:36:49 +0000 (21:36 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sun, 12 Oct 2008 11:36:48 +0000 (09:36 -0200)
Tuners currently hook different things to the private pointer in their
callback function. Longer term we should make that private pointer
consistent, but for now separate out the guts of the cx23885 tuner callback
so we can reuse it.

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
drivers/media/video/cx23885/cx23885-dvb.c
drivers/media/video/cx23885/cx23885.h

index c36d3f632104a22c37b408805f056ccddec936c8..e5e688e5e4b0ba71e3b49c0664de82322b3c3c82 100644 (file)
@@ -319,13 +319,9 @@ static void hauppauge_eeprom(struct cx23885_dev *dev, u8 *eeprom_data)
                        dev->name, tv.model);
 }
 
-/* Tuner callback function for cx23885 boards. Currently only needed
- * for HVR1500Q, which has an xc5000 tuner.
- */
-int cx23885_tuner_callback(void *priv, int command, int arg)
+static int cx23885_tuner_callback(struct cx23885_dev *dev, int port,
+                                 int command, int arg)
 {
-       struct cx23885_i2c *bus = priv;
-       struct cx23885_dev *dev = bus->dev;
        u32 bitmask = 0;
 
        if (command != 0) {
@@ -345,9 +341,9 @@ int cx23885_tuner_callback(void *priv, int command, int arg)
 
                        /* Two identical tuners on two different i2c buses,
                         * we need to reset the correct gpio. */
-                       if (bus->nr == 0)
+                       if (port == 0)
                                bitmask = 0x01;
-                       else if (bus->nr == 1)
+                       else if (port == 1)
                                bitmask = 0x04;
                }
                break;
@@ -363,6 +359,14 @@ int cx23885_tuner_callback(void *priv, int command, int arg)
        return 0;
 }
 
+int cx23885_xc5000_tuner_callback(void *priv, int command, int arg)
+{
+       struct cx23885_i2c *bus = priv;
+       struct cx23885_dev *dev = bus->dev;
+
+       return cx23885_tuner_callback(dev, bus->nr, command, arg);
+}
+
 void cx23885_gpio_setup(struct cx23885_dev *dev)
 {
        switch(dev->board) {
index 291b9d008da87f17897390b09cbcbf785201d5a1..bfe49df3f6dd0e4fc566e237e9b5013558e983c8 100644 (file)
@@ -188,13 +188,13 @@ static struct s5h1411_config dvico_s5h1411_config = {
 static struct xc5000_config hauppauge_hvr1500q_tunerconfig = {
        .i2c_address      = 0x61,
        .if_khz           = 5380,
-       .tuner_callback   = cx23885_tuner_callback
+       .tuner_callback   = cx23885_xc5000_tuner_callback,
 };
 
 static struct xc5000_config dvico_xc5000_tunerconfig = {
        .i2c_address      = 0x64,
        .if_khz           = 5380,
-       .tuner_callback   = cx23885_tuner_callback
+       .tuner_callback   = cx23885_xc5000_tuner_callback,
 };
 
 static struct tda829x_config tda829x_no_probe = {
index e23d97c071e05d49c2ad15dafc10cc33e15d636a..c3478b24012a3f948732080dbbbf2048a544d9bf 100644 (file)
@@ -409,7 +409,7 @@ extern const unsigned int cx23885_bcount;
 extern struct cx23885_subid cx23885_subids[];
 extern const unsigned int cx23885_idcount;
 
-extern int cx23885_tuner_callback(void *priv, int command, int arg);
+extern int cx23885_xc5000_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);