/* In that file, frequencies are expressed in kiloHertz to avoid 32 bits overflows */
#include <linux/module.h>
-#include <linux/moduleparam.h>
#include <linux/delay.h>
#include <linux/dvb/frontend.h>
#include <linux/i2c.h>
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);
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;
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)
.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;
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));
mt2060_calibrate(priv);
- return 0;
+ return fe;
}
EXPORT_SYMBOL(mt2060_attach);