diff options
author | Andrew de Quincy <devnull@localhost> | 2004-03-11 18:40:44 +0000 |
---|---|---|
committer | Andrew de Quincy <devnull@localhost> | 2004-03-11 18:40:44 +0000 |
commit | 4881f248a09885725d1ad51ec35339ff4db2d81c (patch) | |
tree | f28e1ee6e7e472092c1a2a5e9ea55825c61f7c04 /linux/drivers/media/dvb/frontends/stv0299.c | |
parent | 455c6bb685dcf96d46dc80361513fc6476d541e7 (diff) | |
download | mediapointer-dvb-s2-4881f248a09885725d1ad51ec35339ff4db2d81c.tar.gz mediapointer-dvb-s2-4881f248a09885725d1ad51ec35339ff4db2d81c.tar.bz2 |
Checked in experimental frontend patch
Also some minimal budget-ci CI support implemented (just detection+IRQs)
Diffstat (limited to 'linux/drivers/media/dvb/frontends/stv0299.c')
-rw-r--r-- | linux/drivers/media/dvb/frontends/stv0299.c | 140 |
1 files changed, 86 insertions, 54 deletions
diff --git a/linux/drivers/media/dvb/frontends/stv0299.c b/linux/drivers/media/dvb/frontends/stv0299.c index d5eae378a..608323c9b 100644 --- a/linux/drivers/media/dvb/frontends/stv0299.c +++ b/linux/drivers/media/dvb/frontends/stv0299.c @@ -96,8 +96,7 @@ static struct dvb_frontend_info uni0299_info = { .caps = FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_QPSK | - FE_CAN_FEC_AUTO | - FE_CAN_CLEAN_SETUP + FE_CAN_FEC_AUTO }; @@ -368,9 +367,14 @@ static int tsa5059_set_tv_freq (struct dvb_i2c_bus *i2c, u32 freq, int ftype, in if ((freq < 950000) || (freq > 2150000)) return -EINVAL; - divisor = 500; - regcode = 2; - + if (ftype == PHILIPS_SU1278_TSA_TT) { + divisor = 500; + regcode = 2; + } else { + divisor = 125; + regcode = 4; + } + // setup frequency divisor div = (freq + (divisor - 1)) / divisor; // round correctly buf[0] = (div >> 8) & 0x7f; @@ -395,7 +399,8 @@ static int tsa5059_set_tv_freq (struct dvb_i2c_bus *i2c, u32 freq, int ftype, in case ALPS_BSRU6: addr = 0x61; - buf[3] |= 0xC0; + buf[3] = 0xC4; + if (freq > 1530000) buf[3] = 0xc0; break; default: @@ -923,20 +928,18 @@ static int stv0299_set_symbolrate (struct dvb_i2c_bus *i2c, u32 srate, int tuner case ALPS_BSRU6: default: - if (srate <= 1500000) { aclk = 0xb7; bclk = 0x87; } - else if (srate <= 3000000) { aclk = 0xb7; bclk = 0x8b; } - else if (srate <= 7000000) { aclk = 0xb7; bclk = 0x8f; } - else if (srate <= 14000000) { aclk = 0xb7; bclk = 0x93; } - else if (srate <= 30000000) { aclk = 0xb6; bclk = 0x93; } - else if (srate <= 45000000) { aclk = 0xb4; bclk = 0x91; } - m1 = 0x12; + if (srate < 1500000) { aclk = 0xb7; bclk = 0x47; } + else if (srate < 3000000) { aclk = 0xb7; bclk = 0x4b; } + else if (srate < 7000000) { aclk = 0xb7; bclk = 0x4f; } + else if (srate < 14000000) { aclk = 0xb7; bclk = 0x53; } + else if (srate < 30000000) { aclk = 0xb6; bclk = 0x53; } + else if (srate < 45000000) { aclk = 0xb4; bclk = 0x51; } stv0299_writereg (i2c, 0x13, aclk); stv0299_writereg (i2c, 0x14, bclk); stv0299_writereg (i2c, 0x1f, (ratio >> 16) & 0xff); stv0299_writereg (i2c, 0x20, (ratio >> 8) & 0xff); stv0299_writereg (i2c, 0x21, (ratio ) & 0xf0); - stv0299_writereg (i2c, 0x0f, (stv0299_readreg(i2c, 0x0f) & 0xc0) | m1); break; } @@ -979,21 +982,6 @@ static int stv0299_get_symbolrate (struct dvb_i2c_bus *i2c, int tuner_type) return srate; } -static int stv0299_check_inversion (struct dvb_i2c_bus *i2c) -{ - dprintk ("%s\n", __FUNCTION__); - - if ((stv0299_readreg (i2c, 0x1b) & 0x98) != 0x98) { - dvb_delay(30); - if ((stv0299_readreg (i2c, 0x1b) & 0x98) != 0x98) { - u8 val = stv0299_readreg (i2c, 0x0c); - return stv0299_writereg (i2c, 0x0c, val ^ 0x01); - } - } - - return 0; -} - static int uni0299_ioctl (struct dvb_frontend *fe, unsigned int cmd, void *arg) { struct dvb_i2c_bus *i2c = fe->i2c; @@ -1093,14 +1081,13 @@ static int uni0299_ioctl (struct dvb_frontend *fe, unsigned int cmd, void *arg) } else if (p->inversion == INVERSION_ON) { stv0299_writereg(i2c, 0x0c, stv0299_readreg(i2c, 0x0c) | 1); } else { - // temporary hack until the new dvb_frontend.c becomes mainline - stv0299_check_inversion(i2c); - -// printk("stv0299 does not support auto-inversion\n"); -// return -EINVAL; + printk("stv0299 does not support auto-inversion\n"); + return -EINVAL; } - if (state->tuner_type == PHILIPS_SU1278_TSA_TT) { + switch(state->tuner_type) { + case PHILIPS_SU1278_TSA_TT: + { /* check if we should do a finetune */ int frequency_delta = p->frequency - state->tuner_frequency; int minmax = p->u.qpsk.symbol_rate / 2000; @@ -1118,23 +1105,30 @@ static int uni0299_ioctl (struct dvb_frontend *fe, unsigned int cmd, void *arg) // now set them as we want stv0299_writereg (i2c, 0x22, Drot_freq >> 8); stv0299_writereg (i2c, 0x23, Drot_freq); - break; + } else { + /* A "normal" tune is requested */ + pll_set_tv_freq (i2c, p->frequency, state->tuner_type, p->u.qpsk.symbol_rate); + stv0299_writereg (i2c, 0x32, 0x80); + stv0299_writereg (i2c, 0x22, 0x00); + stv0299_writereg (i2c, 0x23, 0x00); + stv0299_writereg (i2c, 0x32, 0x19); + stv0299_set_symbolrate (i2c, p->u.qpsk.symbol_rate, state->tuner_type); + stv0299_set_FEC (i2c, p->u.qpsk.fec_inner); } + break; + } + + default: + pll_set_tv_freq (i2c, p->frequency, state->tuner_type, p->u.qpsk.symbol_rate); + stv0299_set_FEC (i2c, p->u.qpsk.fec_inner); + stv0299_set_symbolrate (i2c, p->u.qpsk.symbol_rate, state->tuner_type); + stv0299_writereg (i2c, 0x22, 0x00); + stv0299_writereg (i2c, 0x23, 0x00); + stv0299_readreg (i2c, 0x23); + stv0299_writereg (i2c, 0x12, 0xb9); + break; } - /* A "normal" tune is requested */ - stv0299_writereg (i2c, 0x32, 0x80); - stv0299_writereg (i2c, 0x22, 0x00); - stv0299_writereg (i2c, 0x23, 0x00); - stv0299_writereg (i2c, 0x32, 0x19); - stv0299_set_symbolrate (i2c, p->u.qpsk.symbol_rate, state->tuner_type); - stv0299_set_FEC (i2c, p->u.qpsk.fec_inner); - pll_set_tv_freq (i2c, p->frequency, state->tuner_type, p->u.qpsk.symbol_rate); - dvb_delay(50); - stv0299_writereg (i2c, 0x22, 0x00); - stv0299_writereg (i2c, 0x23, 0x00); - pll_set_tv_freq (i2c, p->frequency, state->tuner_type, p->u.qpsk.symbol_rate); - state->tuner_frequency = p->frequency; state->fec_inner = p->u.qpsk.fec_inner; state->symbol_rate = p->u.qpsk.symbol_rate; @@ -1172,10 +1166,17 @@ static int uni0299_ioctl (struct dvb_frontend *fe, unsigned int cmd, void *arg) break; case FE_INIT: - state->tuner_frequency = 0; - if (!state->initialised) { - state->initialised = 1; - return stv0299_init (i2c, state->tuner_type); + switch(state->tuner_type) { + case PHILIPS_SU1278_TSA_TT: + state->tuner_frequency = 0; + if (!state->initialised) { + state->initialised = 1; + return stv0299_init (i2c, state->tuner_type); + } + break; + + default: + return stv0299_init (i2c, state->tuner_type); } break; @@ -1191,7 +1192,38 @@ static int uni0299_ioctl (struct dvb_frontend *fe, unsigned int cmd, void *arg) case FE_SET_VOLTAGE: return stv0299_set_voltage (i2c, (fe_sec_voltage_t) arg); - default: + case FE_GET_TUNE_SETTINGS: + { + struct dvb_frontend_tune_settings* fesettings = (struct dvb_frontend_tune_settings*) arg; + + switch(state->tuner_type) { + case PHILIPS_SU1278_TSA_TT: + fesettings->min_delay_ms = 50; + if (fesettings->parameters.u.qpsk.symbol_rate < 10000000) { + fesettings->step_size = fesettings->parameters.u.qpsk.symbol_rate / 32000; + fesettings->max_drift = 5000; + } else { + fesettings->step_size = fesettings->parameters.u.qpsk.symbol_rate / 16000; + fesettings->max_drift = fesettings->parameters.u.qpsk.symbol_rate / 2000; + } + break; + + default: + fesettings->min_delay_ms = 100; + if (fesettings->parameters.u.qpsk.symbol_rate < 10000000) { + fesettings->step_size = fesettings->parameters.u.qpsk.symbol_rate / 32000; + fesettings->max_drift = 5000; + } else { + fesettings->step_size = fesettings->parameters.u.qpsk.symbol_rate / 16000; + fesettings->max_drift = fesettings->parameters.u.qpsk.symbol_rate / 2000; + } + break; + } + + return 0; + } + + default: return -EOPNOTSUPP; }; |