mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-28 06:34:12 +08:00
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>
This commit is contained in:
parent
548b1f9490
commit
1e5fde1bc2
@ -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;
|
||||
|
@ -93,6 +93,8 @@ struct si2165_config {
|
||||
#define REG_GP_REG0_LSB 0x0384
|
||||
#define REG_GP_REG0_MSB 0x0387
|
||||
#define REG_CRC 0x037a
|
||||
#define REG_CHECK_SIGNAL 0x03a8
|
||||
#define REG_PS_LOCK 0x0440
|
||||
#define REG_BER_PKT 0x0470
|
||||
#define REG_FEC_LOCK 0x04e0
|
||||
#define REG_TS_DATA_MODE 0x04e4
|
||||
|
Loading…
Reference in New Issue
Block a user