diff options
author | Matthias Schwarzott <zzam@gentoo.org> | 2007-12-21 06:56:44 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-01-25 16:04:08 -0500 |
commit | 89f6475857b89e956a8bcfef64944409ce4173b4 (patch) | |
tree | 8b7198a54376129b55c5ddb4b7936cbdd8005d2d /drivers | |
parent | 6fb377f85cb8c2c1580ce8b134c887a7b53c7aa9 (diff) |
V4L/DVB (6873): Fixes issues listed by checkpatch
Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/dvb/frontends/mt312.c | 131 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/mt312.h | 15 |
2 files changed, 80 insertions, 66 deletions
diff --git a/drivers/media/dvb/frontends/mt312.c b/drivers/media/dvb/frontends/mt312.c index 0606b9a5b61..55d42440e97 100644 --- a/drivers/media/dvb/frontends/mt312.c +++ b/drivers/media/dvb/frontends/mt312.c | |||
@@ -37,9 +37,9 @@ | |||
37 | 37 | ||
38 | 38 | ||
39 | struct mt312_state { | 39 | struct mt312_state { |
40 | struct i2c_adapter* i2c; | 40 | struct i2c_adapter *i2c; |
41 | /* configuration settings */ | 41 | /* configuration settings */ |
42 | const struct mt312_config* config; | 42 | const struct mt312_config *config; |
43 | struct dvb_frontend frontend; | 43 | struct dvb_frontend frontend; |
44 | 44 | ||
45 | u8 id; | 45 | u8 id; |
@@ -49,14 +49,15 @@ struct mt312_state { | |||
49 | static int debug; | 49 | static int debug; |
50 | #define dprintk(args...) \ | 50 | #define dprintk(args...) \ |
51 | do { \ | 51 | do { \ |
52 | if (debug) printk(KERN_DEBUG "mt312: " args); \ | 52 | if (debug) \ |
53 | printk(KERN_DEBUG "mt312: " args); \ | ||
53 | } while (0) | 54 | } while (0) |
54 | 55 | ||
55 | #define MT312_SYS_CLK 90000000UL /* 90 MHz */ | 56 | #define MT312_SYS_CLK 90000000UL /* 90 MHz */ |
56 | #define MT312_LPOWER_SYS_CLK 60000000UL /* 60 MHz */ | 57 | #define MT312_LPOWER_SYS_CLK 60000000UL /* 60 MHz */ |
57 | #define MT312_PLL_CLK 10000000UL /* 10 MHz */ | 58 | #define MT312_PLL_CLK 10000000UL /* 10 MHz */ |
58 | 59 | ||
59 | static int mt312_read(struct mt312_state* state, const enum mt312_reg_addr reg, | 60 | static int mt312_read(struct mt312_state *state, const enum mt312_reg_addr reg, |
60 | void *buf, const size_t count) | 61 | void *buf, const size_t count) |
61 | { | 62 | { |
62 | int ret; | 63 | int ret; |
@@ -79,7 +80,7 @@ static int mt312_read(struct mt312_state* state, const enum mt312_reg_addr reg, | |||
79 | return -EREMOTEIO; | 80 | return -EREMOTEIO; |
80 | } | 81 | } |
81 | 82 | ||
82 | if(debug) { | 83 | if (debug) { |
83 | int i; | 84 | int i; |
84 | dprintk("R(%d):", reg & 0x7f); | 85 | dprintk("R(%d):", reg & 0x7f); |
85 | for (i = 0; i < count; i++) | 86 | for (i = 0; i < count; i++) |
@@ -90,14 +91,14 @@ static int mt312_read(struct mt312_state* state, const enum mt312_reg_addr reg, | |||
90 | return 0; | 91 | return 0; |
91 | } | 92 | } |
92 | 93 | ||
93 | static int mt312_write(struct mt312_state* state, const enum mt312_reg_addr reg, | 94 | static int mt312_write(struct mt312_state *state, const enum mt312_reg_addr reg, |
94 | const void *src, const size_t count) | 95 | const void *src, const size_t count) |
95 | { | 96 | { |
96 | int ret; | 97 | int ret; |
97 | u8 buf[count + 1]; | 98 | u8 buf[count + 1]; |
98 | struct i2c_msg msg; | 99 | struct i2c_msg msg; |
99 | 100 | ||
100 | if(debug) { | 101 | if (debug) { |
101 | int i; | 102 | int i; |
102 | dprintk("W(%d):", reg & 0x7f); | 103 | dprintk("W(%d):", reg & 0x7f); |
103 | for (i = 0; i < count; i++) | 104 | for (i = 0; i < count; i++) |
@@ -123,13 +124,13 @@ static int mt312_write(struct mt312_state* state, const enum mt312_reg_addr reg, | |||
123 | return 0; | 124 | return 0; |
124 | } | 125 | } |
125 | 126 | ||
126 | static inline int mt312_readreg(struct mt312_state* state, | 127 | static inline int mt312_readreg(struct mt312_state *state, |
127 | const enum mt312_reg_addr reg, u8 *val) | 128 | const enum mt312_reg_addr reg, u8 *val) |
128 | { | 129 | { |
129 | return mt312_read(state, reg, val, 1); | 130 | return mt312_read(state, reg, val, 1); |
130 | } | 131 | } |
131 | 132 | ||
132 | static inline int mt312_writereg(struct mt312_state* state, | 133 | static inline int mt312_writereg(struct mt312_state *state, |
133 | const enum mt312_reg_addr reg, const u8 val) | 134 | const enum mt312_reg_addr reg, const u8 val) |
134 | { | 135 | { |
135 | return mt312_write(state, reg, &val, 1); | 136 | return mt312_write(state, reg, &val, 1); |
@@ -140,12 +141,12 @@ static inline u32 mt312_div(u32 a, u32 b) | |||
140 | return (a + (b / 2)) / b; | 141 | return (a + (b / 2)) / b; |
141 | } | 142 | } |
142 | 143 | ||
143 | static int mt312_reset(struct mt312_state* state, const u8 full) | 144 | static int mt312_reset(struct mt312_state *state, const u8 full) |
144 | { | 145 | { |
145 | return mt312_writereg(state, RESET, full ? 0x80 : 0x40); | 146 | return mt312_writereg(state, RESET, full ? 0x80 : 0x40); |
146 | } | 147 | } |
147 | 148 | ||
148 | static int mt312_get_inversion(struct mt312_state* state, | 149 | static int mt312_get_inversion(struct mt312_state *state, |
149 | fe_spectral_inversion_t *i) | 150 | fe_spectral_inversion_t *i) |
150 | { | 151 | { |
151 | int ret; | 152 | int ret; |
@@ -160,7 +161,7 @@ static int mt312_get_inversion(struct mt312_state* state, | |||
160 | return 0; | 161 | return 0; |
161 | } | 162 | } |
162 | 163 | ||
163 | static int mt312_get_symbol_rate(struct mt312_state* state, u32 *sr) | 164 | static int mt312_get_symbol_rate(struct mt312_state *state, u32 *sr) |
164 | { | 165 | { |
165 | int ret; | 166 | int ret; |
166 | u8 sym_rate_h; | 167 | u8 sym_rate_h; |
@@ -172,7 +173,8 @@ static int mt312_get_symbol_rate(struct mt312_state* state, u32 *sr) | |||
172 | if ((ret = mt312_readreg(state, SYM_RATE_H, &sym_rate_h)) < 0) | 173 | if ((ret = mt312_readreg(state, SYM_RATE_H, &sym_rate_h)) < 0) |
173 | return ret; | 174 | return ret; |
174 | 175 | ||
175 | if (sym_rate_h & 0x80) { /* symbol rate search was used */ | 176 | if (sym_rate_h & 0x80) { |
177 | /* symbol rate search was used */ | ||
176 | if ((ret = mt312_writereg(state, MON_CTRL, 0x03)) < 0) | 178 | if ((ret = mt312_writereg(state, MON_CTRL, 0x03)) < 0) |
177 | return ret; | 179 | return ret; |
178 | 180 | ||
@@ -192,7 +194,8 @@ static int mt312_get_symbol_rate(struct mt312_state* state, u32 *sr) | |||
192 | 194 | ||
193 | dec_ratio = ((buf[0] >> 5) & 0x07) * 32; | 195 | dec_ratio = ((buf[0] >> 5) & 0x07) * 32; |
194 | 196 | ||
195 | if ((ret = mt312_read(state, SYM_RAT_OP_H, buf, sizeof(buf))) < 0) | 197 | if ((ret = mt312_read(state, SYM_RAT_OP_H, buf, |
198 | sizeof(buf))) < 0) | ||
196 | return ret; | 199 | return ret; |
197 | 200 | ||
198 | sym_rat_op = (buf[0] << 8) | buf[1]; | 201 | sym_rat_op = (buf[0] << 8) | buf[1]; |
@@ -207,7 +210,7 @@ static int mt312_get_symbol_rate(struct mt312_state* state, u32 *sr) | |||
207 | return 0; | 210 | return 0; |
208 | } | 211 | } |
209 | 212 | ||
210 | static int mt312_get_code_rate(struct mt312_state* state, fe_code_rate_t *cr) | 213 | static int mt312_get_code_rate(struct mt312_state *state, fe_code_rate_t *cr) |
211 | { | 214 | { |
212 | const fe_code_rate_t fec_tab[8] = | 215 | const fe_code_rate_t fec_tab[8] = |
213 | { FEC_1_2, FEC_2_3, FEC_3_4, FEC_5_6, FEC_6_7, FEC_7_8, | 216 | { FEC_1_2, FEC_2_3, FEC_3_4, FEC_5_6, FEC_6_7, FEC_7_8, |
@@ -224,14 +227,15 @@ static int mt312_get_code_rate(struct mt312_state* state, fe_code_rate_t *cr) | |||
224 | return 0; | 227 | return 0; |
225 | } | 228 | } |
226 | 229 | ||
227 | static int mt312_initfe(struct dvb_frontend* fe) | 230 | static int mt312_initfe(struct dvb_frontend *fe) |
228 | { | 231 | { |
229 | struct mt312_state *state = fe->demodulator_priv; | 232 | struct mt312_state *state = fe->demodulator_priv; |
230 | int ret; | 233 | int ret; |
231 | u8 buf[2]; | 234 | u8 buf[2]; |
232 | 235 | ||
233 | /* wake up */ | 236 | /* wake up */ |
234 | if ((ret = mt312_writereg(state, CONFIG, (state->frequency == 60 ? 0x88 : 0x8c))) < 0) | 237 | if ((ret = mt312_writereg(state, CONFIG, |
238 | (state->frequency == 60 ? 0x88 : 0x8c))) < 0) | ||
235 | return ret; | 239 | return ret; |
236 | 240 | ||
237 | /* wait at least 150 usec */ | 241 | /* wait at least 150 usec */ |
@@ -241,17 +245,20 @@ static int mt312_initfe(struct dvb_frontend* fe) | |||
241 | if ((ret = mt312_reset(state, 1)) < 0) | 245 | if ((ret = mt312_reset(state, 1)) < 0) |
242 | return ret; | 246 | return ret; |
243 | 247 | ||
244 | // Per datasheet, write correct values. 09/28/03 ACCJr. | 248 | /* Per datasheet, write correct values. 09/28/03 ACCJr. |
245 | // If we don't do this, we won't get FE_HAS_VITERBI in the VP310. | 249 | * If we don't do this, we won't get FE_HAS_VITERBI in the VP310. */ |
246 | { | 250 | { |
247 | u8 buf_def[8]={0x14, 0x12, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00}; | 251 | u8 buf_def[8] = { 0x14, 0x12, 0x03, 0x02, |
252 | 0x01, 0x00, 0x00, 0x00 }; | ||
248 | 253 | ||
249 | if ((ret = mt312_write(state, VIT_SETUP, buf_def, sizeof(buf_def))) < 0) | 254 | if ((ret = mt312_write(state, VIT_SETUP, buf_def, |
255 | sizeof(buf_def))) < 0) | ||
250 | return ret; | 256 | return ret; |
251 | } | 257 | } |
252 | 258 | ||
253 | /* SYS_CLK */ | 259 | /* SYS_CLK */ |
254 | buf[0] = mt312_div((state->frequency == 60 ? MT312_LPOWER_SYS_CLK : MT312_SYS_CLK) * 2, 1000000); | 260 | buf[0] = mt312_div((state->frequency == 60 ? MT312_LPOWER_SYS_CLK : |
261 | MT312_SYS_CLK) * 2, 1000000); | ||
255 | 262 | ||
256 | /* DISEQC_RATIO */ | 263 | /* DISEQC_RATIO */ |
257 | buf[1] = mt312_div(MT312_PLL_CLK, 15000 * 4); | 264 | buf[1] = mt312_div(MT312_PLL_CLK, 15000 * 4); |
@@ -278,7 +285,7 @@ static int mt312_initfe(struct dvb_frontend* fe) | |||
278 | return 0; | 285 | return 0; |
279 | } | 286 | } |
280 | 287 | ||
281 | static int mt312_send_master_cmd(struct dvb_frontend* fe, | 288 | static int mt312_send_master_cmd(struct dvb_frontend *fe, |
282 | struct dvb_diseqc_master_cmd *c) | 289 | struct dvb_diseqc_master_cmd *c) |
283 | { | 290 | { |
284 | struct mt312_state *state = fe->demodulator_priv; | 291 | struct mt312_state *state = fe->demodulator_priv; |
@@ -303,14 +310,14 @@ static int mt312_send_master_cmd(struct dvb_frontend* fe, | |||
303 | 310 | ||
304 | /* set DISEQC_MODE[2:0] to zero if a return message is expected */ | 311 | /* set DISEQC_MODE[2:0] to zero if a return message is expected */ |
305 | if (c->msg[0] & 0x02) | 312 | if (c->msg[0] & 0x02) |
306 | if ((ret = | 313 | if ((ret = mt312_writereg(state, DISEQC_MODE, |
307 | mt312_writereg(state, DISEQC_MODE, (diseqc_mode & 0x40))) < 0) | 314 | (diseqc_mode & 0x40))) < 0) |
308 | return ret; | 315 | return ret; |
309 | 316 | ||
310 | return 0; | 317 | return 0; |
311 | } | 318 | } |
312 | 319 | ||
313 | static int mt312_send_burst(struct dvb_frontend* fe, const fe_sec_mini_cmd_t c) | 320 | static int mt312_send_burst(struct dvb_frontend *fe, const fe_sec_mini_cmd_t c) |
314 | { | 321 | { |
315 | struct mt312_state *state = fe->demodulator_priv; | 322 | struct mt312_state *state = fe->demodulator_priv; |
316 | const u8 mini_tab[2] = { 0x02, 0x03 }; | 323 | const u8 mini_tab[2] = { 0x02, 0x03 }; |
@@ -332,7 +339,7 @@ static int mt312_send_burst(struct dvb_frontend* fe, const fe_sec_mini_cmd_t c) | |||
332 | return 0; | 339 | return 0; |
333 | } | 340 | } |
334 | 341 | ||
335 | static int mt312_set_tone(struct dvb_frontend* fe, const fe_sec_tone_mode_t t) | 342 | static int mt312_set_tone(struct dvb_frontend *fe, const fe_sec_tone_mode_t t) |
336 | { | 343 | { |
337 | struct mt312_state *state = fe->demodulator_priv; | 344 | struct mt312_state *state = fe->demodulator_priv; |
338 | const u8 tone_tab[2] = { 0x01, 0x00 }; | 345 | const u8 tone_tab[2] = { 0x01, 0x00 }; |
@@ -354,7 +361,7 @@ static int mt312_set_tone(struct dvb_frontend* fe, const fe_sec_tone_mode_t t) | |||
354 | return 0; | 361 | return 0; |
355 | } | 362 | } |
356 | 363 | ||
357 | static int mt312_set_voltage(struct dvb_frontend* fe, const fe_sec_voltage_t v) | 364 | static int mt312_set_voltage(struct dvb_frontend *fe, const fe_sec_voltage_t v) |
358 | { | 365 | { |
359 | struct mt312_state *state = fe->demodulator_priv; | 366 | struct mt312_state *state = fe->demodulator_priv; |
360 | const u8 volt_tab[3] = { 0x00, 0x40, 0x00 }; | 367 | const u8 volt_tab[3] = { 0x00, 0x40, 0x00 }; |
@@ -365,7 +372,7 @@ static int mt312_set_voltage(struct dvb_frontend* fe, const fe_sec_voltage_t v) | |||
365 | return mt312_writereg(state, DISEQC_MODE, volt_tab[v]); | 372 | return mt312_writereg(state, DISEQC_MODE, volt_tab[v]); |
366 | } | 373 | } |
367 | 374 | ||
368 | static int mt312_read_status(struct dvb_frontend* fe, fe_status_t *s) | 375 | static int mt312_read_status(struct dvb_frontend *fe, fe_status_t *s) |
369 | { | 376 | { |
370 | struct mt312_state *state = fe->demodulator_priv; | 377 | struct mt312_state *state = fe->demodulator_priv; |
371 | int ret; | 378 | int ret; |
@@ -376,7 +383,8 @@ static int mt312_read_status(struct dvb_frontend* fe, fe_status_t *s) | |||
376 | if ((ret = mt312_read(state, QPSK_STAT_H, status, sizeof(status))) < 0) | 383 | if ((ret = mt312_read(state, QPSK_STAT_H, status, sizeof(status))) < 0) |
377 | return ret; | 384 | return ret; |
378 | 385 | ||
379 | dprintk(KERN_DEBUG "QPSK_STAT_H: 0x%02x, QPSK_STAT_L: 0x%02x, FEC_STATUS: 0x%02x\n", status[0], status[1], status[2]); | 386 | dprintk(KERN_DEBUG "QPSK_STAT_H: 0x%02x, QPSK_STAT_L: 0x%02x," |
387 | " FEC_STATUS: 0x%02x\n", status[0], status[1], status[2]); | ||
380 | 388 | ||
381 | if (status[0] & 0xc0) | 389 | if (status[0] & 0xc0) |
382 | *s |= FE_HAS_SIGNAL; /* signal noise ratio */ | 390 | *s |= FE_HAS_SIGNAL; /* signal noise ratio */ |
@@ -392,7 +400,7 @@ static int mt312_read_status(struct dvb_frontend* fe, fe_status_t *s) | |||
392 | return 0; | 400 | return 0; |
393 | } | 401 | } |
394 | 402 | ||
395 | static int mt312_read_ber(struct dvb_frontend* fe, u32 *ber) | 403 | static int mt312_read_ber(struct dvb_frontend *fe, u32 *ber) |
396 | { | 404 | { |
397 | struct mt312_state *state = fe->demodulator_priv; | 405 | struct mt312_state *state = fe->demodulator_priv; |
398 | int ret; | 406 | int ret; |
@@ -406,7 +414,8 @@ static int mt312_read_ber(struct dvb_frontend* fe, u32 *ber) | |||
406 | return 0; | 414 | return 0; |
407 | } | 415 | } |
408 | 416 | ||
409 | static int mt312_read_signal_strength(struct dvb_frontend* fe, u16 *signal_strength) | 417 | static int mt312_read_signal_strength(struct dvb_frontend *fe, |
418 | u16 *signal_strength) | ||
410 | { | 419 | { |
411 | struct mt312_state *state = fe->demodulator_priv; | 420 | struct mt312_state *state = fe->demodulator_priv; |
412 | int ret; | 421 | int ret; |
@@ -427,7 +436,7 @@ static int mt312_read_signal_strength(struct dvb_frontend* fe, u16 *signal_stren | |||
427 | return 0; | 436 | return 0; |
428 | } | 437 | } |
429 | 438 | ||
430 | static int mt312_read_snr(struct dvb_frontend* fe, u16 *snr) | 439 | static int mt312_read_snr(struct dvb_frontend *fe, u16 *snr) |
431 | { | 440 | { |
432 | struct mt312_state *state = fe->demodulator_priv; | 441 | struct mt312_state *state = fe->demodulator_priv; |
433 | int ret; | 442 | int ret; |
@@ -441,7 +450,7 @@ static int mt312_read_snr(struct dvb_frontend* fe, u16 *snr) | |||
441 | return 0; | 450 | return 0; |
442 | } | 451 | } |
443 | 452 | ||
444 | static int mt312_read_ucblocks(struct dvb_frontend* fe, u32 *ubc) | 453 | static int mt312_read_ucblocks(struct dvb_frontend *fe, u32 *ubc) |
445 | { | 454 | { |
446 | struct mt312_state *state = fe->demodulator_priv; | 455 | struct mt312_state *state = fe->demodulator_priv; |
447 | int ret; | 456 | int ret; |
@@ -455,7 +464,7 @@ static int mt312_read_ucblocks(struct dvb_frontend* fe, u32 *ubc) | |||
455 | return 0; | 464 | return 0; |
456 | } | 465 | } |
457 | 466 | ||
458 | static int mt312_set_frontend(struct dvb_frontend* fe, | 467 | static int mt312_set_frontend(struct dvb_frontend *fe, |
459 | struct dvb_frontend_parameters *p) | 468 | struct dvb_frontend_parameters *p) |
460 | { | 469 | { |
461 | struct mt312_state *state = fe->demodulator_priv; | 470 | struct mt312_state *state = fe->demodulator_priv; |
@@ -491,22 +500,24 @@ static int mt312_set_frontend(struct dvb_frontend* fe, | |||
491 | 500 | ||
492 | switch (state->id) { | 501 | switch (state->id) { |
493 | case ID_VP310: | 502 | case ID_VP310: |
494 | // For now we will do this only for the VP310. | 503 | /* For now we will do this only for the VP310. |
495 | // It should be better for the mt312 as well, but tunning will be slower. ACCJr 09/29/03 | 504 | * It should be better for the mt312 as well, |
505 | * but tuning will be slower. ACCJr 09/29/03 | ||
506 | */ | ||
496 | ret = mt312_readreg(state, CONFIG, &config_val); | 507 | ret = mt312_readreg(state, CONFIG, &config_val); |
497 | if (ret < 0) | 508 | if (ret < 0) |
498 | return ret; | 509 | return ret; |
499 | if (p->u.qpsk.symbol_rate >= 30000000) //Note that 30MS/s should use 90MHz | 510 | if (p->u.qpsk.symbol_rate >= 30000000) { |
500 | { | 511 | /* Note that 30MS/s should use 90MHz */ |
501 | if ((config_val & 0x0c) == 0x08) { //We are running 60MHz | 512 | if ((config_val & 0x0c) == 0x08) { |
513 | /* We are running 60MHz */ | ||
502 | state->frequency = 90; | 514 | state->frequency = 90; |
503 | if ((ret = mt312_initfe(fe)) < 0) | 515 | if ((ret = mt312_initfe(fe)) < 0) |
504 | return ret; | 516 | return ret; |
505 | } | 517 | } |
506 | } | 518 | } else { |
507 | else | 519 | if ((config_val & 0x0c) == 0x0C) { |
508 | { | 520 | /* We are running 90MHz */ |
509 | if ((config_val & 0x0c) == 0x0C) { //We are running 90MHz | ||
510 | state->frequency = 60; | 521 | state->frequency = 60; |
511 | if ((ret = mt312_initfe(fe)) < 0) | 522 | if ((ret = mt312_initfe(fe)) < 0) |
512 | return ret; | 523 | return ret; |
@@ -523,7 +534,8 @@ static int mt312_set_frontend(struct dvb_frontend* fe, | |||
523 | 534 | ||
524 | if (fe->ops.tuner_ops.set_params) { | 535 | if (fe->ops.tuner_ops.set_params) { |
525 | fe->ops.tuner_ops.set_params(fe, p); | 536 | fe->ops.tuner_ops.set_params(fe, p); |
526 | if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); | 537 | if (fe->ops.i2c_gate_ctrl) |
538 | fe->ops.i2c_gate_ctrl(fe, 0); | ||
527 | } | 539 | } |
528 | 540 | ||
529 | /* sr = (u16)(sr * 256.0 / 1000000.0) */ | 541 | /* sr = (u16)(sr * 256.0 / 1000000.0) */ |
@@ -553,7 +565,7 @@ static int mt312_set_frontend(struct dvb_frontend* fe, | |||
553 | return 0; | 565 | return 0; |
554 | } | 566 | } |
555 | 567 | ||
556 | static int mt312_get_frontend(struct dvb_frontend* fe, | 568 | static int mt312_get_frontend(struct dvb_frontend *fe, |
557 | struct dvb_frontend_parameters *p) | 569 | struct dvb_frontend_parameters *p) |
558 | { | 570 | { |
559 | struct mt312_state *state = fe->demodulator_priv; | 571 | struct mt312_state *state = fe->demodulator_priv; |
@@ -571,9 +583,9 @@ static int mt312_get_frontend(struct dvb_frontend* fe, | |||
571 | return 0; | 583 | return 0; |
572 | } | 584 | } |
573 | 585 | ||
574 | static int mt312_i2c_gate_ctrl(struct dvb_frontend* fe, int enable) | 586 | static int mt312_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) |
575 | { | 587 | { |
576 | struct mt312_state* state = fe->demodulator_priv; | 588 | struct mt312_state *state = fe->demodulator_priv; |
577 | 589 | ||
578 | if (enable) { | 590 | if (enable) { |
579 | return mt312_writereg(state, GPP_CTRL, 0x40); | 591 | return mt312_writereg(state, GPP_CTRL, 0x40); |
@@ -582,7 +594,7 @@ static int mt312_i2c_gate_ctrl(struct dvb_frontend* fe, int enable) | |||
582 | } | 594 | } |
583 | } | 595 | } |
584 | 596 | ||
585 | static int mt312_sleep(struct dvb_frontend* fe) | 597 | static int mt312_sleep(struct dvb_frontend *fe) |
586 | { | 598 | { |
587 | struct mt312_state *state = fe->demodulator_priv; | 599 | struct mt312_state *state = fe->demodulator_priv; |
588 | int ret; | 600 | int ret; |
@@ -602,7 +614,8 @@ static int mt312_sleep(struct dvb_frontend* fe) | |||
602 | return 0; | 614 | return 0; |
603 | } | 615 | } |
604 | 616 | ||
605 | static int mt312_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fesettings) | 617 | static int mt312_get_tune_settings(struct dvb_frontend *fe, |
618 | struct dvb_frontend_tune_settings *fesettings) | ||
606 | { | 619 | { |
607 | fesettings->min_delay_ms = 50; | 620 | fesettings->min_delay_ms = 50; |
608 | fesettings->step_size = 0; | 621 | fesettings->step_size = 0; |
@@ -610,9 +623,9 @@ static int mt312_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_ | |||
610 | return 0; | 623 | return 0; |
611 | } | 624 | } |
612 | 625 | ||
613 | static void mt312_release(struct dvb_frontend* fe) | 626 | static void mt312_release(struct dvb_frontend *fe) |
614 | { | 627 | { |
615 | struct mt312_state* state = fe->demodulator_priv; | 628 | struct mt312_state *state = fe->demodulator_priv; |
616 | kfree(state); | 629 | kfree(state); |
617 | } | 630 | } |
618 | 631 | ||
@@ -655,10 +668,10 @@ static struct dvb_frontend_ops vp310_mt312_ops = { | |||
655 | .set_voltage = mt312_set_voltage, | 668 | .set_voltage = mt312_set_voltage, |
656 | }; | 669 | }; |
657 | 670 | ||
658 | struct dvb_frontend* vp310_mt312_attach(const struct mt312_config* config, | 671 | struct dvb_frontend *vp310_mt312_attach(const struct mt312_config *config, |
659 | struct i2c_adapter* i2c) | 672 | struct i2c_adapter *i2c) |
660 | { | 673 | { |
661 | struct mt312_state* state = NULL; | 674 | struct mt312_state *state = NULL; |
662 | 675 | ||
663 | /* allocate memory for the internal state */ | 676 | /* allocate memory for the internal state */ |
664 | state = kmalloc(sizeof(struct mt312_state), GFP_KERNEL); | 677 | state = kmalloc(sizeof(struct mt312_state), GFP_KERNEL); |
@@ -674,7 +687,8 @@ struct dvb_frontend* vp310_mt312_attach(const struct mt312_config* config, | |||
674 | goto error; | 687 | goto error; |
675 | 688 | ||
676 | /* create dvb_frontend */ | 689 | /* create dvb_frontend */ |
677 | memcpy(&state->frontend.ops, &vp310_mt312_ops, sizeof(struct dvb_frontend_ops)); | 690 | memcpy(&state->frontend.ops, &vp310_mt312_ops, |
691 | sizeof(struct dvb_frontend_ops)); | ||
678 | state->frontend.demodulator_priv = state; | 692 | state->frontend.demodulator_priv = state; |
679 | 693 | ||
680 | switch (state->id) { | 694 | switch (state->id) { |
@@ -687,7 +701,8 @@ struct dvb_frontend* vp310_mt312_attach(const struct mt312_config* config, | |||
687 | state->frequency = 60; | 701 | state->frequency = 60; |
688 | break; | 702 | break; |
689 | default: | 703 | default: |
690 | printk (KERN_WARNING "Only Zarlink VP310/MT312 are supported chips.\n"); | 704 | printk(KERN_WARNING "Only Zarlink VP310/MT312" |
705 | " are supported chips.\n"); | ||
691 | goto error; | 706 | goto error; |
692 | } | 707 | } |
693 | 708 | ||
@@ -697,6 +712,7 @@ error: | |||
697 | kfree(state); | 712 | kfree(state); |
698 | return NULL; | 713 | return NULL; |
699 | } | 714 | } |
715 | EXPORT_SYMBOL(vp310_mt312_attach); | ||
700 | 716 | ||
701 | module_param(debug, int, 0644); | 717 | module_param(debug, int, 0644); |
702 | MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off)."); | 718 | MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off)."); |
@@ -705,4 +721,3 @@ MODULE_DESCRIPTION("Zarlink VP310/MT312 DVB-S Demodulator driver"); | |||
705 | MODULE_AUTHOR("Andreas Oberritter <obi@linuxtv.org>"); | 721 | MODULE_AUTHOR("Andreas Oberritter <obi@linuxtv.org>"); |
706 | MODULE_LICENSE("GPL"); | 722 | MODULE_LICENSE("GPL"); |
707 | 723 | ||
708 | EXPORT_SYMBOL(vp310_mt312_attach); | ||
diff --git a/drivers/media/dvb/frontends/mt312.h b/drivers/media/dvb/frontends/mt312.h index cf9a1505ad4..f17cb93ba9b 100644 --- a/drivers/media/dvb/frontends/mt312.h +++ b/drivers/media/dvb/frontends/mt312.h | |||
@@ -28,22 +28,21 @@ | |||
28 | 28 | ||
29 | #include <linux/dvb/frontend.h> | 29 | #include <linux/dvb/frontend.h> |
30 | 30 | ||
31 | struct mt312_config | 31 | struct mt312_config { |
32 | { | ||
33 | /* the demodulator's i2c address */ | 32 | /* the demodulator's i2c address */ |
34 | u8 demod_address; | 33 | u8 demod_address; |
35 | }; | 34 | }; |
36 | 35 | ||
37 | #if defined(CONFIG_DVB_MT312) || (defined(CONFIG_DVB_MT312_MODULE) && defined(MODULE)) | 36 | #if defined(CONFIG_DVB_MT312) || (defined(CONFIG_DVB_MT312_MODULE) && defined(MODULE)) |
38 | struct dvb_frontend* vp310_mt312_attach(const struct mt312_config* config, | 37 | struct dvb_frontend *vp310_mt312_attach(const struct mt312_config *config, |
39 | struct i2c_adapter* i2c); | 38 | struct i2c_adapter *i2c); |
40 | #else | 39 | #else |
41 | static inline struct dvb_frontend* vp310_mt312_attach(const struct mt312_config* config, | 40 | static inline struct dvb_frontend *vp310_mt312_attach( |
42 | struct i2c_adapter* i2c) | 41 | const struct mt312_config *config, struct i2c_adapter *i2c) |
43 | { | 42 | { |
44 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 43 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); |
45 | return NULL; | 44 | return NULL; |
46 | } | 45 | } |
47 | #endif // CONFIG_DVB_MT312 | 46 | #endif /* CONFIG_DVB_MT312 */ |
48 | 47 | ||
49 | #endif // MT312_H | 48 | #endif /* MT312_H */ |