diff options
author | Gerd Knorr <devnull@localhost> | 2005-01-13 17:22:33 +0000 |
---|---|---|
committer | Gerd Knorr <devnull@localhost> | 2005-01-13 17:22:33 +0000 |
commit | bc5318acb6a825d4efc39704e8fbc5b25e7a69e2 (patch) | |
tree | ff76038c6ddc278f58d517d71c10e50adb96ece2 /v4l | |
parent | 5e7e4300bdef43bbc9db1f4661e1867a18ab8aff (diff) | |
download | mediapointer-dvb-s2-bc5318acb6a825d4efc39704e8fbc5b25e7a69e2.tar.gz mediapointer-dvb-s2-bc5318acb6a825d4efc39704e8fbc5b25e7a69e2.tar.bz2 |
- card-specific and other fixes from various people.
- more pinnacle 300i work (still not functional :-/).
Diffstat (limited to 'v4l')
-rw-r--r-- | v4l/mt352.c | 91 | ||||
-rw-r--r-- | v4l/scripts/update | 2 |
2 files changed, 58 insertions, 35 deletions
diff --git a/v4l/mt352.c b/v4l/mt352.c index b4b8ff830..7b0489dec 100644 --- a/v4l/mt352.c +++ b/v4l/mt352.c @@ -63,26 +63,28 @@ int mt352_write(struct dvb_frontend* fe, u8* ibuf, int ilen) struct mt352_state* state = (struct mt352_state*) fe->demodulator_priv; struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = ibuf, .len = ilen }; +#if 0 int i; printk("%s:",__FUNCTION__); for (i = 0; i < ilen; i++) printk(" %02x",ibuf[i]); printk("\n"); +#endif int err = i2c_transfer(state->i2c, &msg, 1); if (err != 1) { printk(KERN_WARNING "mt352_write() failed (err = %d)!\n", err); return err; -} + } return 0; } static u8 mt352_read_register(struct mt352_state* state, u8 reg) { - int ret; + int ret,i; u8 b0 [] = { reg }; u8 b1 [] = { 0 }; struct i2c_msg msg [] = { { .addr = state->config->demod_address, @@ -92,7 +94,12 @@ static u8 mt352_read_register(struct mt352_state* state, u8 reg) .flags = I2C_M_RD, .buf = b1, .len = 1 } }; - ret = i2c_transfer(state->i2c, msg, 2); + for (i = 0; i < 3; i++) { + ret = i2c_transfer(state->i2c, msg, 2); + if (2 == ret) + break; + udelay(10); + } if (ret != 2) printk(KERN_WARNING @@ -101,6 +108,34 @@ static u8 mt352_read_register(struct mt352_state* state, u8 reg) return b1[0]; } +static u8 mt352_register_dump(struct mt352_state* state) +{ + int i,val; + + for (i = 0x50; i < 0x8f; i++) { + val = mt352_read_register(state,i); + printk("%s: %02x %02x\n",__FUNCTION__,i,val); + } +} + +static u8 mt352_state_dump(struct mt352_state* state) +{ + int i,val,agc,snr; + + printk("mt352: status:"); + for (i = STATUS_0; i <= STATUS_4; i++) { + val = mt352_read_register(state,i); + printk(" %02x",val); + } + agc = 0; + agc |= mt352_read_register(state,AGC_GAIN_3) << 24; + agc |= mt352_read_register(state,AGC_GAIN_2) << 16; + agc |= mt352_read_register(state,AGC_GAIN_1) << 8; + agc |= mt352_read_register(state,AGC_GAIN_0); + snr = mt352_read_register(state,SNR); + printk(" agc: %5d snr: %02x\n", (~agc)>>16, snr); +} + static int mt352_sleep(struct dvb_frontend* fe) { static u8 mt352_softdown[] = { CLOCK_CTL, 0x20, 0x08 }; @@ -114,14 +149,11 @@ static int mt352_set_parameters(struct dvb_frontend* fe, struct dvb_frontend_parameters *param) { struct mt352_state* state = (struct mt352_state*) fe->demodulator_priv; - unsigned char buf[13]; - static unsigned char go[2] = { 0x5b, 0x01 }; + unsigned char buf[14]; unsigned int tps = 0; struct dvb_ofdm_parameters *op = ¶m->u.ofdm; - int regs, tune, i; + int i; - dprintk("%s: hello\n",__FUNCTION__); - switch (op->code_rate_HP) { case FEC_2_3: tps |= (1 << 7); @@ -231,7 +263,8 @@ static int mt352_set_parameters(struct dvb_frontend* fe, buf[1] = msb(tps); /* TPS_GIVEN_(1|0) */ buf[2] = lsb(tps); - buf[3] = 0x50; +// buf[3] = 0x50; + buf[3] = 0xf4; /** * these settings assume 20.48MHz f_ADC, for other tuners you might @@ -253,30 +286,27 @@ static int mt352_set_parameters(struct dvb_frontend* fe, state->config->pll_set(fe, param, buf+8); + buf[13] = 0x01; /* TUNER_GO!! */ - if (0 != buf[8]) { - /* default */ - regs = 13; - tune = 0; - } else { - /* no tuner address given => don't write these registers */ - regs = 8; - tune = 1; - } +#if 0 /* Only send the tuning request if the tuner doesn't have the requested * parameters already set. Enhances tuning time and prevents stream * breakup when retuning the same transponder. */ - for (i = 1; i < regs; i++) { + for (i = 1; i < 13; i++) if (buf[i] != mt352_read_register(state, i + 0x50)) { - mt352_write(fe, buf, regs); - tune = 1; + mt352_write(fe, buf, sizeof(buf)); break; } - } - - if (tune) - mt352_write(fe, go, sizeof(go)); /* set TUNER_GO */ +#else + mt352_write(fe, buf, sizeof(buf)); +#endif + if (0) + mt352_register_dump(state); + for (i = 0; i < 2; i++) { + msleep(500); + mt352_state_dump(state); + } return 0; } @@ -468,12 +498,12 @@ static int mt352_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) static int mt352_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fe_tune_settings) { - fe_tune_settings->min_delay_ms = 800; + fe_tune_settings->min_delay_ms = 800 * 10000; fe_tune_settings->step_size = 0; fe_tune_settings->max_drift = 0; return 0; - } +} static int mt352_init(struct dvb_frontend* fe) { @@ -518,13 +548,6 @@ struct dvb_frontend* mt352_attach(const struct mt352_config* config, memcpy(&state->ops, &mt352_ops, sizeof(struct dvb_frontend_ops)); /* check if the demod is there */ -#if 0 - { - int i; - for (i = 0; i < 4; i++) - mt352_read_register(state, i); - } -#endif if (mt352_read_register(state, CHIP_ID) != ID_MT352) goto error; /* create dvb_frontend */ diff --git a/v4l/scripts/update b/v4l/scripts/update index f73ec913e..1a9731e47 100644 --- a/v4l/scripts/update +++ b/v4l/scripts/update @@ -69,7 +69,7 @@ v4l2basic #xrmmod v4l1-compat #xinsmod v4l1-compat debug=1 -xinsmod tveeprom debug=0 +xinsmod tveeprom debug=1 xinsmod dvb-pll debug=1 xinsmod btcx-risc debug=0 xinsmod ir-common debug=1 repeat=0 |