Commit 18a73f36 authored by Igor M. Liplianin's avatar Igor M. Liplianin Committed by Mauro Carvalho Chehab

[media] ds3000: clean up in tune procedure

Variable 'retune' does not make sense.
Loop is not needed for only one try.
Remove unnecessary dprintk's.
Remove a lot of debug messages and delays.
Signed-off-by: default avatarIgor M. Liplianin <liplianin@me.by>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 2f30fb49
...@@ -536,25 +536,6 @@ static int ds3000_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) ...@@ -536,25 +536,6 @@ static int ds3000_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
return 0; return 0;
} }
static void ds3000_dump_registers(struct dvb_frontend *fe)
{
struct ds3000_state *state = fe->demodulator_priv;
int x, y, reg = 0, val;
for (y = 0; y < 16; y++) {
dprintk("%s: %02x: ", __func__, y);
for (x = 0; x < 16; x++) {
reg = (y << 4) + x;
val = ds3000_readreg(state, reg);
if (x != 15)
dprintk("%02x ", val);
else
dprintk("%02x\n", val);
}
}
dprintk("%s: -- DS3000 DUMP DONE --\n", __func__);
}
static int ds3000_read_status(struct dvb_frontend *fe, fe_status_t* status) static int ds3000_read_status(struct dvb_frontend *fe, fe_status_t* status)
{ {
struct ds3000_state *state = fe->demodulator_priv; struct ds3000_state *state = fe->demodulator_priv;
...@@ -589,16 +570,6 @@ static int ds3000_read_status(struct dvb_frontend *fe, fe_status_t* status) ...@@ -589,16 +570,6 @@ static int ds3000_read_status(struct dvb_frontend *fe, fe_status_t* status)
return 0; return 0;
} }
#define FE_IS_TUNED (FE_HAS_SIGNAL + FE_HAS_LOCK)
static int ds3000_is_tuned(struct dvb_frontend *fe)
{
fe_status_t tunerstat;
ds3000_read_status(fe, &tunerstat);
return ((tunerstat & FE_IS_TUNED) == FE_IS_TUNED);
}
/* read DS3000 BER value */ /* read DS3000 BER value */
static int ds3000_read_ber(struct dvb_frontend *fe, u32* ber) static int ds3000_read_ber(struct dvb_frontend *fe, u32* ber)
{ {
...@@ -1049,7 +1020,7 @@ static int ds3000_tune(struct dvb_frontend *fe, ...@@ -1049,7 +1020,7 @@ static int ds3000_tune(struct dvb_frontend *fe,
struct ds3000_state *state = fe->demodulator_priv; struct ds3000_state *state = fe->demodulator_priv;
struct dtv_frontend_properties *c = &fe->dtv_property_cache; struct dtv_frontend_properties *c = &fe->dtv_property_cache;
int ret = 0, retune, i; int i;
u8 status, mlpf, mlpf_new, mlpf_max, mlpf_min, nlpf; u8 status, mlpf, mlpf_new, mlpf_max, mlpf_min, nlpf;
u16 value, ndiv; u16 value, ndiv;
u32 f3db; u32 f3db;
...@@ -1072,15 +1043,6 @@ static int ds3000_tune(struct dvb_frontend *fe, ...@@ -1072,15 +1043,6 @@ static int ds3000_tune(struct dvb_frontend *fe,
/* discard the 'current' tuning parameters and prepare to tune */ /* discard the 'current' tuning parameters and prepare to tune */
ds3000_clone_params(fe); ds3000_clone_params(fe);
retune = 1; /* try 1 times */
dprintk("%s: retune = %d\n", __func__, retune);
dprintk("%s: frequency = %d\n", __func__, state->dcur.frequency);
dprintk("%s: symbol_rate = %d\n", __func__, state->dcur.symbol_rate);
dprintk("%s: FEC = %d \n", __func__,
state->dcur.fec);
dprintk("%s: Inversion = %d\n", __func__, state->dcur.inversion);
do {
/* Reset status register */ /* Reset status register */
status = 0; status = 0;
/* Tune */ /* Tune */
...@@ -1301,23 +1263,15 @@ static int ds3000_tune(struct dvb_frontend *fe, ...@@ -1301,23 +1263,15 @@ static int ds3000_tune(struct dvb_frontend *fe,
/* TODO: calculate and set carrier offset */ /* TODO: calculate and set carrier offset */
/* wait before retrying */
for (i = 0; i < 30 ; i++) { for (i = 0; i < 30 ; i++) {
if (ds3000_is_tuned(fe)) { ds3000_read_status(fe, &status);
dprintk("%s: Tuned\n", __func__); if (status && FE_HAS_LOCK)
ds3000_dump_registers(fe); break;
goto tuned;
}
msleep(1);
}
dprintk("%s: Not tuned\n", __func__);
ds3000_dump_registers(fe);
} while (--retune); msleep(10);
}
tuned: return 0;
return ret;
} }
static enum dvbfe_algo ds3000_get_algo(struct dvb_frontend *fe) static enum dvbfe_algo ds3000_get_algo(struct dvb_frontend *fe)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment