diff options
Diffstat (limited to 'drivers/media/dvb/frontends')
-rw-r--r-- | drivers/media/dvb/frontends/mt2131.c | 2 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/s5h1409.c | 96 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/stv0297.c | 22 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/tda10021.c | 6 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/ves1820.c | 2 |
5 files changed, 111 insertions, 17 deletions
diff --git a/drivers/media/dvb/frontends/mt2131.c b/drivers/media/dvb/frontends/mt2131.c index 4b93931de4e1..13cf16668171 100644 --- a/drivers/media/dvb/frontends/mt2131.c +++ b/drivers/media/dvb/frontends/mt2131.c | |||
@@ -116,7 +116,7 @@ static int mt2131_set_params(struct dvb_frontend *fe, | |||
116 | f_lo1 = (f_lo1 / 250) * 250; | 116 | f_lo1 = (f_lo1 / 250) * 250; |
117 | f_lo2 = f_lo1 - freq - MT2131_IF2; | 117 | f_lo2 = f_lo1 - freq - MT2131_IF2; |
118 | 118 | ||
119 | priv->frequency = (f_lo1 - f_lo2 - MT2131_IF2) * 1000, | 119 | priv->frequency = (f_lo1 - f_lo2 - MT2131_IF2) * 1000; |
120 | 120 | ||
121 | /* Frequency LO1 = 16MHz * (DIV1 + NUM1/8192 ) */ | 121 | /* Frequency LO1 = 16MHz * (DIV1 + NUM1/8192 ) */ |
122 | num1 = f_lo1 * 64 / (MT2131_FREF / 128); | 122 | num1 = f_lo1 * 64 / (MT2131_FREF / 128); |
diff --git a/drivers/media/dvb/frontends/s5h1409.c b/drivers/media/dvb/frontends/s5h1409.c index 30e8a705fad4..8dee7ec9456a 100644 --- a/drivers/media/dvb/frontends/s5h1409.c +++ b/drivers/media/dvb/frontends/s5h1409.c | |||
@@ -42,6 +42,9 @@ struct s5h1409_state { | |||
42 | fe_modulation_t current_modulation; | 42 | fe_modulation_t current_modulation; |
43 | 43 | ||
44 | u32 current_frequency; | 44 | u32 current_frequency; |
45 | |||
46 | u32 is_qam_locked; | ||
47 | u32 qam_state; | ||
45 | }; | 48 | }; |
46 | 49 | ||
47 | static int debug = 0; | 50 | static int debug = 0; |
@@ -94,6 +97,7 @@ static struct init_tab { | |||
94 | { 0xac, 0x1003, }, | 97 | { 0xac, 0x1003, }, |
95 | { 0xad, 0x103f, }, | 98 | { 0xad, 0x103f, }, |
96 | { 0xe2, 0x0100, }, | 99 | { 0xe2, 0x0100, }, |
100 | { 0xe3, 0x0000, }, | ||
97 | { 0x28, 0x1010, }, | 101 | { 0x28, 0x1010, }, |
98 | { 0xb1, 0x000e, }, | 102 | { 0xb1, 0x000e, }, |
99 | }; | 103 | }; |
@@ -335,6 +339,8 @@ static int s5h1409_softreset(struct dvb_frontend* fe) | |||
335 | 339 | ||
336 | s5h1409_writereg(state, 0xf5, 0); | 340 | s5h1409_writereg(state, 0xf5, 0); |
337 | s5h1409_writereg(state, 0xf5, 1); | 341 | s5h1409_writereg(state, 0xf5, 1); |
342 | state->is_qam_locked = 0; | ||
343 | state->qam_state = 0; | ||
338 | return 0; | 344 | return 0; |
339 | } | 345 | } |
340 | 346 | ||
@@ -349,6 +355,11 @@ static int s5h1409_set_if_freq(struct dvb_frontend* fe, int KHz) | |||
349 | s5h1409_writereg(state, 0x87, 0x01be); | 355 | s5h1409_writereg(state, 0x87, 0x01be); |
350 | s5h1409_writereg(state, 0x88, 0x0436); | 356 | s5h1409_writereg(state, 0x88, 0x0436); |
351 | s5h1409_writereg(state, 0x89, 0x054d); | 357 | s5h1409_writereg(state, 0x89, 0x054d); |
358 | } else | ||
359 | if (KHz == 4000) { | ||
360 | s5h1409_writereg(state, 0x87, 0x014b); | ||
361 | s5h1409_writereg(state, 0x88, 0x0cb5); | ||
362 | s5h1409_writereg(state, 0x89, 0x03e2); | ||
352 | } else { | 363 | } else { |
353 | printk("%s() Invalid arg = %d KHz\n", __FUNCTION__, KHz); | 364 | printk("%s() Invalid arg = %d KHz\n", __FUNCTION__, KHz); |
354 | ret = -1; | 365 | ret = -1; |
@@ -361,7 +372,7 @@ static int s5h1409_set_spectralinversion(struct dvb_frontend* fe, int inverted) | |||
361 | { | 372 | { |
362 | struct s5h1409_state* state = fe->demodulator_priv; | 373 | struct s5h1409_state* state = fe->demodulator_priv; |
363 | 374 | ||
364 | dprintk("%s()\n", __FUNCTION__); | 375 | dprintk("%s(%d)\n", __FUNCTION__, inverted); |
365 | 376 | ||
366 | if(inverted == 1) | 377 | if(inverted == 1) |
367 | return s5h1409_writereg(state, 0x1b, 0x1101); /* Inverted */ | 378 | return s5h1409_writereg(state, 0x1b, 0x1101); /* Inverted */ |
@@ -382,14 +393,10 @@ static int s5h1409_enable_modulation(struct dvb_frontend* fe, | |||
382 | s5h1409_writereg(state, 0xf4, 0); | 393 | s5h1409_writereg(state, 0xf4, 0); |
383 | break; | 394 | break; |
384 | case QAM_64: | 395 | case QAM_64: |
385 | dprintk("%s() QAM_64\n", __FUNCTION__); | ||
386 | s5h1409_writereg(state, 0xf4, 1); | ||
387 | s5h1409_writereg(state, 0x85, 0x100); | ||
388 | break; | ||
389 | case QAM_256: | 396 | case QAM_256: |
390 | dprintk("%s() QAM_256\n", __FUNCTION__); | 397 | dprintk("%s() QAM_AUTO (64/256)\n", __FUNCTION__); |
391 | s5h1409_writereg(state, 0xf4, 1); | 398 | s5h1409_writereg(state, 0xf4, 1); |
392 | s5h1409_writereg(state, 0x85, 0x101); | 399 | s5h1409_writereg(state, 0x85, 0x110); |
393 | break; | 400 | break; |
394 | default: | 401 | default: |
395 | dprintk("%s() Invalid modulation\n", __FUNCTION__); | 402 | dprintk("%s() Invalid modulation\n", __FUNCTION__); |
@@ -423,7 +430,7 @@ static int s5h1409_set_gpio(struct dvb_frontend* fe, int enable) | |||
423 | if (enable) | 430 | if (enable) |
424 | return s5h1409_writereg(state, 0xe3, 0x1100); | 431 | return s5h1409_writereg(state, 0xe3, 0x1100); |
425 | else | 432 | else |
426 | return s5h1409_writereg(state, 0xe3, 0); | 433 | return s5h1409_writereg(state, 0xe3, 0x1000); |
427 | } | 434 | } |
428 | 435 | ||
429 | static int s5h1409_sleep(struct dvb_frontend* fe, int enable) | 436 | static int s5h1409_sleep(struct dvb_frontend* fe, int enable) |
@@ -444,6 +451,66 @@ static int s5h1409_register_reset(struct dvb_frontend* fe) | |||
444 | return s5h1409_writereg(state, 0xfa, 0); | 451 | return s5h1409_writereg(state, 0xfa, 0); |
445 | } | 452 | } |
446 | 453 | ||
454 | static void s5h1409_set_qam_amhum_mode(struct dvb_frontend *fe) | ||
455 | { | ||
456 | struct s5h1409_state *state = fe->demodulator_priv; | ||
457 | u16 reg; | ||
458 | |||
459 | if (state->is_qam_locked) | ||
460 | return; | ||
461 | |||
462 | /* QAM EQ lock check */ | ||
463 | reg = s5h1409_readreg(state, 0xf0); | ||
464 | |||
465 | if ((reg >> 13) & 0x1) { | ||
466 | |||
467 | state->is_qam_locked = 1; | ||
468 | reg &= 0xff; | ||
469 | |||
470 | s5h1409_writereg(state, 0x96, 0x00c); | ||
471 | if ((reg < 0x38) || (reg > 0x68) ) { | ||
472 | s5h1409_writereg(state, 0x93, 0x3332); | ||
473 | s5h1409_writereg(state, 0x9e, 0x2c37); | ||
474 | } else { | ||
475 | s5h1409_writereg(state, 0x93, 0x3130); | ||
476 | s5h1409_writereg(state, 0x9e, 0x2836); | ||
477 | } | ||
478 | |||
479 | } else { | ||
480 | s5h1409_writereg(state, 0x96, 0x0008); | ||
481 | s5h1409_writereg(state, 0x93, 0x3332); | ||
482 | s5h1409_writereg(state, 0x9e, 0x2c37); | ||
483 | } | ||
484 | } | ||
485 | |||
486 | static void s5h1409_set_qam_interleave_mode(struct dvb_frontend *fe) | ||
487 | { | ||
488 | struct s5h1409_state *state = fe->demodulator_priv; | ||
489 | u16 reg, reg1, reg2; | ||
490 | |||
491 | reg = s5h1409_readreg(state, 0xf1); | ||
492 | |||
493 | /* Master lock */ | ||
494 | if ((reg >> 15) & 0x1) { | ||
495 | if (state->qam_state != 2) { | ||
496 | state->qam_state = 2; | ||
497 | reg1 = s5h1409_readreg(state, 0xb2); | ||
498 | reg2 = s5h1409_readreg(state, 0xad); | ||
499 | |||
500 | s5h1409_writereg(state, 0x96, 0x20); | ||
501 | s5h1409_writereg(state, 0xad, | ||
502 | ( ((reg1 & 0xf000) >> 4) | (reg2 & 0xf0ff)) ); | ||
503 | s5h1409_writereg(state, 0xab, 0x1100); | ||
504 | } | ||
505 | } else { | ||
506 | if (state->qam_state != 1) { | ||
507 | state->qam_state = 1; | ||
508 | s5h1409_writereg(state, 0x96, 0x08); | ||
509 | s5h1409_writereg(state, 0xab, 0x1101); | ||
510 | } | ||
511 | } | ||
512 | } | ||
513 | |||
447 | /* Talk to the demod, set the FEC, GUARD, QAM settings etc */ | 514 | /* Talk to the demod, set the FEC, GUARD, QAM settings etc */ |
448 | static int s5h1409_set_frontend (struct dvb_frontend* fe, | 515 | static int s5h1409_set_frontend (struct dvb_frontend* fe, |
449 | struct dvb_frontend_parameters *p) | 516 | struct dvb_frontend_parameters *p) |
@@ -458,12 +525,21 @@ static int s5h1409_set_frontend (struct dvb_frontend* fe, | |||
458 | 525 | ||
459 | s5h1409_enable_modulation(fe, p->u.vsb.modulation); | 526 | s5h1409_enable_modulation(fe, p->u.vsb.modulation); |
460 | 527 | ||
528 | /* Allow the demod to settle */ | ||
529 | msleep(100); | ||
530 | |||
461 | if (fe->ops.tuner_ops.set_params) { | 531 | if (fe->ops.tuner_ops.set_params) { |
462 | if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 1); | 532 | if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 1); |
463 | fe->ops.tuner_ops.set_params(fe, p); | 533 | fe->ops.tuner_ops.set_params(fe, p); |
464 | if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); | 534 | if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); |
465 | } | 535 | } |
466 | 536 | ||
537 | /* Optimize the demod for QAM */ | ||
538 | if (p->u.vsb.modulation != VSB_8) { | ||
539 | s5h1409_set_qam_amhum_mode(fe); | ||
540 | s5h1409_set_qam_interleave_mode(fe); | ||
541 | } | ||
542 | |||
467 | return 0; | 543 | return 0; |
468 | } | 544 | } |
469 | 545 | ||
@@ -495,8 +571,8 @@ static int s5h1409_init (struct dvb_frontend* fe) | |||
495 | s5h1409_set_gpio(fe, state->config->gpio); | 571 | s5h1409_set_gpio(fe, state->config->gpio); |
496 | s5h1409_softreset(fe); | 572 | s5h1409_softreset(fe); |
497 | 573 | ||
498 | /* Note: Leaving the I2C gate open here. */ | 574 | /* Note: Leaving the I2C gate closed. */ |
499 | s5h1409_i2c_gate_ctrl(fe, 1); | 575 | s5h1409_i2c_gate_ctrl(fe, 0); |
500 | 576 | ||
501 | return 0; | 577 | return 0; |
502 | } | 578 | } |
diff --git a/drivers/media/dvb/frontends/stv0297.c b/drivers/media/dvb/frontends/stv0297.c index 17e5cb561cd8..7c23775f77db 100644 --- a/drivers/media/dvb/frontends/stv0297.c +++ b/drivers/media/dvb/frontends/stv0297.c | |||
@@ -358,11 +358,23 @@ static int stv0297_read_ber(struct dvb_frontend *fe, u32 * ber) | |||
358 | static int stv0297_read_signal_strength(struct dvb_frontend *fe, u16 * strength) | 358 | static int stv0297_read_signal_strength(struct dvb_frontend *fe, u16 * strength) |
359 | { | 359 | { |
360 | struct stv0297_state *state = fe->demodulator_priv; | 360 | struct stv0297_state *state = fe->demodulator_priv; |
361 | u8 STRENGTH[2]; | 361 | u8 STRENGTH[3]; |
362 | 362 | u16 tmp; | |
363 | stv0297_readregs(state, 0x41, STRENGTH, 2); | 363 | |
364 | *strength = (STRENGTH[1] & 0x03) << 8 | STRENGTH[0]; | 364 | stv0297_readregs(state, 0x41, STRENGTH, 3); |
365 | 365 | tmp = (STRENGTH[1] & 0x03) << 8 | STRENGTH[0]; | |
366 | if (STRENGTH[2] & 0x20) { | ||
367 | if (tmp < 0x200) | ||
368 | tmp = 0; | ||
369 | else | ||
370 | tmp = tmp - 0x200; | ||
371 | } else { | ||
372 | if (tmp > 0x1ff) | ||
373 | tmp = 0; | ||
374 | else | ||
375 | tmp = 0x1ff - tmp; | ||
376 | } | ||
377 | *strength = (tmp << 7) | (tmp >> 2); | ||
366 | return 0; | 378 | return 0; |
367 | } | 379 | } |
368 | 380 | ||
diff --git a/drivers/media/dvb/frontends/tda10021.c b/drivers/media/dvb/frontends/tda10021.c index 4cd9e82c4669..45137d2ebfb9 100644 --- a/drivers/media/dvb/frontends/tda10021.c +++ b/drivers/media/dvb/frontends/tda10021.c | |||
@@ -301,6 +301,8 @@ static int tda10021_read_ber(struct dvb_frontend* fe, u32* ber) | |||
301 | u32 _ber = tda10021_readreg(state, 0x14) | | 301 | u32 _ber = tda10021_readreg(state, 0x14) | |
302 | (tda10021_readreg(state, 0x15) << 8) | | 302 | (tda10021_readreg(state, 0x15) << 8) | |
303 | ((tda10021_readreg(state, 0x16) & 0x0f) << 16); | 303 | ((tda10021_readreg(state, 0x16) & 0x0f) << 16); |
304 | _tda10021_writereg(state, 0x10, (tda10021_readreg(state, 0x10) & ~0xc0) | ||
305 | | (tda10021_inittab[0x10] & 0xc0)); | ||
304 | *ber = 10 * _ber; | 306 | *ber = 10 * _ber; |
305 | 307 | ||
306 | return 0; | 308 | return 0; |
@@ -310,7 +312,11 @@ static int tda10021_read_signal_strength(struct dvb_frontend* fe, u16* strength) | |||
310 | { | 312 | { |
311 | struct tda10021_state* state = fe->demodulator_priv; | 313 | struct tda10021_state* state = fe->demodulator_priv; |
312 | 314 | ||
315 | u8 config = tda10021_readreg(state, 0x02); | ||
313 | u8 gain = tda10021_readreg(state, 0x17); | 316 | u8 gain = tda10021_readreg(state, 0x17); |
317 | if (config & 0x02) | ||
318 | /* the agc value is inverted */ | ||
319 | gain = ~gain; | ||
314 | *strength = (gain << 8) | gain; | 320 | *strength = (gain << 8) | gain; |
315 | 321 | ||
316 | return 0; | 322 | return 0; |
diff --git a/drivers/media/dvb/frontends/ves1820.c b/drivers/media/dvb/frontends/ves1820.c index 066b73b75698..60433b5011fd 100644 --- a/drivers/media/dvb/frontends/ves1820.c +++ b/drivers/media/dvb/frontends/ves1820.c | |||
@@ -47,7 +47,7 @@ struct ves1820_state { | |||
47 | static int verbose; | 47 | static int verbose; |
48 | 48 | ||
49 | static u8 ves1820_inittab[] = { | 49 | static u8 ves1820_inittab[] = { |
50 | 0x69, 0x6A, 0x93, 0x12, 0x12, 0x46, 0x26, 0x1A, | 50 | 0x69, 0x6A, 0x93, 0x1A, 0x12, 0x46, 0x26, 0x1A, |
51 | 0x43, 0x6A, 0xAA, 0xAA, 0x1E, 0x85, 0x43, 0x20, | 51 | 0x43, 0x6A, 0xAA, 0xAA, 0x1E, 0x85, 0x43, 0x20, |
52 | 0xE0, 0x00, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, | 52 | 0xE0, 0x00, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, |
53 | 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, | 53 | 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, |