]> err.no Git - linux-2.6/blobdiff - drivers/media/video/tuner-core.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6
[linux-2.6] / drivers / media / video / tuner-core.c
index 35976e6cb1b8a4181cd1aef9a7756b18d2c16dd3..ba538f6fbcc387a7779ae77e0d64b93f043db4c5 100644 (file)
@@ -27,6 +27,7 @@
 #include "tuner-xc2028.h"
 #include "tuner-simple.h"
 #include "tda9887.h"
+#include "xc5000.h"
 
 #define UNSET (-1U)
 
@@ -296,6 +297,12 @@ static void tuner_i2c_address_check(struct tuner *t)
            ((t->i2c->addr < 0x64) || (t->i2c->addr > 0x6f)))
                return;
 
+       /* We already know that the XC5000 can only be located at
+        * i2c address 0x61, 0x62, 0x63 or 0x64 */
+       if ((t->type == TUNER_XC5000) &&
+           ((t->i2c->addr <= 0x64)) && (t->i2c->addr >= 0x61))
+               return;
+
        tuner_warn("====================== WARNING! ======================\n");
        tuner_warn("Support for tuners in i2c address range 0x64 thru 0x6f\n");
        tuner_warn("will soon be dropped. This message indicates that your\n");
@@ -329,6 +336,8 @@ static void attach_tda829x(struct tuner *t)
        tda829x_attach(&t->fe, t->i2c->adapter, t->i2c->addr, &cfg);
 }
 
+static struct xc5000_config xc5000_cfg;
+
 static void set_type(struct i2c_client *c, unsigned int type,
                     unsigned int new_mode_mask, unsigned int new_config,
                     int (*tuner_callback) (void *dev, int command,int arg))
@@ -428,6 +437,23 @@ static void set_type(struct i2c_client *c, unsigned int type,
        case TUNER_TDA9887:
                tda9887_attach(&t->fe, t->i2c->adapter, t->i2c->addr);
                break;
+       case TUNER_XC5000:
+               xc5000_cfg.i2c_address    = t->i2c->addr;
+               xc5000_cfg.if_khz         = 5380;
+               xc5000_cfg.priv           = c->adapter->algo_data;
+               xc5000_cfg.tuner_callback = t->tuner_callback;
+               if (!xc5000_attach(&t->fe, t->i2c->adapter, &xc5000_cfg)) {
+                       t->type = TUNER_ABSENT;
+                       t->mode_mask = T_UNINITIALIZED;
+                       return;
+               }
+               {
+               struct dvb_tuner_ops *xc_tuner_ops;
+               xc_tuner_ops = &t->fe.ops.tuner_ops;
+               if(xc_tuner_ops->init != NULL)
+                       xc_tuner_ops->init(&t->fe);
+               }
+               break;
        default:
                attach_simple_tuner(t);
                break;