diff options
author | Andrew de Quincy <devnull@localhost> | 2004-02-25 15:47:33 +0000 |
---|---|---|
committer | Andrew de Quincy <devnull@localhost> | 2004-02-25 15:47:33 +0000 |
commit | 846940546b042c4a77719d0c1c96686593fb122d (patch) | |
tree | 70da42bb07918431aa947170723a3df98952e5a6 /linux/drivers/media/dvb/frontends/stv0299.c | |
parent | a68f56427da49aa41827659280c8df810086bc0a (diff) | |
download | mediapointer-dvb-s2-846940546b042c4a77719d0c1c96686593fb122d.tar.gz mediapointer-dvb-s2-846940546b042c4a77719d0c1c96686593fb122d.tar.bz2 |
Expanded INIT code, and sped up finetuning times.
There is still a problem sometimes when waking up from being asleep.
Diffstat (limited to 'linux/drivers/media/dvb/frontends/stv0299.c')
-rw-r--r-- | linux/drivers/media/dvb/frontends/stv0299.c | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/linux/drivers/media/dvb/frontends/stv0299.c b/linux/drivers/media/dvb/frontends/stv0299.c index 3c9cb3a9b..35d9211ad 100644 --- a/linux/drivers/media/dvb/frontends/stv0299.c +++ b/linux/drivers/media/dvb/frontends/stv0299.c @@ -104,6 +104,8 @@ static struct dvb_frontend_info uni0299_info = { struct stv0299_state { u8 tuner_type; u32 tuner_frequency; + u32 symbol_rate; + fe_code_rate_t fec_inner; }; @@ -260,6 +262,9 @@ static u8 init_tab_su1278_tsa_tt [] = { 0x34, 0x13 }; +static int stv0299_set_FEC (struct dvb_i2c_bus *i2c, fe_code_rate_t fec); +static int stv0299_set_symbolrate (struct dvb_i2c_bus *i2c, u32 srate, int tuner_type); + static int stv0299_writereg (struct dvb_i2c_bus *i2c, u8 reg, u8 data) { int ret; @@ -587,6 +592,15 @@ static int stv0299_init (struct dvb_i2c_bus *i2c, int ftype) for (i=0; i<sizeof(init_tab_su1278_tsa_tt); i+=2) { stv0299_writereg (i2c, init_tab_su1278_tsa_tt[i], init_tab_su1278_tsa_tt[i+1]); } + + // seems to be much more reliable if a proper tune is kicked off during init + stv0299_writereg(i2c, 0x0c, stv0299_readreg(i2c, 0x0c) & 0xfe); + stv0299_set_FEC(i2c, FEC_AUTO); + stv0299_set_symbolrate(i2c, 27500000, ftype); + pll_set_tv_freq (i2c, 12200000, ftype, 27500000); + stv0299_writereg (i2c, 0x22, 0x00); + stv0299_writereg (i2c, 0x23, 0x00); + dvb_delay(200); // long delay is needed to recover from sleeping break; default: @@ -1089,18 +1103,18 @@ 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 to get round buggy user-side software - stv0299_check_inversion(i2c); + printk("stv0299 does not support auto-inversion\n"); + return -EINVAL; } - stv0299_set_FEC (i2c, p->u.qpsk.fec_inner); - stv0299_set_symbolrate (i2c, p->u.qpsk.symbol_rate, state->tuner_type); - if (state->tuner_type == 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 / 1000; - if ((frequency_delta > -minmax) && (frequency_delta < minmax)) { + + if ((frequency_delta > -minmax) && (frequency_delta < minmax) && + (state->fec_inner == p->u.qpsk.fec_inner) && + (state->symbol_rate == p->u.qpsk.symbol_rate)) { int Drot_freq = ((frequency_delta) << 16) / (M_CLK_SU1278_TSA_TT /1000); stv0299_writereg (i2c, 0x22, Drot_freq >> 8); stv0299_writereg (i2c, 0x23, Drot_freq); @@ -1109,16 +1123,21 @@ static int uni0299_ioctl (struct dvb_frontend *fe, unsigned int cmd, void *arg) } /* A "normal" tune is requested */ + stv0299_set_FEC (i2c, p->u.qpsk.fec_inner); + stv0299_set_symbolrate (i2c, p->u.qpsk.symbol_rate, state->tuner_type); pll_set_tv_freq (i2c, p->frequency, state->tuner_type, - p->u.qpsk.symbol_rate); + p->u.qpsk.symbol_rate); stv0299_writereg (i2c, 0x22, 0x00); stv0299_writereg (i2c, 0x23, 0x00); if (state->tuner_type != PHILIPS_SU1278_TSA_TT) { stv0299_readreg (i2c, 0x23); stv0299_writereg (i2c, 0x12, 0xb9); } + dvb_delay(10); state->tuner_frequency = p->frequency; + state->fec_inner = p->u.qpsk.fec_inner; + state->symbol_rate = p->u.qpsk.symbol_rate; break; } |