X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fmedia%2Fdvb%2Ffrontends%2Fmt2060.c;h=1305b0e63ce5a6b268c5203eb035393d746407a3;hb=8561b089afbaed2651591e5a4574fdca451d82f2;hp=aa0f0e576d62558fc96a24344ac5c11e024a04c5;hpb=b7571f8d7e12cd70048331e6a0199a42dc995d99;p=linux-2.6 diff --git a/drivers/media/dvb/frontends/mt2060.c b/drivers/media/dvb/frontends/mt2060.c index aa0f0e576d..1305b0e63c 100644 --- a/drivers/media/dvb/frontends/mt2060.c +++ b/drivers/media/dvb/frontends/mt2060.c @@ -22,7 +22,6 @@ /* In that file, frequencies are expressed in kiloHertz to avoid 32 bits overflows */ #include -#include #include #include #include @@ -247,6 +246,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); @@ -277,11 +279,6 @@ static void mt2060_calibrate(struct mt2060_priv *priv) dprintk("FMCAL timed out"); } -static int mt2060_calc_regs(struct dvb_frontend *fe, struct dvb_frontend_parameters *params, u8 *buf, int buf_len) -{ - return -ENODEV; -} - static int mt2060_get_frequency(struct dvb_frontend *fe, u32 *frequency) { struct mt2060_priv *priv = fe->tuner_priv; @@ -296,10 +293,16 @@ static int mt2060_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth) return 0; } +static int mt2060_init(struct dvb_frontend *fe) +{ + struct mt2060_priv *priv = fe->tuner_priv; + 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) @@ -319,23 +322,23 @@ static const struct dvb_tuner_ops mt2060_tuner_ops = { .release = mt2060_release, + .init = mt2060_init, .sleep = mt2060_sleep, .set_params = mt2060_set_params, - .calc_regs = mt2060_calc_regs, .get_frequency = mt2060_get_frequency, .get_bandwidth = mt2060_get_bandwidth }; /* 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; @@ -343,12 +346,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)); @@ -357,7 +360,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);