[media] cx88: added XC4000 tuner callback and DVB attach functions
authoristvan_v@mailbox.hu <istvan_v@mailbox.hu>
Tue, 7 Jun 2011 16:12:29 +0000 (13:12 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 27 Jul 2011 20:53:04 +0000 (17:53 -0300)
Added functions for XC4000 tuner reset and attaching DVB frontend.

Signed-off-by: Istvan Varga <istvan_v@mailbox.hu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/cx88/cx88-cards.c
drivers/media/video/cx88/cx88-dvb.c

index 27222c9..7ae62cc 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "cx88.h"
 #include "tea5767.h"
+#include "xc4000.h"
 
 static unsigned int tuner[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET };
 static unsigned int radio[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET };
@@ -2948,6 +2949,15 @@ static int cx88_xc2028_tuner_callback(struct cx88_core *core,
        return -EINVAL;
 }
 
+static int cx88_xc4000_tuner_callback(struct cx88_core *core,
+                                     int command, int arg)
+{
+       /* Board-specific callbacks */
+       switch (core->boardnr) {
+       }
+       return -EINVAL;
+}
+
 /* ----------------------------------------------------------------------- */
 /* Tuner callback function. Currently only needed for the Pinnacle        *
  * PCTV HD 800i with an xc5000 sillicon tuner. This is used for both      *
@@ -3022,6 +3032,9 @@ int cx88_tuner_callback(void *priv, int component, int command, int arg)
                case TUNER_XC2028:
                        info_printk(core, "Calling XC2028/3028 callback\n");
                        return cx88_xc2028_tuner_callback(core, command, arg);
+               case TUNER_XC4000:
+                       info_printk(core, "Calling XC4000 callback\n");
+                       return cx88_xc4000_tuner_callback(core, command, arg);
                case TUNER_XC5000:
                        info_printk(core, "Calling XC5000 callback\n");
                        return cx88_xc5000_tuner_callback(core, command, arg);
index c69df7e..f0fbff4 100644 (file)
@@ -41,6 +41,7 @@
 #include "or51132.h"
 #include "lgdt330x.h"
 #include "s5h1409.h"
+#include "xc4000.h"
 #include "xc5000.h"
 #include "nxt200x.h"
 #include "cx24123.h"
@@ -605,6 +606,39 @@ static int attach_xc3028(u8 addr, struct cx8802_dev *dev)
        return 0;
 }
 
+static int attach_xc4000(struct cx8802_dev *dev, struct xc4000_config *cfg)
+{
+       struct dvb_frontend *fe;
+       struct videobuf_dvb_frontend *fe0 = NULL;
+
+       /* Get the first frontend */
+       fe0 = videobuf_dvb_get_frontend(&dev->frontends, 1);
+       if (!fe0)
+               return -EINVAL;
+
+       if (!fe0->dvb.frontend) {
+               printk(KERN_ERR "%s/2: dvb frontend not attached. "
+                               "Can't attach xc4000\n",
+                      dev->core->name);
+               return -EINVAL;
+       }
+
+       fe = dvb_attach(xc4000_attach, fe0->dvb.frontend, &dev->core->i2c_adap,
+                       cfg);
+       if (!fe) {
+               printk(KERN_ERR "%s/2: xc4000 attach failed\n",
+                      dev->core->name);
+               dvb_frontend_detach(fe0->dvb.frontend);
+               dvb_unregister_frontend(fe0->dvb.frontend);
+               fe0->dvb.frontend = NULL;
+               return -EINVAL;
+       }
+
+       printk(KERN_INFO "%s/2: xc4000 attached\n", dev->core->name);
+
+       return 0;
+}
+
 static int cx24116_set_ts_param(struct dvb_frontend *fe,
        int is_punctured)
 {