]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/media/dvb/frontends/mt2060.c
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6
[linux-2.6-omap-h63xx.git] / drivers / media / dvb / frontends / mt2060.c
index 508ec1b6d1fb3af79208fb733013787e8ab0df01..450fad8d9b65099ced8ca7f99a789fce9e3636ad 100644 (file)
@@ -247,6 +247,9 @@ static void mt2060_calibrate(struct mt2060_priv *priv)
        if (mt2060_writeregs(priv,mt2060_config2,sizeof(mt2060_config2)))
                return;
 
+       /* initialize the clock output */
+       mt2060_writereg(priv, REG_VGAG, (priv->cfg->clock_out << 6) | 0x30);
+
        do {
                b |= (1 << 6); // FM1SS;
                mt2060_writereg(priv, REG_LO2C1,b);
@@ -294,13 +297,13 @@ static int mt2060_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
 static int mt2060_init(struct dvb_frontend *fe)
 {
        struct mt2060_priv *priv = fe->tuner_priv;
-       return mt2060_writereg(priv, REG_VGAG,0x33);
+       return mt2060_writereg(priv, REG_VGAG, (priv->cfg->clock_out << 6) | 0x33);
 }
 
 static int mt2060_sleep(struct dvb_frontend *fe)
 {
        struct mt2060_priv *priv = fe->tuner_priv;
-       return mt2060_writereg(priv, REG_VGAG,0x30);
+       return mt2060_writereg(priv, REG_VGAG, (priv->cfg->clock_out << 6) | 0x30);
 }
 
 static int mt2060_release(struct dvb_frontend *fe)
@@ -329,14 +332,14 @@ static const struct dvb_tuner_ops mt2060_tuner_ops = {
 };
 
 /* This functions tries to identify a MT2060 tuner by reading the PART/REV register. This is hasty. */
-int mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2060_config *cfg, u16 if1)
+struct dvb_frontend * mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2060_config *cfg, u16 if1)
 {
        struct mt2060_priv *priv = NULL;
        u8 id = 0;
 
        priv = kzalloc(sizeof(struct mt2060_priv), GFP_KERNEL);
        if (priv == NULL)
-               return -ENOMEM;
+               return NULL;
 
        priv->cfg      = cfg;
        priv->i2c      = i2c;
@@ -344,12 +347,12 @@ int mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt206
 
        if (mt2060_readreg(priv,REG_PART_REV,&id) != 0) {
                kfree(priv);
-               return -ENODEV;
+               return NULL;
        }
 
        if (id != PART_REV) {
                kfree(priv);
-               return -ENODEV;
+               return NULL;
        }
        printk(KERN_INFO "MT2060: successfully identified (IF1 = %d)\n", if1);
        memcpy(&fe->ops.tuner_ops, &mt2060_tuner_ops, sizeof(struct dvb_tuner_ops));
@@ -358,7 +361,7 @@ int mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt206
 
        mt2060_calibrate(priv);
 
-       return 0;
+       return fe;
 }
 EXPORT_SYMBOL(mt2060_attach);