diff options
author | Matthias Schwarzott <zzam@gentoo.org> | 2017-11-05 09:25:02 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-12-12 05:52:57 -0500 |
commit | 1e5fde1bc224267ea2c58f9ff8db19c2f67efebf (patch) | |
tree | 4e3cba1abce0b7e399f5d9a8702599cb6e78dbff /drivers/media/dvb-frontends/si2165.c | |
parent | 548b1f94904ae1616f9338a772e89a9f2e705325 (diff) | |
download | linux-1e5fde1bc224267ea2c58f9ff8db19c2f67efebf.tar.gz linux-1e5fde1bc224267ea2c58f9ff8db19c2f67efebf.tar.bz2 linux-1e5fde1bc224267ea2c58f9ff8db19c2f67efebf.zip |
media: si2165: improve read_status
Use check_signal register for DVB-T additionally.
For DVB-C use ps_lock additionally.
Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/dvb-frontends/si2165.c')
-rw-r--r-- | drivers/media/dvb-frontends/si2165.c | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/drivers/media/dvb-frontends/si2165.c b/drivers/media/dvb-frontends/si2165.c index ea9d23e7e266..30ceba664f5f 100644 --- a/drivers/media/dvb-frontends/si2165.c +++ b/drivers/media/dvb-frontends/si2165.c @@ -651,18 +651,47 @@ static int si2165_sleep(struct dvb_frontend *fe) static int si2165_read_status(struct dvb_frontend *fe, enum fe_status *status) { int ret; - u8 fec_lock = 0; + u8 u8tmp; struct si2165_state *state = fe->demodulator_priv; + struct dtv_frontend_properties *p = &fe->dtv_property_cache; + u32 delsys = p->delivery_system; - if (!state->has_dvbt) - return -EINVAL; + *status = 0; + + switch (delsys) { + case SYS_DVBT: + /* check fast signal type */ + ret = si2165_readreg8(state, REG_CHECK_SIGNAL, &u8tmp); + if (ret < 0) + return ret; + switch (u8tmp & 0x3) { + case 0: /* searching */ + case 1: /* nothing */ + break; + case 2: /* digital signal */ + *status |= FE_HAS_SIGNAL | FE_HAS_CARRIER; + break; + } + break; + case SYS_DVBC_ANNEX_A: + /* check packet sync lock */ + ret = si2165_readreg8(state, REG_PS_LOCK, &u8tmp); + if (ret < 0) + return ret; + if (u8tmp & 0x01) { + *status |= FE_HAS_SIGNAL; + *status |= FE_HAS_CARRIER; + *status |= FE_HAS_VITERBI; + *status |= FE_HAS_SYNC; + } + break; + } /* check fec_lock */ - ret = si2165_readreg8(state, REG_FEC_LOCK, &fec_lock); + ret = si2165_readreg8(state, REG_FEC_LOCK, &u8tmp); if (ret < 0) return ret; - *status = 0; - if (fec_lock & 0x01) { + if (u8tmp & 0x01) { *status |= FE_HAS_SIGNAL; *status |= FE_HAS_CARRIER; *status |= FE_HAS_VITERBI; |