diff options
Diffstat (limited to 'drivers/media/dvb/frontends/stv0297.c')
| -rw-r--r-- | drivers/media/dvb/frontends/stv0297.c | 129 |
1 files changed, 10 insertions, 119 deletions
diff --git a/drivers/media/dvb/frontends/stv0297.c b/drivers/media/dvb/frontends/stv0297.c index 928aca052afe..8d09afd7545d 100644 --- a/drivers/media/dvb/frontends/stv0297.c +++ b/drivers/media/dvb/frontends/stv0297.c | |||
| @@ -35,7 +35,6 @@ struct stv0297_state { | |||
| 35 | struct dvb_frontend frontend; | 35 | struct dvb_frontend frontend; |
| 36 | 36 | ||
| 37 | unsigned long base_freq; | 37 | unsigned long base_freq; |
| 38 | u8 pwm; | ||
| 39 | }; | 38 | }; |
| 40 | 39 | ||
| 41 | #if 1 | 40 | #if 1 |
| @@ -46,94 +45,6 @@ struct stv0297_state { | |||
| 46 | 45 | ||
| 47 | #define STV0297_CLOCK_KHZ 28900 | 46 | #define STV0297_CLOCK_KHZ 28900 |
| 48 | 47 | ||
| 49 | static u8 init_tab[] = { | ||
| 50 | 0x00, 0x09, | ||
| 51 | 0x01, 0x69, | ||
| 52 | 0x03, 0x00, | ||
| 53 | 0x04, 0x00, | ||
| 54 | 0x07, 0x00, | ||
| 55 | 0x08, 0x00, | ||
| 56 | 0x20, 0x00, | ||
| 57 | 0x21, 0x40, | ||
| 58 | 0x22, 0x00, | ||
| 59 | 0x23, 0x00, | ||
| 60 | 0x24, 0x40, | ||
| 61 | 0x25, 0x88, | ||
| 62 | 0x30, 0xff, | ||
| 63 | 0x31, 0x00, | ||
| 64 | 0x32, 0xff, | ||
| 65 | 0x33, 0x00, | ||
| 66 | 0x34, 0x50, | ||
| 67 | 0x35, 0x7f, | ||
| 68 | 0x36, 0x00, | ||
| 69 | 0x37, 0x20, | ||
| 70 | 0x38, 0x00, | ||
| 71 | 0x40, 0x1c, | ||
| 72 | 0x41, 0xff, | ||
| 73 | 0x42, 0x29, | ||
| 74 | 0x43, 0x00, | ||
| 75 | 0x44, 0xff, | ||
| 76 | 0x45, 0x00, | ||
| 77 | 0x46, 0x00, | ||
| 78 | 0x49, 0x04, | ||
| 79 | 0x4a, 0xff, | ||
| 80 | 0x4b, 0x7f, | ||
| 81 | 0x52, 0x30, | ||
| 82 | 0x55, 0xae, | ||
| 83 | 0x56, 0x47, | ||
| 84 | 0x57, 0xe1, | ||
| 85 | 0x58, 0x3a, | ||
| 86 | 0x5a, 0x1e, | ||
| 87 | 0x5b, 0x34, | ||
| 88 | 0x60, 0x00, | ||
| 89 | 0x63, 0x00, | ||
| 90 | 0x64, 0x00, | ||
| 91 | 0x65, 0x00, | ||
| 92 | 0x66, 0x00, | ||
| 93 | 0x67, 0x00, | ||
| 94 | 0x68, 0x00, | ||
| 95 | 0x69, 0x00, | ||
| 96 | 0x6a, 0x02, | ||
| 97 | 0x6b, 0x00, | ||
| 98 | 0x70, 0xff, | ||
| 99 | 0x71, 0x00, | ||
| 100 | 0x72, 0x00, | ||
| 101 | 0x73, 0x00, | ||
| 102 | 0x74, 0x0c, | ||
| 103 | 0x80, 0x00, | ||
| 104 | 0x81, 0x00, | ||
| 105 | 0x82, 0x00, | ||
| 106 | 0x83, 0x00, | ||
| 107 | 0x84, 0x04, | ||
| 108 | 0x85, 0x80, | ||
| 109 | 0x86, 0x24, | ||
| 110 | 0x87, 0x78, | ||
| 111 | 0x88, 0x00, | ||
| 112 | 0x89, 0x00, | ||
| 113 | 0x90, 0x01, | ||
| 114 | 0x91, 0x01, | ||
| 115 | 0xa0, 0x00, | ||
| 116 | 0xa1, 0x00, | ||
| 117 | 0xa2, 0x00, | ||
| 118 | 0xb0, 0x91, | ||
| 119 | 0xb1, 0x0b, | ||
| 120 | 0xc0, 0x53, | ||
| 121 | 0xc1, 0x70, | ||
| 122 | 0xc2, 0x12, | ||
| 123 | 0xd0, 0x00, | ||
| 124 | 0xd1, 0x00, | ||
| 125 | 0xd2, 0x00, | ||
| 126 | 0xd3, 0x00, | ||
| 127 | 0xd4, 0x00, | ||
| 128 | 0xd5, 0x00, | ||
| 129 | 0xde, 0x00, | ||
| 130 | 0xdf, 0x00, | ||
| 131 | 0x61, 0x49, | ||
| 132 | 0x62, 0x0b, | ||
| 133 | 0x53, 0x08, | ||
| 134 | 0x59, 0x08, | ||
| 135 | }; | ||
| 136 | |||
| 137 | 48 | ||
| 138 | static int stv0297_writereg(struct stv0297_state *state, u8 reg, u8 data) | 49 | static int stv0297_writereg(struct stv0297_state *state, u8 reg, u8 data) |
| 139 | { | 50 | { |
| @@ -378,34 +289,9 @@ static int stv0297_init(struct dvb_frontend *fe) | |||
| 378 | struct stv0297_state *state = fe->demodulator_priv; | 289 | struct stv0297_state *state = fe->demodulator_priv; |
| 379 | int i; | 290 | int i; |
| 380 | 291 | ||
| 381 | /* soft reset */ | ||
| 382 | stv0297_writereg_mask(state, 0x80, 1, 1); | ||
| 383 | stv0297_writereg_mask(state, 0x80, 1, 0); | ||
| 384 | |||
| 385 | /* reset deinterleaver */ | ||
| 386 | stv0297_writereg_mask(state, 0x81, 1, 1); | ||
| 387 | stv0297_writereg_mask(state, 0x81, 1, 0); | ||
| 388 | |||
| 389 | /* load init table */ | 292 | /* load init table */ |
| 390 | for (i = 0; i < sizeof(init_tab); i += 2) { | 293 | for (i=0; !(state->config->inittab[i] == 0xff && state->config->inittab[i+1] == 0xff); i+=2) |
| 391 | stv0297_writereg(state, init_tab[i], init_tab[i + 1]); | 294 | stv0297_writereg(state, state->config->inittab[i], state->config->inittab[i+1]); |
| 392 | } | ||
| 393 | |||
| 394 | /* set a dummy symbol rate */ | ||
| 395 | stv0297_set_symbolrate(state, 6900); | ||
| 396 | |||
| 397 | /* invert AGC1 polarity */ | ||
| 398 | stv0297_writereg_mask(state, 0x88, 0x10, 0x10); | ||
| 399 | |||
| 400 | /* setup bit error counting */ | ||
| 401 | stv0297_writereg_mask(state, 0xA0, 0x80, 0x00); | ||
| 402 | stv0297_writereg_mask(state, 0xA0, 0x10, 0x00); | ||
| 403 | stv0297_writereg_mask(state, 0xA0, 0x08, 0x00); | ||
| 404 | stv0297_writereg_mask(state, 0xA0, 0x07, 0x04); | ||
| 405 | |||
| 406 | /* min + max PWM */ | ||
| 407 | stv0297_writereg(state, 0x4a, 0x00); | ||
| 408 | stv0297_writereg(state, 0x4b, state->pwm); | ||
| 409 | msleep(200); | 295 | msleep(200); |
| 410 | 296 | ||
| 411 | if (state->config->pll_init) | 297 | if (state->config->pll_init) |
| @@ -606,7 +492,13 @@ static int stv0297_set_frontend(struct dvb_frontend *fe, struct dvb_frontend_par | |||
| 606 | stv0297_set_inversion(state, inversion); | 492 | stv0297_set_inversion(state, inversion); |
| 607 | 493 | ||
| 608 | /* kick off lock */ | 494 | /* kick off lock */ |
| 609 | stv0297_writereg_mask(state, 0x88, 0x08, 0x08); | 495 | /* Disable corner detection for higher QAMs */ |
| 496 | if (p->u.qam.modulation == QAM_128 || | ||
| 497 | p->u.qam.modulation == QAM_256) | ||
| 498 | stv0297_writereg_mask(state, 0x88, 0x08, 0x00); | ||
| 499 | else | ||
| 500 | stv0297_writereg_mask(state, 0x88, 0x08, 0x08); | ||
| 501 | |||
| 610 | stv0297_writereg_mask(state, 0x5a, 0x20, 0x00); | 502 | stv0297_writereg_mask(state, 0x5a, 0x20, 0x00); |
| 611 | stv0297_writereg_mask(state, 0x6a, 0x01, 0x01); | 503 | stv0297_writereg_mask(state, 0x6a, 0x01, 0x01); |
| 612 | stv0297_writereg_mask(state, 0x43, 0x40, 0x40); | 504 | stv0297_writereg_mask(state, 0x43, 0x40, 0x40); |
| @@ -732,7 +624,7 @@ static void stv0297_release(struct dvb_frontend *fe) | |||
| 732 | static struct dvb_frontend_ops stv0297_ops; | 624 | static struct dvb_frontend_ops stv0297_ops; |
| 733 | 625 | ||
| 734 | struct dvb_frontend *stv0297_attach(const struct stv0297_config *config, | 626 | struct dvb_frontend *stv0297_attach(const struct stv0297_config *config, |
| 735 | struct i2c_adapter *i2c, int pwm) | 627 | struct i2c_adapter *i2c) |
| 736 | { | 628 | { |
| 737 | struct stv0297_state *state = NULL; | 629 | struct stv0297_state *state = NULL; |
| 738 | 630 | ||
| @@ -746,7 +638,6 @@ struct dvb_frontend *stv0297_attach(const struct stv0297_config *config, | |||
| 746 | state->i2c = i2c; | 638 | state->i2c = i2c; |
| 747 | memcpy(&state->ops, &stv0297_ops, sizeof(struct dvb_frontend_ops)); | 639 | memcpy(&state->ops, &stv0297_ops, sizeof(struct dvb_frontend_ops)); |
| 748 | state->base_freq = 0; | 640 | state->base_freq = 0; |
| 749 | state->pwm = pwm; | ||
| 750 | 641 | ||
| 751 | /* check if the demod is there */ | 642 | /* check if the demod is there */ |
| 752 | if ((stv0297_readreg(state, 0x80) & 0x70) != 0x20) | 643 | if ((stv0297_readreg(state, 0x80) & 0x70) != 0x20) |
