diff options
Diffstat (limited to 'drivers/media/dvb/frontends')
28 files changed, 567 insertions, 432 deletions
diff --git a/drivers/media/dvb/frontends/Kconfig b/drivers/media/dvb/frontends/Kconfig index 0bfd4df17d08..75fb556ec01f 100644 --- a/drivers/media/dvb/frontends/Kconfig +++ b/drivers/media/dvb/frontends/Kconfig | |||
@@ -12,10 +12,10 @@ config DVB_STV0299 | |||
12 | 12 | ||
13 | config DVB_CX24110 | 13 | config DVB_CX24110 |
14 | tristate "Conexant CX24110 based" | 14 | tristate "Conexant CX24110 based" |
15 | depends on DVB_CORE | 15 | depends on DVB_CORE |
16 | help | 16 | help |
17 | A DVB-S tuner module. Say Y when you want to support this frontend. | 17 | A DVB-S tuner module. Say Y when you want to support this frontend. |
18 | 18 | ||
19 | config DVB_TDA8083 | 19 | config DVB_TDA8083 |
20 | tristate "Philips TDA8083 based" | 20 | tristate "Philips TDA8083 based" |
21 | depends on DVB_CORE | 21 | depends on DVB_CORE |
@@ -127,8 +127,8 @@ comment "DVB-C (cable) frontends" | |||
127 | config DVB_ATMEL_AT76C651 | 127 | config DVB_ATMEL_AT76C651 |
128 | tristate "Atmel AT76C651 based" | 128 | tristate "Atmel AT76C651 based" |
129 | depends on DVB_CORE | 129 | depends on DVB_CORE |
130 | help | 130 | help |
131 | A DVB-C tuner module. Say Y when you want to support this frontend. | 131 | A DVB-C tuner module. Say Y when you want to support this frontend. |
132 | 132 | ||
133 | config DVB_VES1820 | 133 | config DVB_VES1820 |
134 | tristate "VLSI VES1820 based" | 134 | tristate "VLSI VES1820 based" |
@@ -158,10 +158,6 @@ config DVB_NXT2002 | |||
158 | help | 158 | help |
159 | An ATSC 8VSB tuner module. Say Y when you want to support this frontend. | 159 | An ATSC 8VSB tuner module. Say Y when you want to support this frontend. |
160 | 160 | ||
161 | config DVB_OR51132 | ||
162 | tristate "OR51132 based (pcHDTV)" | ||
163 | depends on DVB_CORE | ||
164 | |||
165 | config DVB_OR51211 | 161 | config DVB_OR51211 |
166 | tristate "or51211 based (pcHDTV HD2000 card)" | 162 | tristate "or51211 based (pcHDTV HD2000 card)" |
167 | depends on DVB_CORE | 163 | depends on DVB_CORE |
@@ -169,4 +165,12 @@ config DVB_OR51211 | |||
169 | help | 165 | help |
170 | An ATSC 8VSB tuner module. Say Y when you want to support this frontend. | 166 | An ATSC 8VSB tuner module. Say Y when you want to support this frontend. |
171 | 167 | ||
168 | config DVB_OR51132 | ||
169 | tristate "OR51132 based (pcHDTV HD3000 card)" | ||
170 | depends on DVB_CORE | ||
171 | select FW_LOADER | ||
172 | help | ||
173 | An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want | ||
174 | to support this frontend. | ||
175 | |||
172 | endmenu | 176 | endmenu |
diff --git a/drivers/media/dvb/frontends/at76c651.c b/drivers/media/dvb/frontends/at76c651.c index ce2eaa1640e8..72a2b5455b0b 100644 --- a/drivers/media/dvb/frontends/at76c651.c +++ b/drivers/media/dvb/frontends/at76c651.c | |||
@@ -259,7 +259,7 @@ static int at76c651_set_parameters(struct dvb_frontend* fe, | |||
259 | struct dvb_frontend_parameters *p) | 259 | struct dvb_frontend_parameters *p) |
260 | { | 260 | { |
261 | int ret; | 261 | int ret; |
262 | struct at76c651_state* state = (struct at76c651_state*) fe->demodulator_priv; | 262 | struct at76c651_state* state = fe->demodulator_priv; |
263 | 263 | ||
264 | at76c651_writereg(state, 0x0c, 0xc3); | 264 | at76c651_writereg(state, 0x0c, 0xc3); |
265 | state->config->pll_set(fe, p); | 265 | state->config->pll_set(fe, p); |
@@ -276,7 +276,7 @@ static int at76c651_set_parameters(struct dvb_frontend* fe, | |||
276 | 276 | ||
277 | static int at76c651_set_defaults(struct dvb_frontend* fe) | 277 | static int at76c651_set_defaults(struct dvb_frontend* fe) |
278 | { | 278 | { |
279 | struct at76c651_state* state = (struct at76c651_state*) fe->demodulator_priv; | 279 | struct at76c651_state* state = fe->demodulator_priv; |
280 | 280 | ||
281 | at76c651_set_symbol_rate(state, 6900000); | 281 | at76c651_set_symbol_rate(state, 6900000); |
282 | at76c651_set_qam(state, QAM_64); | 282 | at76c651_set_qam(state, QAM_64); |
@@ -294,7 +294,7 @@ static int at76c651_set_defaults(struct dvb_frontend* fe) | |||
294 | 294 | ||
295 | static int at76c651_read_status(struct dvb_frontend* fe, fe_status_t* status) | 295 | static int at76c651_read_status(struct dvb_frontend* fe, fe_status_t* status) |
296 | { | 296 | { |
297 | struct at76c651_state* state = (struct at76c651_state*) fe->demodulator_priv; | 297 | struct at76c651_state* state = fe->demodulator_priv; |
298 | u8 sync; | 298 | u8 sync; |
299 | 299 | ||
300 | /* | 300 | /* |
@@ -319,7 +319,7 @@ static int at76c651_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
319 | 319 | ||
320 | static int at76c651_read_ber(struct dvb_frontend* fe, u32* ber) | 320 | static int at76c651_read_ber(struct dvb_frontend* fe, u32* ber) |
321 | { | 321 | { |
322 | struct at76c651_state* state = (struct at76c651_state*) fe->demodulator_priv; | 322 | struct at76c651_state* state = fe->demodulator_priv; |
323 | 323 | ||
324 | *ber = (at76c651_readreg(state, 0x81) & 0x0F) << 16; | 324 | *ber = (at76c651_readreg(state, 0x81) & 0x0F) << 16; |
325 | *ber |= at76c651_readreg(state, 0x82) << 8; | 325 | *ber |= at76c651_readreg(state, 0x82) << 8; |
@@ -331,7 +331,7 @@ static int at76c651_read_ber(struct dvb_frontend* fe, u32* ber) | |||
331 | 331 | ||
332 | static int at76c651_read_signal_strength(struct dvb_frontend* fe, u16* strength) | 332 | static int at76c651_read_signal_strength(struct dvb_frontend* fe, u16* strength) |
333 | { | 333 | { |
334 | struct at76c651_state* state = (struct at76c651_state*) fe->demodulator_priv; | 334 | struct at76c651_state* state = fe->demodulator_priv; |
335 | 335 | ||
336 | u8 gain = ~at76c651_readreg(state, 0x91); | 336 | u8 gain = ~at76c651_readreg(state, 0x91); |
337 | *strength = (gain << 8) | gain; | 337 | *strength = (gain << 8) | gain; |
@@ -341,7 +341,7 @@ static int at76c651_read_signal_strength(struct dvb_frontend* fe, u16* strength) | |||
341 | 341 | ||
342 | static int at76c651_read_snr(struct dvb_frontend* fe, u16* snr) | 342 | static int at76c651_read_snr(struct dvb_frontend* fe, u16* snr) |
343 | { | 343 | { |
344 | struct at76c651_state* state = (struct at76c651_state*) fe->demodulator_priv; | 344 | struct at76c651_state* state = fe->demodulator_priv; |
345 | 345 | ||
346 | *snr = 0xFFFF - | 346 | *snr = 0xFFFF - |
347 | ((at76c651_readreg(state, 0x8F) << 8) | | 347 | ((at76c651_readreg(state, 0x8F) << 8) | |
@@ -352,7 +352,7 @@ static int at76c651_read_snr(struct dvb_frontend* fe, u16* snr) | |||
352 | 352 | ||
353 | static int at76c651_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | 353 | static int at76c651_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) |
354 | { | 354 | { |
355 | struct at76c651_state* state = (struct at76c651_state*) fe->demodulator_priv; | 355 | struct at76c651_state* state = fe->demodulator_priv; |
356 | 356 | ||
357 | *ucblocks = at76c651_readreg(state, 0x82); | 357 | *ucblocks = at76c651_readreg(state, 0x82); |
358 | 358 | ||
@@ -369,7 +369,7 @@ static int at76c651_get_tune_settings(struct dvb_frontend* fe, struct dvb_fronte | |||
369 | 369 | ||
370 | static void at76c651_release(struct dvb_frontend* fe) | 370 | static void at76c651_release(struct dvb_frontend* fe) |
371 | { | 371 | { |
372 | struct at76c651_state* state = (struct at76c651_state*) fe->demodulator_priv; | 372 | struct at76c651_state* state = fe->demodulator_priv; |
373 | kfree(state); | 373 | kfree(state); |
374 | } | 374 | } |
375 | 375 | ||
@@ -381,7 +381,7 @@ struct dvb_frontend* at76c651_attach(const struct at76c651_config* config, | |||
381 | struct at76c651_state* state = NULL; | 381 | struct at76c651_state* state = NULL; |
382 | 382 | ||
383 | /* allocate memory for the internal state */ | 383 | /* allocate memory for the internal state */ |
384 | state = (struct at76c651_state*) kmalloc(sizeof(struct at76c651_state), GFP_KERNEL); | 384 | state = kmalloc(sizeof(struct at76c651_state), GFP_KERNEL); |
385 | if (state == NULL) goto error; | 385 | if (state == NULL) goto error; |
386 | 386 | ||
387 | /* setup the state */ | 387 | /* setup the state */ |
diff --git a/drivers/media/dvb/frontends/cx22700.c b/drivers/media/dvb/frontends/cx22700.c index a212279042b8..0c2ed4438618 100644 --- a/drivers/media/dvb/frontends/cx22700.c +++ b/drivers/media/dvb/frontends/cx22700.c | |||
@@ -232,7 +232,7 @@ static int cx22700_get_tps (struct cx22700_state* state, struct dvb_ofdm_paramet | |||
232 | 232 | ||
233 | static int cx22700_init (struct dvb_frontend* fe) | 233 | static int cx22700_init (struct dvb_frontend* fe) |
234 | 234 | ||
235 | { struct cx22700_state* state = (struct cx22700_state*) fe->demodulator_priv; | 235 | { struct cx22700_state* state = fe->demodulator_priv; |
236 | int i; | 236 | int i; |
237 | 237 | ||
238 | dprintk("cx22700_init: init chip\n"); | 238 | dprintk("cx22700_init: init chip\n"); |
@@ -258,7 +258,7 @@ static int cx22700_init (struct dvb_frontend* fe) | |||
258 | 258 | ||
259 | static int cx22700_read_status(struct dvb_frontend* fe, fe_status_t* status) | 259 | static int cx22700_read_status(struct dvb_frontend* fe, fe_status_t* status) |
260 | { | 260 | { |
261 | struct cx22700_state* state = (struct cx22700_state*) fe->demodulator_priv; | 261 | struct cx22700_state* state = fe->demodulator_priv; |
262 | 262 | ||
263 | u16 rs_ber = (cx22700_readreg (state, 0x0d) << 9) | 263 | u16 rs_ber = (cx22700_readreg (state, 0x0d) << 9) |
264 | | (cx22700_readreg (state, 0x0e) << 1); | 264 | | (cx22700_readreg (state, 0x0e) << 1); |
@@ -286,7 +286,7 @@ static int cx22700_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
286 | 286 | ||
287 | static int cx22700_read_ber(struct dvb_frontend* fe, u32* ber) | 287 | static int cx22700_read_ber(struct dvb_frontend* fe, u32* ber) |
288 | { | 288 | { |
289 | struct cx22700_state* state = (struct cx22700_state*) fe->demodulator_priv; | 289 | struct cx22700_state* state = fe->demodulator_priv; |
290 | 290 | ||
291 | *ber = cx22700_readreg (state, 0x0c) & 0x7f; | 291 | *ber = cx22700_readreg (state, 0x0c) & 0x7f; |
292 | cx22700_writereg (state, 0x0c, 0x00); | 292 | cx22700_writereg (state, 0x0c, 0x00); |
@@ -296,7 +296,7 @@ static int cx22700_read_ber(struct dvb_frontend* fe, u32* ber) | |||
296 | 296 | ||
297 | static int cx22700_read_signal_strength(struct dvb_frontend* fe, u16* signal_strength) | 297 | static int cx22700_read_signal_strength(struct dvb_frontend* fe, u16* signal_strength) |
298 | { | 298 | { |
299 | struct cx22700_state* state = (struct cx22700_state*) fe->demodulator_priv; | 299 | struct cx22700_state* state = fe->demodulator_priv; |
300 | 300 | ||
301 | u16 rs_ber = (cx22700_readreg (state, 0x0d) << 9) | 301 | u16 rs_ber = (cx22700_readreg (state, 0x0d) << 9) |
302 | | (cx22700_readreg (state, 0x0e) << 1); | 302 | | (cx22700_readreg (state, 0x0e) << 1); |
@@ -307,7 +307,7 @@ static int cx22700_read_signal_strength(struct dvb_frontend* fe, u16* signal_str | |||
307 | 307 | ||
308 | static int cx22700_read_snr(struct dvb_frontend* fe, u16* snr) | 308 | static int cx22700_read_snr(struct dvb_frontend* fe, u16* snr) |
309 | { | 309 | { |
310 | struct cx22700_state* state = (struct cx22700_state*) fe->demodulator_priv; | 310 | struct cx22700_state* state = fe->demodulator_priv; |
311 | 311 | ||
312 | u16 rs_ber = (cx22700_readreg (state, 0x0d) << 9) | 312 | u16 rs_ber = (cx22700_readreg (state, 0x0d) << 9) |
313 | | (cx22700_readreg (state, 0x0e) << 1); | 313 | | (cx22700_readreg (state, 0x0e) << 1); |
@@ -318,7 +318,7 @@ static int cx22700_read_snr(struct dvb_frontend* fe, u16* snr) | |||
318 | 318 | ||
319 | static int cx22700_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | 319 | static int cx22700_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) |
320 | { | 320 | { |
321 | struct cx22700_state* state = (struct cx22700_state*) fe->demodulator_priv; | 321 | struct cx22700_state* state = fe->demodulator_priv; |
322 | 322 | ||
323 | *ucblocks = cx22700_readreg (state, 0x0f); | 323 | *ucblocks = cx22700_readreg (state, 0x0f); |
324 | cx22700_writereg (state, 0x0f, 0x00); | 324 | cx22700_writereg (state, 0x0f, 0x00); |
@@ -328,7 +328,7 @@ static int cx22700_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | |||
328 | 328 | ||
329 | static int cx22700_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) | 329 | static int cx22700_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) |
330 | { | 330 | { |
331 | struct cx22700_state* state = (struct cx22700_state*) fe->demodulator_priv; | 331 | struct cx22700_state* state = fe->demodulator_priv; |
332 | 332 | ||
333 | cx22700_writereg (state, 0x00, 0x02); /* XXX CHECKME: soft reset*/ | 333 | cx22700_writereg (state, 0x00, 0x02); /* XXX CHECKME: soft reset*/ |
334 | cx22700_writereg (state, 0x00, 0x00); | 334 | cx22700_writereg (state, 0x00, 0x00); |
@@ -346,7 +346,7 @@ static int cx22700_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
346 | 346 | ||
347 | static int cx22700_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) | 347 | static int cx22700_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) |
348 | { | 348 | { |
349 | struct cx22700_state* state = (struct cx22700_state*) fe->demodulator_priv; | 349 | struct cx22700_state* state = fe->demodulator_priv; |
350 | u8 reg09 = cx22700_readreg (state, 0x09); | 350 | u8 reg09 = cx22700_readreg (state, 0x09); |
351 | 351 | ||
352 | p->inversion = reg09 & 0x1 ? INVERSION_ON : INVERSION_OFF; | 352 | p->inversion = reg09 & 0x1 ? INVERSION_ON : INVERSION_OFF; |
@@ -363,7 +363,7 @@ static int cx22700_get_tune_settings(struct dvb_frontend* fe, struct dvb_fronten | |||
363 | 363 | ||
364 | static void cx22700_release(struct dvb_frontend* fe) | 364 | static void cx22700_release(struct dvb_frontend* fe) |
365 | { | 365 | { |
366 | struct cx22700_state* state = (struct cx22700_state*) fe->demodulator_priv; | 366 | struct cx22700_state* state = fe->demodulator_priv; |
367 | kfree(state); | 367 | kfree(state); |
368 | } | 368 | } |
369 | 369 | ||
@@ -375,7 +375,7 @@ struct dvb_frontend* cx22700_attach(const struct cx22700_config* config, | |||
375 | struct cx22700_state* state = NULL; | 375 | struct cx22700_state* state = NULL; |
376 | 376 | ||
377 | /* allocate memory for the internal state */ | 377 | /* allocate memory for the internal state */ |
378 | state = (struct cx22700_state*) kmalloc(sizeof(struct cx22700_state), GFP_KERNEL); | 378 | state = kmalloc(sizeof(struct cx22700_state), GFP_KERNEL); |
379 | if (state == NULL) goto error; | 379 | if (state == NULL) goto error; |
380 | 380 | ||
381 | /* setup the state */ | 381 | /* setup the state */ |
diff --git a/drivers/media/dvb/frontends/cx22702.c b/drivers/media/dvb/frontends/cx22702.c index 011860ce36cc..f4aa44136c7c 100644 --- a/drivers/media/dvb/frontends/cx22702.c +++ b/drivers/media/dvb/frontends/cx22702.c | |||
@@ -200,7 +200,7 @@ static int cx22702_get_tps (struct cx22702_state *state, struct dvb_ofdm_paramet | |||
200 | static int cx22702_set_tps (struct dvb_frontend* fe, struct dvb_frontend_parameters *p) | 200 | static int cx22702_set_tps (struct dvb_frontend* fe, struct dvb_frontend_parameters *p) |
201 | { | 201 | { |
202 | u8 val; | 202 | u8 val; |
203 | struct cx22702_state* state = (struct cx22702_state*) fe->demodulator_priv; | 203 | struct cx22702_state* state = fe->demodulator_priv; |
204 | 204 | ||
205 | /* set PLL */ | 205 | /* set PLL */ |
206 | cx22702_writereg (state, 0x0D, cx22702_readreg(state,0x0D) &0xfe); | 206 | cx22702_writereg (state, 0x0D, cx22702_readreg(state,0x0D) &0xfe); |
@@ -338,7 +338,7 @@ static int cx22702_set_tps (struct dvb_frontend* fe, struct dvb_frontend_paramet | |||
338 | static int cx22702_init (struct dvb_frontend* fe) | 338 | static int cx22702_init (struct dvb_frontend* fe) |
339 | { | 339 | { |
340 | int i; | 340 | int i; |
341 | struct cx22702_state* state = (struct cx22702_state*) fe->demodulator_priv; | 341 | struct cx22702_state* state = fe->demodulator_priv; |
342 | 342 | ||
343 | cx22702_writereg (state, 0x00, 0x02); | 343 | cx22702_writereg (state, 0x00, 0x02); |
344 | 344 | ||
@@ -360,7 +360,7 @@ static int cx22702_init (struct dvb_frontend* fe) | |||
360 | 360 | ||
361 | static int cx22702_read_status(struct dvb_frontend* fe, fe_status_t* status) | 361 | static int cx22702_read_status(struct dvb_frontend* fe, fe_status_t* status) |
362 | { | 362 | { |
363 | struct cx22702_state* state = (struct cx22702_state*) fe->demodulator_priv; | 363 | struct cx22702_state* state = fe->demodulator_priv; |
364 | u8 reg0A; | 364 | u8 reg0A; |
365 | u8 reg23; | 365 | u8 reg23; |
366 | 366 | ||
@@ -389,7 +389,7 @@ static int cx22702_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
389 | 389 | ||
390 | static int cx22702_read_ber(struct dvb_frontend* fe, u32* ber) | 390 | static int cx22702_read_ber(struct dvb_frontend* fe, u32* ber) |
391 | { | 391 | { |
392 | struct cx22702_state* state = (struct cx22702_state*) fe->demodulator_priv; | 392 | struct cx22702_state* state = fe->demodulator_priv; |
393 | 393 | ||
394 | if(cx22702_readreg (state, 0xE4) & 0x02) { | 394 | if(cx22702_readreg (state, 0xE4) & 0x02) { |
395 | /* Realtime statistics */ | 395 | /* Realtime statistics */ |
@@ -406,7 +406,7 @@ static int cx22702_read_ber(struct dvb_frontend* fe, u32* ber) | |||
406 | 406 | ||
407 | static int cx22702_read_signal_strength(struct dvb_frontend* fe, u16* signal_strength) | 407 | static int cx22702_read_signal_strength(struct dvb_frontend* fe, u16* signal_strength) |
408 | { | 408 | { |
409 | struct cx22702_state* state = (struct cx22702_state*) fe->demodulator_priv; | 409 | struct cx22702_state* state = fe->demodulator_priv; |
410 | 410 | ||
411 | *signal_strength = cx22702_readreg (state, 0x23); | 411 | *signal_strength = cx22702_readreg (state, 0x23); |
412 | 412 | ||
@@ -415,7 +415,7 @@ static int cx22702_read_signal_strength(struct dvb_frontend* fe, u16* signal_str | |||
415 | 415 | ||
416 | static int cx22702_read_snr(struct dvb_frontend* fe, u16* snr) | 416 | static int cx22702_read_snr(struct dvb_frontend* fe, u16* snr) |
417 | { | 417 | { |
418 | struct cx22702_state* state = (struct cx22702_state*) fe->demodulator_priv; | 418 | struct cx22702_state* state = fe->demodulator_priv; |
419 | 419 | ||
420 | u16 rs_ber=0; | 420 | u16 rs_ber=0; |
421 | if(cx22702_readreg (state, 0xE4) & 0x02) { | 421 | if(cx22702_readreg (state, 0xE4) & 0x02) { |
@@ -434,7 +434,7 @@ static int cx22702_read_snr(struct dvb_frontend* fe, u16* snr) | |||
434 | 434 | ||
435 | static int cx22702_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | 435 | static int cx22702_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) |
436 | { | 436 | { |
437 | struct cx22702_state* state = (struct cx22702_state*) fe->demodulator_priv; | 437 | struct cx22702_state* state = fe->demodulator_priv; |
438 | 438 | ||
439 | u8 _ucblocks; | 439 | u8 _ucblocks; |
440 | 440 | ||
@@ -449,7 +449,7 @@ static int cx22702_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | |||
449 | 449 | ||
450 | static int cx22702_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) | 450 | static int cx22702_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) |
451 | { | 451 | { |
452 | struct cx22702_state* state = (struct cx22702_state*) fe->demodulator_priv; | 452 | struct cx22702_state* state = fe->demodulator_priv; |
453 | 453 | ||
454 | u8 reg0C = cx22702_readreg (state, 0x0C); | 454 | u8 reg0C = cx22702_readreg (state, 0x0C); |
455 | 455 | ||
@@ -459,7 +459,7 @@ static int cx22702_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
459 | 459 | ||
460 | static void cx22702_release(struct dvb_frontend* fe) | 460 | static void cx22702_release(struct dvb_frontend* fe) |
461 | { | 461 | { |
462 | struct cx22702_state* state = (struct cx22702_state*) fe->demodulator_priv; | 462 | struct cx22702_state* state = fe->demodulator_priv; |
463 | kfree(state); | 463 | kfree(state); |
464 | } | 464 | } |
465 | 465 | ||
@@ -471,7 +471,7 @@ struct dvb_frontend* cx22702_attach(const struct cx22702_config* config, | |||
471 | struct cx22702_state* state = NULL; | 471 | struct cx22702_state* state = NULL; |
472 | 472 | ||
473 | /* allocate memory for the internal state */ | 473 | /* allocate memory for the internal state */ |
474 | state = (struct cx22702_state*) kmalloc(sizeof(struct cx22702_state), GFP_KERNEL); | 474 | state = kmalloc(sizeof(struct cx22702_state), GFP_KERNEL); |
475 | if (state == NULL) goto error; | 475 | if (state == NULL) goto error; |
476 | 476 | ||
477 | /* setup the state */ | 477 | /* setup the state */ |
diff --git a/drivers/media/dvb/frontends/cx24110.c b/drivers/media/dvb/frontends/cx24110.c index ae16112a0653..8222b88cb486 100644 --- a/drivers/media/dvb/frontends/cx24110.c +++ b/drivers/media/dvb/frontends/cx24110.c | |||
@@ -315,7 +315,7 @@ dprintk("cx24110 debug: entering %s(%d)\n",__FUNCTION__,srate); | |||
315 | 315 | ||
316 | int cx24110_pll_write (struct dvb_frontend* fe, u32 data) | 316 | int cx24110_pll_write (struct dvb_frontend* fe, u32 data) |
317 | { | 317 | { |
318 | struct cx24110_state *state = (struct cx24110_state*) fe->demodulator_priv; | 318 | struct cx24110_state *state = fe->demodulator_priv; |
319 | 319 | ||
320 | /* tuner data is 21 bits long, must be left-aligned in data */ | 320 | /* tuner data is 21 bits long, must be left-aligned in data */ |
321 | /* tuner cx24108 is written through a dedicated 3wire interface on the demod chip */ | 321 | /* tuner cx24108 is written through a dedicated 3wire interface on the demod chip */ |
@@ -356,7 +356,7 @@ int cx24110_pll_write (struct dvb_frontend* fe, u32 data) | |||
356 | 356 | ||
357 | static int cx24110_initfe(struct dvb_frontend* fe) | 357 | static int cx24110_initfe(struct dvb_frontend* fe) |
358 | { | 358 | { |
359 | struct cx24110_state *state = (struct cx24110_state*) fe->demodulator_priv; | 359 | struct cx24110_state *state = fe->demodulator_priv; |
360 | /* fixme (low): error handling */ | 360 | /* fixme (low): error handling */ |
361 | int i; | 361 | int i; |
362 | 362 | ||
@@ -373,7 +373,7 @@ static int cx24110_initfe(struct dvb_frontend* fe) | |||
373 | 373 | ||
374 | static int cx24110_set_voltage (struct dvb_frontend* fe, fe_sec_voltage_t voltage) | 374 | static int cx24110_set_voltage (struct dvb_frontend* fe, fe_sec_voltage_t voltage) |
375 | { | 375 | { |
376 | struct cx24110_state *state = (struct cx24110_state*) fe->demodulator_priv; | 376 | struct cx24110_state *state = fe->demodulator_priv; |
377 | 377 | ||
378 | switch (voltage) { | 378 | switch (voltage) { |
379 | case SEC_VOLTAGE_13: | 379 | case SEC_VOLTAGE_13: |
@@ -385,8 +385,7 @@ static int cx24110_set_voltage (struct dvb_frontend* fe, fe_sec_voltage_t voltag | |||
385 | }; | 385 | }; |
386 | } | 386 | } |
387 | 387 | ||
388 | static int cx24110_diseqc_send_burst(struct dvb_frontend* fe, | 388 | static int cx24110_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t burst) |
389 | fe_sec_mini_cmd_t burst) | ||
390 | { | 389 | { |
391 | int rv, bit, i; | 390 | int rv, bit, i; |
392 | struct cx24110_state *state = fe->demodulator_priv; | 391 | struct cx24110_state *state = fe->demodulator_priv; |
@@ -413,7 +412,7 @@ static int cx24110_send_diseqc_msg(struct dvb_frontend* fe, | |||
413 | struct dvb_diseqc_master_cmd *cmd) | 412 | struct dvb_diseqc_master_cmd *cmd) |
414 | { | 413 | { |
415 | int i, rv; | 414 | int i, rv; |
416 | struct cx24110_state *state = (struct cx24110_state*) fe->demodulator_priv; | 415 | struct cx24110_state *state = fe->demodulator_priv; |
417 | 416 | ||
418 | for (i = 0; i < cmd->msg_len; i++) | 417 | for (i = 0; i < cmd->msg_len; i++) |
419 | cx24110_writereg(state, 0x79 + i, cmd->msg[i]); | 418 | cx24110_writereg(state, 0x79 + i, cmd->msg[i]); |
@@ -432,7 +431,7 @@ static int cx24110_send_diseqc_msg(struct dvb_frontend* fe, | |||
432 | 431 | ||
433 | static int cx24110_read_status(struct dvb_frontend* fe, fe_status_t* status) | 432 | static int cx24110_read_status(struct dvb_frontend* fe, fe_status_t* status) |
434 | { | 433 | { |
435 | struct cx24110_state *state = (struct cx24110_state*) fe->demodulator_priv; | 434 | struct cx24110_state *state = fe->demodulator_priv; |
436 | 435 | ||
437 | int sync = cx24110_readreg (state, 0x55); | 436 | int sync = cx24110_readreg (state, 0x55); |
438 | 437 | ||
@@ -460,7 +459,7 @@ static int cx24110_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
460 | 459 | ||
461 | static int cx24110_read_ber(struct dvb_frontend* fe, u32* ber) | 460 | static int cx24110_read_ber(struct dvb_frontend* fe, u32* ber) |
462 | { | 461 | { |
463 | struct cx24110_state *state = (struct cx24110_state*) fe->demodulator_priv; | 462 | struct cx24110_state *state = fe->demodulator_priv; |
464 | 463 | ||
465 | /* fixme (maybe): value range is 16 bit. Scale? */ | 464 | /* fixme (maybe): value range is 16 bit. Scale? */ |
466 | if(cx24110_readreg(state,0x24)&0x10) { | 465 | if(cx24110_readreg(state,0x24)&0x10) { |
@@ -478,7 +477,7 @@ static int cx24110_read_ber(struct dvb_frontend* fe, u32* ber) | |||
478 | 477 | ||
479 | static int cx24110_read_signal_strength(struct dvb_frontend* fe, u16* signal_strength) | 478 | static int cx24110_read_signal_strength(struct dvb_frontend* fe, u16* signal_strength) |
480 | { | 479 | { |
481 | struct cx24110_state *state = (struct cx24110_state*) fe->demodulator_priv; | 480 | struct cx24110_state *state = fe->demodulator_priv; |
482 | 481 | ||
483 | /* no provision in hardware. Read the frontend AGC accumulator. No idea how to scale this, but I know it is 2s complement */ | 482 | /* no provision in hardware. Read the frontend AGC accumulator. No idea how to scale this, but I know it is 2s complement */ |
484 | u8 signal = cx24110_readreg (state, 0x27)+128; | 483 | u8 signal = cx24110_readreg (state, 0x27)+128; |
@@ -489,7 +488,7 @@ static int cx24110_read_signal_strength(struct dvb_frontend* fe, u16* signal_str | |||
489 | 488 | ||
490 | static int cx24110_read_snr(struct dvb_frontend* fe, u16* snr) | 489 | static int cx24110_read_snr(struct dvb_frontend* fe, u16* snr) |
491 | { | 490 | { |
492 | struct cx24110_state *state = (struct cx24110_state*) fe->demodulator_priv; | 491 | struct cx24110_state *state = fe->demodulator_priv; |
493 | 492 | ||
494 | /* no provision in hardware. Can be computed from the Es/N0 estimator, but I don't know how. */ | 493 | /* no provision in hardware. Can be computed from the Es/N0 estimator, but I don't know how. */ |
495 | if(cx24110_readreg(state,0x6a)&0x80) { | 494 | if(cx24110_readreg(state,0x6a)&0x80) { |
@@ -505,7 +504,7 @@ static int cx24110_read_snr(struct dvb_frontend* fe, u16* snr) | |||
505 | 504 | ||
506 | static int cx24110_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | 505 | static int cx24110_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) |
507 | { | 506 | { |
508 | struct cx24110_state *state = (struct cx24110_state*) fe->demodulator_priv; | 507 | struct cx24110_state *state = fe->demodulator_priv; |
509 | u32 lastbyer; | 508 | u32 lastbyer; |
510 | 509 | ||
511 | if(cx24110_readreg(state,0x10)&0x40) { | 510 | if(cx24110_readreg(state,0x10)&0x40) { |
@@ -527,7 +526,7 @@ static int cx24110_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | |||
527 | 526 | ||
528 | static int cx24110_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) | 527 | static int cx24110_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) |
529 | { | 528 | { |
530 | struct cx24110_state *state = (struct cx24110_state*) fe->demodulator_priv; | 529 | struct cx24110_state *state = fe->demodulator_priv; |
531 | 530 | ||
532 | state->config->pll_set(fe, p); | 531 | state->config->pll_set(fe, p); |
533 | cx24110_set_inversion (state, p->inversion); | 532 | cx24110_set_inversion (state, p->inversion); |
@@ -540,7 +539,7 @@ static int cx24110_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
540 | 539 | ||
541 | static int cx24110_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) | 540 | static int cx24110_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) |
542 | { | 541 | { |
543 | struct cx24110_state *state = (struct cx24110_state*) fe->demodulator_priv; | 542 | struct cx24110_state *state = fe->demodulator_priv; |
544 | s32 afc; unsigned sclk; | 543 | s32 afc; unsigned sclk; |
545 | 544 | ||
546 | /* cannot read back tuner settings (freq). Need to have some private storage */ | 545 | /* cannot read back tuner settings (freq). Need to have some private storage */ |
@@ -567,14 +566,14 @@ static int cx24110_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
567 | 566 | ||
568 | static int cx24110_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) | 567 | static int cx24110_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) |
569 | { | 568 | { |
570 | struct cx24110_state *state = (struct cx24110_state*) fe->demodulator_priv; | 569 | struct cx24110_state *state = fe->demodulator_priv; |
571 | 570 | ||
572 | return cx24110_writereg(state,0x76,(cx24110_readreg(state,0x76)&~0x10)|(((tone==SEC_TONE_ON))?0x10:0)); | 571 | return cx24110_writereg(state,0x76,(cx24110_readreg(state,0x76)&~0x10)|(((tone==SEC_TONE_ON))?0x10:0)); |
573 | } | 572 | } |
574 | 573 | ||
575 | static void cx24110_release(struct dvb_frontend* fe) | 574 | static void cx24110_release(struct dvb_frontend* fe) |
576 | { | 575 | { |
577 | struct cx24110_state* state = (struct cx24110_state*) fe->demodulator_priv; | 576 | struct cx24110_state* state = fe->demodulator_priv; |
578 | kfree(state); | 577 | kfree(state); |
579 | } | 578 | } |
580 | 579 | ||
@@ -587,7 +586,7 @@ struct dvb_frontend* cx24110_attach(const struct cx24110_config* config, | |||
587 | int ret; | 586 | int ret; |
588 | 587 | ||
589 | /* allocate memory for the internal state */ | 588 | /* allocate memory for the internal state */ |
590 | state = (struct cx24110_state*) kmalloc(sizeof(struct cx24110_state), GFP_KERNEL); | 589 | state = kmalloc(sizeof(struct cx24110_state), GFP_KERNEL); |
591 | if (state == NULL) goto error; | 590 | if (state == NULL) goto error; |
592 | 591 | ||
593 | /* setup the state */ | 592 | /* setup the state */ |
diff --git a/drivers/media/dvb/frontends/dib3000mb.c b/drivers/media/dvb/frontends/dib3000mb.c index a853d12a26f1..6f52d649e97e 100644 --- a/drivers/media/dvb/frontends/dib3000mb.c +++ b/drivers/media/dvb/frontends/dib3000mb.c | |||
@@ -56,12 +56,12 @@ static int dib3000mb_get_frontend(struct dvb_frontend* fe, | |||
56 | static int dib3000mb_set_frontend(struct dvb_frontend* fe, | 56 | static int dib3000mb_set_frontend(struct dvb_frontend* fe, |
57 | struct dvb_frontend_parameters *fep, int tuner) | 57 | struct dvb_frontend_parameters *fep, int tuner) |
58 | { | 58 | { |
59 | struct dib3000_state* state = (struct dib3000_state*) fe->demodulator_priv; | 59 | struct dib3000_state* state = fe->demodulator_priv; |
60 | struct dvb_ofdm_parameters *ofdm = &fep->u.ofdm; | 60 | struct dvb_ofdm_parameters *ofdm = &fep->u.ofdm; |
61 | fe_code_rate_t fe_cr = FEC_NONE; | 61 | fe_code_rate_t fe_cr = FEC_NONE; |
62 | int search_state, seq; | 62 | int search_state, seq; |
63 | 63 | ||
64 | if (tuner) { | 64 | if (tuner && state->config.pll_addr && state->config.pll_set) { |
65 | dib3000mb_tuner_pass_ctrl(fe,1,state->config.pll_addr(fe)); | 65 | dib3000mb_tuner_pass_ctrl(fe,1,state->config.pll_addr(fe)); |
66 | state->config.pll_set(fe, fep, NULL); | 66 | state->config.pll_set(fe, fep, NULL); |
67 | dib3000mb_tuner_pass_ctrl(fe,0,state->config.pll_addr(fe)); | 67 | dib3000mb_tuner_pass_ctrl(fe,0,state->config.pll_addr(fe)); |
@@ -317,7 +317,7 @@ static int dib3000mb_set_frontend(struct dvb_frontend* fe, | |||
317 | 317 | ||
318 | static int dib3000mb_fe_init(struct dvb_frontend* fe, int mobile_mode) | 318 | static int dib3000mb_fe_init(struct dvb_frontend* fe, int mobile_mode) |
319 | { | 319 | { |
320 | struct dib3000_state* state = (struct dib3000_state*) fe->demodulator_priv; | 320 | struct dib3000_state* state = fe->demodulator_priv; |
321 | 321 | ||
322 | deb_info("dib3000mb is getting up.\n"); | 322 | deb_info("dib3000mb is getting up.\n"); |
323 | wr(DIB3000MB_REG_POWER_CONTROL, DIB3000MB_POWER_UP); | 323 | wr(DIB3000MB_REG_POWER_CONTROL, DIB3000MB_POWER_UP); |
@@ -401,7 +401,7 @@ static int dib3000mb_fe_init(struct dvb_frontend* fe, int mobile_mode) | |||
401 | static int dib3000mb_get_frontend(struct dvb_frontend* fe, | 401 | static int dib3000mb_get_frontend(struct dvb_frontend* fe, |
402 | struct dvb_frontend_parameters *fep) | 402 | struct dvb_frontend_parameters *fep) |
403 | { | 403 | { |
404 | struct dib3000_state* state = (struct dib3000_state*) fe->demodulator_priv; | 404 | struct dib3000_state* state = fe->demodulator_priv; |
405 | struct dvb_ofdm_parameters *ofdm = &fep->u.ofdm; | 405 | struct dvb_ofdm_parameters *ofdm = &fep->u.ofdm; |
406 | fe_code_rate_t *cr; | 406 | fe_code_rate_t *cr; |
407 | u16 tps_val; | 407 | u16 tps_val; |
@@ -562,7 +562,7 @@ static int dib3000mb_get_frontend(struct dvb_frontend* fe, | |||
562 | 562 | ||
563 | static int dib3000mb_read_status(struct dvb_frontend* fe, fe_status_t *stat) | 563 | static int dib3000mb_read_status(struct dvb_frontend* fe, fe_status_t *stat) |
564 | { | 564 | { |
565 | struct dib3000_state* state = (struct dib3000_state*) fe->demodulator_priv; | 565 | struct dib3000_state* state = fe->demodulator_priv; |
566 | 566 | ||
567 | *stat = 0; | 567 | *stat = 0; |
568 | 568 | ||
@@ -594,7 +594,7 @@ static int dib3000mb_read_status(struct dvb_frontend* fe, fe_status_t *stat) | |||
594 | 594 | ||
595 | static int dib3000mb_read_ber(struct dvb_frontend* fe, u32 *ber) | 595 | static int dib3000mb_read_ber(struct dvb_frontend* fe, u32 *ber) |
596 | { | 596 | { |
597 | struct dib3000_state* state = (struct dib3000_state*) fe->demodulator_priv; | 597 | struct dib3000_state* state = fe->demodulator_priv; |
598 | 598 | ||
599 | *ber = ((rd(DIB3000MB_REG_BER_MSB) << 16) | rd(DIB3000MB_REG_BER_LSB)); | 599 | *ber = ((rd(DIB3000MB_REG_BER_MSB) << 16) | rd(DIB3000MB_REG_BER_LSB)); |
600 | return 0; | 600 | return 0; |
@@ -603,7 +603,7 @@ static int dib3000mb_read_ber(struct dvb_frontend* fe, u32 *ber) | |||
603 | /* see dib3000-watch dvb-apps for exact calcuations of signal_strength and snr */ | 603 | /* see dib3000-watch dvb-apps for exact calcuations of signal_strength and snr */ |
604 | static int dib3000mb_read_signal_strength(struct dvb_frontend* fe, u16 *strength) | 604 | static int dib3000mb_read_signal_strength(struct dvb_frontend* fe, u16 *strength) |
605 | { | 605 | { |
606 | struct dib3000_state* state = (struct dib3000_state*) fe->demodulator_priv; | 606 | struct dib3000_state* state = fe->demodulator_priv; |
607 | 607 | ||
608 | *strength = rd(DIB3000MB_REG_SIGNAL_POWER) * 0xffff / 0x170; | 608 | *strength = rd(DIB3000MB_REG_SIGNAL_POWER) * 0xffff / 0x170; |
609 | return 0; | 609 | return 0; |
@@ -611,7 +611,7 @@ static int dib3000mb_read_signal_strength(struct dvb_frontend* fe, u16 *strength | |||
611 | 611 | ||
612 | static int dib3000mb_read_snr(struct dvb_frontend* fe, u16 *snr) | 612 | static int dib3000mb_read_snr(struct dvb_frontend* fe, u16 *snr) |
613 | { | 613 | { |
614 | struct dib3000_state* state = (struct dib3000_state*) fe->demodulator_priv; | 614 | struct dib3000_state* state = fe->demodulator_priv; |
615 | short sigpow = rd(DIB3000MB_REG_SIGNAL_POWER); | 615 | short sigpow = rd(DIB3000MB_REG_SIGNAL_POWER); |
616 | int icipow = ((rd(DIB3000MB_REG_NOISE_POWER_MSB) & 0xff) << 16) | | 616 | int icipow = ((rd(DIB3000MB_REG_NOISE_POWER_MSB) & 0xff) << 16) | |
617 | rd(DIB3000MB_REG_NOISE_POWER_LSB); | 617 | rd(DIB3000MB_REG_NOISE_POWER_LSB); |
@@ -621,7 +621,7 @@ static int dib3000mb_read_snr(struct dvb_frontend* fe, u16 *snr) | |||
621 | 621 | ||
622 | static int dib3000mb_read_unc_blocks(struct dvb_frontend* fe, u32 *unc) | 622 | static int dib3000mb_read_unc_blocks(struct dvb_frontend* fe, u32 *unc) |
623 | { | 623 | { |
624 | struct dib3000_state* state = (struct dib3000_state*) fe->demodulator_priv; | 624 | struct dib3000_state* state = fe->demodulator_priv; |
625 | 625 | ||
626 | *unc = rd(DIB3000MB_REG_UNC); | 626 | *unc = rd(DIB3000MB_REG_UNC); |
627 | return 0; | 627 | return 0; |
@@ -629,7 +629,7 @@ static int dib3000mb_read_unc_blocks(struct dvb_frontend* fe, u32 *unc) | |||
629 | 629 | ||
630 | static int dib3000mb_sleep(struct dvb_frontend* fe) | 630 | static int dib3000mb_sleep(struct dvb_frontend* fe) |
631 | { | 631 | { |
632 | struct dib3000_state* state = (struct dib3000_state*) fe->demodulator_priv; | 632 | struct dib3000_state* state = fe->demodulator_priv; |
633 | deb_info("dib3000mb is going to bed.\n"); | 633 | deb_info("dib3000mb is going to bed.\n"); |
634 | wr(DIB3000MB_REG_POWER_CONTROL, DIB3000MB_POWER_DOWN); | 634 | wr(DIB3000MB_REG_POWER_CONTROL, DIB3000MB_POWER_DOWN); |
635 | return 0; | 635 | return 0; |
@@ -656,7 +656,7 @@ static int dib3000mb_set_frontend_and_tuner(struct dvb_frontend* fe, struct dvb_ | |||
656 | 656 | ||
657 | static void dib3000mb_release(struct dvb_frontend* fe) | 657 | static void dib3000mb_release(struct dvb_frontend* fe) |
658 | { | 658 | { |
659 | struct dib3000_state *state = (struct dib3000_state*) fe->demodulator_priv; | 659 | struct dib3000_state *state = fe->demodulator_priv; |
660 | kfree(state); | 660 | kfree(state); |
661 | } | 661 | } |
662 | 662 | ||
@@ -671,7 +671,7 @@ static int dib3000mb_pid_control(struct dvb_frontend *fe,int index, int pid,int | |||
671 | 671 | ||
672 | static int dib3000mb_fifo_control(struct dvb_frontend *fe, int onoff) | 672 | static int dib3000mb_fifo_control(struct dvb_frontend *fe, int onoff) |
673 | { | 673 | { |
674 | struct dib3000_state *state = (struct dib3000_state*) fe->demodulator_priv; | 674 | struct dib3000_state *state = fe->demodulator_priv; |
675 | 675 | ||
676 | deb_xfer("%s fifo\n",onoff ? "enabling" : "disabling"); | 676 | deb_xfer("%s fifo\n",onoff ? "enabling" : "disabling"); |
677 | if (onoff) { | 677 | if (onoff) { |
@@ -692,7 +692,7 @@ static int dib3000mb_pid_parse(struct dvb_frontend *fe, int onoff) | |||
692 | 692 | ||
693 | static int dib3000mb_tuner_pass_ctrl(struct dvb_frontend *fe, int onoff, u8 pll_addr) | 693 | static int dib3000mb_tuner_pass_ctrl(struct dvb_frontend *fe, int onoff, u8 pll_addr) |
694 | { | 694 | { |
695 | struct dib3000_state *state = (struct dib3000_state*) fe->demodulator_priv; | 695 | struct dib3000_state *state = fe->demodulator_priv; |
696 | if (onoff) { | 696 | if (onoff) { |
697 | wr(DIB3000MB_REG_TUNER, DIB3000_TUNER_WRITE_ENABLE(pll_addr)); | 697 | wr(DIB3000MB_REG_TUNER, DIB3000_TUNER_WRITE_ENABLE(pll_addr)); |
698 | } else { | 698 | } else { |
@@ -709,7 +709,7 @@ struct dvb_frontend* dib3000mb_attach(const struct dib3000_config* config, | |||
709 | struct dib3000_state* state = NULL; | 709 | struct dib3000_state* state = NULL; |
710 | 710 | ||
711 | /* allocate memory for the internal state */ | 711 | /* allocate memory for the internal state */ |
712 | state = (struct dib3000_state*) kmalloc(sizeof(struct dib3000_state), GFP_KERNEL); | 712 | state = kmalloc(sizeof(struct dib3000_state), GFP_KERNEL); |
713 | if (state == NULL) | 713 | if (state == NULL) |
714 | goto error; | 714 | goto error; |
715 | memset(state,0,sizeof(struct dib3000_state)); | 715 | memset(state,0,sizeof(struct dib3000_state)); |
diff --git a/drivers/media/dvb/frontends/dib3000mc.c b/drivers/media/dvb/frontends/dib3000mc.c index 4a31c05eaecd..888f10a5e96b 100644 --- a/drivers/media/dvb/frontends/dib3000mc.c +++ b/drivers/media/dvb/frontends/dib3000mc.c | |||
@@ -297,7 +297,7 @@ static int dib3000mc_set_general_cfg(struct dib3000_state *state, struct dvb_fro | |||
297 | static int dib3000mc_get_frontend(struct dvb_frontend* fe, | 297 | static int dib3000mc_get_frontend(struct dvb_frontend* fe, |
298 | struct dvb_frontend_parameters *fep) | 298 | struct dvb_frontend_parameters *fep) |
299 | { | 299 | { |
300 | struct dib3000_state* state = (struct dib3000_state*) fe->demodulator_priv; | 300 | struct dib3000_state* state = fe->demodulator_priv; |
301 | struct dvb_ofdm_parameters *ofdm = &fep->u.ofdm; | 301 | struct dvb_ofdm_parameters *ofdm = &fep->u.ofdm; |
302 | fe_code_rate_t *cr; | 302 | fe_code_rate_t *cr; |
303 | u16 tps_val,cr_val; | 303 | u16 tps_val,cr_val; |
@@ -458,12 +458,12 @@ static int dib3000mc_get_frontend(struct dvb_frontend* fe, | |||
458 | static int dib3000mc_set_frontend(struct dvb_frontend* fe, | 458 | static int dib3000mc_set_frontend(struct dvb_frontend* fe, |
459 | struct dvb_frontend_parameters *fep, int tuner) | 459 | struct dvb_frontend_parameters *fep, int tuner) |
460 | { | 460 | { |
461 | struct dib3000_state* state = (struct dib3000_state*) fe->demodulator_priv; | 461 | struct dib3000_state* state = fe->demodulator_priv; |
462 | struct dvb_ofdm_parameters *ofdm = &fep->u.ofdm; | 462 | struct dvb_ofdm_parameters *ofdm = &fep->u.ofdm; |
463 | int search_state,auto_val; | 463 | int search_state,auto_val; |
464 | u16 val; | 464 | u16 val; |
465 | 465 | ||
466 | if (tuner) { /* initial call from dvb */ | 466 | if (tuner && state->config.pll_addr && state->config.pll_set) { /* initial call from dvb */ |
467 | dib3000mc_tuner_pass_ctrl(fe,1,state->config.pll_addr(fe)); | 467 | dib3000mc_tuner_pass_ctrl(fe,1,state->config.pll_addr(fe)); |
468 | state->config.pll_set(fe,fep,NULL); | 468 | state->config.pll_set(fe,fep,NULL); |
469 | dib3000mc_tuner_pass_ctrl(fe,0,state->config.pll_addr(fe)); | 469 | dib3000mc_tuner_pass_ctrl(fe,0,state->config.pll_addr(fe)); |
@@ -659,7 +659,7 @@ static int dib3000mc_fe_init(struct dvb_frontend* fe, int mobile_mode) | |||
659 | } | 659 | } |
660 | static int dib3000mc_read_status(struct dvb_frontend* fe, fe_status_t *stat) | 660 | static int dib3000mc_read_status(struct dvb_frontend* fe, fe_status_t *stat) |
661 | { | 661 | { |
662 | struct dib3000_state* state = (struct dib3000_state*) fe->demodulator_priv; | 662 | struct dib3000_state* state = fe->demodulator_priv; |
663 | u16 lock = rd(DIB3000MC_REG_LOCKING); | 663 | u16 lock = rd(DIB3000MC_REG_LOCKING); |
664 | 664 | ||
665 | *stat = 0; | 665 | *stat = 0; |
@@ -679,14 +679,14 @@ static int dib3000mc_read_status(struct dvb_frontend* fe, fe_status_t *stat) | |||
679 | 679 | ||
680 | static int dib3000mc_read_ber(struct dvb_frontend* fe, u32 *ber) | 680 | static int dib3000mc_read_ber(struct dvb_frontend* fe, u32 *ber) |
681 | { | 681 | { |
682 | struct dib3000_state* state = (struct dib3000_state*) fe->demodulator_priv; | 682 | struct dib3000_state* state = fe->demodulator_priv; |
683 | *ber = ((rd(DIB3000MC_REG_BER_MSB) << 16) | rd(DIB3000MC_REG_BER_LSB)); | 683 | *ber = ((rd(DIB3000MC_REG_BER_MSB) << 16) | rd(DIB3000MC_REG_BER_LSB)); |
684 | return 0; | 684 | return 0; |
685 | } | 685 | } |
686 | 686 | ||
687 | static int dib3000mc_read_unc_blocks(struct dvb_frontend* fe, u32 *unc) | 687 | static int dib3000mc_read_unc_blocks(struct dvb_frontend* fe, u32 *unc) |
688 | { | 688 | { |
689 | struct dib3000_state* state = (struct dib3000_state*) fe->demodulator_priv; | 689 | struct dib3000_state* state = fe->demodulator_priv; |
690 | 690 | ||
691 | *unc = rd(DIB3000MC_REG_PACKET_ERROR_COUNT); | 691 | *unc = rd(DIB3000MC_REG_PACKET_ERROR_COUNT); |
692 | return 0; | 692 | return 0; |
@@ -695,7 +695,7 @@ static int dib3000mc_read_unc_blocks(struct dvb_frontend* fe, u32 *unc) | |||
695 | /* see dib3000mb.c for calculation comments */ | 695 | /* see dib3000mb.c for calculation comments */ |
696 | static int dib3000mc_read_signal_strength(struct dvb_frontend* fe, u16 *strength) | 696 | static int dib3000mc_read_signal_strength(struct dvb_frontend* fe, u16 *strength) |
697 | { | 697 | { |
698 | struct dib3000_state* state = (struct dib3000_state*) fe->demodulator_priv; | 698 | struct dib3000_state* state = fe->demodulator_priv; |
699 | u16 val = rd(DIB3000MC_REG_SIGNAL_NOISE_LSB); | 699 | u16 val = rd(DIB3000MC_REG_SIGNAL_NOISE_LSB); |
700 | *strength = (((val >> 6) & 0xff) << 8) + (val & 0x3f); | 700 | *strength = (((val >> 6) & 0xff) << 8) + (val & 0x3f); |
701 | 701 | ||
@@ -706,7 +706,7 @@ static int dib3000mc_read_signal_strength(struct dvb_frontend* fe, u16 *strength | |||
706 | /* see dib3000mb.c for calculation comments */ | 706 | /* see dib3000mb.c for calculation comments */ |
707 | static int dib3000mc_read_snr(struct dvb_frontend* fe, u16 *snr) | 707 | static int dib3000mc_read_snr(struct dvb_frontend* fe, u16 *snr) |
708 | { | 708 | { |
709 | struct dib3000_state* state = (struct dib3000_state*) fe->demodulator_priv; | 709 | struct dib3000_state* state = fe->demodulator_priv; |
710 | u16 val = rd(DIB3000MC_REG_SIGNAL_NOISE_LSB), | 710 | u16 val = rd(DIB3000MC_REG_SIGNAL_NOISE_LSB), |
711 | val2 = rd(DIB3000MC_REG_SIGNAL_NOISE_MSB); | 711 | val2 = rd(DIB3000MC_REG_SIGNAL_NOISE_MSB); |
712 | u16 sig,noise; | 712 | u16 sig,noise; |
@@ -726,7 +726,7 @@ static int dib3000mc_read_snr(struct dvb_frontend* fe, u16 *snr) | |||
726 | 726 | ||
727 | static int dib3000mc_sleep(struct dvb_frontend* fe) | 727 | static int dib3000mc_sleep(struct dvb_frontend* fe) |
728 | { | 728 | { |
729 | struct dib3000_state* state = (struct dib3000_state*) fe->demodulator_priv; | 729 | struct dib3000_state* state = fe->demodulator_priv; |
730 | 730 | ||
731 | set_or(DIB3000MC_REG_CLK_CFG_7,DIB3000MC_CLK_CFG_7_PWR_DOWN); | 731 | set_or(DIB3000MC_REG_CLK_CFG_7,DIB3000MC_CLK_CFG_7_PWR_DOWN); |
732 | wr(DIB3000MC_REG_CLK_CFG_1,DIB3000MC_CLK_CFG_1_POWER_DOWN); | 732 | wr(DIB3000MC_REG_CLK_CFG_1,DIB3000MC_CLK_CFG_1_POWER_DOWN); |
@@ -756,7 +756,7 @@ static int dib3000mc_set_frontend_and_tuner(struct dvb_frontend* fe, struct dvb_ | |||
756 | 756 | ||
757 | static void dib3000mc_release(struct dvb_frontend* fe) | 757 | static void dib3000mc_release(struct dvb_frontend* fe) |
758 | { | 758 | { |
759 | struct dib3000_state *state = (struct dib3000_state *) fe->demodulator_priv; | 759 | struct dib3000_state *state = fe->demodulator_priv; |
760 | kfree(state); | 760 | kfree(state); |
761 | } | 761 | } |
762 | 762 | ||
@@ -771,7 +771,7 @@ static int dib3000mc_pid_control(struct dvb_frontend *fe,int index, int pid,int | |||
771 | 771 | ||
772 | static int dib3000mc_fifo_control(struct dvb_frontend *fe, int onoff) | 772 | static int dib3000mc_fifo_control(struct dvb_frontend *fe, int onoff) |
773 | { | 773 | { |
774 | struct dib3000_state *state = (struct dib3000_state*) fe->demodulator_priv; | 774 | struct dib3000_state *state = fe->demodulator_priv; |
775 | u16 tmp = rd(DIB3000MC_REG_SMO_MODE); | 775 | u16 tmp = rd(DIB3000MC_REG_SMO_MODE); |
776 | 776 | ||
777 | deb_xfer("%s fifo\n",onoff ? "enabling" : "disabling"); | 777 | deb_xfer("%s fifo\n",onoff ? "enabling" : "disabling"); |
@@ -803,7 +803,7 @@ static int dib3000mc_pid_parse(struct dvb_frontend *fe, int onoff) | |||
803 | 803 | ||
804 | static int dib3000mc_tuner_pass_ctrl(struct dvb_frontend *fe, int onoff, u8 pll_addr) | 804 | static int dib3000mc_tuner_pass_ctrl(struct dvb_frontend *fe, int onoff, u8 pll_addr) |
805 | { | 805 | { |
806 | struct dib3000_state *state = (struct dib3000_state*) fe->demodulator_priv; | 806 | struct dib3000_state *state = fe->demodulator_priv; |
807 | if (onoff) { | 807 | if (onoff) { |
808 | wr(DIB3000MC_REG_TUNER, DIB3000_TUNER_WRITE_ENABLE(pll_addr)); | 808 | wr(DIB3000MC_REG_TUNER, DIB3000_TUNER_WRITE_ENABLE(pll_addr)); |
809 | } else { | 809 | } else { |
@@ -844,7 +844,7 @@ struct dvb_frontend* dib3000mc_attach(const struct dib3000_config* config, | |||
844 | u16 devid; | 844 | u16 devid; |
845 | 845 | ||
846 | /* allocate memory for the internal state */ | 846 | /* allocate memory for the internal state */ |
847 | state = (struct dib3000_state*) kmalloc(sizeof(struct dib3000_state), GFP_KERNEL); | 847 | state = kmalloc(sizeof(struct dib3000_state), GFP_KERNEL); |
848 | if (state == NULL) | 848 | if (state == NULL) |
849 | goto error; | 849 | goto error; |
850 | memset(state,0,sizeof(struct dib3000_state)); | 850 | memset(state,0,sizeof(struct dib3000_state)); |
diff --git a/drivers/media/dvb/frontends/dvb-pll.h b/drivers/media/dvb/frontends/dvb-pll.h index 016c794a5677..c4c3c56c4a81 100644 --- a/drivers/media/dvb/frontends/dvb-pll.h +++ b/drivers/media/dvb/frontends/dvb-pll.h | |||
@@ -2,6 +2,9 @@ | |||
2 | * $Id: dvb-pll.h,v 1.2 2005/02/10 11:43:41 kraxel Exp $ | 2 | * $Id: dvb-pll.h,v 1.2 2005/02/10 11:43:41 kraxel Exp $ |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #ifndef __DVB_PLL_H__ | ||
6 | #define __DVB_PLL_H__ | ||
7 | |||
5 | struct dvb_pll_desc { | 8 | struct dvb_pll_desc { |
6 | char *name; | 9 | char *name; |
7 | u32 min; | 10 | u32 min; |
@@ -26,9 +29,4 @@ extern struct dvb_pll_desc dvb_pll_unknown_1; | |||
26 | int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf, | 29 | int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf, |
27 | u32 freq, int bandwidth); | 30 | u32 freq, int bandwidth); |
28 | 31 | ||
29 | /* | 32 | #endif |
30 | * Local variables: | ||
31 | * c-basic-offset: 8 | ||
32 | * compile-command: "make DVB=1" | ||
33 | * End: | ||
34 | */ | ||
diff --git a/drivers/media/dvb/frontends/dvb_dummy_fe.c b/drivers/media/dvb/frontends/dvb_dummy_fe.c index c05a9b05600c..cff93b9d8ab2 100644 --- a/drivers/media/dvb/frontends/dvb_dummy_fe.c +++ b/drivers/media/dvb/frontends/dvb_dummy_fe.c | |||
@@ -100,7 +100,7 @@ static int dvb_dummy_fe_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t vo | |||
100 | 100 | ||
101 | static void dvb_dummy_fe_release(struct dvb_frontend* fe) | 101 | static void dvb_dummy_fe_release(struct dvb_frontend* fe) |
102 | { | 102 | { |
103 | struct dvb_dummy_fe_state* state = (struct dvb_dummy_fe_state*) fe->demodulator_priv; | 103 | struct dvb_dummy_fe_state* state = fe->demodulator_priv; |
104 | kfree(state); | 104 | kfree(state); |
105 | } | 105 | } |
106 | 106 | ||
@@ -111,7 +111,7 @@ struct dvb_frontend* dvb_dummy_fe_ofdm_attach(void) | |||
111 | struct dvb_dummy_fe_state* state = NULL; | 111 | struct dvb_dummy_fe_state* state = NULL; |
112 | 112 | ||
113 | /* allocate memory for the internal state */ | 113 | /* allocate memory for the internal state */ |
114 | state = (struct dvb_dummy_fe_state*) kmalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL); | 114 | state = kmalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL); |
115 | if (state == NULL) goto error; | 115 | if (state == NULL) goto error; |
116 | 116 | ||
117 | /* setup the state */ | 117 | /* setup the state */ |
@@ -134,7 +134,7 @@ struct dvb_frontend* dvb_dummy_fe_qpsk_attach() | |||
134 | struct dvb_dummy_fe_state* state = NULL; | 134 | struct dvb_dummy_fe_state* state = NULL; |
135 | 135 | ||
136 | /* allocate memory for the internal state */ | 136 | /* allocate memory for the internal state */ |
137 | state = (struct dvb_dummy_fe_state*) kmalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL); | 137 | state = kmalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL); |
138 | if (state == NULL) goto error; | 138 | if (state == NULL) goto error; |
139 | 139 | ||
140 | /* setup the state */ | 140 | /* setup the state */ |
@@ -157,7 +157,7 @@ struct dvb_frontend* dvb_dummy_fe_qam_attach() | |||
157 | struct dvb_dummy_fe_state* state = NULL; | 157 | struct dvb_dummy_fe_state* state = NULL; |
158 | 158 | ||
159 | /* allocate memory for the internal state */ | 159 | /* allocate memory for the internal state */ |
160 | state = (struct dvb_dummy_fe_state*) kmalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL); | 160 | state = kmalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL); |
161 | if (state == NULL) goto error; | 161 | if (state == NULL) goto error; |
162 | 162 | ||
163 | /* setup the state */ | 163 | /* setup the state */ |
diff --git a/drivers/media/dvb/frontends/l64781.c b/drivers/media/dvb/frontends/l64781.c index 9ac95de9834d..031a1ddc7d11 100644 --- a/drivers/media/dvb/frontends/l64781.c +++ b/drivers/media/dvb/frontends/l64781.c | |||
@@ -121,7 +121,7 @@ static int reset_and_configure (struct l64781_state* state) | |||
121 | 121 | ||
122 | static int apply_frontend_param (struct dvb_frontend* fe, struct dvb_frontend_parameters *param) | 122 | static int apply_frontend_param (struct dvb_frontend* fe, struct dvb_frontend_parameters *param) |
123 | { | 123 | { |
124 | struct l64781_state* state = (struct l64781_state*) fe->demodulator_priv; | 124 | struct l64781_state* state = fe->demodulator_priv; |
125 | /* The coderates for FEC_NONE, FEC_4_5 and FEC_FEC_6_7 are arbitrary */ | 125 | /* The coderates for FEC_NONE, FEC_4_5 and FEC_FEC_6_7 are arbitrary */ |
126 | static const u8 fec_tab[] = { 7, 0, 1, 2, 9, 3, 10, 4 }; | 126 | static const u8 fec_tab[] = { 7, 0, 1, 2, 9, 3, 10, 4 }; |
127 | /* QPSK, QAM_16, QAM_64 */ | 127 | /* QPSK, QAM_16, QAM_64 */ |
@@ -234,7 +234,7 @@ static int apply_frontend_param (struct dvb_frontend* fe, struct dvb_frontend_pa | |||
234 | 234 | ||
235 | static int get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters* param) | 235 | static int get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters* param) |
236 | { | 236 | { |
237 | struct l64781_state* state = (struct l64781_state*) fe->demodulator_priv; | 237 | struct l64781_state* state = fe->demodulator_priv; |
238 | int tmp; | 238 | int tmp; |
239 | 239 | ||
240 | 240 | ||
@@ -352,7 +352,7 @@ static int get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters* | |||
352 | 352 | ||
353 | static int l64781_read_status(struct dvb_frontend* fe, fe_status_t* status) | 353 | static int l64781_read_status(struct dvb_frontend* fe, fe_status_t* status) |
354 | { | 354 | { |
355 | struct l64781_state* state = (struct l64781_state*) fe->demodulator_priv; | 355 | struct l64781_state* state = fe->demodulator_priv; |
356 | int sync = l64781_readreg (state, 0x32); | 356 | int sync = l64781_readreg (state, 0x32); |
357 | int gain = l64781_readreg (state, 0x0e); | 357 | int gain = l64781_readreg (state, 0x0e); |
358 | 358 | ||
@@ -381,7 +381,7 @@ static int l64781_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
381 | 381 | ||
382 | static int l64781_read_ber(struct dvb_frontend* fe, u32* ber) | 382 | static int l64781_read_ber(struct dvb_frontend* fe, u32* ber) |
383 | { | 383 | { |
384 | struct l64781_state* state = (struct l64781_state*) fe->demodulator_priv; | 384 | struct l64781_state* state = fe->demodulator_priv; |
385 | 385 | ||
386 | /* XXX FIXME: set up counting period (reg 0x26...0x28) | 386 | /* XXX FIXME: set up counting period (reg 0x26...0x28) |
387 | */ | 387 | */ |
@@ -393,7 +393,7 @@ static int l64781_read_ber(struct dvb_frontend* fe, u32* ber) | |||
393 | 393 | ||
394 | static int l64781_read_signal_strength(struct dvb_frontend* fe, u16* signal_strength) | 394 | static int l64781_read_signal_strength(struct dvb_frontend* fe, u16* signal_strength) |
395 | { | 395 | { |
396 | struct l64781_state* state = (struct l64781_state*) fe->demodulator_priv; | 396 | struct l64781_state* state = fe->demodulator_priv; |
397 | 397 | ||
398 | u8 gain = l64781_readreg (state, 0x0e); | 398 | u8 gain = l64781_readreg (state, 0x0e); |
399 | *signal_strength = (gain << 8) | gain; | 399 | *signal_strength = (gain << 8) | gain; |
@@ -403,7 +403,7 @@ static int l64781_read_signal_strength(struct dvb_frontend* fe, u16* signal_stre | |||
403 | 403 | ||
404 | static int l64781_read_snr(struct dvb_frontend* fe, u16* snr) | 404 | static int l64781_read_snr(struct dvb_frontend* fe, u16* snr) |
405 | { | 405 | { |
406 | struct l64781_state* state = (struct l64781_state*) fe->demodulator_priv; | 406 | struct l64781_state* state = fe->demodulator_priv; |
407 | 407 | ||
408 | u8 avg_quality = 0xff - l64781_readreg (state, 0x33); | 408 | u8 avg_quality = 0xff - l64781_readreg (state, 0x33); |
409 | *snr = (avg_quality << 8) | avg_quality; /* not exact, but...*/ | 409 | *snr = (avg_quality << 8) | avg_quality; /* not exact, but...*/ |
@@ -413,7 +413,7 @@ static int l64781_read_snr(struct dvb_frontend* fe, u16* snr) | |||
413 | 413 | ||
414 | static int l64781_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | 414 | static int l64781_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) |
415 | { | 415 | { |
416 | struct l64781_state* state = (struct l64781_state*) fe->demodulator_priv; | 416 | struct l64781_state* state = fe->demodulator_priv; |
417 | 417 | ||
418 | *ucblocks = l64781_readreg (state, 0x37) | 418 | *ucblocks = l64781_readreg (state, 0x37) |
419 | | (l64781_readreg (state, 0x38) << 8); | 419 | | (l64781_readreg (state, 0x38) << 8); |
@@ -423,7 +423,7 @@ static int l64781_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | |||
423 | 423 | ||
424 | static int l64781_sleep(struct dvb_frontend* fe) | 424 | static int l64781_sleep(struct dvb_frontend* fe) |
425 | { | 425 | { |
426 | struct l64781_state* state = (struct l64781_state*) fe->demodulator_priv; | 426 | struct l64781_state* state = fe->demodulator_priv; |
427 | 427 | ||
428 | /* Power down */ | 428 | /* Power down */ |
429 | return l64781_writereg (state, 0x3e, 0x5a); | 429 | return l64781_writereg (state, 0x3e, 0x5a); |
@@ -431,7 +431,7 @@ static int l64781_sleep(struct dvb_frontend* fe) | |||
431 | 431 | ||
432 | static int l64781_init(struct dvb_frontend* fe) | 432 | static int l64781_init(struct dvb_frontend* fe) |
433 | { | 433 | { |
434 | struct l64781_state* state = (struct l64781_state*) fe->demodulator_priv; | 434 | struct l64781_state* state = fe->demodulator_priv; |
435 | 435 | ||
436 | reset_and_configure (state); | 436 | reset_and_configure (state); |
437 | 437 | ||
@@ -484,7 +484,7 @@ static int l64781_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend | |||
484 | 484 | ||
485 | static void l64781_release(struct dvb_frontend* fe) | 485 | static void l64781_release(struct dvb_frontend* fe) |
486 | { | 486 | { |
487 | struct l64781_state* state = (struct l64781_state*) fe->demodulator_priv; | 487 | struct l64781_state* state = fe->demodulator_priv; |
488 | kfree(state); | 488 | kfree(state); |
489 | } | 489 | } |
490 | 490 | ||
@@ -501,7 +501,7 @@ struct dvb_frontend* l64781_attach(const struct l64781_config* config, | |||
501 | { .addr = config->demod_address, .flags = I2C_M_RD, .buf = b1, .len = 1 } }; | 501 | { .addr = config->demod_address, .flags = I2C_M_RD, .buf = b1, .len = 1 } }; |
502 | 502 | ||
503 | /* allocate memory for the internal state */ | 503 | /* allocate memory for the internal state */ |
504 | state = (struct l64781_state*) kmalloc(sizeof(struct l64781_state), GFP_KERNEL); | 504 | state = kmalloc(sizeof(struct l64781_state), GFP_KERNEL); |
505 | if (state == NULL) goto error; | 505 | if (state == NULL) goto error; |
506 | 506 | ||
507 | /* setup the state */ | 507 | /* setup the state */ |
diff --git a/drivers/media/dvb/frontends/mt312.c b/drivers/media/dvb/frontends/mt312.c index 176a22e3441b..e455aecd76b2 100644 --- a/drivers/media/dvb/frontends/mt312.c +++ b/drivers/media/dvb/frontends/mt312.c | |||
@@ -226,7 +226,7 @@ static int mt312_get_code_rate(struct mt312_state* state, fe_code_rate_t *cr) | |||
226 | 226 | ||
227 | static int mt312_initfe(struct dvb_frontend* fe) | 227 | static int mt312_initfe(struct dvb_frontend* fe) |
228 | { | 228 | { |
229 | struct mt312_state *state = (struct mt312_state*) fe->demodulator_priv; | 229 | struct mt312_state *state = fe->demodulator_priv; |
230 | int ret; | 230 | int ret; |
231 | u8 buf[2]; | 231 | u8 buf[2]; |
232 | 232 | ||
@@ -287,7 +287,7 @@ static int mt312_initfe(struct dvb_frontend* fe) | |||
287 | static int mt312_send_master_cmd(struct dvb_frontend* fe, | 287 | static int mt312_send_master_cmd(struct dvb_frontend* fe, |
288 | struct dvb_diseqc_master_cmd *c) | 288 | struct dvb_diseqc_master_cmd *c) |
289 | { | 289 | { |
290 | struct mt312_state *state = (struct mt312_state*) fe->demodulator_priv; | 290 | struct mt312_state *state = fe->demodulator_priv; |
291 | int ret; | 291 | int ret; |
292 | u8 diseqc_mode; | 292 | u8 diseqc_mode; |
293 | 293 | ||
@@ -318,7 +318,7 @@ static int mt312_send_master_cmd(struct dvb_frontend* fe, | |||
318 | 318 | ||
319 | static int mt312_send_burst(struct dvb_frontend* fe, const fe_sec_mini_cmd_t c) | 319 | static int mt312_send_burst(struct dvb_frontend* fe, const fe_sec_mini_cmd_t c) |
320 | { | 320 | { |
321 | struct mt312_state *state = (struct mt312_state*) fe->demodulator_priv; | 321 | struct mt312_state *state = fe->demodulator_priv; |
322 | const u8 mini_tab[2] = { 0x02, 0x03 }; | 322 | const u8 mini_tab[2] = { 0x02, 0x03 }; |
323 | 323 | ||
324 | int ret; | 324 | int ret; |
@@ -340,7 +340,7 @@ static int mt312_send_burst(struct dvb_frontend* fe, const fe_sec_mini_cmd_t c) | |||
340 | 340 | ||
341 | static int mt312_set_tone(struct dvb_frontend* fe, const fe_sec_tone_mode_t t) | 341 | static int mt312_set_tone(struct dvb_frontend* fe, const fe_sec_tone_mode_t t) |
342 | { | 342 | { |
343 | struct mt312_state *state = (struct mt312_state*) fe->demodulator_priv; | 343 | struct mt312_state *state = fe->demodulator_priv; |
344 | const u8 tone_tab[2] = { 0x01, 0x00 }; | 344 | const u8 tone_tab[2] = { 0x01, 0x00 }; |
345 | 345 | ||
346 | int ret; | 346 | int ret; |
@@ -362,7 +362,7 @@ static int mt312_set_tone(struct dvb_frontend* fe, const fe_sec_tone_mode_t t) | |||
362 | 362 | ||
363 | static int mt312_set_voltage(struct dvb_frontend* fe, const fe_sec_voltage_t v) | 363 | static int mt312_set_voltage(struct dvb_frontend* fe, const fe_sec_voltage_t v) |
364 | { | 364 | { |
365 | struct mt312_state *state = (struct mt312_state*) fe->demodulator_priv; | 365 | struct mt312_state *state = fe->demodulator_priv; |
366 | const u8 volt_tab[3] = { 0x00, 0x40, 0x00 }; | 366 | const u8 volt_tab[3] = { 0x00, 0x40, 0x00 }; |
367 | 367 | ||
368 | if (v > SEC_VOLTAGE_OFF) | 368 | if (v > SEC_VOLTAGE_OFF) |
@@ -373,7 +373,7 @@ static int mt312_set_voltage(struct dvb_frontend* fe, const fe_sec_voltage_t v) | |||
373 | 373 | ||
374 | static int mt312_read_status(struct dvb_frontend* fe, fe_status_t *s) | 374 | static int mt312_read_status(struct dvb_frontend* fe, fe_status_t *s) |
375 | { | 375 | { |
376 | struct mt312_state *state = (struct mt312_state*) fe->demodulator_priv; | 376 | struct mt312_state *state = fe->demodulator_priv; |
377 | int ret; | 377 | int ret; |
378 | u8 status[3]; | 378 | u8 status[3]; |
379 | 379 | ||
@@ -400,7 +400,7 @@ static int mt312_read_status(struct dvb_frontend* fe, fe_status_t *s) | |||
400 | 400 | ||
401 | static int mt312_read_ber(struct dvb_frontend* fe, u32 *ber) | 401 | static int mt312_read_ber(struct dvb_frontend* fe, u32 *ber) |
402 | { | 402 | { |
403 | struct mt312_state *state = (struct mt312_state*) fe->demodulator_priv; | 403 | struct mt312_state *state = fe->demodulator_priv; |
404 | int ret; | 404 | int ret; |
405 | u8 buf[3]; | 405 | u8 buf[3]; |
406 | 406 | ||
@@ -414,7 +414,7 @@ static int mt312_read_ber(struct dvb_frontend* fe, u32 *ber) | |||
414 | 414 | ||
415 | static int mt312_read_signal_strength(struct dvb_frontend* fe, u16 *signal_strength) | 415 | static int mt312_read_signal_strength(struct dvb_frontend* fe, u16 *signal_strength) |
416 | { | 416 | { |
417 | struct mt312_state *state = (struct mt312_state*) fe->demodulator_priv; | 417 | struct mt312_state *state = fe->demodulator_priv; |
418 | int ret; | 418 | int ret; |
419 | u8 buf[3]; | 419 | u8 buf[3]; |
420 | u16 agc; | 420 | u16 agc; |
@@ -435,7 +435,7 @@ static int mt312_read_signal_strength(struct dvb_frontend* fe, u16 *signal_stren | |||
435 | 435 | ||
436 | static int mt312_read_snr(struct dvb_frontend* fe, u16 *snr) | 436 | static int mt312_read_snr(struct dvb_frontend* fe, u16 *snr) |
437 | { | 437 | { |
438 | struct mt312_state *state = (struct mt312_state*) fe->demodulator_priv; | 438 | struct mt312_state *state = fe->demodulator_priv; |
439 | int ret; | 439 | int ret; |
440 | u8 buf[2]; | 440 | u8 buf[2]; |
441 | 441 | ||
@@ -449,7 +449,7 @@ static int mt312_read_snr(struct dvb_frontend* fe, u16 *snr) | |||
449 | 449 | ||
450 | static int mt312_read_ucblocks(struct dvb_frontend* fe, u32 *ubc) | 450 | static int mt312_read_ucblocks(struct dvb_frontend* fe, u32 *ubc) |
451 | { | 451 | { |
452 | struct mt312_state *state = (struct mt312_state*) fe->demodulator_priv; | 452 | struct mt312_state *state = fe->demodulator_priv; |
453 | int ret; | 453 | int ret; |
454 | u8 buf[2]; | 454 | u8 buf[2]; |
455 | 455 | ||
@@ -464,7 +464,7 @@ static int mt312_read_ucblocks(struct dvb_frontend* fe, u32 *ubc) | |||
464 | static int mt312_set_frontend(struct dvb_frontend* fe, | 464 | static int mt312_set_frontend(struct dvb_frontend* fe, |
465 | struct dvb_frontend_parameters *p) | 465 | struct dvb_frontend_parameters *p) |
466 | { | 466 | { |
467 | struct mt312_state *state = (struct mt312_state*) fe->demodulator_priv; | 467 | struct mt312_state *state = fe->demodulator_priv; |
468 | int ret; | 468 | int ret; |
469 | u8 buf[5], config_val; | 469 | u8 buf[5], config_val; |
470 | u16 sr; | 470 | u16 sr; |
@@ -560,7 +560,7 @@ static int mt312_set_frontend(struct dvb_frontend* fe, | |||
560 | static int mt312_get_frontend(struct dvb_frontend* fe, | 560 | static int mt312_get_frontend(struct dvb_frontend* fe, |
561 | struct dvb_frontend_parameters *p) | 561 | struct dvb_frontend_parameters *p) |
562 | { | 562 | { |
563 | struct mt312_state *state = (struct mt312_state*) fe->demodulator_priv; | 563 | struct mt312_state *state = fe->demodulator_priv; |
564 | int ret; | 564 | int ret; |
565 | 565 | ||
566 | if ((ret = mt312_get_inversion(state, &p->inversion)) < 0) | 566 | if ((ret = mt312_get_inversion(state, &p->inversion)) < 0) |
@@ -577,7 +577,7 @@ static int mt312_get_frontend(struct dvb_frontend* fe, | |||
577 | 577 | ||
578 | static int mt312_sleep(struct dvb_frontend* fe) | 578 | static int mt312_sleep(struct dvb_frontend* fe) |
579 | { | 579 | { |
580 | struct mt312_state *state = (struct mt312_state*) fe->demodulator_priv; | 580 | struct mt312_state *state = fe->demodulator_priv; |
581 | int ret; | 581 | int ret; |
582 | u8 config; | 582 | u8 config; |
583 | 583 | ||
@@ -605,7 +605,7 @@ static int mt312_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_ | |||
605 | 605 | ||
606 | static void mt312_release(struct dvb_frontend* fe) | 606 | static void mt312_release(struct dvb_frontend* fe) |
607 | { | 607 | { |
608 | struct mt312_state* state = (struct mt312_state*) fe->demodulator_priv; | 608 | struct mt312_state* state = fe->demodulator_priv; |
609 | kfree(state); | 609 | kfree(state); |
610 | } | 610 | } |
611 | 611 | ||
@@ -617,7 +617,7 @@ struct dvb_frontend* vp310_attach(const struct mt312_config* config, | |||
617 | struct mt312_state* state = NULL; | 617 | struct mt312_state* state = NULL; |
618 | 618 | ||
619 | /* allocate memory for the internal state */ | 619 | /* allocate memory for the internal state */ |
620 | state = (struct mt312_state*) kmalloc(sizeof(struct mt312_state), GFP_KERNEL); | 620 | state = kmalloc(sizeof(struct mt312_state), GFP_KERNEL); |
621 | if (state == NULL) | 621 | if (state == NULL) |
622 | goto error; | 622 | goto error; |
623 | 623 | ||
@@ -651,7 +651,7 @@ struct dvb_frontend* mt312_attach(const struct mt312_config* config, | |||
651 | struct mt312_state* state = NULL; | 651 | struct mt312_state* state = NULL; |
652 | 652 | ||
653 | /* allocate memory for the internal state */ | 653 | /* allocate memory for the internal state */ |
654 | state = (struct mt312_state*) kmalloc(sizeof(struct mt312_state), GFP_KERNEL); | 654 | state = kmalloc(sizeof(struct mt312_state), GFP_KERNEL); |
655 | if (state == NULL) | 655 | if (state == NULL) |
656 | goto error; | 656 | goto error; |
657 | 657 | ||
diff --git a/drivers/media/dvb/frontends/mt352.c b/drivers/media/dvb/frontends/mt352.c index 50326c7248fa..d32dc4de9e7f 100644 --- a/drivers/media/dvb/frontends/mt352.c +++ b/drivers/media/dvb/frontends/mt352.c | |||
@@ -46,7 +46,7 @@ struct mt352_state { | |||
46 | struct dvb_frontend_ops ops; | 46 | struct dvb_frontend_ops ops; |
47 | 47 | ||
48 | /* configuration settings */ | 48 | /* configuration settings */ |
49 | const struct mt352_config* config; | 49 | struct mt352_config config; |
50 | }; | 50 | }; |
51 | 51 | ||
52 | static int debug; | 52 | static int debug; |
@@ -59,7 +59,7 @@ static int mt352_single_write(struct dvb_frontend *fe, u8 reg, u8 val) | |||
59 | { | 59 | { |
60 | struct mt352_state* state = fe->demodulator_priv; | 60 | struct mt352_state* state = fe->demodulator_priv; |
61 | u8 buf[2] = { reg, val }; | 61 | u8 buf[2] = { reg, val }; |
62 | struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, | 62 | struct i2c_msg msg = { .addr = state->config.demod_address, .flags = 0, |
63 | .buf = buf, .len = 2 }; | 63 | .buf = buf, .len = 2 }; |
64 | int err = i2c_transfer(state->i2c, &msg, 1); | 64 | int err = i2c_transfer(state->i2c, &msg, 1); |
65 | if (err != 1) { | 65 | if (err != 1) { |
@@ -84,10 +84,10 @@ static int mt352_read_register(struct mt352_state* state, u8 reg) | |||
84 | int ret; | 84 | int ret; |
85 | u8 b0 [] = { reg }; | 85 | u8 b0 [] = { reg }; |
86 | u8 b1 [] = { 0 }; | 86 | u8 b1 [] = { 0 }; |
87 | struct i2c_msg msg [] = { { .addr = state->config->demod_address, | 87 | struct i2c_msg msg [] = { { .addr = state->config.demod_address, |
88 | .flags = 0, | 88 | .flags = 0, |
89 | .buf = b0, .len = 1 }, | 89 | .buf = b0, .len = 1 }, |
90 | { .addr = state->config->demod_address, | 90 | { .addr = state->config.demod_address, |
91 | .flags = I2C_M_RD, | 91 | .flags = I2C_M_RD, |
92 | .buf = b1, .len = 1 } }; | 92 | .buf = b1, .len = 1 } }; |
93 | 93 | ||
@@ -102,11 +102,6 @@ static int mt352_read_register(struct mt352_state* state, u8 reg) | |||
102 | return b1[0]; | 102 | return b1[0]; |
103 | } | 103 | } |
104 | 104 | ||
105 | int mt352_read(struct dvb_frontend *fe, u8 reg) | ||
106 | { | ||
107 | return mt352_read_register(fe->demodulator_priv,reg); | ||
108 | } | ||
109 | |||
110 | static int mt352_sleep(struct dvb_frontend* fe) | 105 | static int mt352_sleep(struct dvb_frontend* fe) |
111 | { | 106 | { |
112 | static u8 mt352_softdown[] = { CLOCK_CTL, 0x20, 0x08 }; | 107 | static u8 mt352_softdown[] = { CLOCK_CTL, 0x20, 0x08 }; |
@@ -134,8 +129,8 @@ static void mt352_calc_nominal_rate(struct mt352_state* state, | |||
134 | bw = 8; | 129 | bw = 8; |
135 | break; | 130 | break; |
136 | } | 131 | } |
137 | if (state->config->adc_clock) | 132 | if (state->config.adc_clock) |
138 | adc_clock = state->config->adc_clock; | 133 | adc_clock = state->config.adc_clock; |
139 | 134 | ||
140 | value = 64 * bw * (1<<16) / (7 * 8); | 135 | value = 64 * bw * (1<<16) / (7 * 8); |
141 | value = value * 1000 / adc_clock; | 136 | value = value * 1000 / adc_clock; |
@@ -152,10 +147,10 @@ static void mt352_calc_input_freq(struct mt352_state* state, | |||
152 | int if2 = 36167; /* 36.166667 MHz */ | 147 | int if2 = 36167; /* 36.166667 MHz */ |
153 | int ife,value; | 148 | int ife,value; |
154 | 149 | ||
155 | if (state->config->adc_clock) | 150 | if (state->config.adc_clock) |
156 | adc_clock = state->config->adc_clock; | 151 | adc_clock = state->config.adc_clock; |
157 | if (state->config->if2) | 152 | if (state->config.if2) |
158 | if2 = state->config->if2; | 153 | if2 = state->config.if2; |
159 | 154 | ||
160 | ife = (2*adc_clock - if2); | 155 | ife = (2*adc_clock - if2); |
161 | value = -16374 * ife / adc_clock; | 156 | value = -16374 * ife / adc_clock; |
@@ -289,10 +284,10 @@ static int mt352_set_parameters(struct dvb_frontend* fe, | |||
289 | 284 | ||
290 | mt352_calc_nominal_rate(state, op->bandwidth, buf+4); | 285 | mt352_calc_nominal_rate(state, op->bandwidth, buf+4); |
291 | mt352_calc_input_freq(state, buf+6); | 286 | mt352_calc_input_freq(state, buf+6); |
292 | state->config->pll_set(fe, param, buf+8); | 287 | state->config.pll_set(fe, param, buf+8); |
293 | 288 | ||
294 | mt352_write(fe, buf, sizeof(buf)); | 289 | mt352_write(fe, buf, sizeof(buf)); |
295 | if (state->config->no_tuner) { | 290 | if (state->config.no_tuner) { |
296 | /* start decoding */ | 291 | /* start decoding */ |
297 | mt352_write(fe, fsm_go, 2); | 292 | mt352_write(fe, fsm_go, 2); |
298 | } else { | 293 | } else { |
@@ -516,7 +511,7 @@ static int mt352_init(struct dvb_frontend* fe) | |||
516 | 511 | ||
517 | /* Do a "hard" reset */ | 512 | /* Do a "hard" reset */ |
518 | mt352_write(fe, mt352_reset_attach, sizeof(mt352_reset_attach)); | 513 | mt352_write(fe, mt352_reset_attach, sizeof(mt352_reset_attach)); |
519 | return state->config->demod_init(fe); | 514 | return state->config.demod_init(fe); |
520 | } | 515 | } |
521 | 516 | ||
522 | return 0; | 517 | return 0; |
@@ -541,8 +536,8 @@ struct dvb_frontend* mt352_attach(const struct mt352_config* config, | |||
541 | memset(state,0,sizeof(*state)); | 536 | memset(state,0,sizeof(*state)); |
542 | 537 | ||
543 | /* setup the state */ | 538 | /* setup the state */ |
544 | state->config = config; | ||
545 | state->i2c = i2c; | 539 | state->i2c = i2c; |
540 | memcpy(&state->config,config,sizeof(struct mt352_config)); | ||
546 | memcpy(&state->ops, &mt352_ops, sizeof(struct dvb_frontend_ops)); | 541 | memcpy(&state->ops, &mt352_ops, sizeof(struct dvb_frontend_ops)); |
547 | 542 | ||
548 | /* check if the demod is there */ | 543 | /* check if the demod is there */ |
@@ -601,10 +596,3 @@ MODULE_LICENSE("GPL"); | |||
601 | 596 | ||
602 | EXPORT_SYMBOL(mt352_attach); | 597 | EXPORT_SYMBOL(mt352_attach); |
603 | EXPORT_SYMBOL(mt352_write); | 598 | EXPORT_SYMBOL(mt352_write); |
604 | EXPORT_SYMBOL(mt352_read); | ||
605 | /* | ||
606 | * Local variables: | ||
607 | * c-basic-offset: 8 | ||
608 | * compile-command: "make DVB=1" | ||
609 | * End: | ||
610 | */ | ||
diff --git a/drivers/media/dvb/frontends/mt352.h b/drivers/media/dvb/frontends/mt352.h index f5d8a5aed8a9..03040cd595bb 100644 --- a/drivers/media/dvb/frontends/mt352.h +++ b/drivers/media/dvb/frontends/mt352.h | |||
@@ -61,12 +61,5 @@ extern struct dvb_frontend* mt352_attach(const struct mt352_config* config, | |||
61 | struct i2c_adapter* i2c); | 61 | struct i2c_adapter* i2c); |
62 | 62 | ||
63 | extern int mt352_write(struct dvb_frontend* fe, u8* ibuf, int ilen); | 63 | extern int mt352_write(struct dvb_frontend* fe, u8* ibuf, int ilen); |
64 | extern int mt352_read(struct dvb_frontend *fe, u8 reg); | ||
65 | 64 | ||
66 | #endif // MT352_H | 65 | #endif // MT352_H |
67 | |||
68 | /* | ||
69 | * Local variables: | ||
70 | * c-basic-offset: 8 | ||
71 | * End: | ||
72 | */ | ||
diff --git a/drivers/media/dvb/frontends/nxt2002.c b/drivers/media/dvb/frontends/nxt2002.c index 4743aa17406e..35a1d60f1927 100644 --- a/drivers/media/dvb/frontends/nxt2002.c +++ b/drivers/media/dvb/frontends/nxt2002.c | |||
@@ -241,7 +241,7 @@ static void nxt2002_agc_reset(struct nxt2002_state* state) | |||
241 | static int nxt2002_load_firmware (struct dvb_frontend* fe, const struct firmware *fw) | 241 | static int nxt2002_load_firmware (struct dvb_frontend* fe, const struct firmware *fw) |
242 | { | 242 | { |
243 | 243 | ||
244 | struct nxt2002_state* state = (struct nxt2002_state*) fe->demodulator_priv; | 244 | struct nxt2002_state* state = fe->demodulator_priv; |
245 | u8 buf[256],written = 0,chunkpos = 0; | 245 | u8 buf[256],written = 0,chunkpos = 0; |
246 | u16 rambase,position,crc = 0; | 246 | u16 rambase,position,crc = 0; |
247 | 247 | ||
@@ -309,7 +309,7 @@ static int nxt2002_load_firmware (struct dvb_frontend* fe, const struct firmware | |||
309 | static int nxt2002_setup_frontend_parameters (struct dvb_frontend* fe, | 309 | static int nxt2002_setup_frontend_parameters (struct dvb_frontend* fe, |
310 | struct dvb_frontend_parameters *p) | 310 | struct dvb_frontend_parameters *p) |
311 | { | 311 | { |
312 | struct nxt2002_state* state = (struct nxt2002_state*) fe->demodulator_priv; | 312 | struct nxt2002_state* state = fe->demodulator_priv; |
313 | u32 freq = 0; | 313 | u32 freq = 0; |
314 | u16 tunerfreq = 0; | 314 | u16 tunerfreq = 0; |
315 | u8 buf[4]; | 315 | u8 buf[4]; |
@@ -343,8 +343,6 @@ static int nxt2002_setup_frontend_parameters (struct dvb_frontend* fe, | |||
343 | /* reset the agc now that tuning has been completed */ | 343 | /* reset the agc now that tuning has been completed */ |
344 | nxt2002_agc_reset(state); | 344 | nxt2002_agc_reset(state); |
345 | 345 | ||
346 | |||
347 | |||
348 | /* set target power level */ | 346 | /* set target power level */ |
349 | switch (p->u.vsb.modulation) { | 347 | switch (p->u.vsb.modulation) { |
350 | case QAM_64: | 348 | case QAM_64: |
@@ -453,7 +451,7 @@ static int nxt2002_setup_frontend_parameters (struct dvb_frontend* fe, | |||
453 | 451 | ||
454 | static int nxt2002_read_status(struct dvb_frontend* fe, fe_status_t* status) | 452 | static int nxt2002_read_status(struct dvb_frontend* fe, fe_status_t* status) |
455 | { | 453 | { |
456 | struct nxt2002_state* state = (struct nxt2002_state*) fe->demodulator_priv; | 454 | struct nxt2002_state* state = fe->demodulator_priv; |
457 | u8 lock; | 455 | u8 lock; |
458 | i2c_readbytes(state,0x31,&lock,1); | 456 | i2c_readbytes(state,0x31,&lock,1); |
459 | 457 | ||
@@ -470,7 +468,7 @@ static int nxt2002_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
470 | 468 | ||
471 | static int nxt2002_read_ber(struct dvb_frontend* fe, u32* ber) | 469 | static int nxt2002_read_ber(struct dvb_frontend* fe, u32* ber) |
472 | { | 470 | { |
473 | struct nxt2002_state* state = (struct nxt2002_state*) fe->demodulator_priv; | 471 | struct nxt2002_state* state = fe->demodulator_priv; |
474 | u8 b[3]; | 472 | u8 b[3]; |
475 | 473 | ||
476 | nxt2002_readreg_multibyte(state,0xE6,b,3); | 474 | nxt2002_readreg_multibyte(state,0xE6,b,3); |
@@ -482,7 +480,7 @@ static int nxt2002_read_ber(struct dvb_frontend* fe, u32* ber) | |||
482 | 480 | ||
483 | static int nxt2002_read_signal_strength(struct dvb_frontend* fe, u16* strength) | 481 | static int nxt2002_read_signal_strength(struct dvb_frontend* fe, u16* strength) |
484 | { | 482 | { |
485 | struct nxt2002_state* state = (struct nxt2002_state*) fe->demodulator_priv; | 483 | struct nxt2002_state* state = fe->demodulator_priv; |
486 | u8 b[2]; | 484 | u8 b[2]; |
487 | u16 temp = 0; | 485 | u16 temp = 0; |
488 | 486 | ||
@@ -502,7 +500,7 @@ static int nxt2002_read_signal_strength(struct dvb_frontend* fe, u16* strength) | |||
502 | static int nxt2002_read_snr(struct dvb_frontend* fe, u16* snr) | 500 | static int nxt2002_read_snr(struct dvb_frontend* fe, u16* snr) |
503 | { | 501 | { |
504 | 502 | ||
505 | struct nxt2002_state* state = (struct nxt2002_state*) fe->demodulator_priv; | 503 | struct nxt2002_state* state = fe->demodulator_priv; |
506 | u8 b[2]; | 504 | u8 b[2]; |
507 | u16 temp = 0, temp2; | 505 | u16 temp = 0, temp2; |
508 | u32 snrdb = 0; | 506 | u32 snrdb = 0; |
@@ -536,7 +534,7 @@ static int nxt2002_read_snr(struct dvb_frontend* fe, u16* snr) | |||
536 | 534 | ||
537 | static int nxt2002_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | 535 | static int nxt2002_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) |
538 | { | 536 | { |
539 | struct nxt2002_state* state = (struct nxt2002_state*) fe->demodulator_priv; | 537 | struct nxt2002_state* state = fe->demodulator_priv; |
540 | u8 b[3]; | 538 | u8 b[3]; |
541 | 539 | ||
542 | nxt2002_readreg_multibyte(state,0xE6,b,3); | 540 | nxt2002_readreg_multibyte(state,0xE6,b,3); |
@@ -552,7 +550,7 @@ static int nxt2002_sleep(struct dvb_frontend* fe) | |||
552 | 550 | ||
553 | static int nxt2002_init(struct dvb_frontend* fe) | 551 | static int nxt2002_init(struct dvb_frontend* fe) |
554 | { | 552 | { |
555 | struct nxt2002_state* state = (struct nxt2002_state*) fe->demodulator_priv; | 553 | struct nxt2002_state* state = fe->demodulator_priv; |
556 | const struct firmware *fw; | 554 | const struct firmware *fw; |
557 | int ret; | 555 | int ret; |
558 | u8 buf[2]; | 556 | u8 buf[2]; |
@@ -624,7 +622,7 @@ static int nxt2002_get_tune_settings(struct dvb_frontend* fe, struct dvb_fronten | |||
624 | 622 | ||
625 | static void nxt2002_release(struct dvb_frontend* fe) | 623 | static void nxt2002_release(struct dvb_frontend* fe) |
626 | { | 624 | { |
627 | struct nxt2002_state* state = (struct nxt2002_state*) fe->demodulator_priv; | 625 | struct nxt2002_state* state = fe->demodulator_priv; |
628 | kfree(state); | 626 | kfree(state); |
629 | } | 627 | } |
630 | 628 | ||
@@ -637,7 +635,7 @@ struct dvb_frontend* nxt2002_attach(const struct nxt2002_config* config, | |||
637 | u8 buf [] = {0,0,0,0,0}; | 635 | u8 buf [] = {0,0,0,0,0}; |
638 | 636 | ||
639 | /* allocate memory for the internal state */ | 637 | /* allocate memory for the internal state */ |
640 | state = (struct nxt2002_state*) kmalloc(sizeof(struct nxt2002_state), GFP_KERNEL); | 638 | state = kmalloc(sizeof(struct nxt2002_state), GFP_KERNEL); |
641 | if (state == NULL) goto error; | 639 | if (state == NULL) goto error; |
642 | 640 | ||
643 | /* setup the state */ | 641 | /* setup the state */ |
diff --git a/drivers/media/dvb/frontends/nxt6000.c b/drivers/media/dvb/frontends/nxt6000.c index a41f7da8b842..966de9853d18 100644 --- a/drivers/media/dvb/frontends/nxt6000.c +++ b/drivers/media/dvb/frontends/nxt6000.c | |||
@@ -176,11 +176,16 @@ static int nxt6000_set_transmission_mode(struct nxt6000_state* state, fe_transmi | |||
176 | 176 | ||
177 | static void nxt6000_setup(struct dvb_frontend* fe) | 177 | static void nxt6000_setup(struct dvb_frontend* fe) |
178 | { | 178 | { |
179 | struct nxt6000_state* state = (struct nxt6000_state*) fe->demodulator_priv; | 179 | struct nxt6000_state* state = fe->demodulator_priv; |
180 | 180 | ||
181 | nxt6000_writereg(state, RS_COR_SYNC_PARAM, SYNC_PARAM); | 181 | nxt6000_writereg(state, RS_COR_SYNC_PARAM, SYNC_PARAM); |
182 | nxt6000_writereg(state, BER_CTRL, /*(1 << 2) | */ (0x01 << 1) | 0x01); | 182 | nxt6000_writereg(state, BER_CTRL, /*(1 << 2) | */ (0x01 << 1) | 0x01); |
183 | nxt6000_writereg(state, VIT_COR_CTL, VIT_COR_RESYNC); | 183 | nxt6000_writereg(state, VIT_BERTIME_2, 0x00); // BER Timer = 0x000200 * 256 = 131072 bits |
184 | nxt6000_writereg(state, VIT_BERTIME_1, 0x02); // | ||
185 | nxt6000_writereg(state, VIT_BERTIME_0, 0x00); // | ||
186 | nxt6000_writereg(state, VIT_COR_INTEN, 0x98); // Enable BER interrupts | ||
187 | nxt6000_writereg(state, VIT_COR_CTL, 0x82); // Enable BER measurement | ||
188 | nxt6000_writereg(state, VIT_COR_CTL, VIT_COR_RESYNC | 0x02 ); | ||
184 | nxt6000_writereg(state, OFDM_COR_CTL, (0x01 << 5) | (nxt6000_readreg(state, OFDM_COR_CTL) & 0x0F)); | 189 | nxt6000_writereg(state, OFDM_COR_CTL, (0x01 << 5) | (nxt6000_readreg(state, OFDM_COR_CTL) & 0x0F)); |
185 | nxt6000_writereg(state, OFDM_COR_MODEGUARD, FORCEMODE8K | 0x02); | 190 | nxt6000_writereg(state, OFDM_COR_MODEGUARD, FORCEMODE8K | 0x02); |
186 | nxt6000_writereg(state, OFDM_AGC_CTL, AGCLAST | INITIAL_AGC_BW); | 191 | nxt6000_writereg(state, OFDM_AGC_CTL, AGCLAST | INITIAL_AGC_BW); |
@@ -422,7 +427,7 @@ static void nxt6000_dump_status(struct nxt6000_state *state) | |||
422 | static int nxt6000_read_status(struct dvb_frontend* fe, fe_status_t* status) | 427 | static int nxt6000_read_status(struct dvb_frontend* fe, fe_status_t* status) |
423 | { | 428 | { |
424 | u8 core_status; | 429 | u8 core_status; |
425 | struct nxt6000_state* state = (struct nxt6000_state*) fe->demodulator_priv; | 430 | struct nxt6000_state* state = fe->demodulator_priv; |
426 | 431 | ||
427 | *status = 0; | 432 | *status = 0; |
428 | 433 | ||
@@ -451,7 +456,7 @@ static int nxt6000_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
451 | 456 | ||
452 | static int nxt6000_init(struct dvb_frontend* fe) | 457 | static int nxt6000_init(struct dvb_frontend* fe) |
453 | { | 458 | { |
454 | struct nxt6000_state* state = (struct nxt6000_state*) fe->demodulator_priv; | 459 | struct nxt6000_state* state = fe->demodulator_priv; |
455 | 460 | ||
456 | nxt6000_reset(state); | 461 | nxt6000_reset(state); |
457 | nxt6000_setup(fe); | 462 | nxt6000_setup(fe); |
@@ -461,7 +466,7 @@ static int nxt6000_init(struct dvb_frontend* fe) | |||
461 | 466 | ||
462 | static int nxt6000_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *param) | 467 | static int nxt6000_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *param) |
463 | { | 468 | { |
464 | struct nxt6000_state* state = (struct nxt6000_state*) fe->demodulator_priv; | 469 | struct nxt6000_state* state = fe->demodulator_priv; |
465 | int result; | 470 | int result; |
466 | 471 | ||
467 | nxt6000_writereg(state, ENABLE_TUNER_IIC, 0x01); /* open i2c bus switch */ | 472 | nxt6000_writereg(state, ENABLE_TUNER_IIC, 0x01); /* open i2c bus switch */ |
@@ -482,10 +487,44 @@ static int nxt6000_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
482 | 487 | ||
483 | static void nxt6000_release(struct dvb_frontend* fe) | 488 | static void nxt6000_release(struct dvb_frontend* fe) |
484 | { | 489 | { |
485 | struct nxt6000_state* state = (struct nxt6000_state*) fe->demodulator_priv; | 490 | struct nxt6000_state* state = fe->demodulator_priv; |
486 | kfree(state); | 491 | kfree(state); |
487 | } | 492 | } |
488 | 493 | ||
494 | static int nxt6000_read_snr(struct dvb_frontend* fe, u16* snr) | ||
495 | { | ||
496 | struct nxt6000_state* state = fe->demodulator_priv; | ||
497 | |||
498 | *snr = nxt6000_readreg( state, OFDM_CHC_SNR) / 8; | ||
499 | |||
500 | return 0; | ||
501 | } | ||
502 | |||
503 | static int nxt6000_read_ber(struct dvb_frontend* fe, u32* ber) | ||
504 | { | ||
505 | struct nxt6000_state* state = fe->demodulator_priv; | ||
506 | |||
507 | nxt6000_writereg( state, VIT_COR_INTSTAT, 0x18 ); | ||
508 | |||
509 | *ber = (nxt6000_readreg( state, VIT_BER_1 ) << 8 ) | | ||
510 | nxt6000_readreg( state, VIT_BER_0 ); | ||
511 | |||
512 | nxt6000_writereg( state, VIT_COR_INTSTAT, 0x18); // Clear BER Done interrupts | ||
513 | |||
514 | return 0; | ||
515 | } | ||
516 | |||
517 | static int nxt6000_read_signal_strength(struct dvb_frontend* fe, u16* signal_strength) | ||
518 | { | ||
519 | struct nxt6000_state* state = fe->demodulator_priv; | ||
520 | |||
521 | *signal_strength = (short) (511 - | ||
522 | (nxt6000_readreg(state, AGC_GAIN_1) + | ||
523 | ((nxt6000_readreg(state, AGC_GAIN_2) & 0x03) << 8))); | ||
524 | |||
525 | return 0; | ||
526 | } | ||
527 | |||
489 | static struct dvb_frontend_ops nxt6000_ops; | 528 | static struct dvb_frontend_ops nxt6000_ops; |
490 | 529 | ||
491 | struct dvb_frontend* nxt6000_attach(const struct nxt6000_config* config, | 530 | struct dvb_frontend* nxt6000_attach(const struct nxt6000_config* config, |
@@ -494,7 +533,7 @@ struct dvb_frontend* nxt6000_attach(const struct nxt6000_config* config, | |||
494 | struct nxt6000_state* state = NULL; | 533 | struct nxt6000_state* state = NULL; |
495 | 534 | ||
496 | /* allocate memory for the internal state */ | 535 | /* allocate memory for the internal state */ |
497 | state = (struct nxt6000_state*) kmalloc(sizeof(struct nxt6000_state), GFP_KERNEL); | 536 | state = kmalloc(sizeof(struct nxt6000_state), GFP_KERNEL); |
498 | if (state == NULL) goto error; | 537 | if (state == NULL) goto error; |
499 | 538 | ||
500 | /* setup the state */ | 539 | /* setup the state */ |
@@ -542,6 +581,9 @@ static struct dvb_frontend_ops nxt6000_ops = { | |||
542 | .set_frontend = nxt6000_set_frontend, | 581 | .set_frontend = nxt6000_set_frontend, |
543 | 582 | ||
544 | .read_status = nxt6000_read_status, | 583 | .read_status = nxt6000_read_status, |
584 | .read_ber = nxt6000_read_ber, | ||
585 | .read_signal_strength = nxt6000_read_signal_strength, | ||
586 | .read_snr = nxt6000_read_snr, | ||
545 | }; | 587 | }; |
546 | 588 | ||
547 | module_param(debug, int, 0644); | 589 | module_param(debug, int, 0644); |
diff --git a/drivers/media/dvb/frontends/nxt6000_priv.h b/drivers/media/dvb/frontends/nxt6000_priv.h index 64b1a89b2a22..0422e580038a 100644 --- a/drivers/media/dvb/frontends/nxt6000_priv.h +++ b/drivers/media/dvb/frontends/nxt6000_priv.h | |||
@@ -65,12 +65,27 @@ | |||
65 | #define BER_DONE (0x08) | 65 | #define BER_DONE (0x08) |
66 | #define BER_OVERFLOW (0x10) | 66 | #define BER_OVERFLOW (0x10) |
67 | 67 | ||
68 | /* 0x38 VIT_BERTIME_2 */ | ||
69 | #define VIT_BERTIME_2 (0x38) | ||
70 | |||
71 | /* 0x39 VIT_BERTIME_1 */ | ||
72 | #define VIT_BERTIME_1 (0x39) | ||
73 | |||
74 | /* 0x3A VIT_BERTIME_0 */ | ||
75 | #define VIT_BERTIME_0 (0x3a) | ||
76 | |||
68 | /* 0x38 OFDM_BERTimer *//* Use the alias registers */ | 77 | /* 0x38 OFDM_BERTimer *//* Use the alias registers */ |
69 | #define A_VIT_BER_TIMER_0 (0x1D) | 78 | #define A_VIT_BER_TIMER_0 (0x1D) |
70 | 79 | ||
71 | /* 0x3A VIT_BER_TIMER_0 *//* Use the alias registers */ | 80 | /* 0x3A VIT_BER_TIMER_0 *//* Use the alias registers */ |
72 | #define A_VIT_BER_0 (0x1B) | 81 | #define A_VIT_BER_0 (0x1B) |
73 | 82 | ||
83 | /* 0x3B VIT_BER_1 */ | ||
84 | #define VIT_BER_1 (0x3b) | ||
85 | |||
86 | /* 0x3C VIT_BER_0 */ | ||
87 | #define VIT_BER_0 (0x3c) | ||
88 | |||
74 | /* 0x40 OFDM_COR_CTL */ | 89 | /* 0x40 OFDM_COR_CTL */ |
75 | #define OFDM_COR_CTL (0x40) | 90 | #define OFDM_COR_CTL (0x40) |
76 | #define COREACT (0x20) | 91 | #define COREACT (0x20) |
@@ -117,6 +132,12 @@ | |||
117 | #define OFDM_ITB_CTL (0x4B) | 132 | #define OFDM_ITB_CTL (0x4B) |
118 | #define ITBINV (0x01) | 133 | #define ITBINV (0x01) |
119 | 134 | ||
135 | /* 0x49 AGC_GAIN_1 */ | ||
136 | #define AGC_GAIN_1 (0x49) | ||
137 | |||
138 | /* 0x4A AGC_GAIN_2 */ | ||
139 | #define AGC_GAIN_2 (0x4A) | ||
140 | |||
120 | /* 0x4C OFDM_ITB_FREQ_1 */ | 141 | /* 0x4C OFDM_ITB_FREQ_1 */ |
121 | #define OFDM_ITB_FREQ_1 (0x4C) | 142 | #define OFDM_ITB_FREQ_1 (0x4C) |
122 | 143 | ||
diff --git a/drivers/media/dvb/frontends/or51132.c b/drivers/media/dvb/frontends/or51132.c index df5dee7760a3..cc0a77c790f1 100644 --- a/drivers/media/dvb/frontends/or51132.c +++ b/drivers/media/dvb/frontends/or51132.c | |||
@@ -102,7 +102,7 @@ static u8 i2c_readbytes (struct or51132_state* state, u8 reg, u8* buf, int len) | |||
102 | 102 | ||
103 | static int or51132_load_firmware (struct dvb_frontend* fe, const struct firmware *fw) | 103 | static int or51132_load_firmware (struct dvb_frontend* fe, const struct firmware *fw) |
104 | { | 104 | { |
105 | struct or51132_state* state = (struct or51132_state*) fe->demodulator_priv; | 105 | struct or51132_state* state = fe->demodulator_priv; |
106 | static u8 run_buf[] = {0x7F,0x01}; | 106 | static u8 run_buf[] = {0x7F,0x01}; |
107 | static u8 get_ver_buf[] = {0x04,0x00,0x30,0x00,0x00}; | 107 | static u8 get_ver_buf[] = {0x04,0x00,0x30,0x00,0x00}; |
108 | u8 rec_buf[14]; | 108 | u8 rec_buf[14]; |
@@ -240,7 +240,7 @@ static int or51132_sleep(struct dvb_frontend* fe) | |||
240 | 240 | ||
241 | static int or51132_setmode(struct dvb_frontend* fe) | 241 | static int or51132_setmode(struct dvb_frontend* fe) |
242 | { | 242 | { |
243 | struct or51132_state* state = (struct or51132_state*) fe->demodulator_priv; | 243 | struct or51132_state* state = fe->demodulator_priv; |
244 | unsigned char cmd_buf[4]; | 244 | unsigned char cmd_buf[4]; |
245 | 245 | ||
246 | dprintk("setmode %d\n",(int)state->current_modulation); | 246 | dprintk("setmode %d\n",(int)state->current_modulation); |
@@ -316,7 +316,7 @@ static int or51132_set_parameters(struct dvb_frontend* fe, | |||
316 | { | 316 | { |
317 | int ret; | 317 | int ret; |
318 | u8 buf[4]; | 318 | u8 buf[4]; |
319 | struct or51132_state* state = (struct or51132_state*) fe->demodulator_priv; | 319 | struct or51132_state* state = fe->demodulator_priv; |
320 | const struct firmware *fw; | 320 | const struct firmware *fw; |
321 | 321 | ||
322 | /* Change only if we are actually changing the modulation */ | 322 | /* Change only if we are actually changing the modulation */ |
@@ -391,7 +391,7 @@ static int or51132_set_parameters(struct dvb_frontend* fe, | |||
391 | 391 | ||
392 | static int or51132_read_status(struct dvb_frontend* fe, fe_status_t* status) | 392 | static int or51132_read_status(struct dvb_frontend* fe, fe_status_t* status) |
393 | { | 393 | { |
394 | struct or51132_state* state = (struct or51132_state*) fe->demodulator_priv; | 394 | struct or51132_state* state = fe->demodulator_priv; |
395 | unsigned char rec_buf[2]; | 395 | unsigned char rec_buf[2]; |
396 | unsigned char snd_buf[2]; | 396 | unsigned char snd_buf[2]; |
397 | *status = 0; | 397 | *status = 0; |
@@ -464,7 +464,7 @@ static unsigned int i20Log10(unsigned short val) | |||
464 | 464 | ||
465 | static int or51132_read_signal_strength(struct dvb_frontend* fe, u16* strength) | 465 | static int or51132_read_signal_strength(struct dvb_frontend* fe, u16* strength) |
466 | { | 466 | { |
467 | struct or51132_state* state = (struct or51132_state*) fe->demodulator_priv; | 467 | struct or51132_state* state = fe->demodulator_priv; |
468 | unsigned char rec_buf[2]; | 468 | unsigned char rec_buf[2]; |
469 | unsigned char snd_buf[2]; | 469 | unsigned char snd_buf[2]; |
470 | u8 rcvr_stat; | 470 | u8 rcvr_stat; |
@@ -512,7 +512,7 @@ static int or51132_read_signal_strength(struct dvb_frontend* fe, u16* strength) | |||
512 | 512 | ||
513 | static int or51132_read_snr(struct dvb_frontend* fe, u16* snr) | 513 | static int or51132_read_snr(struct dvb_frontend* fe, u16* snr) |
514 | { | 514 | { |
515 | struct or51132_state* state = (struct or51132_state*) fe->demodulator_priv; | 515 | struct or51132_state* state = fe->demodulator_priv; |
516 | unsigned char rec_buf[2]; | 516 | unsigned char rec_buf[2]; |
517 | unsigned char snd_buf[2]; | 517 | unsigned char snd_buf[2]; |
518 | u16 snr_equ; | 518 | u16 snr_equ; |
@@ -549,7 +549,7 @@ static int or51132_get_tune_settings(struct dvb_frontend* fe, struct dvb_fronten | |||
549 | 549 | ||
550 | static void or51132_release(struct dvb_frontend* fe) | 550 | static void or51132_release(struct dvb_frontend* fe) |
551 | { | 551 | { |
552 | struct or51132_state* state = (struct or51132_state*) fe->demodulator_priv; | 552 | struct or51132_state* state = fe->demodulator_priv; |
553 | kfree(state); | 553 | kfree(state); |
554 | } | 554 | } |
555 | 555 | ||
diff --git a/drivers/media/dvb/frontends/sp8870.c b/drivers/media/dvb/frontends/sp8870.c index 58ad34ef0a00..764a95a2e212 100644 --- a/drivers/media/dvb/frontends/sp8870.c +++ b/drivers/media/dvb/frontends/sp8870.c | |||
@@ -248,7 +248,7 @@ static int sp8870_wake_up(struct sp8870_state* state) | |||
248 | static int sp8870_set_frontend_parameters (struct dvb_frontend* fe, | 248 | static int sp8870_set_frontend_parameters (struct dvb_frontend* fe, |
249 | struct dvb_frontend_parameters *p) | 249 | struct dvb_frontend_parameters *p) |
250 | { | 250 | { |
251 | struct sp8870_state* state = (struct sp8870_state*) fe->demodulator_priv; | 251 | struct sp8870_state* state = fe->demodulator_priv; |
252 | int err; | 252 | int err; |
253 | u16 reg0xc05; | 253 | u16 reg0xc05; |
254 | 254 | ||
@@ -302,7 +302,7 @@ static int sp8870_set_frontend_parameters (struct dvb_frontend* fe, | |||
302 | 302 | ||
303 | static int sp8870_init (struct dvb_frontend* fe) | 303 | static int sp8870_init (struct dvb_frontend* fe) |
304 | { | 304 | { |
305 | struct sp8870_state* state = (struct sp8870_state*) fe->demodulator_priv; | 305 | struct sp8870_state* state = fe->demodulator_priv; |
306 | const struct firmware *fw = NULL; | 306 | const struct firmware *fw = NULL; |
307 | 307 | ||
308 | sp8870_wake_up(state); | 308 | sp8870_wake_up(state); |
@@ -358,7 +358,7 @@ static int sp8870_init (struct dvb_frontend* fe) | |||
358 | 358 | ||
359 | static int sp8870_read_status (struct dvb_frontend* fe, fe_status_t * fe_status) | 359 | static int sp8870_read_status (struct dvb_frontend* fe, fe_status_t * fe_status) |
360 | { | 360 | { |
361 | struct sp8870_state* state = (struct sp8870_state*) fe->demodulator_priv; | 361 | struct sp8870_state* state = fe->demodulator_priv; |
362 | int status; | 362 | int status; |
363 | int signal; | 363 | int signal; |
364 | 364 | ||
@@ -384,7 +384,7 @@ static int sp8870_read_status (struct dvb_frontend* fe, fe_status_t * fe_status) | |||
384 | 384 | ||
385 | static int sp8870_read_ber (struct dvb_frontend* fe, u32 * ber) | 385 | static int sp8870_read_ber (struct dvb_frontend* fe, u32 * ber) |
386 | { | 386 | { |
387 | struct sp8870_state* state = (struct sp8870_state*) fe->demodulator_priv; | 387 | struct sp8870_state* state = fe->demodulator_priv; |
388 | int ret; | 388 | int ret; |
389 | u32 tmp; | 389 | u32 tmp; |
390 | 390 | ||
@@ -412,7 +412,7 @@ static int sp8870_read_ber (struct dvb_frontend* fe, u32 * ber) | |||
412 | 412 | ||
413 | static int sp8870_read_signal_strength(struct dvb_frontend* fe, u16 * signal) | 413 | static int sp8870_read_signal_strength(struct dvb_frontend* fe, u16 * signal) |
414 | { | 414 | { |
415 | struct sp8870_state* state = (struct sp8870_state*) fe->demodulator_priv; | 415 | struct sp8870_state* state = fe->demodulator_priv; |
416 | int ret; | 416 | int ret; |
417 | u16 tmp; | 417 | u16 tmp; |
418 | 418 | ||
@@ -438,7 +438,7 @@ static int sp8870_read_signal_strength(struct dvb_frontend* fe, u16 * signal) | |||
438 | 438 | ||
439 | static int sp8870_read_uncorrected_blocks (struct dvb_frontend* fe, u32* ublocks) | 439 | static int sp8870_read_uncorrected_blocks (struct dvb_frontend* fe, u32* ublocks) |
440 | { | 440 | { |
441 | struct sp8870_state* state = (struct sp8870_state*) fe->demodulator_priv; | 441 | struct sp8870_state* state = fe->demodulator_priv; |
442 | int ret; | 442 | int ret; |
443 | 443 | ||
444 | *ublocks = 0; | 444 | *ublocks = 0; |
@@ -467,7 +467,7 @@ static int switches = 0; | |||
467 | 467 | ||
468 | static int sp8870_set_frontend (struct dvb_frontend* fe, struct dvb_frontend_parameters *p) | 468 | static int sp8870_set_frontend (struct dvb_frontend* fe, struct dvb_frontend_parameters *p) |
469 | { | 469 | { |
470 | struct sp8870_state* state = (struct sp8870_state*) fe->demodulator_priv; | 470 | struct sp8870_state* state = fe->demodulator_priv; |
471 | 471 | ||
472 | /* | 472 | /* |
473 | The firmware of the sp8870 sometimes locks up after setting frontend parameters. | 473 | The firmware of the sp8870 sometimes locks up after setting frontend parameters. |
@@ -524,7 +524,7 @@ static int sp8870_set_frontend (struct dvb_frontend* fe, struct dvb_frontend_par | |||
524 | 524 | ||
525 | static int sp8870_sleep(struct dvb_frontend* fe) | 525 | static int sp8870_sleep(struct dvb_frontend* fe) |
526 | { | 526 | { |
527 | struct sp8870_state* state = (struct sp8870_state*) fe->demodulator_priv; | 527 | struct sp8870_state* state = fe->demodulator_priv; |
528 | 528 | ||
529 | // tristate TS output and disable interface pins | 529 | // tristate TS output and disable interface pins |
530 | return sp8870_writereg(state, 0xC18, 0x000); | 530 | return sp8870_writereg(state, 0xC18, 0x000); |
@@ -540,7 +540,7 @@ static int sp8870_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend | |||
540 | 540 | ||
541 | static void sp8870_release(struct dvb_frontend* fe) | 541 | static void sp8870_release(struct dvb_frontend* fe) |
542 | { | 542 | { |
543 | struct sp8870_state* state = (struct sp8870_state*) fe->demodulator_priv; | 543 | struct sp8870_state* state = fe->demodulator_priv; |
544 | kfree(state); | 544 | kfree(state); |
545 | } | 545 | } |
546 | 546 | ||
@@ -552,7 +552,7 @@ struct dvb_frontend* sp8870_attach(const struct sp8870_config* config, | |||
552 | struct sp8870_state* state = NULL; | 552 | struct sp8870_state* state = NULL; |
553 | 553 | ||
554 | /* allocate memory for the internal state */ | 554 | /* allocate memory for the internal state */ |
555 | state = (struct sp8870_state*) kmalloc(sizeof(struct sp8870_state), GFP_KERNEL); | 555 | state = kmalloc(sizeof(struct sp8870_state), GFP_KERNEL); |
556 | if (state == NULL) goto error; | 556 | if (state == NULL) goto error; |
557 | 557 | ||
558 | /* setup the state */ | 558 | /* setup the state */ |
diff --git a/drivers/media/dvb/frontends/sp887x.c b/drivers/media/dvb/frontends/sp887x.c index 7eae833ece49..d868a6927a16 100644 --- a/drivers/media/dvb/frontends/sp887x.c +++ b/drivers/media/dvb/frontends/sp887x.c | |||
@@ -135,7 +135,7 @@ static void sp887x_setup_agc (struct sp887x_state* state) | |||
135 | */ | 135 | */ |
136 | static int sp887x_initial_setup (struct dvb_frontend* fe, const struct firmware *fw) | 136 | static int sp887x_initial_setup (struct dvb_frontend* fe, const struct firmware *fw) |
137 | { | 137 | { |
138 | struct sp887x_state* state = (struct sp887x_state*) fe->demodulator_priv; | 138 | struct sp887x_state* state = fe->demodulator_priv; |
139 | u8 buf [BLOCKSIZE+2]; | 139 | u8 buf [BLOCKSIZE+2]; |
140 | int i; | 140 | int i; |
141 | int fw_size = fw->size; | 141 | int fw_size = fw->size; |
@@ -344,7 +344,7 @@ static void sp887x_correct_offsets (struct sp887x_state* state, | |||
344 | static int sp887x_setup_frontend_parameters (struct dvb_frontend* fe, | 344 | static int sp887x_setup_frontend_parameters (struct dvb_frontend* fe, |
345 | struct dvb_frontend_parameters *p) | 345 | struct dvb_frontend_parameters *p) |
346 | { | 346 | { |
347 | struct sp887x_state* state = (struct sp887x_state*) fe->demodulator_priv; | 347 | struct sp887x_state* state = fe->demodulator_priv; |
348 | int actual_freq, err; | 348 | int actual_freq, err; |
349 | u16 val, reg0xc05; | 349 | u16 val, reg0xc05; |
350 | 350 | ||
@@ -405,7 +405,7 @@ static int sp887x_setup_frontend_parameters (struct dvb_frontend* fe, | |||
405 | 405 | ||
406 | static int sp887x_read_status(struct dvb_frontend* fe, fe_status_t* status) | 406 | static int sp887x_read_status(struct dvb_frontend* fe, fe_status_t* status) |
407 | { | 407 | { |
408 | struct sp887x_state* state = (struct sp887x_state*) fe->demodulator_priv; | 408 | struct sp887x_state* state = fe->demodulator_priv; |
409 | u16 snr12 = sp887x_readreg(state, 0xf16); | 409 | u16 snr12 = sp887x_readreg(state, 0xf16); |
410 | u16 sync0x200 = sp887x_readreg(state, 0x200); | 410 | u16 sync0x200 = sp887x_readreg(state, 0x200); |
411 | u16 sync0xf17 = sp887x_readreg(state, 0xf17); | 411 | u16 sync0xf17 = sp887x_readreg(state, 0xf17); |
@@ -439,7 +439,7 @@ static int sp887x_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
439 | 439 | ||
440 | static int sp887x_read_ber(struct dvb_frontend* fe, u32* ber) | 440 | static int sp887x_read_ber(struct dvb_frontend* fe, u32* ber) |
441 | { | 441 | { |
442 | struct sp887x_state* state = (struct sp887x_state*) fe->demodulator_priv; | 442 | struct sp887x_state* state = fe->demodulator_priv; |
443 | 443 | ||
444 | *ber = (sp887x_readreg(state, 0xc08) & 0x3f) | | 444 | *ber = (sp887x_readreg(state, 0xc08) & 0x3f) | |
445 | (sp887x_readreg(state, 0xc07) << 6); | 445 | (sp887x_readreg(state, 0xc07) << 6); |
@@ -453,7 +453,7 @@ static int sp887x_read_ber(struct dvb_frontend* fe, u32* ber) | |||
453 | 453 | ||
454 | static int sp887x_read_signal_strength(struct dvb_frontend* fe, u16* strength) | 454 | static int sp887x_read_signal_strength(struct dvb_frontend* fe, u16* strength) |
455 | { | 455 | { |
456 | struct sp887x_state* state = (struct sp887x_state*) fe->demodulator_priv; | 456 | struct sp887x_state* state = fe->demodulator_priv; |
457 | 457 | ||
458 | u16 snr12 = sp887x_readreg(state, 0xf16); | 458 | u16 snr12 = sp887x_readreg(state, 0xf16); |
459 | u32 signal = 3 * (snr12 << 4); | 459 | u32 signal = 3 * (snr12 << 4); |
@@ -464,7 +464,7 @@ static int sp887x_read_signal_strength(struct dvb_frontend* fe, u16* strength) | |||
464 | 464 | ||
465 | static int sp887x_read_snr(struct dvb_frontend* fe, u16* snr) | 465 | static int sp887x_read_snr(struct dvb_frontend* fe, u16* snr) |
466 | { | 466 | { |
467 | struct sp887x_state* state = (struct sp887x_state*) fe->demodulator_priv; | 467 | struct sp887x_state* state = fe->demodulator_priv; |
468 | 468 | ||
469 | u16 snr12 = sp887x_readreg(state, 0xf16); | 469 | u16 snr12 = sp887x_readreg(state, 0xf16); |
470 | *snr = (snr12 << 4) | (snr12 >> 8); | 470 | *snr = (snr12 << 4) | (snr12 >> 8); |
@@ -474,7 +474,7 @@ static int sp887x_read_snr(struct dvb_frontend* fe, u16* snr) | |||
474 | 474 | ||
475 | static int sp887x_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | 475 | static int sp887x_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) |
476 | { | 476 | { |
477 | struct sp887x_state* state = (struct sp887x_state*) fe->demodulator_priv; | 477 | struct sp887x_state* state = fe->demodulator_priv; |
478 | 478 | ||
479 | *ucblocks = sp887x_readreg(state, 0xc0c); | 479 | *ucblocks = sp887x_readreg(state, 0xc0c); |
480 | if (*ucblocks == 0xfff) | 480 | if (*ucblocks == 0xfff) |
@@ -485,7 +485,7 @@ static int sp887x_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | |||
485 | 485 | ||
486 | static int sp887x_sleep(struct dvb_frontend* fe) | 486 | static int sp887x_sleep(struct dvb_frontend* fe) |
487 | { | 487 | { |
488 | struct sp887x_state* state = (struct sp887x_state*) fe->demodulator_priv; | 488 | struct sp887x_state* state = fe->demodulator_priv; |
489 | 489 | ||
490 | /* tristate TS output and disable interface pins */ | 490 | /* tristate TS output and disable interface pins */ |
491 | sp887x_writereg(state, 0xc18, 0x000); | 491 | sp887x_writereg(state, 0xc18, 0x000); |
@@ -495,7 +495,7 @@ static int sp887x_sleep(struct dvb_frontend* fe) | |||
495 | 495 | ||
496 | static int sp887x_init(struct dvb_frontend* fe) | 496 | static int sp887x_init(struct dvb_frontend* fe) |
497 | { | 497 | { |
498 | struct sp887x_state* state = (struct sp887x_state*) fe->demodulator_priv; | 498 | struct sp887x_state* state = fe->demodulator_priv; |
499 | const struct firmware *fw = NULL; | 499 | const struct firmware *fw = NULL; |
500 | int ret; | 500 | int ret; |
501 | 501 | ||
@@ -534,7 +534,7 @@ static int sp887x_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend | |||
534 | 534 | ||
535 | static void sp887x_release(struct dvb_frontend* fe) | 535 | static void sp887x_release(struct dvb_frontend* fe) |
536 | { | 536 | { |
537 | struct sp887x_state* state = (struct sp887x_state*) fe->demodulator_priv; | 537 | struct sp887x_state* state = fe->demodulator_priv; |
538 | kfree(state); | 538 | kfree(state); |
539 | } | 539 | } |
540 | 540 | ||
@@ -546,7 +546,7 @@ struct dvb_frontend* sp887x_attach(const struct sp887x_config* config, | |||
546 | struct sp887x_state* state = NULL; | 546 | struct sp887x_state* state = NULL; |
547 | 547 | ||
548 | /* allocate memory for the internal state */ | 548 | /* allocate memory for the internal state */ |
549 | state = (struct sp887x_state*) kmalloc(sizeof(struct sp887x_state), GFP_KERNEL); | 549 | state = kmalloc(sizeof(struct sp887x_state), GFP_KERNEL); |
550 | if (state == NULL) goto error; | 550 | if (state == NULL) goto error; |
551 | 551 | ||
552 | /* setup the state */ | 552 | /* setup the state */ |
diff --git a/drivers/media/dvb/frontends/stv0297.c b/drivers/media/dvb/frontends/stv0297.c index 502c6403dfc6..e681263bf079 100644 --- a/drivers/media/dvb/frontends/stv0297.c +++ b/drivers/media/dvb/frontends/stv0297.c | |||
@@ -365,7 +365,7 @@ static int stv0297_set_inversion(struct stv0297_state *state, fe_spectral_invers | |||
365 | 365 | ||
366 | int stv0297_enable_plli2c(struct dvb_frontend *fe) | 366 | int stv0297_enable_plli2c(struct dvb_frontend *fe) |
367 | { | 367 | { |
368 | struct stv0297_state *state = (struct stv0297_state *) fe->demodulator_priv; | 368 | struct stv0297_state *state = fe->demodulator_priv; |
369 | 369 | ||
370 | stv0297_writereg(state, 0x87, 0x78); | 370 | stv0297_writereg(state, 0x87, 0x78); |
371 | stv0297_writereg(state, 0x86, 0xc8); | 371 | stv0297_writereg(state, 0x86, 0xc8); |
@@ -375,7 +375,7 @@ int stv0297_enable_plli2c(struct dvb_frontend *fe) | |||
375 | 375 | ||
376 | static int stv0297_init(struct dvb_frontend *fe) | 376 | static int stv0297_init(struct dvb_frontend *fe) |
377 | { | 377 | { |
378 | struct stv0297_state *state = (struct stv0297_state *) fe->demodulator_priv; | 378 | struct stv0297_state *state = fe->demodulator_priv; |
379 | int i; | 379 | int i; |
380 | 380 | ||
381 | /* soft reset */ | 381 | /* soft reset */ |
@@ -416,7 +416,7 @@ static int stv0297_init(struct dvb_frontend *fe) | |||
416 | 416 | ||
417 | static int stv0297_sleep(struct dvb_frontend *fe) | 417 | static int stv0297_sleep(struct dvb_frontend *fe) |
418 | { | 418 | { |
419 | struct stv0297_state *state = (struct stv0297_state *) fe->demodulator_priv; | 419 | struct stv0297_state *state = fe->demodulator_priv; |
420 | 420 | ||
421 | stv0297_writereg_mask(state, 0x80, 1, 1); | 421 | stv0297_writereg_mask(state, 0x80, 1, 1); |
422 | 422 | ||
@@ -425,7 +425,7 @@ static int stv0297_sleep(struct dvb_frontend *fe) | |||
425 | 425 | ||
426 | static int stv0297_read_status(struct dvb_frontend *fe, fe_status_t * status) | 426 | static int stv0297_read_status(struct dvb_frontend *fe, fe_status_t * status) |
427 | { | 427 | { |
428 | struct stv0297_state *state = (struct stv0297_state *) fe->demodulator_priv; | 428 | struct stv0297_state *state = fe->demodulator_priv; |
429 | 429 | ||
430 | u8 sync = stv0297_readreg(state, 0xDF); | 430 | u8 sync = stv0297_readreg(state, 0xDF); |
431 | 431 | ||
@@ -438,7 +438,7 @@ static int stv0297_read_status(struct dvb_frontend *fe, fe_status_t * status) | |||
438 | 438 | ||
439 | static int stv0297_read_ber(struct dvb_frontend *fe, u32 * ber) | 439 | static int stv0297_read_ber(struct dvb_frontend *fe, u32 * ber) |
440 | { | 440 | { |
441 | struct stv0297_state *state = (struct stv0297_state *) fe->demodulator_priv; | 441 | struct stv0297_state *state = fe->demodulator_priv; |
442 | u8 BER[3]; | 442 | u8 BER[3]; |
443 | 443 | ||
444 | stv0297_writereg(state, 0xA0, 0x80); // Start Counting bit errors for 4096 Bytes | 444 | stv0297_writereg(state, 0xA0, 0x80); // Start Counting bit errors for 4096 Bytes |
@@ -453,7 +453,7 @@ static int stv0297_read_ber(struct dvb_frontend *fe, u32 * ber) | |||
453 | 453 | ||
454 | static int stv0297_read_signal_strength(struct dvb_frontend *fe, u16 * strength) | 454 | static int stv0297_read_signal_strength(struct dvb_frontend *fe, u16 * strength) |
455 | { | 455 | { |
456 | struct stv0297_state *state = (struct stv0297_state *) fe->demodulator_priv; | 456 | struct stv0297_state *state = fe->demodulator_priv; |
457 | u8 STRENGTH[2]; | 457 | u8 STRENGTH[2]; |
458 | 458 | ||
459 | stv0297_readregs(state, 0x41, STRENGTH, 2); | 459 | stv0297_readregs(state, 0x41, STRENGTH, 2); |
@@ -464,7 +464,7 @@ static int stv0297_read_signal_strength(struct dvb_frontend *fe, u16 * strength) | |||
464 | 464 | ||
465 | static int stv0297_read_snr(struct dvb_frontend *fe, u16 * snr) | 465 | static int stv0297_read_snr(struct dvb_frontend *fe, u16 * snr) |
466 | { | 466 | { |
467 | struct stv0297_state *state = (struct stv0297_state *) fe->demodulator_priv; | 467 | struct stv0297_state *state = fe->demodulator_priv; |
468 | u8 SNR[2]; | 468 | u8 SNR[2]; |
469 | 469 | ||
470 | stv0297_readregs(state, 0x07, SNR, 2); | 470 | stv0297_readregs(state, 0x07, SNR, 2); |
@@ -475,7 +475,7 @@ static int stv0297_read_snr(struct dvb_frontend *fe, u16 * snr) | |||
475 | 475 | ||
476 | static int stv0297_read_ucblocks(struct dvb_frontend *fe, u32 * ucblocks) | 476 | static int stv0297_read_ucblocks(struct dvb_frontend *fe, u32 * ucblocks) |
477 | { | 477 | { |
478 | struct stv0297_state *state = (struct stv0297_state *) fe->demodulator_priv; | 478 | struct stv0297_state *state = fe->demodulator_priv; |
479 | 479 | ||
480 | *ucblocks = (stv0297_readreg(state, 0xD5) << 8) | 480 | *ucblocks = (stv0297_readreg(state, 0xD5) << 8) |
481 | | stv0297_readreg(state, 0xD4); | 481 | | stv0297_readreg(state, 0xD4); |
@@ -485,7 +485,7 @@ static int stv0297_read_ucblocks(struct dvb_frontend *fe, u32 * ucblocks) | |||
485 | 485 | ||
486 | static int stv0297_set_frontend(struct dvb_frontend *fe, struct dvb_frontend_parameters *p) | 486 | static int stv0297_set_frontend(struct dvb_frontend *fe, struct dvb_frontend_parameters *p) |
487 | { | 487 | { |
488 | struct stv0297_state *state = (struct stv0297_state *) fe->demodulator_priv; | 488 | struct stv0297_state *state = fe->demodulator_priv; |
489 | int u_threshold; | 489 | int u_threshold; |
490 | int initial_u; | 490 | int initial_u; |
491 | int blind_u; | 491 | int blind_u; |
@@ -689,7 +689,7 @@ timeout: | |||
689 | 689 | ||
690 | static int stv0297_get_frontend(struct dvb_frontend *fe, struct dvb_frontend_parameters *p) | 690 | static int stv0297_get_frontend(struct dvb_frontend *fe, struct dvb_frontend_parameters *p) |
691 | { | 691 | { |
692 | struct stv0297_state *state = (struct stv0297_state *) fe->demodulator_priv; | 692 | struct stv0297_state *state = fe->demodulator_priv; |
693 | int reg_00, reg_83; | 693 | int reg_00, reg_83; |
694 | 694 | ||
695 | reg_00 = stv0297_readreg(state, 0x00); | 695 | reg_00 = stv0297_readreg(state, 0x00); |
@@ -725,7 +725,7 @@ static int stv0297_get_frontend(struct dvb_frontend *fe, struct dvb_frontend_par | |||
725 | 725 | ||
726 | static void stv0297_release(struct dvb_frontend *fe) | 726 | static void stv0297_release(struct dvb_frontend *fe) |
727 | { | 727 | { |
728 | struct stv0297_state *state = (struct stv0297_state *) fe->demodulator_priv; | 728 | struct stv0297_state *state = fe->demodulator_priv; |
729 | kfree(state); | 729 | kfree(state); |
730 | } | 730 | } |
731 | 731 | ||
@@ -737,7 +737,7 @@ struct dvb_frontend *stv0297_attach(const struct stv0297_config *config, | |||
737 | struct stv0297_state *state = NULL; | 737 | struct stv0297_state *state = NULL; |
738 | 738 | ||
739 | /* allocate memory for the internal state */ | 739 | /* allocate memory for the internal state */ |
740 | state = (struct stv0297_state *) kmalloc(sizeof(struct stv0297_state), GFP_KERNEL); | 740 | state = kmalloc(sizeof(struct stv0297_state), GFP_KERNEL); |
741 | if (state == NULL) | 741 | if (state == NULL) |
742 | goto error; | 742 | goto error; |
743 | 743 | ||
diff --git a/drivers/media/dvb/frontends/stv0299.c b/drivers/media/dvb/frontends/stv0299.c index 15b40541b62d..cfa3928bb487 100644 --- a/drivers/media/dvb/frontends/stv0299.c +++ b/drivers/media/dvb/frontends/stv0299.c | |||
@@ -70,6 +70,7 @@ struct stv0299_state { | |||
70 | #define STATUS_UCBLOCKS 1 | 70 | #define STATUS_UCBLOCKS 1 |
71 | 71 | ||
72 | static int debug; | 72 | static int debug; |
73 | static int debug_legacy_dish_switch; | ||
73 | #define dprintk(args...) \ | 74 | #define dprintk(args...) \ |
74 | do { \ | 75 | do { \ |
75 | if (debug) printk(KERN_DEBUG "stv0299: " args); \ | 76 | if (debug) printk(KERN_DEBUG "stv0299: " args); \ |
@@ -93,7 +94,7 @@ static int stv0299_writeregI (struct stv0299_state* state, u8 reg, u8 data) | |||
93 | 94 | ||
94 | int stv0299_writereg (struct dvb_frontend* fe, u8 reg, u8 data) | 95 | int stv0299_writereg (struct dvb_frontend* fe, u8 reg, u8 data) |
95 | { | 96 | { |
96 | struct stv0299_state* state = (struct stv0299_state*) fe->demodulator_priv; | 97 | struct stv0299_state* state = fe->demodulator_priv; |
97 | 98 | ||
98 | return stv0299_writeregI(state, reg, data); | 99 | return stv0299_writeregI(state, reg, data); |
99 | } | 100 | } |
@@ -218,7 +219,7 @@ static int stv0299_wait_diseqc_idle (struct stv0299_state* state, int timeout) | |||
218 | 219 | ||
219 | static int stv0299_set_symbolrate (struct dvb_frontend* fe, u32 srate) | 220 | static int stv0299_set_symbolrate (struct dvb_frontend* fe, u32 srate) |
220 | { | 221 | { |
221 | struct stv0299_state* state = (struct stv0299_state*) fe->demodulator_priv; | 222 | struct stv0299_state* state = fe->demodulator_priv; |
222 | u64 big = srate; | 223 | u64 big = srate; |
223 | u32 ratio; | 224 | u32 ratio; |
224 | 225 | ||
@@ -269,7 +270,7 @@ static int stv0299_get_symbolrate (struct stv0299_state* state) | |||
269 | static int stv0299_send_diseqc_msg (struct dvb_frontend* fe, | 270 | static int stv0299_send_diseqc_msg (struct dvb_frontend* fe, |
270 | struct dvb_diseqc_master_cmd *m) | 271 | struct dvb_diseqc_master_cmd *m) |
271 | { | 272 | { |
272 | struct stv0299_state* state = (struct stv0299_state*) fe->demodulator_priv; | 273 | struct stv0299_state* state = fe->demodulator_priv; |
273 | u8 val; | 274 | u8 val; |
274 | int i; | 275 | int i; |
275 | 276 | ||
@@ -299,7 +300,7 @@ static int stv0299_send_diseqc_msg (struct dvb_frontend* fe, | |||
299 | 300 | ||
300 | static int stv0299_send_diseqc_burst (struct dvb_frontend* fe, fe_sec_mini_cmd_t burst) | 301 | static int stv0299_send_diseqc_burst (struct dvb_frontend* fe, fe_sec_mini_cmd_t burst) |
301 | { | 302 | { |
302 | struct stv0299_state* state = (struct stv0299_state*) fe->demodulator_priv; | 303 | struct stv0299_state* state = fe->demodulator_priv; |
303 | u8 val; | 304 | u8 val; |
304 | 305 | ||
305 | dprintk ("%s\n", __FUNCTION__); | 306 | dprintk ("%s\n", __FUNCTION__); |
@@ -326,7 +327,7 @@ static int stv0299_send_diseqc_burst (struct dvb_frontend* fe, fe_sec_mini_cmd_t | |||
326 | 327 | ||
327 | static int stv0299_set_tone (struct dvb_frontend* fe, fe_sec_tone_mode_t tone) | 328 | static int stv0299_set_tone (struct dvb_frontend* fe, fe_sec_tone_mode_t tone) |
328 | { | 329 | { |
329 | struct stv0299_state* state = (struct stv0299_state*) fe->demodulator_priv; | 330 | struct stv0299_state* state = fe->demodulator_priv; |
330 | u8 val; | 331 | u8 val; |
331 | 332 | ||
332 | if (stv0299_wait_diseqc_idle (state, 100) < 0) | 333 | if (stv0299_wait_diseqc_idle (state, 100) < 0) |
@@ -348,7 +349,7 @@ static int stv0299_set_tone (struct dvb_frontend* fe, fe_sec_tone_mode_t tone) | |||
348 | 349 | ||
349 | static int stv0299_set_voltage (struct dvb_frontend* fe, fe_sec_voltage_t voltage) | 350 | static int stv0299_set_voltage (struct dvb_frontend* fe, fe_sec_voltage_t voltage) |
350 | { | 351 | { |
351 | struct stv0299_state* state = (struct stv0299_state*) fe->demodulator_priv; | 352 | struct stv0299_state* state = fe->demodulator_priv; |
352 | u8 reg0x08; | 353 | u8 reg0x08; |
353 | u8 reg0x0c; | 354 | u8 reg0x0c; |
354 | 355 | ||
@@ -385,34 +386,84 @@ static int stv0299_set_voltage (struct dvb_frontend* fe, fe_sec_voltage_t voltag | |||
385 | }; | 386 | }; |
386 | } | 387 | } |
387 | 388 | ||
388 | static int stv0299_send_legacy_dish_cmd(struct dvb_frontend* fe, u32 cmd) | 389 | static inline s32 stv0299_calc_usec_delay (struct timeval lasttime, struct timeval curtime) |
389 | { | 390 | { |
391 | return ((curtime.tv_usec < lasttime.tv_usec) ? | ||
392 | 1000000 - lasttime.tv_usec + curtime.tv_usec : | ||
393 | curtime.tv_usec - lasttime.tv_usec); | ||
394 | } | ||
395 | |||
396 | static void stv0299_sleep_until (struct timeval *waketime, u32 add_usec) | ||
397 | { | ||
398 | struct timeval lasttime; | ||
399 | s32 delta, newdelta; | ||
400 | |||
401 | waketime->tv_usec += add_usec; | ||
402 | if (waketime->tv_usec >= 1000000) { | ||
403 | waketime->tv_usec -= 1000000; | ||
404 | waketime->tv_sec++; | ||
405 | } | ||
406 | |||
407 | do_gettimeofday (&lasttime); | ||
408 | delta = stv0299_calc_usec_delay (lasttime, *waketime); | ||
409 | if (delta > 2500) { | ||
410 | msleep ((delta - 1500) / 1000); | ||
411 | do_gettimeofday (&lasttime); | ||
412 | newdelta = stv0299_calc_usec_delay (lasttime, *waketime); | ||
413 | delta = (newdelta > delta) ? 0 : newdelta; | ||
414 | } | ||
415 | if (delta > 0) | ||
416 | udelay (delta); | ||
417 | } | ||
418 | |||
419 | static int stv0299_send_legacy_dish_cmd (struct dvb_frontend* fe, u32 cmd) | ||
420 | { | ||
421 | struct stv0299_state* state = fe->demodulator_priv; | ||
422 | u8 reg0x08; | ||
423 | u8 reg0x0c; | ||
424 | u8 lv_mask = 0x40; | ||
390 | u8 last = 1; | 425 | u8 last = 1; |
391 | int i; | 426 | int i; |
427 | struct timeval nexttime; | ||
428 | struct timeval tv[10]; | ||
392 | 429 | ||
393 | /* reset voltage at the end | 430 | reg0x08 = stv0299_readreg (state, 0x08); |
394 | if((0x50 & stv0299_readreg (i2c, 0x0c)) == 0x50) | 431 | reg0x0c = stv0299_readreg (state, 0x0c); |
395 | cmd |= 0x80; | 432 | reg0x0c &= 0x0f; |
396 | else | 433 | stv0299_writeregI (state, 0x08, (reg0x08 & 0x3f) | (state->config->lock_output << 6)); |
397 | cmd &= 0x7F; | 434 | if (state->config->volt13_op0_op1 == STV0299_VOLT13_OP0) |
398 | */ | 435 | lv_mask = 0x10; |
399 | 436 | ||
400 | cmd = cmd << 1; | 437 | cmd = cmd << 1; |
401 | dprintk("%s switch command: 0x%04x\n",__FUNCTION__, cmd); | 438 | if (debug_legacy_dish_switch) |
439 | printk ("%s switch command: 0x%04x\n",__FUNCTION__, cmd); | ||
440 | |||
441 | do_gettimeofday (&nexttime); | ||
442 | if (debug_legacy_dish_switch) | ||
443 | memcpy (&tv[0], &nexttime, sizeof (struct timeval)); | ||
444 | stv0299_writeregI (state, 0x0c, reg0x0c | 0x50); /* set LNB to 18V */ | ||
402 | 445 | ||
403 | stv0299_set_voltage(fe,SEC_VOLTAGE_18); | 446 | stv0299_sleep_until (&nexttime, 32000); |
404 | msleep(32); | ||
405 | 447 | ||
406 | for (i=0; i<9; i++) { | 448 | for (i=0; i<9; i++) { |
449 | if (debug_legacy_dish_switch) | ||
450 | do_gettimeofday (&tv[i+1]); | ||
407 | if((cmd & 0x01) != last) { | 451 | if((cmd & 0x01) != last) { |
408 | stv0299_set_voltage(fe, last ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18); | 452 | /* set voltage to (last ? 13V : 18V) */ |
453 | stv0299_writeregI (state, 0x0c, reg0x0c | (last ? lv_mask : 0x50)); | ||
409 | last = (last) ? 0 : 1; | 454 | last = (last) ? 0 : 1; |
410 | } | 455 | } |
411 | 456 | ||
412 | cmd = cmd >> 1; | 457 | cmd = cmd >> 1; |
413 | 458 | ||
414 | if (i != 8) | 459 | if (i != 8) |
415 | msleep(8); | 460 | stv0299_sleep_until (&nexttime, 8000); |
461 | } | ||
462 | if (debug_legacy_dish_switch) { | ||
463 | printk ("%s(%d): switch delay (should be 32k followed by all 8k\n", | ||
464 | __FUNCTION__, fe->dvb->num); | ||
465 | for (i=1; i < 10; i++) | ||
466 | printk ("%d: %d\n", i, stv0299_calc_usec_delay (tv[i-1] , tv[i])); | ||
416 | } | 467 | } |
417 | 468 | ||
418 | return 0; | 469 | return 0; |
@@ -420,7 +471,7 @@ static int stv0299_send_legacy_dish_cmd(struct dvb_frontend* fe, u32 cmd) | |||
420 | 471 | ||
421 | static int stv0299_init (struct dvb_frontend* fe) | 472 | static int stv0299_init (struct dvb_frontend* fe) |
422 | { | 473 | { |
423 | struct stv0299_state* state = (struct stv0299_state*) fe->demodulator_priv; | 474 | struct stv0299_state* state = fe->demodulator_priv; |
424 | int i; | 475 | int i; |
425 | 476 | ||
426 | dprintk("stv0299: init chip\n"); | 477 | dprintk("stv0299: init chip\n"); |
@@ -439,7 +490,7 @@ static int stv0299_init (struct dvb_frontend* fe) | |||
439 | 490 | ||
440 | static int stv0299_read_status(struct dvb_frontend* fe, fe_status_t* status) | 491 | static int stv0299_read_status(struct dvb_frontend* fe, fe_status_t* status) |
441 | { | 492 | { |
442 | struct stv0299_state* state = (struct stv0299_state*) fe->demodulator_priv; | 493 | struct stv0299_state* state = fe->demodulator_priv; |
443 | 494 | ||
444 | u8 signal = 0xff - stv0299_readreg (state, 0x18); | 495 | u8 signal = 0xff - stv0299_readreg (state, 0x18); |
445 | u8 sync = stv0299_readreg (state, 0x1b); | 496 | u8 sync = stv0299_readreg (state, 0x1b); |
@@ -467,7 +518,7 @@ static int stv0299_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
467 | 518 | ||
468 | static int stv0299_read_ber(struct dvb_frontend* fe, u32* ber) | 519 | static int stv0299_read_ber(struct dvb_frontend* fe, u32* ber) |
469 | { | 520 | { |
470 | struct stv0299_state* state = (struct stv0299_state*) fe->demodulator_priv; | 521 | struct stv0299_state* state = fe->demodulator_priv; |
471 | 522 | ||
472 | if (state->errmode != STATUS_BER) return 0; | 523 | if (state->errmode != STATUS_BER) return 0; |
473 | *ber = (stv0299_readreg (state, 0x1d) << 8) | stv0299_readreg (state, 0x1e); | 524 | *ber = (stv0299_readreg (state, 0x1d) << 8) | stv0299_readreg (state, 0x1e); |
@@ -477,7 +528,7 @@ static int stv0299_read_ber(struct dvb_frontend* fe, u32* ber) | |||
477 | 528 | ||
478 | static int stv0299_read_signal_strength(struct dvb_frontend* fe, u16* strength) | 529 | static int stv0299_read_signal_strength(struct dvb_frontend* fe, u16* strength) |
479 | { | 530 | { |
480 | struct stv0299_state* state = (struct stv0299_state*) fe->demodulator_priv; | 531 | struct stv0299_state* state = fe->demodulator_priv; |
481 | 532 | ||
482 | s32 signal = 0xffff - ((stv0299_readreg (state, 0x18) << 8) | 533 | s32 signal = 0xffff - ((stv0299_readreg (state, 0x18) << 8) |
483 | | stv0299_readreg (state, 0x19)); | 534 | | stv0299_readreg (state, 0x19)); |
@@ -494,7 +545,7 @@ static int stv0299_read_signal_strength(struct dvb_frontend* fe, u16* strength) | |||
494 | 545 | ||
495 | static int stv0299_read_snr(struct dvb_frontend* fe, u16* snr) | 546 | static int stv0299_read_snr(struct dvb_frontend* fe, u16* snr) |
496 | { | 547 | { |
497 | struct stv0299_state* state = (struct stv0299_state*) fe->demodulator_priv; | 548 | struct stv0299_state* state = fe->demodulator_priv; |
498 | 549 | ||
499 | s32 xsnr = 0xffff - ((stv0299_readreg (state, 0x24) << 8) | 550 | s32 xsnr = 0xffff - ((stv0299_readreg (state, 0x24) << 8) |
500 | | stv0299_readreg (state, 0x25)); | 551 | | stv0299_readreg (state, 0x25)); |
@@ -506,7 +557,7 @@ static int stv0299_read_snr(struct dvb_frontend* fe, u16* snr) | |||
506 | 557 | ||
507 | static int stv0299_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | 558 | static int stv0299_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) |
508 | { | 559 | { |
509 | struct stv0299_state* state = (struct stv0299_state*) fe->demodulator_priv; | 560 | struct stv0299_state* state = fe->demodulator_priv; |
510 | 561 | ||
511 | if (state->errmode != STATUS_UCBLOCKS) *ucblocks = 0; | 562 | if (state->errmode != STATUS_UCBLOCKS) *ucblocks = 0; |
512 | else *ucblocks = (stv0299_readreg (state, 0x1d) << 8) | stv0299_readreg (state, 0x1e); | 563 | else *ucblocks = (stv0299_readreg (state, 0x1d) << 8) | stv0299_readreg (state, 0x1e); |
@@ -516,7 +567,7 @@ static int stv0299_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | |||
516 | 567 | ||
517 | static int stv0299_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters * p) | 568 | static int stv0299_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters * p) |
518 | { | 569 | { |
519 | struct stv0299_state* state = (struct stv0299_state*) fe->demodulator_priv; | 570 | struct stv0299_state* state = fe->demodulator_priv; |
520 | int invval = 0; | 571 | int invval = 0; |
521 | 572 | ||
522 | dprintk ("%s : FE_SET_FRONTEND\n", __FUNCTION__); | 573 | dprintk ("%s : FE_SET_FRONTEND\n", __FUNCTION__); |
@@ -584,7 +635,7 @@ static int stv0299_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
584 | 635 | ||
585 | static int stv0299_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters * p) | 636 | static int stv0299_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters * p) |
586 | { | 637 | { |
587 | struct stv0299_state* state = (struct stv0299_state*) fe->demodulator_priv; | 638 | struct stv0299_state* state = fe->demodulator_priv; |
588 | s32 derot_freq; | 639 | s32 derot_freq; |
589 | int invval; | 640 | int invval; |
590 | 641 | ||
@@ -609,7 +660,7 @@ static int stv0299_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
609 | 660 | ||
610 | static int stv0299_sleep(struct dvb_frontend* fe) | 661 | static int stv0299_sleep(struct dvb_frontend* fe) |
611 | { | 662 | { |
612 | struct stv0299_state* state = (struct stv0299_state*) fe->demodulator_priv; | 663 | struct stv0299_state* state = fe->demodulator_priv; |
613 | 664 | ||
614 | stv0299_writeregI(state, 0x02, 0x80); | 665 | stv0299_writeregI(state, 0x02, 0x80); |
615 | state->initialised = 0; | 666 | state->initialised = 0; |
@@ -619,7 +670,7 @@ static int stv0299_sleep(struct dvb_frontend* fe) | |||
619 | 670 | ||
620 | static int stv0299_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fesettings) | 671 | static int stv0299_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fesettings) |
621 | { | 672 | { |
622 | struct stv0299_state* state = (struct stv0299_state*) fe->demodulator_priv; | 673 | struct stv0299_state* state = fe->demodulator_priv; |
623 | 674 | ||
624 | fesettings->min_delay_ms = state->config->min_delay_ms; | 675 | fesettings->min_delay_ms = state->config->min_delay_ms; |
625 | if (fesettings->parameters.u.qpsk.symbol_rate < 10000000) { | 676 | if (fesettings->parameters.u.qpsk.symbol_rate < 10000000) { |
@@ -634,7 +685,7 @@ static int stv0299_get_tune_settings(struct dvb_frontend* fe, struct dvb_fronten | |||
634 | 685 | ||
635 | static void stv0299_release(struct dvb_frontend* fe) | 686 | static void stv0299_release(struct dvb_frontend* fe) |
636 | { | 687 | { |
637 | struct stv0299_state* state = (struct stv0299_state*) fe->demodulator_priv; | 688 | struct stv0299_state* state = fe->demodulator_priv; |
638 | kfree(state); | 689 | kfree(state); |
639 | } | 690 | } |
640 | 691 | ||
@@ -647,7 +698,7 @@ struct dvb_frontend* stv0299_attach(const struct stv0299_config* config, | |||
647 | int id; | 698 | int id; |
648 | 699 | ||
649 | /* allocate memory for the internal state */ | 700 | /* allocate memory for the internal state */ |
650 | state = (struct stv0299_state*) kmalloc(sizeof(struct stv0299_state), GFP_KERNEL); | 701 | state = kmalloc(sizeof(struct stv0299_state), GFP_KERNEL); |
651 | if (state == NULL) goto error; | 702 | if (state == NULL) goto error; |
652 | 703 | ||
653 | /* setup the state */ | 704 | /* setup the state */ |
@@ -719,6 +770,9 @@ static struct dvb_frontend_ops stv0299_ops = { | |||
719 | .dishnetwork_send_legacy_command = stv0299_send_legacy_dish_cmd, | 770 | .dishnetwork_send_legacy_command = stv0299_send_legacy_dish_cmd, |
720 | }; | 771 | }; |
721 | 772 | ||
773 | module_param(debug_legacy_dish_switch, int, 0444); | ||
774 | MODULE_PARM_DESC(debug_legacy_dish_switch, "Enable timing analysis for Dish Network legacy switches"); | ||
775 | |||
722 | module_param(debug, int, 0644); | 776 | module_param(debug, int, 0644); |
723 | MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off)."); | 777 | MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off)."); |
724 | 778 | ||
diff --git a/drivers/media/dvb/frontends/tda10021.c b/drivers/media/dvb/frontends/tda10021.c index 4e40d95ee95d..87d5f4d8790f 100644 --- a/drivers/media/dvb/frontends/tda10021.c +++ b/drivers/media/dvb/frontends/tda10021.c | |||
@@ -205,7 +205,7 @@ static int tda10021_set_symbolrate (struct tda10021_state* state, u32 symbolrate | |||
205 | 205 | ||
206 | static int tda10021_init (struct dvb_frontend *fe) | 206 | static int tda10021_init (struct dvb_frontend *fe) |
207 | { | 207 | { |
208 | struct tda10021_state* state = (struct tda10021_state*) fe->demodulator_priv; | 208 | struct tda10021_state* state = fe->demodulator_priv; |
209 | int i; | 209 | int i; |
210 | 210 | ||
211 | dprintk("DVB: TDA10021(%d): init chip\n", fe->adapter->num); | 211 | dprintk("DVB: TDA10021(%d): init chip\n", fe->adapter->num); |
@@ -238,7 +238,7 @@ static int tda10021_init (struct dvb_frontend *fe) | |||
238 | static int tda10021_set_parameters (struct dvb_frontend *fe, | 238 | static int tda10021_set_parameters (struct dvb_frontend *fe, |
239 | struct dvb_frontend_parameters *p) | 239 | struct dvb_frontend_parameters *p) |
240 | { | 240 | { |
241 | struct tda10021_state* state = (struct tda10021_state*) fe->demodulator_priv; | 241 | struct tda10021_state* state = fe->demodulator_priv; |
242 | 242 | ||
243 | //table for QAM4-QAM256 ready QAM4 QAM16 QAM32 QAM64 QAM128 QAM256 | 243 | //table for QAM4-QAM256 ready QAM4 QAM16 QAM32 QAM64 QAM128 QAM256 |
244 | //CONF | 244 | //CONF |
@@ -278,7 +278,7 @@ static int tda10021_set_parameters (struct dvb_frontend *fe, | |||
278 | 278 | ||
279 | static int tda10021_read_status(struct dvb_frontend* fe, fe_status_t* status) | 279 | static int tda10021_read_status(struct dvb_frontend* fe, fe_status_t* status) |
280 | { | 280 | { |
281 | struct tda10021_state* state = (struct tda10021_state*) fe->demodulator_priv; | 281 | struct tda10021_state* state = fe->demodulator_priv; |
282 | int sync; | 282 | int sync; |
283 | 283 | ||
284 | *status = 0; | 284 | *status = 0; |
@@ -303,7 +303,7 @@ static int tda10021_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
303 | 303 | ||
304 | static int tda10021_read_ber(struct dvb_frontend* fe, u32* ber) | 304 | static int tda10021_read_ber(struct dvb_frontend* fe, u32* ber) |
305 | { | 305 | { |
306 | struct tda10021_state* state = (struct tda10021_state*) fe->demodulator_priv; | 306 | struct tda10021_state* state = fe->demodulator_priv; |
307 | 307 | ||
308 | u32 _ber = tda10021_readreg(state, 0x14) | | 308 | u32 _ber = tda10021_readreg(state, 0x14) | |
309 | (tda10021_readreg(state, 0x15) << 8) | | 309 | (tda10021_readreg(state, 0x15) << 8) | |
@@ -315,7 +315,7 @@ static int tda10021_read_ber(struct dvb_frontend* fe, u32* ber) | |||
315 | 315 | ||
316 | static int tda10021_read_signal_strength(struct dvb_frontend* fe, u16* strength) | 316 | static int tda10021_read_signal_strength(struct dvb_frontend* fe, u16* strength) |
317 | { | 317 | { |
318 | struct tda10021_state* state = (struct tda10021_state*) fe->demodulator_priv; | 318 | struct tda10021_state* state = fe->demodulator_priv; |
319 | 319 | ||
320 | u8 gain = tda10021_readreg(state, 0x17); | 320 | u8 gain = tda10021_readreg(state, 0x17); |
321 | *strength = (gain << 8) | gain; | 321 | *strength = (gain << 8) | gain; |
@@ -325,7 +325,7 @@ static int tda10021_read_signal_strength(struct dvb_frontend* fe, u16* strength) | |||
325 | 325 | ||
326 | static int tda10021_read_snr(struct dvb_frontend* fe, u16* snr) | 326 | static int tda10021_read_snr(struct dvb_frontend* fe, u16* snr) |
327 | { | 327 | { |
328 | struct tda10021_state* state = (struct tda10021_state*) fe->demodulator_priv; | 328 | struct tda10021_state* state = fe->demodulator_priv; |
329 | 329 | ||
330 | u8 quality = ~tda10021_readreg(state, 0x18); | 330 | u8 quality = ~tda10021_readreg(state, 0x18); |
331 | *snr = (quality << 8) | quality; | 331 | *snr = (quality << 8) | quality; |
@@ -335,7 +335,7 @@ static int tda10021_read_snr(struct dvb_frontend* fe, u16* snr) | |||
335 | 335 | ||
336 | static int tda10021_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | 336 | static int tda10021_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) |
337 | { | 337 | { |
338 | struct tda10021_state* state = (struct tda10021_state*) fe->demodulator_priv; | 338 | struct tda10021_state* state = fe->demodulator_priv; |
339 | 339 | ||
340 | *ucblocks = tda10021_readreg (state, 0x13) & 0x7f; | 340 | *ucblocks = tda10021_readreg (state, 0x13) & 0x7f; |
341 | if (*ucblocks == 0x7f) | 341 | if (*ucblocks == 0x7f) |
@@ -350,7 +350,7 @@ static int tda10021_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | |||
350 | 350 | ||
351 | static int tda10021_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) | 351 | static int tda10021_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) |
352 | { | 352 | { |
353 | struct tda10021_state* state = (struct tda10021_state*) fe->demodulator_priv; | 353 | struct tda10021_state* state = fe->demodulator_priv; |
354 | int sync; | 354 | int sync; |
355 | s8 afc = 0; | 355 | s8 afc = 0; |
356 | 356 | ||
@@ -378,7 +378,7 @@ static int tda10021_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_pa | |||
378 | 378 | ||
379 | static int tda10021_sleep(struct dvb_frontend* fe) | 379 | static int tda10021_sleep(struct dvb_frontend* fe) |
380 | { | 380 | { |
381 | struct tda10021_state* state = (struct tda10021_state*) fe->demodulator_priv; | 381 | struct tda10021_state* state = fe->demodulator_priv; |
382 | 382 | ||
383 | tda10021_writereg (state, 0x1b, 0x02); /* pdown ADC */ | 383 | tda10021_writereg (state, 0x1b, 0x02); /* pdown ADC */ |
384 | tda10021_writereg (state, 0x00, 0x80); /* standby */ | 384 | tda10021_writereg (state, 0x00, 0x80); /* standby */ |
@@ -388,7 +388,7 @@ static int tda10021_sleep(struct dvb_frontend* fe) | |||
388 | 388 | ||
389 | static void tda10021_release(struct dvb_frontend* fe) | 389 | static void tda10021_release(struct dvb_frontend* fe) |
390 | { | 390 | { |
391 | struct tda10021_state* state = (struct tda10021_state*) fe->demodulator_priv; | 391 | struct tda10021_state* state = fe->demodulator_priv; |
392 | kfree(state); | 392 | kfree(state); |
393 | } | 393 | } |
394 | 394 | ||
@@ -401,7 +401,7 @@ struct dvb_frontend* tda10021_attach(const struct tda10021_config* config, | |||
401 | struct tda10021_state* state = NULL; | 401 | struct tda10021_state* state = NULL; |
402 | 402 | ||
403 | /* allocate memory for the internal state */ | 403 | /* allocate memory for the internal state */ |
404 | state = (struct tda10021_state*) kmalloc(sizeof(struct tda10021_state), GFP_KERNEL); | 404 | state = kmalloc(sizeof(struct tda10021_state), GFP_KERNEL); |
405 | if (state == NULL) goto error; | 405 | if (state == NULL) goto error; |
406 | 406 | ||
407 | /* setup the state */ | 407 | /* setup the state */ |
diff --git a/drivers/media/dvb/frontends/tda1004x.c b/drivers/media/dvb/frontends/tda1004x.c index 687ad9cf3384..0beb370792ae 100644 --- a/drivers/media/dvb/frontends/tda1004x.c +++ b/drivers/media/dvb/frontends/tda1004x.c | |||
@@ -35,9 +35,10 @@ | |||
35 | #include "dvb_frontend.h" | 35 | #include "dvb_frontend.h" |
36 | #include "tda1004x.h" | 36 | #include "tda1004x.h" |
37 | 37 | ||
38 | #define TDA1004X_DEMOD_TDA10045 0 | 38 | enum tda1004x_demod { |
39 | #define TDA1004X_DEMOD_TDA10046 1 | 39 | TDA1004X_DEMOD_TDA10045, |
40 | 40 | TDA1004X_DEMOD_TDA10046, | |
41 | }; | ||
41 | 42 | ||
42 | struct tda1004x_state { | 43 | struct tda1004x_state { |
43 | struct i2c_adapter* i2c; | 44 | struct i2c_adapter* i2c; |
@@ -46,8 +47,9 @@ struct tda1004x_state { | |||
46 | struct dvb_frontend frontend; | 47 | struct dvb_frontend frontend; |
47 | 48 | ||
48 | /* private demod data */ | 49 | /* private demod data */ |
49 | u8 initialised:1; | 50 | u8 initialised; |
50 | u8 demod_type; | 51 | enum tda1004x_demod demod_type; |
52 | u8 fw_version; | ||
51 | }; | 53 | }; |
52 | 54 | ||
53 | 55 | ||
@@ -139,7 +141,7 @@ static int tda1004x_write_byteI(struct tda1004x_state *state, int reg, int data) | |||
139 | { | 141 | { |
140 | int ret; | 142 | int ret; |
141 | u8 buf[] = { reg, data }; | 143 | u8 buf[] = { reg, data }; |
142 | struct i2c_msg msg = { .addr=0, .flags=0, .buf=buf, .len=2 }; | 144 | struct i2c_msg msg = { .flags = 0, .buf = buf, .len = 2 }; |
143 | 145 | ||
144 | dprintk("%s: reg=0x%x, data=0x%x\n", __FUNCTION__, reg, data); | 146 | dprintk("%s: reg=0x%x, data=0x%x\n", __FUNCTION__, reg, data); |
145 | 147 | ||
@@ -160,8 +162,8 @@ static int tda1004x_read_byte(struct tda1004x_state *state, int reg) | |||
160 | int ret; | 162 | int ret; |
161 | u8 b0[] = { reg }; | 163 | u8 b0[] = { reg }; |
162 | u8 b1[] = { 0 }; | 164 | u8 b1[] = { 0 }; |
163 | struct i2c_msg msg[] = {{ .addr=0, .flags=0, .buf=b0, .len=1}, | 165 | struct i2c_msg msg[] = {{ .flags = 0, .buf = b0, .len = 1 }, |
164 | { .addr=0, .flags=I2C_M_RD, .buf=b1, .len = 1}}; | 166 | { .flags = I2C_M_RD, .buf = b1, .len = 1 }}; |
165 | 167 | ||
166 | dprintk("%s: reg=0x%x\n", __FUNCTION__, reg); | 168 | dprintk("%s: reg=0x%x\n", __FUNCTION__, reg); |
167 | 169 | ||
@@ -294,7 +296,7 @@ static int tda1004x_do_upload(struct tda1004x_state *state, | |||
294 | u8 dspCodeCounterReg, u8 dspCodeInReg) | 296 | u8 dspCodeCounterReg, u8 dspCodeInReg) |
295 | { | 297 | { |
296 | u8 buf[65]; | 298 | u8 buf[65]; |
297 | struct i2c_msg fw_msg = {.addr = 0,.flags = 0,.buf = buf,.len = 0 }; | 299 | struct i2c_msg fw_msg = { .flags = 0, .buf = buf, .len = 0 }; |
298 | int tx_size; | 300 | int tx_size; |
299 | int pos = 0; | 301 | int pos = 0; |
300 | 302 | ||
@@ -304,12 +306,10 @@ static int tda1004x_do_upload(struct tda1004x_state *state, | |||
304 | 306 | ||
305 | buf[0] = dspCodeInReg; | 307 | buf[0] = dspCodeInReg; |
306 | while (pos != len) { | 308 | while (pos != len) { |
307 | |||
308 | // work out how much to send this time | 309 | // work out how much to send this time |
309 | tx_size = len - pos; | 310 | tx_size = len - pos; |
310 | if (tx_size > 0x10) { | 311 | if (tx_size > 0x10) |
311 | tx_size = 0x10; | 312 | tx_size = 0x10; |
312 | } | ||
313 | 313 | ||
314 | // send the chunk | 314 | // send the chunk |
315 | memcpy(buf + 1, mem + pos, tx_size); | 315 | memcpy(buf + 1, mem + pos, tx_size); |
@@ -322,6 +322,7 @@ static int tda1004x_do_upload(struct tda1004x_state *state, | |||
322 | 322 | ||
323 | dprintk("%s: fw_pos=0x%x\n", __FUNCTION__, pos); | 323 | dprintk("%s: fw_pos=0x%x\n", __FUNCTION__, pos); |
324 | } | 324 | } |
325 | |||
325 | return 0; | 326 | return 0; |
326 | } | 327 | } |
327 | 328 | ||
@@ -335,9 +336,8 @@ static int tda1004x_check_upload_ok(struct tda1004x_state *state, u8 dspVersion) | |||
335 | 336 | ||
336 | data1 = tda1004x_read_byte(state, TDA1004X_DSP_DATA1); | 337 | data1 = tda1004x_read_byte(state, TDA1004X_DSP_DATA1); |
337 | data2 = tda1004x_read_byte(state, TDA1004X_DSP_DATA2); | 338 | data2 = tda1004x_read_byte(state, TDA1004X_DSP_DATA2); |
338 | if (data1 != 0x67 || data2 != dspVersion) { | 339 | if ((data1 != 0x67) || (data2 != dspVersion)) |
339 | return -EIO; | 340 | return -EIO; |
340 | } | ||
341 | 341 | ||
342 | return 0; | 342 | return 0; |
343 | } | 343 | } |
@@ -348,9 +348,9 @@ static int tda10045_fwupload(struct dvb_frontend* fe) | |||
348 | int ret; | 348 | int ret; |
349 | const struct firmware *fw; | 349 | const struct firmware *fw; |
350 | 350 | ||
351 | |||
352 | /* don't re-upload unless necessary */ | 351 | /* don't re-upload unless necessary */ |
353 | if (tda1004x_check_upload_ok(state, 0x2c) == 0) return 0; | 352 | if (tda1004x_check_upload_ok(state, 0x2c) == 0) |
353 | return 0; | ||
354 | 354 | ||
355 | /* request the firmware, this will block until someone uploads it */ | 355 | /* request the firmware, this will block until someone uploads it */ |
356 | printk("tda1004x: waiting for firmware upload (%s)...\n", TDA10045_DEFAULT_FIRMWARE); | 356 | printk("tda1004x: waiting for firmware upload (%s)...\n", TDA10045_DEFAULT_FIRMWARE); |
@@ -381,6 +381,25 @@ static int tda10045_fwupload(struct dvb_frontend* fe) | |||
381 | return tda1004x_check_upload_ok(state, 0x2c); | 381 | return tda1004x_check_upload_ok(state, 0x2c); |
382 | } | 382 | } |
383 | 383 | ||
384 | static int tda10046_get_fw_version(struct tda1004x_state *state, | ||
385 | const struct firmware *fw) | ||
386 | { | ||
387 | const unsigned char pattern[] = { 0x67, 0x00, 0x50, 0x62, 0x5e, 0x18, 0x67 }; | ||
388 | unsigned int i; | ||
389 | |||
390 | /* area guessed from firmware v20, v21 and v25 */ | ||
391 | for (i = 0x660; i < 0x700; i++) { | ||
392 | if (!memcmp(&fw->data[i], pattern, sizeof(pattern))) { | ||
393 | state->fw_version = fw->data[i + sizeof(pattern)]; | ||
394 | printk(KERN_INFO "tda1004x: using firmware v%02x\n", | ||
395 | state->fw_version); | ||
396 | return 0; | ||
397 | } | ||
398 | } | ||
399 | |||
400 | return -EINVAL; | ||
401 | } | ||
402 | |||
384 | static int tda10046_fwupload(struct dvb_frontend* fe) | 403 | static int tda10046_fwupload(struct dvb_frontend* fe) |
385 | { | 404 | { |
386 | struct tda1004x_state* state = fe->demodulator_priv; | 405 | struct tda1004x_state* state = fe->demodulator_priv; |
@@ -394,7 +413,8 @@ static int tda10046_fwupload(struct dvb_frontend* fe) | |||
394 | msleep(100); | 413 | msleep(100); |
395 | 414 | ||
396 | /* don't re-upload unless necessary */ | 415 | /* don't re-upload unless necessary */ |
397 | if (tda1004x_check_upload_ok(state, 0x20) == 0) return 0; | 416 | if (tda1004x_check_upload_ok(state, state->fw_version) == 0) |
417 | return 0; | ||
398 | 418 | ||
399 | /* request the firmware, this will block until someone uploads it */ | 419 | /* request the firmware, this will block until someone uploads it */ |
400 | printk("tda1004x: waiting for firmware upload (%s)...\n", TDA10046_DEFAULT_FIRMWARE); | 420 | printk("tda1004x: waiting for firmware upload (%s)...\n", TDA10046_DEFAULT_FIRMWARE); |
@@ -404,9 +424,20 @@ static int tda10046_fwupload(struct dvb_frontend* fe) | |||
404 | return ret; | 424 | return ret; |
405 | } | 425 | } |
406 | 426 | ||
427 | if (fw->size < 24478) { /* size of firmware v20, which is the smallest of v20, v21 and v25 */ | ||
428 | printk("tda1004x: firmware file seems to be too small (%d bytes)\n", fw->size); | ||
429 | return -EINVAL; | ||
430 | } | ||
431 | |||
432 | ret = tda10046_get_fw_version(state, fw); | ||
433 | if (ret < 0) { | ||
434 | printk("tda1004x: unable to find firmware version\n"); | ||
435 | return ret; | ||
436 | } | ||
437 | |||
407 | /* set parameters */ | 438 | /* set parameters */ |
408 | tda1004x_write_byteI(state, TDA10046H_CONFPLL2, 10); | 439 | tda1004x_write_byteI(state, TDA10046H_CONFPLL2, 10); |
409 | tda1004x_write_byteI(state, TDA10046H_CONFPLL3, 0); | 440 | tda1004x_write_byteI(state, TDA10046H_CONFPLL3, state->config->n_i2c); |
410 | tda1004x_write_byteI(state, TDA10046H_FREQ_OFFSET, 99); | 441 | tda1004x_write_byteI(state, TDA10046H_FREQ_OFFSET, 99); |
411 | tda1004x_write_byteI(state, TDA10046H_FREQ_PHY2_MSB, 0xd4); | 442 | tda1004x_write_byteI(state, TDA10046H_FREQ_PHY2_MSB, 0xd4); |
412 | tda1004x_write_byteI(state, TDA10046H_FREQ_PHY2_LSB, 0x2c); | 443 | tda1004x_write_byteI(state, TDA10046H_FREQ_PHY2_LSB, 0x2c); |
@@ -419,7 +450,7 @@ static int tda10046_fwupload(struct dvb_frontend* fe) | |||
419 | 450 | ||
420 | /* wait for DSP to initialise */ | 451 | /* wait for DSP to initialise */ |
421 | timeout = jiffies + HZ; | 452 | timeout = jiffies + HZ; |
422 | while(!(tda1004x_read_byte(state, TDA1004X_STATUS_CD) & 0x20)) { | 453 | while (!(tda1004x_read_byte(state, TDA1004X_STATUS_CD) & 0x20)) { |
423 | if (time_after(jiffies, timeout)) { | 454 | if (time_after(jiffies, timeout)) { |
424 | printk("tda1004x: DSP failed to initialised.\n"); | 455 | printk("tda1004x: DSP failed to initialised.\n"); |
425 | return -EIO; | 456 | return -EIO; |
@@ -427,7 +458,7 @@ static int tda10046_fwupload(struct dvb_frontend* fe) | |||
427 | msleep(1); | 458 | msleep(1); |
428 | } | 459 | } |
429 | 460 | ||
430 | return tda1004x_check_upload_ok(state, 0x20); | 461 | return tda1004x_check_upload_ok(state, state->fw_version); |
431 | } | 462 | } |
432 | 463 | ||
433 | static int tda1004x_encode_fec(int fec) | 464 | static int tda1004x_encode_fec(int fec) |
@@ -483,7 +514,8 @@ static int tda10045_init(struct dvb_frontend* fe) | |||
483 | 514 | ||
484 | dprintk("%s\n", __FUNCTION__); | 515 | dprintk("%s\n", __FUNCTION__); |
485 | 516 | ||
486 | if (state->initialised) return 0; | 517 | if (state->initialised) |
518 | return 0; | ||
487 | 519 | ||
488 | if (tda10045_fwupload(fe)) { | 520 | if (tda10045_fwupload(fe)) { |
489 | printk("tda1004x: firmware upload failed\n"); | 521 | printk("tda1004x: firmware upload failed\n"); |
@@ -523,7 +555,8 @@ static int tda10046_init(struct dvb_frontend* fe) | |||
523 | struct tda1004x_state* state = fe->demodulator_priv; | 555 | struct tda1004x_state* state = fe->demodulator_priv; |
524 | dprintk("%s\n", __FUNCTION__); | 556 | dprintk("%s\n", __FUNCTION__); |
525 | 557 | ||
526 | if (state->initialised) return 0; | 558 | if (state->initialised) |
559 | return 0; | ||
527 | 560 | ||
528 | if (tda10046_fwupload(fe)) { | 561 | if (tda10046_fwupload(fe)) { |
529 | printk("tda1004x: firmware upload failed\n"); | 562 | printk("tda1004x: firmware upload failed\n"); |
@@ -545,7 +578,7 @@ static int tda10046_init(struct dvb_frontend* fe) | |||
545 | tda1004x_write_mask(state, TDA1004X_AUTO, 8, 0); // select HP stream | 578 | tda1004x_write_mask(state, TDA1004X_AUTO, 8, 0); // select HP stream |
546 | tda1004x_write_mask(state, TDA1004X_CONFC1, 0x80, 0); // disable pulse killer | 579 | tda1004x_write_mask(state, TDA1004X_CONFC1, 0x80, 0); // disable pulse killer |
547 | tda1004x_write_byteI(state, TDA10046H_CONFPLL2, 10); // PLL M = 10 | 580 | tda1004x_write_byteI(state, TDA10046H_CONFPLL2, 10); // PLL M = 10 |
548 | tda1004x_write_byteI(state, TDA10046H_CONFPLL3, 0); // PLL P = N = 0 | 581 | tda1004x_write_byteI(state, TDA10046H_CONFPLL3, state->config->n_i2c); // PLL P = N = 0 |
549 | tda1004x_write_byteI(state, TDA10046H_FREQ_OFFSET, 99); // FREQOFFS = 99 | 582 | tda1004x_write_byteI(state, TDA10046H_FREQ_OFFSET, 99); // FREQOFFS = 99 |
550 | tda1004x_write_byteI(state, TDA10046H_FREQ_PHY2_MSB, 0xd4); // } PHY2 = -11221 | 583 | tda1004x_write_byteI(state, TDA10046H_FREQ_PHY2_MSB, 0xd4); // } PHY2 = -11221 |
551 | tda1004x_write_byteI(state, TDA10046H_FREQ_PHY2_LSB, 0x2c); // } | 584 | tda1004x_write_byteI(state, TDA10046H_FREQ_PHY2_LSB, 0x2c); // } |
@@ -621,12 +654,14 @@ static int tda1004x_set_fe(struct dvb_frontend* fe, | |||
621 | 654 | ||
622 | // set HP FEC | 655 | // set HP FEC |
623 | tmp = tda1004x_encode_fec(fe_params->u.ofdm.code_rate_HP); | 656 | tmp = tda1004x_encode_fec(fe_params->u.ofdm.code_rate_HP); |
624 | if (tmp < 0) return tmp; | 657 | if (tmp < 0) |
658 | return tmp; | ||
625 | tda1004x_write_mask(state, TDA1004X_IN_CONF2, 7, tmp); | 659 | tda1004x_write_mask(state, TDA1004X_IN_CONF2, 7, tmp); |
626 | 660 | ||
627 | // set LP FEC | 661 | // set LP FEC |
628 | tmp = tda1004x_encode_fec(fe_params->u.ofdm.code_rate_LP); | 662 | tmp = tda1004x_encode_fec(fe_params->u.ofdm.code_rate_LP); |
629 | if (tmp < 0) return tmp; | 663 | if (tmp < 0) |
664 | return tmp; | ||
630 | tda1004x_write_mask(state, TDA1004X_IN_CONF2, 0x38, tmp << 3); | 665 | tda1004x_write_mask(state, TDA1004X_IN_CONF2, 0x38, tmp << 3); |
631 | 666 | ||
632 | // set constellation | 667 | // set constellation |
@@ -671,7 +706,7 @@ static int tda1004x_set_fe(struct dvb_frontend* fe, | |||
671 | } | 706 | } |
672 | 707 | ||
673 | // set bandwidth | 708 | // set bandwidth |
674 | switch(state->demod_type) { | 709 | switch (state->demod_type) { |
675 | case TDA1004X_DEMOD_TDA10045: | 710 | case TDA1004X_DEMOD_TDA10045: |
676 | tda10045h_set_bandwidth(state, fe_params->u.ofdm.bandwidth); | 711 | tda10045h_set_bandwidth(state, fe_params->u.ofdm.bandwidth); |
677 | break; | 712 | break; |
@@ -683,7 +718,8 @@ static int tda1004x_set_fe(struct dvb_frontend* fe, | |||
683 | 718 | ||
684 | // set inversion | 719 | // set inversion |
685 | inversion = fe_params->inversion; | 720 | inversion = fe_params->inversion; |
686 | if (state->config->invert) inversion = inversion ? INVERSION_OFF : INVERSION_ON; | 721 | if (state->config->invert) |
722 | inversion = inversion ? INVERSION_OFF : INVERSION_ON; | ||
687 | switch (inversion) { | 723 | switch (inversion) { |
688 | case INVERSION_OFF: | 724 | case INVERSION_OFF: |
689 | tda1004x_write_mask(state, TDA1004X_CONFC1, 0x20, 0); | 725 | tda1004x_write_mask(state, TDA1004X_CONFC1, 0x20, 0); |
@@ -750,19 +786,19 @@ static int tda1004x_set_fe(struct dvb_frontend* fe, | |||
750 | } | 786 | } |
751 | 787 | ||
752 | // start the lock | 788 | // start the lock |
753 | switch(state->demod_type) { | 789 | switch (state->demod_type) { |
754 | case TDA1004X_DEMOD_TDA10045: | 790 | case TDA1004X_DEMOD_TDA10045: |
755 | tda1004x_write_mask(state, TDA1004X_CONFC4, 8, 8); | 791 | tda1004x_write_mask(state, TDA1004X_CONFC4, 8, 8); |
756 | tda1004x_write_mask(state, TDA1004X_CONFC4, 8, 0); | 792 | tda1004x_write_mask(state, TDA1004X_CONFC4, 8, 0); |
757 | msleep(10); | ||
758 | break; | 793 | break; |
759 | 794 | ||
760 | case TDA1004X_DEMOD_TDA10046: | 795 | case TDA1004X_DEMOD_TDA10046: |
761 | tda1004x_write_mask(state, TDA1004X_AUTO, 0x40, 0x40); | 796 | tda1004x_write_mask(state, TDA1004X_AUTO, 0x40, 0x40); |
762 | msleep(10); | ||
763 | break; | 797 | break; |
764 | } | 798 | } |
765 | 799 | ||
800 | msleep(10); | ||
801 | |||
766 | return 0; | 802 | return 0; |
767 | } | 803 | } |
768 | 804 | ||
@@ -773,13 +809,13 @@ static int tda1004x_get_fe(struct dvb_frontend* fe, struct dvb_frontend_paramete | |||
773 | 809 | ||
774 | // inversion status | 810 | // inversion status |
775 | fe_params->inversion = INVERSION_OFF; | 811 | fe_params->inversion = INVERSION_OFF; |
776 | if (tda1004x_read_byte(state, TDA1004X_CONFC1) & 0x20) { | 812 | if (tda1004x_read_byte(state, TDA1004X_CONFC1) & 0x20) |
777 | fe_params->inversion = INVERSION_ON; | 813 | fe_params->inversion = INVERSION_ON; |
778 | } | 814 | if (state->config->invert) |
779 | if (state->config->invert) fe_params->inversion = fe_params->inversion ? INVERSION_OFF : INVERSION_ON; | 815 | fe_params->inversion = fe_params->inversion ? INVERSION_OFF : INVERSION_ON; |
780 | 816 | ||
781 | // bandwidth | 817 | // bandwidth |
782 | switch(state->demod_type) { | 818 | switch (state->demod_type) { |
783 | case TDA1004X_DEMOD_TDA10045: | 819 | case TDA1004X_DEMOD_TDA10045: |
784 | switch (tda1004x_read_byte(state, TDA10045H_WREF_LSB)) { | 820 | switch (tda1004x_read_byte(state, TDA10045H_WREF_LSB)) { |
785 | case 0x14: | 821 | case 0x14: |
@@ -830,9 +866,8 @@ static int tda1004x_get_fe(struct dvb_frontend* fe, struct dvb_frontend_paramete | |||
830 | 866 | ||
831 | // transmission mode | 867 | // transmission mode |
832 | fe_params->u.ofdm.transmission_mode = TRANSMISSION_MODE_2K; | 868 | fe_params->u.ofdm.transmission_mode = TRANSMISSION_MODE_2K; |
833 | if (tda1004x_read_byte(state, TDA1004X_OUT_CONF1) & 0x10) { | 869 | if (tda1004x_read_byte(state, TDA1004X_OUT_CONF1) & 0x10) |
834 | fe_params->u.ofdm.transmission_mode = TRANSMISSION_MODE_8K; | 870 | fe_params->u.ofdm.transmission_mode = TRANSMISSION_MODE_8K; |
835 | } | ||
836 | 871 | ||
837 | // guard interval | 872 | // guard interval |
838 | switch ((tda1004x_read_byte(state, TDA1004X_OUT_CONF1) & 0x0c) >> 2) { | 873 | switch ((tda1004x_read_byte(state, TDA1004X_OUT_CONF1) & 0x0c) >> 2) { |
@@ -880,30 +915,33 @@ static int tda1004x_read_status(struct dvb_frontend* fe, fe_status_t * fe_status | |||
880 | 915 | ||
881 | // read status | 916 | // read status |
882 | status = tda1004x_read_byte(state, TDA1004X_STATUS_CD); | 917 | status = tda1004x_read_byte(state, TDA1004X_STATUS_CD); |
883 | if (status == -1) { | 918 | if (status == -1) |
884 | return -EIO; | 919 | return -EIO; |
885 | } | ||
886 | 920 | ||
887 | // decode | 921 | // decode |
888 | *fe_status = 0; | 922 | *fe_status = 0; |
889 | if (status & 4) *fe_status |= FE_HAS_SIGNAL; | 923 | if (status & 4) |
890 | if (status & 2) *fe_status |= FE_HAS_CARRIER; | 924 | *fe_status |= FE_HAS_SIGNAL; |
891 | if (status & 8) *fe_status |= FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK; | 925 | if (status & 2) |
926 | *fe_status |= FE_HAS_CARRIER; | ||
927 | if (status & 8) | ||
928 | *fe_status |= FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK; | ||
892 | 929 | ||
893 | // if we don't already have VITERBI (i.e. not LOCKED), see if the viterbi | 930 | // if we don't already have VITERBI (i.e. not LOCKED), see if the viterbi |
894 | // is getting anything valid | 931 | // is getting anything valid |
895 | if (!(*fe_status & FE_HAS_VITERBI)) { | 932 | if (!(*fe_status & FE_HAS_VITERBI)) { |
896 | // read the CBER | 933 | // read the CBER |
897 | cber = tda1004x_read_byte(state, TDA1004X_CBER_LSB); | 934 | cber = tda1004x_read_byte(state, TDA1004X_CBER_LSB); |
898 | if (cber == -1) return -EIO; | 935 | if (cber == -1) |
936 | return -EIO; | ||
899 | status = tda1004x_read_byte(state, TDA1004X_CBER_MSB); | 937 | status = tda1004x_read_byte(state, TDA1004X_CBER_MSB); |
900 | if (status == -1) return -EIO; | 938 | if (status == -1) |
939 | return -EIO; | ||
901 | cber |= (status << 8); | 940 | cber |= (status << 8); |
902 | tda1004x_read_byte(state, TDA1004X_CBER_RESET); | 941 | tda1004x_read_byte(state, TDA1004X_CBER_RESET); |
903 | 942 | ||
904 | if (cber != 65535) { | 943 | if (cber != 65535) |
905 | *fe_status |= FE_HAS_VITERBI; | 944 | *fe_status |= FE_HAS_VITERBI; |
906 | } | ||
907 | } | 945 | } |
908 | 946 | ||
909 | // if we DO have some valid VITERBI output, but don't already have SYNC | 947 | // if we DO have some valid VITERBI output, but don't already have SYNC |
@@ -911,20 +949,22 @@ static int tda1004x_read_status(struct dvb_frontend* fe, fe_status_t * fe_status | |||
911 | if ((*fe_status & FE_HAS_VITERBI) && (!(*fe_status & FE_HAS_SYNC))) { | 949 | if ((*fe_status & FE_HAS_VITERBI) && (!(*fe_status & FE_HAS_SYNC))) { |
912 | // read the VBER | 950 | // read the VBER |
913 | vber = tda1004x_read_byte(state, TDA1004X_VBER_LSB); | 951 | vber = tda1004x_read_byte(state, TDA1004X_VBER_LSB); |
914 | if (vber == -1) return -EIO; | 952 | if (vber == -1) |
953 | return -EIO; | ||
915 | status = tda1004x_read_byte(state, TDA1004X_VBER_MID); | 954 | status = tda1004x_read_byte(state, TDA1004X_VBER_MID); |
916 | if (status == -1) return -EIO; | 955 | if (status == -1) |
956 | return -EIO; | ||
917 | vber |= (status << 8); | 957 | vber |= (status << 8); |
918 | status = tda1004x_read_byte(state, TDA1004X_VBER_MSB); | 958 | status = tda1004x_read_byte(state, TDA1004X_VBER_MSB); |
919 | if (status == -1) return -EIO; | 959 | if (status == -1) |
960 | return -EIO; | ||
920 | vber |= ((status << 16) & 0x0f); | 961 | vber |= ((status << 16) & 0x0f); |
921 | tda1004x_read_byte(state, TDA1004X_CVBER_LUT); | 962 | tda1004x_read_byte(state, TDA1004X_CVBER_LUT); |
922 | 963 | ||
923 | // if RS has passed some valid TS packets, then we must be | 964 | // if RS has passed some valid TS packets, then we must be |
924 | // getting some SYNC bytes | 965 | // getting some SYNC bytes |
925 | if (vber < 16632) { | 966 | if (vber < 16632) |
926 | *fe_status |= FE_HAS_SYNC; | 967 | *fe_status |= FE_HAS_SYNC; |
927 | } | ||
928 | } | 968 | } |
929 | 969 | ||
930 | // success | 970 | // success |
@@ -941,7 +981,7 @@ static int tda1004x_read_signal_strength(struct dvb_frontend* fe, u16 * signal) | |||
941 | dprintk("%s\n", __FUNCTION__); | 981 | dprintk("%s\n", __FUNCTION__); |
942 | 982 | ||
943 | // determine the register to use | 983 | // determine the register to use |
944 | switch(state->demod_type) { | 984 | switch (state->demod_type) { |
945 | case TDA1004X_DEMOD_TDA10045: | 985 | case TDA1004X_DEMOD_TDA10045: |
946 | reg = TDA10045H_S_AGC; | 986 | reg = TDA10045H_S_AGC; |
947 | break; | 987 | break; |
@@ -972,9 +1012,8 @@ static int tda1004x_read_snr(struct dvb_frontend* fe, u16 * snr) | |||
972 | tmp = tda1004x_read_byte(state, TDA1004X_SNR); | 1012 | tmp = tda1004x_read_byte(state, TDA1004X_SNR); |
973 | if (tmp < 0) | 1013 | if (tmp < 0) |
974 | return -EIO; | 1014 | return -EIO; |
975 | if (tmp) { | 1015 | if (tmp) |
976 | tmp = 255 - tmp; | 1016 | tmp = 255 - tmp; |
977 | } | ||
978 | 1017 | ||
979 | *snr = ((tmp << 8) | tmp); | 1018 | *snr = ((tmp << 8) | tmp); |
980 | dprintk("%s: snr=0x%x\n", __FUNCTION__, *snr); | 1019 | dprintk("%s: snr=0x%x\n", __FUNCTION__, *snr); |
@@ -1009,11 +1048,11 @@ static int tda1004x_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | |||
1009 | break; | 1048 | break; |
1010 | } | 1049 | } |
1011 | 1050 | ||
1012 | if (tmp != 0x7f) { | 1051 | if (tmp != 0x7f) |
1013 | *ucblocks = tmp; | 1052 | *ucblocks = tmp; |
1014 | } else { | 1053 | else |
1015 | *ucblocks = 0xffffffff; | 1054 | *ucblocks = 0xffffffff; |
1016 | } | 1055 | |
1017 | dprintk("%s: ucblocks=0x%x\n", __FUNCTION__, *ucblocks); | 1056 | dprintk("%s: ucblocks=0x%x\n", __FUNCTION__, *ucblocks); |
1018 | return 0; | 1057 | return 0; |
1019 | } | 1058 | } |
@@ -1027,10 +1066,12 @@ static int tda1004x_read_ber(struct dvb_frontend* fe, u32* ber) | |||
1027 | 1066 | ||
1028 | // read it in | 1067 | // read it in |
1029 | tmp = tda1004x_read_byte(state, TDA1004X_CBER_LSB); | 1068 | tmp = tda1004x_read_byte(state, TDA1004X_CBER_LSB); |
1030 | if (tmp < 0) return -EIO; | 1069 | if (tmp < 0) |
1070 | return -EIO; | ||
1031 | *ber = tmp << 1; | 1071 | *ber = tmp << 1; |
1032 | tmp = tda1004x_read_byte(state, TDA1004X_CBER_MSB); | 1072 | tmp = tda1004x_read_byte(state, TDA1004X_CBER_MSB); |
1033 | if (tmp < 0) return -EIO; | 1073 | if (tmp < 0) |
1074 | return -EIO; | ||
1034 | *ber |= (tmp << 9); | 1075 | *ber |= (tmp << 9); |
1035 | tda1004x_read_byte(state, TDA1004X_CBER_RESET); | 1076 | tda1004x_read_byte(state, TDA1004X_CBER_RESET); |
1036 | 1077 | ||
@@ -1042,7 +1083,7 @@ static int tda1004x_sleep(struct dvb_frontend* fe) | |||
1042 | { | 1083 | { |
1043 | struct tda1004x_state* state = fe->demodulator_priv; | 1084 | struct tda1004x_state* state = fe->demodulator_priv; |
1044 | 1085 | ||
1045 | switch(state->demod_type) { | 1086 | switch (state->demod_type) { |
1046 | case TDA1004X_DEMOD_TDA10045: | 1087 | case TDA1004X_DEMOD_TDA10045: |
1047 | tda1004x_write_mask(state, TDA1004X_CONFADC1, 0x10, 0x10); | 1088 | tda1004x_write_mask(state, TDA1004X_CONFADC1, 0x10, 0x10); |
1048 | break; | 1089 | break; |
@@ -1066,74 +1107,11 @@ static int tda1004x_get_tune_settings(struct dvb_frontend* fe, struct dvb_fronte | |||
1066 | 1107 | ||
1067 | static void tda1004x_release(struct dvb_frontend* fe) | 1108 | static void tda1004x_release(struct dvb_frontend* fe) |
1068 | { | 1109 | { |
1069 | struct tda1004x_state* state = (struct tda1004x_state*) fe->demodulator_priv; | 1110 | struct tda1004x_state *state = fe->demodulator_priv; |
1070 | kfree(state); | ||
1071 | } | ||
1072 | |||
1073 | static struct dvb_frontend_ops tda10045_ops; | ||
1074 | |||
1075 | struct dvb_frontend* tda10045_attach(const struct tda1004x_config* config, | ||
1076 | struct i2c_adapter* i2c) | ||
1077 | { | ||
1078 | struct tda1004x_state* state = NULL; | ||
1079 | |||
1080 | /* allocate memory for the internal state */ | ||
1081 | state = (struct tda1004x_state*) kmalloc(sizeof(struct tda1004x_state), GFP_KERNEL); | ||
1082 | if (state == NULL) goto error; | ||
1083 | |||
1084 | /* setup the state */ | ||
1085 | state->config = config; | ||
1086 | state->i2c = i2c; | ||
1087 | memcpy(&state->ops, &tda10045_ops, sizeof(struct dvb_frontend_ops)); | ||
1088 | state->initialised = 0; | ||
1089 | state->demod_type = TDA1004X_DEMOD_TDA10045; | ||
1090 | |||
1091 | /* check if the demod is there */ | ||
1092 | if (tda1004x_read_byte(state, TDA1004X_CHIPID) != 0x25) goto error; | ||
1093 | |||
1094 | /* create dvb_frontend */ | ||
1095 | state->frontend.ops = &state->ops; | ||
1096 | state->frontend.demodulator_priv = state; | ||
1097 | return &state->frontend; | ||
1098 | |||
1099 | error: | ||
1100 | kfree(state); | 1111 | kfree(state); |
1101 | return NULL; | ||
1102 | } | ||
1103 | |||
1104 | static struct dvb_frontend_ops tda10046_ops; | ||
1105 | |||
1106 | struct dvb_frontend* tda10046_attach(const struct tda1004x_config* config, | ||
1107 | struct i2c_adapter* i2c) | ||
1108 | { | ||
1109 | struct tda1004x_state* state = NULL; | ||
1110 | |||
1111 | /* allocate memory for the internal state */ | ||
1112 | state = (struct tda1004x_state*) kmalloc(sizeof(struct tda1004x_state), GFP_KERNEL); | ||
1113 | if (state == NULL) goto error; | ||
1114 | |||
1115 | /* setup the state */ | ||
1116 | state->config = config; | ||
1117 | state->i2c = i2c; | ||
1118 | memcpy(&state->ops, &tda10046_ops, sizeof(struct dvb_frontend_ops)); | ||
1119 | state->initialised = 0; | ||
1120 | state->demod_type = TDA1004X_DEMOD_TDA10046; | ||
1121 | |||
1122 | /* check if the demod is there */ | ||
1123 | if (tda1004x_read_byte(state, TDA1004X_CHIPID) != 0x46) goto error; | ||
1124 | |||
1125 | /* create dvb_frontend */ | ||
1126 | state->frontend.ops = &state->ops; | ||
1127 | state->frontend.demodulator_priv = state; | ||
1128 | return &state->frontend; | ||
1129 | |||
1130 | error: | ||
1131 | if (state) kfree(state); | ||
1132 | return NULL; | ||
1133 | } | 1112 | } |
1134 | 1113 | ||
1135 | static struct dvb_frontend_ops tda10045_ops = { | 1114 | static struct dvb_frontend_ops tda10045_ops = { |
1136 | |||
1137 | .info = { | 1115 | .info = { |
1138 | .name = "Philips TDA10045H DVB-T", | 1116 | .name = "Philips TDA10045H DVB-T", |
1139 | .type = FE_OFDM, | 1117 | .type = FE_OFDM, |
@@ -1163,8 +1141,36 @@ static struct dvb_frontend_ops tda10045_ops = { | |||
1163 | .read_ucblocks = tda1004x_read_ucblocks, | 1141 | .read_ucblocks = tda1004x_read_ucblocks, |
1164 | }; | 1142 | }; |
1165 | 1143 | ||
1166 | static struct dvb_frontend_ops tda10046_ops = { | 1144 | struct dvb_frontend* tda10045_attach(const struct tda1004x_config* config, |
1145 | struct i2c_adapter* i2c) | ||
1146 | { | ||
1147 | struct tda1004x_state *state; | ||
1148 | |||
1149 | /* allocate memory for the internal state */ | ||
1150 | state = kmalloc(sizeof(struct tda1004x_state), GFP_KERNEL); | ||
1151 | if (!state) | ||
1152 | return NULL; | ||
1153 | |||
1154 | /* setup the state */ | ||
1155 | state->config = config; | ||
1156 | state->i2c = i2c; | ||
1157 | memcpy(&state->ops, &tda10045_ops, sizeof(struct dvb_frontend_ops)); | ||
1158 | state->initialised = 0; | ||
1159 | state->demod_type = TDA1004X_DEMOD_TDA10045; | ||
1160 | |||
1161 | /* check if the demod is there */ | ||
1162 | if (tda1004x_read_byte(state, TDA1004X_CHIPID) != 0x25) { | ||
1163 | kfree(state); | ||
1164 | return NULL; | ||
1165 | } | ||
1167 | 1166 | ||
1167 | /* create dvb_frontend */ | ||
1168 | state->frontend.ops = &state->ops; | ||
1169 | state->frontend.demodulator_priv = state; | ||
1170 | return &state->frontend; | ||
1171 | } | ||
1172 | |||
1173 | static struct dvb_frontend_ops tda10046_ops = { | ||
1168 | .info = { | 1174 | .info = { |
1169 | .name = "Philips TDA10046H DVB-T", | 1175 | .name = "Philips TDA10046H DVB-T", |
1170 | .type = FE_OFDM, | 1176 | .type = FE_OFDM, |
@@ -1194,6 +1200,36 @@ static struct dvb_frontend_ops tda10046_ops = { | |||
1194 | .read_ucblocks = tda1004x_read_ucblocks, | 1200 | .read_ucblocks = tda1004x_read_ucblocks, |
1195 | }; | 1201 | }; |
1196 | 1202 | ||
1203 | struct dvb_frontend* tda10046_attach(const struct tda1004x_config* config, | ||
1204 | struct i2c_adapter* i2c) | ||
1205 | { | ||
1206 | struct tda1004x_state *state; | ||
1207 | |||
1208 | /* allocate memory for the internal state */ | ||
1209 | state = kmalloc(sizeof(struct tda1004x_state), GFP_KERNEL); | ||
1210 | if (!state) | ||
1211 | return NULL; | ||
1212 | |||
1213 | /* setup the state */ | ||
1214 | state->config = config; | ||
1215 | state->i2c = i2c; | ||
1216 | memcpy(&state->ops, &tda10046_ops, sizeof(struct dvb_frontend_ops)); | ||
1217 | state->initialised = 0; | ||
1218 | state->demod_type = TDA1004X_DEMOD_TDA10046; | ||
1219 | state->fw_version = 0x20; /* dummy default value */ | ||
1220 | |||
1221 | /* check if the demod is there */ | ||
1222 | if (tda1004x_read_byte(state, TDA1004X_CHIPID) != 0x46) { | ||
1223 | kfree(state); | ||
1224 | return NULL; | ||
1225 | } | ||
1226 | |||
1227 | /* create dvb_frontend */ | ||
1228 | state->frontend.ops = &state->ops; | ||
1229 | state->frontend.demodulator_priv = state; | ||
1230 | return &state->frontend; | ||
1231 | } | ||
1232 | |||
1197 | module_param(debug, int, 0644); | 1233 | module_param(debug, int, 0644); |
1198 | MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off)."); | 1234 | MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off)."); |
1199 | 1235 | ||
diff --git a/drivers/media/dvb/frontends/tda1004x.h b/drivers/media/dvb/frontends/tda1004x.h index e452fc0bad11..c8e1d54ff262 100644 --- a/drivers/media/dvb/frontends/tda1004x.h +++ b/drivers/media/dvb/frontends/tda1004x.h | |||
@@ -32,10 +32,13 @@ struct tda1004x_config | |||
32 | u8 demod_address; | 32 | u8 demod_address; |
33 | 33 | ||
34 | /* does the "inversion" need inverted? */ | 34 | /* does the "inversion" need inverted? */ |
35 | u8 invert:1; | 35 | u8 invert; |
36 | 36 | ||
37 | /* Does the OCLK signal need inverted? */ | 37 | /* Does the OCLK signal need inverted? */ |
38 | u8 invert_oclk:1; | 38 | u8 invert_oclk; |
39 | |||
40 | /* value of N_I2C of the CONF_PLL3 register */ | ||
41 | u8 n_i2c; | ||
39 | 42 | ||
40 | /* PLL maintenance */ | 43 | /* PLL maintenance */ |
41 | int (*pll_init)(struct dvb_frontend* fe); | 44 | int (*pll_init)(struct dvb_frontend* fe); |
diff --git a/drivers/media/dvb/frontends/tda8083.c b/drivers/media/dvb/frontends/tda8083.c index da82e90d6d13..168e013d23bd 100644 --- a/drivers/media/dvb/frontends/tda8083.c +++ b/drivers/media/dvb/frontends/tda8083.c | |||
@@ -226,7 +226,7 @@ static int tda8083_send_diseqc_burst (struct tda8083_state* state, fe_sec_mini_c | |||
226 | static int tda8083_send_diseqc_msg (struct dvb_frontend* fe, | 226 | static int tda8083_send_diseqc_msg (struct dvb_frontend* fe, |
227 | struct dvb_diseqc_master_cmd *m) | 227 | struct dvb_diseqc_master_cmd *m) |
228 | { | 228 | { |
229 | struct tda8083_state* state = (struct tda8083_state*) fe->demodulator_priv; | 229 | struct tda8083_state* state = fe->demodulator_priv; |
230 | int i; | 230 | int i; |
231 | 231 | ||
232 | tda8083_writereg (state, 0x29, (m->msg_len - 3) | (1 << 2)); /* enable */ | 232 | tda8083_writereg (state, 0x29, (m->msg_len - 3) | (1 << 2)); /* enable */ |
@@ -243,7 +243,7 @@ static int tda8083_send_diseqc_msg (struct dvb_frontend* fe, | |||
243 | 243 | ||
244 | static int tda8083_read_status(struct dvb_frontend* fe, fe_status_t* status) | 244 | static int tda8083_read_status(struct dvb_frontend* fe, fe_status_t* status) |
245 | { | 245 | { |
246 | struct tda8083_state* state = (struct tda8083_state*) fe->demodulator_priv; | 246 | struct tda8083_state* state = fe->demodulator_priv; |
247 | 247 | ||
248 | u8 signal = ~tda8083_readreg (state, 0x01); | 248 | u8 signal = ~tda8083_readreg (state, 0x01); |
249 | u8 sync = tda8083_readreg (state, 0x02); | 249 | u8 sync = tda8083_readreg (state, 0x02); |
@@ -270,7 +270,7 @@ static int tda8083_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
270 | 270 | ||
271 | static int tda8083_read_signal_strength(struct dvb_frontend* fe, u16* strength) | 271 | static int tda8083_read_signal_strength(struct dvb_frontend* fe, u16* strength) |
272 | { | 272 | { |
273 | struct tda8083_state* state = (struct tda8083_state*) fe->demodulator_priv; | 273 | struct tda8083_state* state = fe->demodulator_priv; |
274 | 274 | ||
275 | u8 signal = ~tda8083_readreg (state, 0x01); | 275 | u8 signal = ~tda8083_readreg (state, 0x01); |
276 | *strength = (signal << 8) | signal; | 276 | *strength = (signal << 8) | signal; |
@@ -280,7 +280,7 @@ static int tda8083_read_signal_strength(struct dvb_frontend* fe, u16* strength) | |||
280 | 280 | ||
281 | static int tda8083_read_snr(struct dvb_frontend* fe, u16* snr) | 281 | static int tda8083_read_snr(struct dvb_frontend* fe, u16* snr) |
282 | { | 282 | { |
283 | struct tda8083_state* state = (struct tda8083_state*) fe->demodulator_priv; | 283 | struct tda8083_state* state = fe->demodulator_priv; |
284 | 284 | ||
285 | u8 _snr = tda8083_readreg (state, 0x08); | 285 | u8 _snr = tda8083_readreg (state, 0x08); |
286 | *snr = (_snr << 8) | _snr; | 286 | *snr = (_snr << 8) | _snr; |
@@ -290,7 +290,7 @@ static int tda8083_read_snr(struct dvb_frontend* fe, u16* snr) | |||
290 | 290 | ||
291 | static int tda8083_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) | 291 | static int tda8083_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) |
292 | { | 292 | { |
293 | struct tda8083_state* state = (struct tda8083_state*) fe->demodulator_priv; | 293 | struct tda8083_state* state = fe->demodulator_priv; |
294 | 294 | ||
295 | state->config->pll_set(fe, p); | 295 | state->config->pll_set(fe, p); |
296 | tda8083_set_inversion (state, p->inversion); | 296 | tda8083_set_inversion (state, p->inversion); |
@@ -305,7 +305,7 @@ static int tda8083_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
305 | 305 | ||
306 | static int tda8083_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) | 306 | static int tda8083_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) |
307 | { | 307 | { |
308 | struct tda8083_state* state = (struct tda8083_state*) fe->demodulator_priv; | 308 | struct tda8083_state* state = fe->demodulator_priv; |
309 | 309 | ||
310 | /* FIXME: get symbolrate & frequency offset...*/ | 310 | /* FIXME: get symbolrate & frequency offset...*/ |
311 | /*p->frequency = ???;*/ | 311 | /*p->frequency = ???;*/ |
@@ -319,7 +319,7 @@ static int tda8083_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
319 | 319 | ||
320 | static int tda8083_sleep(struct dvb_frontend* fe) | 320 | static int tda8083_sleep(struct dvb_frontend* fe) |
321 | { | 321 | { |
322 | struct tda8083_state* state = (struct tda8083_state*) fe->demodulator_priv; | 322 | struct tda8083_state* state = fe->demodulator_priv; |
323 | 323 | ||
324 | tda8083_writereg (state, 0x00, 0x02); | 324 | tda8083_writereg (state, 0x00, 0x02); |
325 | return 0; | 325 | return 0; |
@@ -327,7 +327,7 @@ static int tda8083_sleep(struct dvb_frontend* fe) | |||
327 | 327 | ||
328 | static int tda8083_init(struct dvb_frontend* fe) | 328 | static int tda8083_init(struct dvb_frontend* fe) |
329 | { | 329 | { |
330 | struct tda8083_state* state = (struct tda8083_state*) fe->demodulator_priv; | 330 | struct tda8083_state* state = fe->demodulator_priv; |
331 | int i; | 331 | int i; |
332 | 332 | ||
333 | for (i=0; i<44; i++) | 333 | for (i=0; i<44; i++) |
@@ -343,7 +343,7 @@ static int tda8083_init(struct dvb_frontend* fe) | |||
343 | 343 | ||
344 | static int tda8083_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t burst) | 344 | static int tda8083_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t burst) |
345 | { | 345 | { |
346 | struct tda8083_state* state = (struct tda8083_state*) fe->demodulator_priv; | 346 | struct tda8083_state* state = fe->demodulator_priv; |
347 | 347 | ||
348 | tda8083_send_diseqc_burst (state, burst); | 348 | tda8083_send_diseqc_burst (state, burst); |
349 | tda8083_writereg (state, 0x00, 0x3c); | 349 | tda8083_writereg (state, 0x00, 0x3c); |
@@ -354,7 +354,7 @@ static int tda8083_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t | |||
354 | 354 | ||
355 | static int tda8083_diseqc_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) | 355 | static int tda8083_diseqc_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) |
356 | { | 356 | { |
357 | struct tda8083_state* state = (struct tda8083_state*) fe->demodulator_priv; | 357 | struct tda8083_state* state = fe->demodulator_priv; |
358 | 358 | ||
359 | tda8083_set_tone (state, tone); | 359 | tda8083_set_tone (state, tone); |
360 | tda8083_writereg (state, 0x00, 0x3c); | 360 | tda8083_writereg (state, 0x00, 0x3c); |
@@ -365,7 +365,7 @@ static int tda8083_diseqc_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t t | |||
365 | 365 | ||
366 | static int tda8083_diseqc_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage) | 366 | static int tda8083_diseqc_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage) |
367 | { | 367 | { |
368 | struct tda8083_state* state = (struct tda8083_state*) fe->demodulator_priv; | 368 | struct tda8083_state* state = fe->demodulator_priv; |
369 | 369 | ||
370 | tda8083_set_voltage (state, voltage); | 370 | tda8083_set_voltage (state, voltage); |
371 | tda8083_writereg (state, 0x00, 0x3c); | 371 | tda8083_writereg (state, 0x00, 0x3c); |
@@ -376,7 +376,7 @@ static int tda8083_diseqc_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t | |||
376 | 376 | ||
377 | static void tda8083_release(struct dvb_frontend* fe) | 377 | static void tda8083_release(struct dvb_frontend* fe) |
378 | { | 378 | { |
379 | struct tda8083_state* state = (struct tda8083_state*) fe->demodulator_priv; | 379 | struct tda8083_state* state = fe->demodulator_priv; |
380 | kfree(state); | 380 | kfree(state); |
381 | } | 381 | } |
382 | 382 | ||
@@ -388,7 +388,7 @@ struct dvb_frontend* tda8083_attach(const struct tda8083_config* config, | |||
388 | struct tda8083_state* state = NULL; | 388 | struct tda8083_state* state = NULL; |
389 | 389 | ||
390 | /* allocate memory for the internal state */ | 390 | /* allocate memory for the internal state */ |
391 | state = (struct tda8083_state*) kmalloc(sizeof(struct tda8083_state), GFP_KERNEL); | 391 | state = kmalloc(sizeof(struct tda8083_state), GFP_KERNEL); |
392 | if (state == NULL) goto error; | 392 | if (state == NULL) goto error; |
393 | 393 | ||
394 | /* setup the state */ | 394 | /* setup the state */ |
diff --git a/drivers/media/dvb/frontends/tda80xx.c b/drivers/media/dvb/frontends/tda80xx.c index c99632114283..032d348dafb7 100644 --- a/drivers/media/dvb/frontends/tda80xx.c +++ b/drivers/media/dvb/frontends/tda80xx.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include <linux/spinlock.h> | 27 | #include <linux/spinlock.h> |
28 | #include <linux/threads.h> | 28 | #include <linux/threads.h> |
29 | #include <linux/interrupt.h> | 29 | #include <linux/interrupt.h> |
30 | #include <asm/irq.h> | 30 | #include <linux/irq.h> |
31 | #include <linux/kernel.h> | 31 | #include <linux/kernel.h> |
32 | #include <linux/module.h> | 32 | #include <linux/module.h> |
33 | #include <linux/slab.h> | 33 | #include <linux/slab.h> |
@@ -400,7 +400,7 @@ static void tda80xx_wait_diseqc_fifo(struct tda80xx_state* state) | |||
400 | 400 | ||
401 | static int tda8044_init(struct dvb_frontend* fe) | 401 | static int tda8044_init(struct dvb_frontend* fe) |
402 | { | 402 | { |
403 | struct tda80xx_state* state = (struct tda80xx_state*) fe->demodulator_priv; | 403 | struct tda80xx_state* state = fe->demodulator_priv; |
404 | int ret; | 404 | int ret; |
405 | 405 | ||
406 | /* | 406 | /* |
@@ -432,7 +432,7 @@ static int tda8044_init(struct dvb_frontend* fe) | |||
432 | 432 | ||
433 | static int tda8083_init(struct dvb_frontend* fe) | 433 | static int tda8083_init(struct dvb_frontend* fe) |
434 | { | 434 | { |
435 | struct tda80xx_state* state = (struct tda80xx_state*) fe->demodulator_priv; | 435 | struct tda80xx_state* state = fe->demodulator_priv; |
436 | 436 | ||
437 | tda80xx_write(state, 0x00, tda8083_inittab, sizeof(tda8083_inittab)); | 437 | tda80xx_write(state, 0x00, tda8083_inittab, sizeof(tda8083_inittab)); |
438 | 438 | ||
@@ -447,7 +447,7 @@ static int tda8083_init(struct dvb_frontend* fe) | |||
447 | 447 | ||
448 | static int tda80xx_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage) | 448 | static int tda80xx_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage) |
449 | { | 449 | { |
450 | struct tda80xx_state* state = (struct tda80xx_state*) fe->demodulator_priv; | 450 | struct tda80xx_state* state = fe->demodulator_priv; |
451 | 451 | ||
452 | switch (voltage) { | 452 | switch (voltage) { |
453 | case SEC_VOLTAGE_13: | 453 | case SEC_VOLTAGE_13: |
@@ -463,7 +463,7 @@ static int tda80xx_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage | |||
463 | 463 | ||
464 | static int tda80xx_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) | 464 | static int tda80xx_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) |
465 | { | 465 | { |
466 | struct tda80xx_state* state = (struct tda80xx_state*) fe->demodulator_priv; | 466 | struct tda80xx_state* state = fe->demodulator_priv; |
467 | 467 | ||
468 | switch (tone) { | 468 | switch (tone) { |
469 | case SEC_TONE_OFF: | 469 | case SEC_TONE_OFF: |
@@ -477,7 +477,7 @@ static int tda80xx_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) | |||
477 | 477 | ||
478 | static int tda80xx_send_diseqc_msg(struct dvb_frontend* fe, struct dvb_diseqc_master_cmd *cmd) | 478 | static int tda80xx_send_diseqc_msg(struct dvb_frontend* fe, struct dvb_diseqc_master_cmd *cmd) |
479 | { | 479 | { |
480 | struct tda80xx_state* state = (struct tda80xx_state*) fe->demodulator_priv; | 480 | struct tda80xx_state* state = fe->demodulator_priv; |
481 | 481 | ||
482 | if (cmd->msg_len > 6) | 482 | if (cmd->msg_len > 6) |
483 | return -EINVAL; | 483 | return -EINVAL; |
@@ -492,7 +492,7 @@ static int tda80xx_send_diseqc_msg(struct dvb_frontend* fe, struct dvb_diseqc_ma | |||
492 | 492 | ||
493 | static int tda80xx_send_diseqc_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t cmd) | 493 | static int tda80xx_send_diseqc_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t cmd) |
494 | { | 494 | { |
495 | struct tda80xx_state* state = (struct tda80xx_state*) fe->demodulator_priv; | 495 | struct tda80xx_state* state = fe->demodulator_priv; |
496 | 496 | ||
497 | switch (cmd) { | 497 | switch (cmd) { |
498 | case SEC_MINI_A: | 498 | case SEC_MINI_A: |
@@ -512,7 +512,7 @@ static int tda80xx_send_diseqc_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t | |||
512 | 512 | ||
513 | static int tda80xx_sleep(struct dvb_frontend* fe) | 513 | static int tda80xx_sleep(struct dvb_frontend* fe) |
514 | { | 514 | { |
515 | struct tda80xx_state* state = (struct tda80xx_state*) fe->demodulator_priv; | 515 | struct tda80xx_state* state = fe->demodulator_priv; |
516 | 516 | ||
517 | tda80xx_writereg(state, 0x00, 0x02); /* enter standby */ | 517 | tda80xx_writereg(state, 0x00, 0x02); /* enter standby */ |
518 | 518 | ||
@@ -521,7 +521,7 @@ static int tda80xx_sleep(struct dvb_frontend* fe) | |||
521 | 521 | ||
522 | static int tda80xx_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) | 522 | static int tda80xx_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) |
523 | { | 523 | { |
524 | struct tda80xx_state* state = (struct tda80xx_state*) fe->demodulator_priv; | 524 | struct tda80xx_state* state = fe->demodulator_priv; |
525 | 525 | ||
526 | tda80xx_writereg(state, 0x1c, 0x80); | 526 | tda80xx_writereg(state, 0x1c, 0x80); |
527 | state->config->pll_set(fe, p); | 527 | state->config->pll_set(fe, p); |
@@ -537,7 +537,7 @@ static int tda80xx_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
537 | 537 | ||
538 | static int tda80xx_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) | 538 | static int tda80xx_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) |
539 | { | 539 | { |
540 | struct tda80xx_state* state = (struct tda80xx_state*) fe->demodulator_priv; | 540 | struct tda80xx_state* state = fe->demodulator_priv; |
541 | 541 | ||
542 | if (!state->config->irq) | 542 | if (!state->config->irq) |
543 | tda80xx_read_status_int(state); | 543 | tda80xx_read_status_int(state); |
@@ -550,7 +550,7 @@ static int tda80xx_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
550 | 550 | ||
551 | static int tda80xx_read_status(struct dvb_frontend* fe, fe_status_t* status) | 551 | static int tda80xx_read_status(struct dvb_frontend* fe, fe_status_t* status) |
552 | { | 552 | { |
553 | struct tda80xx_state* state = (struct tda80xx_state*) fe->demodulator_priv; | 553 | struct tda80xx_state* state = fe->demodulator_priv; |
554 | 554 | ||
555 | if (!state->config->irq) | 555 | if (!state->config->irq) |
556 | tda80xx_read_status_int(state); | 556 | tda80xx_read_status_int(state); |
@@ -561,7 +561,7 @@ static int tda80xx_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
561 | 561 | ||
562 | static int tda80xx_read_ber(struct dvb_frontend* fe, u32* ber) | 562 | static int tda80xx_read_ber(struct dvb_frontend* fe, u32* ber) |
563 | { | 563 | { |
564 | struct tda80xx_state* state = (struct tda80xx_state*) fe->demodulator_priv; | 564 | struct tda80xx_state* state = fe->demodulator_priv; |
565 | int ret; | 565 | int ret; |
566 | u8 buf[3]; | 566 | u8 buf[3]; |
567 | 567 | ||
@@ -575,7 +575,7 @@ static int tda80xx_read_ber(struct dvb_frontend* fe, u32* ber) | |||
575 | 575 | ||
576 | static int tda80xx_read_signal_strength(struct dvb_frontend* fe, u16* strength) | 576 | static int tda80xx_read_signal_strength(struct dvb_frontend* fe, u16* strength) |
577 | { | 577 | { |
578 | struct tda80xx_state* state = (struct tda80xx_state*) fe->demodulator_priv; | 578 | struct tda80xx_state* state = fe->demodulator_priv; |
579 | 579 | ||
580 | u8 gain = ~tda80xx_readreg(state, 0x01); | 580 | u8 gain = ~tda80xx_readreg(state, 0x01); |
581 | *strength = (gain << 8) | gain; | 581 | *strength = (gain << 8) | gain; |
@@ -585,7 +585,7 @@ static int tda80xx_read_signal_strength(struct dvb_frontend* fe, u16* strength) | |||
585 | 585 | ||
586 | static int tda80xx_read_snr(struct dvb_frontend* fe, u16* snr) | 586 | static int tda80xx_read_snr(struct dvb_frontend* fe, u16* snr) |
587 | { | 587 | { |
588 | struct tda80xx_state* state = (struct tda80xx_state*) fe->demodulator_priv; | 588 | struct tda80xx_state* state = fe->demodulator_priv; |
589 | 589 | ||
590 | u8 quality = tda80xx_readreg(state, 0x08); | 590 | u8 quality = tda80xx_readreg(state, 0x08); |
591 | *snr = (quality << 8) | quality; | 591 | *snr = (quality << 8) | quality; |
@@ -595,7 +595,7 @@ static int tda80xx_read_snr(struct dvb_frontend* fe, u16* snr) | |||
595 | 595 | ||
596 | static int tda80xx_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | 596 | static int tda80xx_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) |
597 | { | 597 | { |
598 | struct tda80xx_state* state = (struct tda80xx_state*) fe->demodulator_priv; | 598 | struct tda80xx_state* state = fe->demodulator_priv; |
599 | 599 | ||
600 | *ucblocks = tda80xx_readreg(state, 0x0f); | 600 | *ucblocks = tda80xx_readreg(state, 0x0f); |
601 | if (*ucblocks == 0xff) | 601 | if (*ucblocks == 0xff) |
@@ -606,7 +606,7 @@ static int tda80xx_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | |||
606 | 606 | ||
607 | static int tda80xx_init(struct dvb_frontend* fe) | 607 | static int tda80xx_init(struct dvb_frontend* fe) |
608 | { | 608 | { |
609 | struct tda80xx_state* state = (struct tda80xx_state*) fe->demodulator_priv; | 609 | struct tda80xx_state* state = fe->demodulator_priv; |
610 | 610 | ||
611 | switch(state->id) { | 611 | switch(state->id) { |
612 | case ID_TDA8044: | 612 | case ID_TDA8044: |
@@ -620,7 +620,7 @@ static int tda80xx_init(struct dvb_frontend* fe) | |||
620 | 620 | ||
621 | static void tda80xx_release(struct dvb_frontend* fe) | 621 | static void tda80xx_release(struct dvb_frontend* fe) |
622 | { | 622 | { |
623 | struct tda80xx_state* state = (struct tda80xx_state*) fe->demodulator_priv; | 623 | struct tda80xx_state* state = fe->demodulator_priv; |
624 | 624 | ||
625 | if (state->config->irq) | 625 | if (state->config->irq) |
626 | free_irq(state->config->irq, &state->worklet); | 626 | free_irq(state->config->irq, &state->worklet); |
@@ -637,7 +637,7 @@ struct dvb_frontend* tda80xx_attach(const struct tda80xx_config* config, | |||
637 | int ret; | 637 | int ret; |
638 | 638 | ||
639 | /* allocate memory for the internal state */ | 639 | /* allocate memory for the internal state */ |
640 | state = (struct tda80xx_state*) kmalloc(sizeof(struct tda80xx_state), GFP_KERNEL); | 640 | state = kmalloc(sizeof(struct tda80xx_state), GFP_KERNEL); |
641 | if (state == NULL) goto error; | 641 | if (state == NULL) goto error; |
642 | 642 | ||
643 | /* setup the state */ | 643 | /* setup the state */ |
diff --git a/drivers/media/dvb/frontends/ves1820.c b/drivers/media/dvb/frontends/ves1820.c index 9c0d23e1d9e5..70fb44b391a7 100644 --- a/drivers/media/dvb/frontends/ves1820.c +++ b/drivers/media/dvb/frontends/ves1820.c | |||
@@ -70,7 +70,6 @@ static int ves1820_writereg(struct ves1820_state *state, u8 reg, u8 data) | |||
70 | printk("ves1820: %s(): writereg error (reg == 0x%02x," | 70 | printk("ves1820: %s(): writereg error (reg == 0x%02x," |
71 | "val == 0x%02x, ret == %i)\n", __FUNCTION__, reg, data, ret); | 71 | "val == 0x%02x, ret == %i)\n", __FUNCTION__, reg, data, ret); |
72 | 72 | ||
73 | msleep(10); | ||
74 | return (ret != 1) ? -EREMOTEIO : 0; | 73 | return (ret != 1) ? -EREMOTEIO : 0; |
75 | } | 74 | } |
76 | 75 | ||
@@ -193,7 +192,7 @@ static int ves1820_set_symbolrate(struct ves1820_state *state, u32 symbolrate) | |||
193 | 192 | ||
194 | static int ves1820_init(struct dvb_frontend* fe) | 193 | static int ves1820_init(struct dvb_frontend* fe) |
195 | { | 194 | { |
196 | struct ves1820_state* state = (struct ves1820_state*) fe->demodulator_priv; | 195 | struct ves1820_state* state = fe->demodulator_priv; |
197 | int i; | 196 | int i; |
198 | int val; | 197 | int val; |
199 | 198 | ||
@@ -214,7 +213,7 @@ static int ves1820_init(struct dvb_frontend* fe) | |||
214 | 213 | ||
215 | static int ves1820_set_parameters(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) | 214 | static int ves1820_set_parameters(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) |
216 | { | 215 | { |
217 | struct ves1820_state* state = (struct ves1820_state*) fe->demodulator_priv; | 216 | struct ves1820_state* state = fe->demodulator_priv; |
218 | static const u8 reg0x00[] = { 0x00, 0x04, 0x08, 0x0c, 0x10 }; | 217 | static const u8 reg0x00[] = { 0x00, 0x04, 0x08, 0x0c, 0x10 }; |
219 | static const u8 reg0x01[] = { 140, 140, 106, 100, 92 }; | 218 | static const u8 reg0x01[] = { 140, 140, 106, 100, 92 }; |
220 | static const u8 reg0x05[] = { 135, 100, 70, 54, 38 }; | 219 | static const u8 reg0x05[] = { 135, 100, 70, 54, 38 }; |
@@ -241,7 +240,7 @@ static int ves1820_set_parameters(struct dvb_frontend* fe, struct dvb_frontend_p | |||
241 | 240 | ||
242 | static int ves1820_read_status(struct dvb_frontend* fe, fe_status_t* status) | 241 | static int ves1820_read_status(struct dvb_frontend* fe, fe_status_t* status) |
243 | { | 242 | { |
244 | struct ves1820_state* state = (struct ves1820_state*) fe->demodulator_priv; | 243 | struct ves1820_state* state = fe->demodulator_priv; |
245 | int sync; | 244 | int sync; |
246 | 245 | ||
247 | *status = 0; | 246 | *status = 0; |
@@ -267,7 +266,7 @@ static int ves1820_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
267 | 266 | ||
268 | static int ves1820_read_ber(struct dvb_frontend* fe, u32* ber) | 267 | static int ves1820_read_ber(struct dvb_frontend* fe, u32* ber) |
269 | { | 268 | { |
270 | struct ves1820_state* state = (struct ves1820_state*) fe->demodulator_priv; | 269 | struct ves1820_state* state = fe->demodulator_priv; |
271 | 270 | ||
272 | u32 _ber = ves1820_readreg(state, 0x14) | | 271 | u32 _ber = ves1820_readreg(state, 0x14) | |
273 | (ves1820_readreg(state, 0x15) << 8) | | 272 | (ves1820_readreg(state, 0x15) << 8) | |
@@ -279,7 +278,7 @@ static int ves1820_read_ber(struct dvb_frontend* fe, u32* ber) | |||
279 | 278 | ||
280 | static int ves1820_read_signal_strength(struct dvb_frontend* fe, u16* strength) | 279 | static int ves1820_read_signal_strength(struct dvb_frontend* fe, u16* strength) |
281 | { | 280 | { |
282 | struct ves1820_state* state = (struct ves1820_state*) fe->demodulator_priv; | 281 | struct ves1820_state* state = fe->demodulator_priv; |
283 | 282 | ||
284 | u8 gain = ves1820_readreg(state, 0x17); | 283 | u8 gain = ves1820_readreg(state, 0x17); |
285 | *strength = (gain << 8) | gain; | 284 | *strength = (gain << 8) | gain; |
@@ -289,7 +288,7 @@ static int ves1820_read_signal_strength(struct dvb_frontend* fe, u16* strength) | |||
289 | 288 | ||
290 | static int ves1820_read_snr(struct dvb_frontend* fe, u16* snr) | 289 | static int ves1820_read_snr(struct dvb_frontend* fe, u16* snr) |
291 | { | 290 | { |
292 | struct ves1820_state* state = (struct ves1820_state*) fe->demodulator_priv; | 291 | struct ves1820_state* state = fe->demodulator_priv; |
293 | 292 | ||
294 | u8 quality = ~ves1820_readreg(state, 0x18); | 293 | u8 quality = ~ves1820_readreg(state, 0x18); |
295 | *snr = (quality << 8) | quality; | 294 | *snr = (quality << 8) | quality; |
@@ -299,7 +298,7 @@ static int ves1820_read_snr(struct dvb_frontend* fe, u16* snr) | |||
299 | 298 | ||
300 | static int ves1820_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | 299 | static int ves1820_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) |
301 | { | 300 | { |
302 | struct ves1820_state* state = (struct ves1820_state*) fe->demodulator_priv; | 301 | struct ves1820_state* state = fe->demodulator_priv; |
303 | 302 | ||
304 | *ucblocks = ves1820_readreg(state, 0x13) & 0x7f; | 303 | *ucblocks = ves1820_readreg(state, 0x13) & 0x7f; |
305 | if (*ucblocks == 0x7f) | 304 | if (*ucblocks == 0x7f) |
@@ -314,7 +313,7 @@ static int ves1820_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | |||
314 | 313 | ||
315 | static int ves1820_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) | 314 | static int ves1820_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) |
316 | { | 315 | { |
317 | struct ves1820_state* state = (struct ves1820_state*) fe->demodulator_priv; | 316 | struct ves1820_state* state = fe->demodulator_priv; |
318 | int sync; | 317 | int sync; |
319 | s8 afc = 0; | 318 | s8 afc = 0; |
320 | 319 | ||
@@ -345,7 +344,7 @@ static int ves1820_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
345 | 344 | ||
346 | static int ves1820_sleep(struct dvb_frontend* fe) | 345 | static int ves1820_sleep(struct dvb_frontend* fe) |
347 | { | 346 | { |
348 | struct ves1820_state* state = (struct ves1820_state*) fe->demodulator_priv; | 347 | struct ves1820_state* state = fe->demodulator_priv; |
349 | 348 | ||
350 | ves1820_writereg(state, 0x1b, 0x02); /* pdown ADC */ | 349 | ves1820_writereg(state, 0x1b, 0x02); /* pdown ADC */ |
351 | ves1820_writereg(state, 0x00, 0x80); /* standby */ | 350 | ves1820_writereg(state, 0x00, 0x80); /* standby */ |
@@ -364,7 +363,7 @@ static int ves1820_get_tune_settings(struct dvb_frontend* fe, struct dvb_fronten | |||
364 | 363 | ||
365 | static void ves1820_release(struct dvb_frontend* fe) | 364 | static void ves1820_release(struct dvb_frontend* fe) |
366 | { | 365 | { |
367 | struct ves1820_state* state = (struct ves1820_state*) fe->demodulator_priv; | 366 | struct ves1820_state* state = fe->demodulator_priv; |
368 | kfree(state); | 367 | kfree(state); |
369 | } | 368 | } |
370 | 369 | ||
@@ -377,7 +376,7 @@ struct dvb_frontend* ves1820_attach(const struct ves1820_config* config, | |||
377 | struct ves1820_state* state = NULL; | 376 | struct ves1820_state* state = NULL; |
378 | 377 | ||
379 | /* allocate memory for the internal state */ | 378 | /* allocate memory for the internal state */ |
380 | state = (struct ves1820_state*) kmalloc(sizeof(struct ves1820_state), GFP_KERNEL); | 379 | state = kmalloc(sizeof(struct ves1820_state), GFP_KERNEL); |
381 | if (state == NULL) | 380 | if (state == NULL) |
382 | goto error; | 381 | goto error; |
383 | 382 | ||
diff --git a/drivers/media/dvb/frontends/ves1x93.c b/drivers/media/dvb/frontends/ves1x93.c index edcad283aa86..821df8e839d0 100644 --- a/drivers/media/dvb/frontends/ves1x93.c +++ b/drivers/media/dvb/frontends/ves1x93.c | |||
@@ -263,7 +263,7 @@ static int ves1x93_set_symbolrate (struct ves1x93_state* state, u32 srate) | |||
263 | 263 | ||
264 | static int ves1x93_init (struct dvb_frontend* fe) | 264 | static int ves1x93_init (struct dvb_frontend* fe) |
265 | { | 265 | { |
266 | struct ves1x93_state* state = (struct ves1x93_state*) fe->demodulator_priv; | 266 | struct ves1x93_state* state = fe->demodulator_priv; |
267 | int i; | 267 | int i; |
268 | int val; | 268 | int val; |
269 | 269 | ||
@@ -289,7 +289,7 @@ static int ves1x93_init (struct dvb_frontend* fe) | |||
289 | 289 | ||
290 | static int ves1x93_set_voltage (struct dvb_frontend* fe, fe_sec_voltage_t voltage) | 290 | static int ves1x93_set_voltage (struct dvb_frontend* fe, fe_sec_voltage_t voltage) |
291 | { | 291 | { |
292 | struct ves1x93_state* state = (struct ves1x93_state*) fe->demodulator_priv; | 292 | struct ves1x93_state* state = fe->demodulator_priv; |
293 | 293 | ||
294 | switch (voltage) { | 294 | switch (voltage) { |
295 | case SEC_VOLTAGE_13: | 295 | case SEC_VOLTAGE_13: |
@@ -305,7 +305,7 @@ static int ves1x93_set_voltage (struct dvb_frontend* fe, fe_sec_voltage_t voltag | |||
305 | 305 | ||
306 | static int ves1x93_read_status(struct dvb_frontend* fe, fe_status_t* status) | 306 | static int ves1x93_read_status(struct dvb_frontend* fe, fe_status_t* status) |
307 | { | 307 | { |
308 | struct ves1x93_state* state = (struct ves1x93_state*) fe->demodulator_priv; | 308 | struct ves1x93_state* state = fe->demodulator_priv; |
309 | 309 | ||
310 | u8 sync = ves1x93_readreg (state, 0x0e); | 310 | u8 sync = ves1x93_readreg (state, 0x0e); |
311 | 311 | ||
@@ -346,7 +346,7 @@ static int ves1x93_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
346 | 346 | ||
347 | static int ves1x93_read_ber(struct dvb_frontend* fe, u32* ber) | 347 | static int ves1x93_read_ber(struct dvb_frontend* fe, u32* ber) |
348 | { | 348 | { |
349 | struct ves1x93_state* state = (struct ves1x93_state*) fe->demodulator_priv; | 349 | struct ves1x93_state* state = fe->demodulator_priv; |
350 | 350 | ||
351 | *ber = ves1x93_readreg (state, 0x15); | 351 | *ber = ves1x93_readreg (state, 0x15); |
352 | *ber |= (ves1x93_readreg (state, 0x16) << 8); | 352 | *ber |= (ves1x93_readreg (state, 0x16) << 8); |
@@ -358,7 +358,7 @@ static int ves1x93_read_ber(struct dvb_frontend* fe, u32* ber) | |||
358 | 358 | ||
359 | static int ves1x93_read_signal_strength(struct dvb_frontend* fe, u16* strength) | 359 | static int ves1x93_read_signal_strength(struct dvb_frontend* fe, u16* strength) |
360 | { | 360 | { |
361 | struct ves1x93_state* state = (struct ves1x93_state*) fe->demodulator_priv; | 361 | struct ves1x93_state* state = fe->demodulator_priv; |
362 | 362 | ||
363 | u8 signal = ~ves1x93_readreg (state, 0x0b); | 363 | u8 signal = ~ves1x93_readreg (state, 0x0b); |
364 | *strength = (signal << 8) | signal; | 364 | *strength = (signal << 8) | signal; |
@@ -368,7 +368,7 @@ static int ves1x93_read_signal_strength(struct dvb_frontend* fe, u16* strength) | |||
368 | 368 | ||
369 | static int ves1x93_read_snr(struct dvb_frontend* fe, u16* snr) | 369 | static int ves1x93_read_snr(struct dvb_frontend* fe, u16* snr) |
370 | { | 370 | { |
371 | struct ves1x93_state* state = (struct ves1x93_state*) fe->demodulator_priv; | 371 | struct ves1x93_state* state = fe->demodulator_priv; |
372 | 372 | ||
373 | u8 _snr = ~ves1x93_readreg (state, 0x1c); | 373 | u8 _snr = ~ves1x93_readreg (state, 0x1c); |
374 | *snr = (_snr << 8) | _snr; | 374 | *snr = (_snr << 8) | _snr; |
@@ -378,7 +378,7 @@ static int ves1x93_read_snr(struct dvb_frontend* fe, u16* snr) | |||
378 | 378 | ||
379 | static int ves1x93_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | 379 | static int ves1x93_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) |
380 | { | 380 | { |
381 | struct ves1x93_state* state = (struct ves1x93_state*) fe->demodulator_priv; | 381 | struct ves1x93_state* state = fe->demodulator_priv; |
382 | 382 | ||
383 | *ucblocks = ves1x93_readreg (state, 0x18) & 0x7f; | 383 | *ucblocks = ves1x93_readreg (state, 0x18) & 0x7f; |
384 | 384 | ||
@@ -393,7 +393,7 @@ static int ves1x93_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | |||
393 | 393 | ||
394 | static int ves1x93_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) | 394 | static int ves1x93_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) |
395 | { | 395 | { |
396 | struct ves1x93_state* state = (struct ves1x93_state*) fe->demodulator_priv; | 396 | struct ves1x93_state* state = fe->demodulator_priv; |
397 | 397 | ||
398 | ves1x93_writereg(state, 0x00, 0x11); | 398 | ves1x93_writereg(state, 0x00, 0x11); |
399 | state->config->pll_set(fe, p); | 399 | state->config->pll_set(fe, p); |
@@ -408,7 +408,7 @@ static int ves1x93_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
408 | 408 | ||
409 | static int ves1x93_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) | 409 | static int ves1x93_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) |
410 | { | 410 | { |
411 | struct ves1x93_state* state = (struct ves1x93_state*) fe->demodulator_priv; | 411 | struct ves1x93_state* state = fe->demodulator_priv; |
412 | int afc; | 412 | int afc; |
413 | 413 | ||
414 | afc = ((int)((char)(ves1x93_readreg (state, 0x0a) << 1)))/2; | 414 | afc = ((int)((char)(ves1x93_readreg (state, 0x0a) << 1)))/2; |
@@ -431,14 +431,14 @@ static int ves1x93_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
431 | 431 | ||
432 | static int ves1x93_sleep(struct dvb_frontend* fe) | 432 | static int ves1x93_sleep(struct dvb_frontend* fe) |
433 | { | 433 | { |
434 | struct ves1x93_state* state = (struct ves1x93_state*) fe->demodulator_priv; | 434 | struct ves1x93_state* state = fe->demodulator_priv; |
435 | 435 | ||
436 | return ves1x93_writereg (state, 0x00, 0x08); | 436 | return ves1x93_writereg (state, 0x00, 0x08); |
437 | } | 437 | } |
438 | 438 | ||
439 | static void ves1x93_release(struct dvb_frontend* fe) | 439 | static void ves1x93_release(struct dvb_frontend* fe) |
440 | { | 440 | { |
441 | struct ves1x93_state* state = (struct ves1x93_state*) fe->demodulator_priv; | 441 | struct ves1x93_state* state = fe->demodulator_priv; |
442 | kfree(state); | 442 | kfree(state); |
443 | } | 443 | } |
444 | 444 | ||
@@ -451,7 +451,7 @@ struct dvb_frontend* ves1x93_attach(const struct ves1x93_config* config, | |||
451 | u8 identity; | 451 | u8 identity; |
452 | 452 | ||
453 | /* allocate memory for the internal state */ | 453 | /* allocate memory for the internal state */ |
454 | state = (struct ves1x93_state*) kmalloc(sizeof(struct ves1x93_state), GFP_KERNEL); | 454 | state = kmalloc(sizeof(struct ves1x93_state), GFP_KERNEL); |
455 | if (state == NULL) goto error; | 455 | if (state == NULL) goto error; |
456 | 456 | ||
457 | /* setup the state */ | 457 | /* setup the state */ |