aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends/mt2131.c
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2007-07-28 19:02:55 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-10-09 21:03:40 -0400
commit3873dd041465799cfdeb642531c0ade4fb6614e5 (patch)
treea818b9878ebe6ccda2546948a1f44072aec55463 /drivers/media/dvb/frontends/mt2131.c
parenta45c92756ed60bc89528701ac512e954acd23b9e (diff)
V4L/DVB (5950): whitespace cleanup for mt2131 and s5h1409
- trivial whitespace cleanups - add "c-basic-offset: 8" to enforce tabbing style in emacs Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/frontends/mt2131.c')
-rw-r--r--drivers/media/dvb/frontends/mt2131.c46
1 files changed, 32 insertions, 14 deletions
diff --git a/drivers/media/dvb/frontends/mt2131.c b/drivers/media/dvb/frontends/mt2131.c
index 4fe1e62c9f06..375dfa166817 100644
--- a/drivers/media/dvb/frontends/mt2131.c
+++ b/drivers/media/dvb/frontends/mt2131.c
@@ -53,8 +53,10 @@ static u8 mt2131_config2[] = {
53static int mt2131_readreg(struct mt2131_priv *priv, u8 reg, u8 *val) 53static int mt2131_readreg(struct mt2131_priv *priv, u8 reg, u8 *val)
54{ 54{
55 struct i2c_msg msg[2] = { 55 struct i2c_msg msg[2] = {
56 { .addr = priv->cfg->i2c_address, .flags = 0, .buf = &reg, .len = 1 }, 56 { .addr = priv->cfg->i2c_address, .flags = 0,
57 { .addr = priv->cfg->i2c_address, .flags = I2C_M_RD, .buf = val, .len = 1 }, 57 .buf = &reg, .len = 1 },
58 { .addr = priv->cfg->i2c_address, .flags = I2C_M_RD,
59 .buf = val, .len = 1 },
58 }; 60 };
59 61
60 if (i2c_transfer(priv->i2c, msg, 2) != 2) { 62 if (i2c_transfer(priv->i2c, msg, 2) != 2) {
@@ -67,7 +69,8 @@ static int mt2131_readreg(struct mt2131_priv *priv, u8 reg, u8 *val)
67static int mt2131_writereg(struct mt2131_priv *priv, u8 reg, u8 val) 69static int mt2131_writereg(struct mt2131_priv *priv, u8 reg, u8 val)
68{ 70{
69 u8 buf[2] = { reg, val }; 71 u8 buf[2] = { reg, val };
70 struct i2c_msg msg = { .addr = priv->cfg->i2c_address, .flags = 0, .buf = buf, .len = 2 }; 72 struct i2c_msg msg = { .addr = priv->cfg->i2c_address, .flags = 0,
73 .buf = buf, .len = 2 };
71 74
72 if (i2c_transfer(priv->i2c, &msg, 1) != 1) { 75 if (i2c_transfer(priv->i2c, &msg, 1) != 1) {
73 printk(KERN_WARNING "mt2131 I2C write failed\n"); 76 printk(KERN_WARNING "mt2131 I2C write failed\n");
@@ -78,10 +81,12 @@ static int mt2131_writereg(struct mt2131_priv *priv, u8 reg, u8 val)
78 81
79static int mt2131_writeregs(struct mt2131_priv *priv,u8 *buf, u8 len) 82static int mt2131_writeregs(struct mt2131_priv *priv,u8 *buf, u8 len)
80{ 83{
81 struct i2c_msg msg = { .addr = priv->cfg->i2c_address, .flags = 0, .buf = buf, .len = len }; 84 struct i2c_msg msg = { .addr = priv->cfg->i2c_address,
85 .flags = 0, .buf = buf, .len = len };
82 86
83 if (i2c_transfer(priv->i2c, &msg, 1) != 1) { 87 if (i2c_transfer(priv->i2c, &msg, 1) != 1) {
84 printk(KERN_WARNING "mt2131 I2C write failed (len=%i)\n",(int)len); 88 printk(KERN_WARNING "mt2131 I2C write failed (len=%i)\n",
89 (int)len);
85 return -EREMOTEIO; 90 return -EREMOTEIO;
86 } 91 }
87 return 0; 92 return 0;
@@ -98,14 +103,15 @@ static int mt2131_set_gpo(struct dvb_frontend *fe, u8 val)
98 return 0; 103 return 0;
99} 104}
100 105
101static int mt2131_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) 106static int mt2131_set_params(struct dvb_frontend *fe,
107 struct dvb_frontend_parameters *params)
102{ 108{
103 struct mt2131_priv *priv; 109 struct mt2131_priv *priv;
104 int ret=0, i; 110 int ret=0, i;
105 u32 freq; 111 u32 freq;
106 u8 if_band_center; 112 u8 if_band_center;
107 u32 f_lo1,f_lo2; 113 u32 f_lo1, f_lo2;
108 u32 div1,num1,div2,num2; 114 u32 div1, num1, div2, num2;
109 u8 b[8]; 115 u8 b[8];
110 u8 lockval = 0; 116 u8 lockval = 0;
111 117
@@ -231,7 +237,8 @@ static int mt2131_init(struct dvb_frontend *fe)
231 int ret; 237 int ret;
232 dprintk(1, "%s()\n", __FUNCTION__); 238 dprintk(1, "%s()\n", __FUNCTION__);
233 239
234 if ((ret = mt2131_writeregs(priv, mt2131_config1, sizeof(mt2131_config1))) < 0) 240 if ((ret = mt2131_writeregs(priv, mt2131_config1,
241 sizeof(mt2131_config1))) < 0)
235 return ret; 242 return ret;
236 243
237 mt2131_writereg(priv, 0x0b, 0x09); 244 mt2131_writereg(priv, 0x0b, 0x09);
@@ -239,7 +246,8 @@ static int mt2131_init(struct dvb_frontend *fe)
239 mt2131_writereg(priv, 0x07, 0xf2); 246 mt2131_writereg(priv, 0x07, 0xf2);
240 mt2131_writereg(priv, 0x0b, 0x01); 247 mt2131_writereg(priv, 0x0b, 0x01);
241 248
242 if ((ret = mt2131_writeregs(priv, mt2131_config2, sizeof(mt2131_config2))) < 0) 249 if ((ret = mt2131_writeregs(priv, mt2131_config2,
250 sizeof(mt2131_config2))) < 0)
243 return ret; 251 return ret;
244 252
245 return ret; 253 return ret;
@@ -270,7 +278,9 @@ static const struct dvb_tuner_ops mt2131_tuner_ops = {
270 .get_status = mt2131_get_status 278 .get_status = mt2131_get_status
271}; 279};
272 280
273struct dvb_frontend * mt2131_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2131_config *cfg, u16 if1) 281struct dvb_frontend * mt2131_attach(struct dvb_frontend *fe,
282 struct i2c_adapter *i2c,
283 struct mt2131_config *cfg, u16 if1)
274{ 284{
275 struct mt2131_priv *priv = NULL; 285 struct mt2131_priv *priv = NULL;
276 u8 id = 0; 286 u8 id = 0;
@@ -290,13 +300,16 @@ struct dvb_frontend * mt2131_attach(struct dvb_frontend *fe, struct i2c_adapter
290 return NULL; 300 return NULL;
291 } 301 }
292 if ( (id != 0x3E) && (id != 0x3F) ) { 302 if ( (id != 0x3E) && (id != 0x3F) ) {
293 printk(KERN_ERR "MT2131: Device not found at addr 0x%02x\n", cfg->i2c_address); 303 printk(KERN_ERR "MT2131: Device not found at addr 0x%02x\n",
304 cfg->i2c_address);
294 kfree(priv); 305 kfree(priv);
295 return NULL; 306 return NULL;
296 } 307 }
297 308
298 printk(KERN_INFO "MT2131: successfully identified at address 0x%02x\n", cfg->i2c_address); 309 printk(KERN_INFO "MT2131: successfully identified at address 0x%02x\n",
299 memcpy(&fe->ops.tuner_ops, &mt2131_tuner_ops, sizeof(struct dvb_tuner_ops)); 310 cfg->i2c_address);
311 memcpy(&fe->ops.tuner_ops, &mt2131_tuner_ops,
312 sizeof(struct dvb_tuner_ops));
300 313
301 fe->tuner_priv = priv; 314 fe->tuner_priv = priv;
302 return fe; 315 return fe;
@@ -306,3 +319,8 @@ EXPORT_SYMBOL(mt2131_attach);
306MODULE_AUTHOR("Steven Toth"); 319MODULE_AUTHOR("Steven Toth");
307MODULE_DESCRIPTION("Microtune MT2131 silicon tuner driver"); 320MODULE_DESCRIPTION("Microtune MT2131 silicon tuner driver");
308MODULE_LICENSE("GPL"); 321MODULE_LICENSE("GPL");
322
323/*
324 * Local variables:
325 * c-basic-offset: 8
326 */