*/
#include <linux/module.h>
-#include <linux/moduleparam.h>
#include <linux/delay.h>
#include <linux/dvb/frontend.h>
#include <linux/i2c.h>
static int mt2131_readreg(struct mt2131_priv *priv, u8 reg, u8 *val)
{
struct i2c_msg msg[2] = {
- { .addr = priv->cfg->i2c_address, .flags = 0, .buf = ®, .len = 1 },
- { .addr = priv->cfg->i2c_address, .flags = I2C_M_RD, .buf = val, .len = 1 },
+ { .addr = priv->cfg->i2c_address, .flags = 0,
+ .buf = ®, .len = 1 },
+ { .addr = priv->cfg->i2c_address, .flags = I2C_M_RD,
+ .buf = val, .len = 1 },
};
if (i2c_transfer(priv->i2c, msg, 2) != 2) {
static int mt2131_writereg(struct mt2131_priv *priv, u8 reg, u8 val)
{
u8 buf[2] = { reg, val };
- struct i2c_msg msg = { .addr = priv->cfg->i2c_address, .flags = 0, .buf = buf, .len = 2 };
+ struct i2c_msg msg = { .addr = priv->cfg->i2c_address, .flags = 0,
+ .buf = buf, .len = 2 };
if (i2c_transfer(priv->i2c, &msg, 1) != 1) {
printk(KERN_WARNING "mt2131 I2C write failed\n");
static int mt2131_writeregs(struct mt2131_priv *priv,u8 *buf, u8 len)
{
- struct i2c_msg msg = { .addr = priv->cfg->i2c_address, .flags = 0, .buf = buf, .len = len };
+ struct i2c_msg msg = { .addr = priv->cfg->i2c_address,
+ .flags = 0, .buf = buf, .len = len };
if (i2c_transfer(priv->i2c, &msg, 1) != 1) {
- printk(KERN_WARNING "mt2131 I2C write failed (len=%i)\n",(int)len);
+ printk(KERN_WARNING "mt2131 I2C write failed (len=%i)\n",
+ (int)len);
return -EREMOTEIO;
}
return 0;
}
-static int mt2131_set_gpo(struct dvb_frontend *fe, u8 val)
-{
- struct mt2131_priv *priv = fe->tuner_priv;
- u8 v;
-
- mt2131_readreg(priv, 0x07, &v);
- mt2131_writereg(priv, 0x07, (v & 0xfe) | (val & 0x01));
-
- return 0;
-}
-
-static int mt2131_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
+static int mt2131_set_params(struct dvb_frontend *fe,
+ struct dvb_frontend_parameters *params)
{
struct mt2131_priv *priv;
int ret=0, i;
u32 freq;
u8 if_band_center;
- u32 f_lo1,f_lo2;
- u32 div1,num1,div2,num2;
+ u32 f_lo1, f_lo2;
+ u32 div1, num1, div2, num2;
u8 b[8];
u8 lockval = 0;
f_lo1 = (f_lo1 / 250) * 250;
f_lo2 = f_lo1 - freq - MT2131_IF2;
- priv->frequency = (f_lo1 - f_lo2 - MT2131_IF2) * 1000,
+ priv->frequency = (f_lo1 - f_lo2 - MT2131_IF2) * 1000;
/* Frequency LO1 = 16MHz * (DIV1 + NUM1/8192 ) */
num1 = f_lo1 * 64 / (MT2131_FREF / 128);
int ret;
dprintk(1, "%s()\n", __FUNCTION__);
- if ((ret = mt2131_writeregs(priv, mt2131_config1, sizeof(mt2131_config1))) < 0)
+ if ((ret = mt2131_writeregs(priv, mt2131_config1,
+ sizeof(mt2131_config1))) < 0)
return ret;
mt2131_writereg(priv, 0x0b, 0x09);
mt2131_writereg(priv, 0x07, 0xf2);
mt2131_writereg(priv, 0x0b, 0x01);
- if ((ret = mt2131_writeregs(priv, mt2131_config2, sizeof(mt2131_config2))) < 0)
+ if ((ret = mt2131_writeregs(priv, mt2131_config2,
+ sizeof(mt2131_config2))) < 0)
return ret;
return ret;
.get_status = mt2131_get_status
};
-struct dvb_frontend * mt2131_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2131_config *cfg, u16 if1)
+struct dvb_frontend * mt2131_attach(struct dvb_frontend *fe,
+ struct i2c_adapter *i2c,
+ struct mt2131_config *cfg, u16 if1)
{
struct mt2131_priv *priv = NULL;
u8 id = 0;
return NULL;
}
if ( (id != 0x3E) && (id != 0x3F) ) {
- printk(KERN_ERR "MT2131: Device not found at addr 0x%02x\n", cfg->i2c_address);
+ printk(KERN_ERR "MT2131: Device not found at addr 0x%02x\n",
+ cfg->i2c_address);
kfree(priv);
return NULL;
}
- printk(KERN_INFO "MT2131: successfully identified at address 0x%02x\n", cfg->i2c_address);
- memcpy(&fe->ops.tuner_ops, &mt2131_tuner_ops, sizeof(struct dvb_tuner_ops));
+ printk(KERN_INFO "MT2131: successfully identified at address 0x%02x\n",
+ cfg->i2c_address);
+ memcpy(&fe->ops.tuner_ops, &mt2131_tuner_ops,
+ sizeof(struct dvb_tuner_ops));
fe->tuner_priv = priv;
return fe;
MODULE_AUTHOR("Steven Toth");
MODULE_DESCRIPTION("Microtune MT2131 silicon tuner driver");
MODULE_LICENSE("GPL");
+
+/*
+ * Local variables:
+ * c-basic-offset: 8
+ */