aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
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
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')
-rw-r--r--drivers/media/dvb/frontends/mt2131.c46
-rw-r--r--drivers/media/dvb/frontends/mt2131.h9
-rw-r--r--drivers/media/dvb/frontends/mt2131_priv.h11
-rw-r--r--drivers/media/dvb/frontends/s5h1409.c48
-rw-r--r--drivers/media/dvb/frontends/s5h1409.h15
5 files changed, 88 insertions, 41 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 */
diff --git a/drivers/media/dvb/frontends/mt2131.h b/drivers/media/dvb/frontends/mt2131.h
index 5d1f281d87b2..608f1f66c9e7 100644
--- a/drivers/media/dvb/frontends/mt2131.h
+++ b/drivers/media/dvb/frontends/mt2131.h
@@ -44,6 +44,11 @@ static inline struct dvb_frontend* mt2131_attach(struct dvb_frontend *fe,
44 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); 44 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__);
45 return NULL; 45 return NULL;
46} 46}
47#endif // CONFIG_DVB_TUNER_MT2131 47#endif /* CONFIG_DVB_TUNER_MT2131 */
48 48
49#endif // __MT2131_H__ 49#endif /* __MT2131_H__ */
50
51/*
52 * Local variables:
53 * c-basic-offset: 8
54 */
diff --git a/drivers/media/dvb/frontends/mt2131_priv.h b/drivers/media/dvb/frontends/mt2131_priv.h
index fe6333b49c93..e930759c2c00 100644
--- a/drivers/media/dvb/frontends/mt2131_priv.h
+++ b/drivers/media/dvb/frontends/mt2131_priv.h
@@ -19,8 +19,8 @@
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 20 */
21 21
22#ifndef MT2131_PRIV_H 22#ifndef __MT2131_PRIV_H__
23#define MT2131_PRIV_H 23#define __MT2131_PRIV_H__
24 24
25/* Regs */ 25/* Regs */
26#define MT2131_PWR 0x07 26#define MT2131_PWR 0x07
@@ -41,4 +41,9 @@ struct mt2131_priv {
41 u32 bandwidth; 41 u32 bandwidth;
42}; 42};
43 43
44#endif 44#endif /* __MT2131_PRIV_H__ */
45
46/*
47 * Local variables:
48 * c-basic-offset: 8
49 */
diff --git a/drivers/media/dvb/frontends/s5h1409.c b/drivers/media/dvb/frontends/s5h1409.c
index 25cf78142d94..30e8a705fad4 100644
--- a/drivers/media/dvb/frontends/s5h1409.c
+++ b/drivers/media/dvb/frontends/s5h1409.c
@@ -296,13 +296,14 @@ static int s5h1409_writereg(struct s5h1409_state* state, u8 reg, u16 data)
296 int ret; 296 int ret;
297 u8 buf [] = { reg, data >> 8, data & 0xff }; 297 u8 buf [] = { reg, data >> 8, data & 0xff };
298 298
299 struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf, .len = 3 }; 299 struct i2c_msg msg = { .addr = state->config->demod_address,
300 .flags = 0, .buf = buf, .len = 3 };
300 301
301 ret = i2c_transfer(state->i2c, &msg, 1); 302 ret = i2c_transfer(state->i2c, &msg, 1);
302 303
303 if (ret != 1) 304 if (ret != 1)
304 printk("%s: writereg error (reg == 0x%02x, val == 0x%04x, ret == %i)\n", 305 printk("%s: writereg error (reg == 0x%02x, val == 0x%04x, "
305 __FUNCTION__, reg, data, ret); 306 "ret == %i)\n", __FUNCTION__, reg, data, ret);
306 307
307 return (ret != 1) ? -1 : 0; 308 return (ret != 1) ? -1 : 0;
308} 309}
@@ -314,14 +315,15 @@ static u16 s5h1409_readreg(struct s5h1409_state* state, u8 reg)
314 u8 b1 [] = { 0, 0 }; 315 u8 b1 [] = { 0, 0 };
315 316
316 struct i2c_msg msg [] = { 317 struct i2c_msg msg [] = {
317 { .addr = state->config->demod_address, .flags = 0, .buf = b0, .len = 1 }, 318 { .addr = state->config->demod_address, .flags = 0,
318 { .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = b1, .len = 2 } }; 319 .buf = b0, .len = 1 },
320 { .addr = state->config->demod_address, .flags = I2C_M_RD,
321 .buf = b1, .len = 2 } };
319 322
320 ret = i2c_transfer(state->i2c, msg, 2); 323 ret = i2c_transfer(state->i2c, msg, 2);
321 324
322 if (ret != 2) 325 if (ret != 2)
323 printk("%s: readreg error (ret == %i)\n", __FUNCTION__, ret) 326 printk("%s: readreg error (ret == %i)\n", __FUNCTION__, ret);
324 ;
325 return (b1[0] << 8) | b1[1]; 327 return (b1[0] << 8) | b1[1];
326} 328}
327 329
@@ -343,8 +345,7 @@ static int s5h1409_set_if_freq(struct dvb_frontend* fe, int KHz)
343 345
344 dprintk("%s(%d KHz)\n", __FUNCTION__, KHz); 346 dprintk("%s(%d KHz)\n", __FUNCTION__, KHz);
345 347
346 if( (KHz == 44000) || (KHz == 5380) ) 348 if( (KHz == 44000) || (KHz == 5380) ) {
347 {
348 s5h1409_writereg(state, 0x87, 0x01be); 349 s5h1409_writereg(state, 0x87, 0x01be);
349 s5h1409_writereg(state, 0x88, 0x0436); 350 s5h1409_writereg(state, 0x88, 0x0436);
350 s5h1409_writereg(state, 0x89, 0x054d); 351 s5h1409_writereg(state, 0x89, 0x054d);
@@ -368,7 +369,8 @@ static int s5h1409_set_spectralinversion(struct dvb_frontend* fe, int inverted)
368 return s5h1409_writereg(state, 0x1b, 0x0110); /* Normal */ 369 return s5h1409_writereg(state, 0x1b, 0x0110); /* Normal */
369} 370}
370 371
371static int s5h1409_enable_modulation(struct dvb_frontend* fe, fe_modulation_t m) 372static int s5h1409_enable_modulation(struct dvb_frontend* fe,
373 fe_modulation_t m)
372{ 374{
373 struct s5h1409_state* state = fe->demodulator_priv; 375 struct s5h1409_state* state = fe->demodulator_priv;
374 376
@@ -443,7 +445,8 @@ static int s5h1409_register_reset(struct dvb_frontend* fe)
443} 445}
444 446
445/* Talk to the demod, set the FEC, GUARD, QAM settings etc */ 447/* Talk to the demod, set the FEC, GUARD, QAM settings etc */
446static int s5h1409_set_frontend (struct dvb_frontend* fe, struct dvb_frontend_parameters *p) 448static int s5h1409_set_frontend (struct dvb_frontend* fe,
449 struct dvb_frontend_parameters *p)
447{ 450{
448 struct s5h1409_state* state = fe->demodulator_priv; 451 struct s5h1409_state* state = fe->demodulator_priv;
449 452
@@ -521,11 +524,13 @@ static int s5h1409_read_status(struct dvb_frontend* fe, fe_status_t* status)
521 case S5H1409_TUNERLOCKING: 524 case S5H1409_TUNERLOCKING:
522 /* Get the tuner status */ 525 /* Get the tuner status */
523 if (fe->ops.tuner_ops.get_status) { 526 if (fe->ops.tuner_ops.get_status) {
524 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 1); 527 if (fe->ops.i2c_gate_ctrl)
528 fe->ops.i2c_gate_ctrl(fe, 1);
525 529
526 fe->ops.tuner_ops.get_status(fe, &tuner_status); 530 fe->ops.tuner_ops.get_status(fe, &tuner_status);
527 531
528 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); 532 if (fe->ops.i2c_gate_ctrl)
533 fe->ops.i2c_gate_ctrl(fe, 0);
529 } 534 }
530 if (tuner_status) 535 if (tuner_status)
531 *status |= FE_HAS_CARRIER | FE_HAS_SIGNAL; 536 *status |= FE_HAS_CARRIER | FE_HAS_SIGNAL;
@@ -605,7 +610,8 @@ static int s5h1409_read_snr(struct dvb_frontend* fe, u16* snr)
605 return -EINVAL; 610 return -EINVAL;
606} 611}
607 612
608static int s5h1409_read_signal_strength(struct dvb_frontend* fe, u16* signal_strength) 613static int s5h1409_read_signal_strength(struct dvb_frontend* fe,
614 u16* signal_strength)
609{ 615{
610 return s5h1409_read_snr(fe, signal_strength); 616 return s5h1409_read_snr(fe, signal_strength);
611} 617}
@@ -624,7 +630,8 @@ static int s5h1409_read_ber(struct dvb_frontend* fe, u32* ber)
624 return s5h1409_read_ucblocks(fe, ber); 630 return s5h1409_read_ucblocks(fe, ber);
625} 631}
626 632
627static int s5h1409_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) 633static int s5h1409_get_frontend(struct dvb_frontend* fe,
634 struct dvb_frontend_parameters *p)
628{ 635{
629 struct s5h1409_state* state = fe->demodulator_priv; 636 struct s5h1409_state* state = fe->demodulator_priv;
630 637
@@ -634,7 +641,8 @@ static int s5h1409_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_par
634 return 0; 641 return 0;
635} 642}
636 643
637static int s5h1409_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings *tune) 644static int s5h1409_get_tune_settings(struct dvb_frontend* fe,
645 struct dvb_frontend_tune_settings *tune)
638{ 646{
639 tune->min_delay_ms = 1000; 647 tune->min_delay_ms = 1000;
640 return 0; 648 return 0;
@@ -668,7 +676,8 @@ struct dvb_frontend* s5h1409_attach(const struct s5h1409_config* config,
668 goto error; 676 goto error;
669 677
670 /* create dvb_frontend */ 678 /* create dvb_frontend */
671 memcpy(&state->frontend.ops, &s5h1409_ops, sizeof(struct dvb_frontend_ops)); 679 memcpy(&state->frontend.ops, &s5h1409_ops,
680 sizeof(struct dvb_frontend_ops));
672 state->frontend.demodulator_priv = state; 681 state->frontend.demodulator_priv = state;
673 682
674 /* Note: Leaving the I2C gate open here. */ 683 /* Note: Leaving the I2C gate open here. */
@@ -713,3 +722,8 @@ MODULE_AUTHOR("Steven Toth");
713MODULE_LICENSE("GPL"); 722MODULE_LICENSE("GPL");
714 723
715EXPORT_SYMBOL(s5h1409_attach); 724EXPORT_SYMBOL(s5h1409_attach);
725
726/*
727 * Local variables:
728 * c-basic-offset: 8
729 */
diff --git a/drivers/media/dvb/frontends/s5h1409.h b/drivers/media/dvb/frontends/s5h1409.h
index 6e9b9f24b60c..bccfd8a6fbd4 100644
--- a/drivers/media/dvb/frontends/s5h1409.h
+++ b/drivers/media/dvb/frontends/s5h1409.h
@@ -19,8 +19,8 @@
19 19
20*/ 20*/
21 21
22#ifndef S5H1409_H 22#ifndef __S5H1409_H__
23#define S5H1409_H 23#define __S5H1409_H__
24 24
25#include <linux/dvb/frontend.h> 25#include <linux/dvb/frontend.h>
26 26
@@ -58,11 +58,16 @@ extern struct dvb_frontend* s5h1409_attach(const struct s5h1409_config* config,
58 struct i2c_adapter* i2c); 58 struct i2c_adapter* i2c);
59#else 59#else
60static inline struct dvb_frontend* s5h1409_attach(const struct s5h1409_config* config, 60static inline struct dvb_frontend* s5h1409_attach(const struct s5h1409_config* config,
61 struct i2c_adapter* i2c) 61 struct i2c_adapter* i2c)
62{ 62{
63 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); 63 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__);
64 return NULL; 64 return NULL;
65} 65}
66#endif // CONFIG_DVB_S5H1409 66#endif /* CONFIG_DVB_S5H1409 */
67 67
68#endif // S5H1409_H 68#endif /* __S5H1409_H__ */
69
70/*
71 * Local variables:
72 * c-basic-offset: 8
73 */