From 6639f1e060c2d2f3331ba6bcefe8f65b623365f3 Mon Sep 17 00:00:00 2001 From: Darron Broad Date: Thu, 18 Dec 2008 06:28:18 -0300 Subject: [PATCH] V4L/DVB (9917): cx24116: change to ALGO_HW Slow tuning, EG: > szap-s2 -r -c 39.FTATV "1=Pgm1;Net1" reading channels from file '39.FTATV' zapping to 3 '1=Pgm1;Net1': delivery DVB-S, modulation QPSK sat 0, frequency 11140 MHz V, symbolrate 1425000, coderate 5/6, rolloff 0.35 vpid 0x0200, apid 0x0300, sid 0x0001 using '/dev/dvb/adapter0/frontend0' and '/dev/dvb/adapter0/demux0' status 00 | signal c2c0 | snr 0000 | ber 00012d4a | unc 00000000 | status 03 | signal ff80 | snr 0000 | ber 00000000 | unc 00000000 | status 01 | signal ff80 | snr 0000 | ber 00000000 | unc 00000000 | status 01 | signal ff80 | snr 0000 | ber 00000000 | unc 00000000 | status 03 | signal c040 | snr 0000 | ber 00000000 | unc 00000000 | status 03 | signal ff80 | snr 0000 | ber 00000000 | unc 00000000 | status 01 | signal ff80 | snr 0000 | ber 00000000 | unc 00000000 | status 03 | signal c040 | snr 0000 | ber 00000000 | unc 00000000 | status 01 | signal ff80 | snr 0000 | ber 00000000 | unc 00000000 | status 01 | signal ff80 | snr 0000 | ber 00000000 | unc 00000000 | status 01 | signal c040 | snr 0000 | ber 00000000 | unc 00000000 | status 01 | signal ff80 | snr 0000 | ber 00000000 | unc 00000000 | status 01 | signal ff80 | snr 0000 | ber 00000000 | unc 00000000 | status 01 | signal c040 | snr 0000 | ber 00000000 | unc 00000000 | status 03 | signal c040 | snr 0000 | ber 00000000 | unc 00000000 | status 1f | signal c040 | snr bb33 | ber 00000000 | unc 00000000 | FE_HAS_LOCK Appears to be resolved by dropping zig-zag tuning and relying on hardware only: > szap-s2 -r -c 39.FTATV "1=Pgm1;Net1" reading channels from file '39.FTATV' zapping to 3 '1=Pgm1;Net1': delivery DVB-S, modulation QPSK sat 0, frequency 11140 MHz V, symbolrate 1425000, coderate 5/6, rolloff 0.35 vpid 0x0200, apid 0x0300, sid 0x0001 using '/dev/dvb/adapter0/frontend0' and '/dev/dvb/adapter0/demux0' status 01 | signal ff80 | snr 0000 | ber 00000000 | unc 00000000 | status 1f | signal ff80 | snr c199 | ber 00000000 | unc 00000000 | FE_HAS_LOCK status 1f | signal c040 | snr c199 | ber 00000000 | unc 00000000 | FE_HAS_LOCK status 1f | signal ff80 | snr c199 | ber 00000000 | unc 00000000 | FE_HAS_LOCK Tuning to a weaker channel shows that the hardware recovers sync: status 1f | signal fe40 | snr 5199 | ber 00000000 | unc 00000000 | FE_HAS_LOCK status 03 | signal fd40 | snr 5000 | ber 00000000 | unc 00000000 | status 1f | signal fe40 | snr 5000 | ber 00000000 | unc 00000000 | FE_HAS_LOCK status 03 | signal fd80 | snr 5000 | ber 00000000 | unc 00000000 | status 01 | signal fd80 | snr 4e66 | ber 00000000 | unc 00000000 | status 1f | signal fe40 | snr 5000 | ber 00000000 | unc 00000000 | FE_HAS_LOCK status 03 | signal fe40 | snr 5000 | ber 00000000 | unc 00000000 | status 01 | signal fd80 | snr 0000 | ber 00000000 | unc 00000000 | status 1f | signal fe40 | snr 5199 | ber 00000000 | unc 00000000 | FE_HAS_LOCK Also, tuning, moving the dish and then restoring the dish also retunes. Signed-off-by: Darron Broad Cc: Steven Toth Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/cx24116.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/drivers/media/dvb/frontends/cx24116.c b/drivers/media/dvb/frontends/cx24116.c index a62ae5f578b0..9b6c89e93f16 100644 --- a/drivers/media/dvb/frontends/cx24116.c +++ b/drivers/media/dvb/frontends/cx24116.c @@ -106,7 +106,7 @@ MODULE_PARM_DESC(debug, "Activates frontend debugging (default:0)"); #define CX24116_HAS_SYNCLOCK (0x08) #define CX24116_HAS_UNKNOWN1 (0x10) #define CX24116_HAS_UNKNOWN2 (0x20) -#define CX24116_STATUS_MASK (0x3f) +#define CX24116_STATUS_MASK (0x0f) #define CX24116_SIGNAL_MASK (0xc0) #define CX24116_DISEQC_TONEOFF (0) /* toneburst never sent */ @@ -681,7 +681,8 @@ static int cx24116_read_status(struct dvb_frontend *fe, fe_status_t *status) { struct cx24116_state *state = fe->demodulator_priv; - int lock = cx24116_readreg(state, CX24116_REG_SSTATUS); + int lock = cx24116_readreg(state, CX24116_REG_SSTATUS) & + CX24116_STATUS_MASK; dprintk("%s: status = 0x%02x\n", __func__, lock); @@ -1430,6 +1431,23 @@ static int cx24116_set_frontend(struct dvb_frontend *fe, return ret; } +static int cx24116_tune(struct dvb_frontend *fe, struct dvb_frontend_parameters *params, + unsigned int mode_flags, unsigned int *delay, fe_status_t *status) +{ + *delay = HZ / 5; + if (params) { + int ret = cx24116_set_frontend(fe, params); + if (ret) + return ret; + } + return cx24116_read_status(fe, status); +} + +static int cx24116_get_algo(struct dvb_frontend *fe) +{ + return DVBFE_ALGO_HW; +} + static struct dvb_frontend_ops cx24116_ops = { .info = { @@ -1461,6 +1479,8 @@ static struct dvb_frontend_ops cx24116_ops = { .set_voltage = cx24116_set_voltage, .diseqc_send_master_cmd = cx24116_send_diseqc_msg, .diseqc_send_burst = cx24116_diseqc_send_burst, + .get_frontend_algo = cx24116_get_algo, + .tune = cx24116_tune, .set_property = cx24116_set_property, .get_property = cx24116_get_property, -- GitLab