media: lgdt3306a: Add CNR v5 stat

The CNR is already calculated, so populate DVBv5 CNR stat
during read_status.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
Brad Love 2019-11-14 21:04:07 +01:00 коммит произвёл Mauro Carvalho Chehab
Родитель d99846cb1c
Коммит 722b3c140d
1 изменённых файлов: 14 добавлений и 0 удалений

Просмотреть файл

@ -846,6 +846,7 @@ static int lgdt3306a_fe_sleep(struct dvb_frontend *fe)
static int lgdt3306a_init(struct dvb_frontend *fe)
{
struct lgdt3306a_state *state = fe->demodulator_priv;
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
u8 val;
int ret;
@ -997,6 +998,9 @@ static int lgdt3306a_init(struct dvb_frontend *fe)
ret = lgdt3306a_sleep(state);
lg_chkerr(ret);
c->cnr.len = 1;
c->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
fail:
return ret;
}
@ -1597,6 +1601,7 @@ static int lgdt3306a_read_status(struct dvb_frontend *fe,
enum fe_status *status)
{
struct lgdt3306a_state *state = fe->demodulator_priv;
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
u16 strength = 0;
int ret = 0;
@ -1637,6 +1642,15 @@ static int lgdt3306a_read_status(struct dvb_frontend *fe,
default:
ret = -EINVAL;
}
if (*status & FE_HAS_SYNC) {
c->cnr.len = 1;
c->cnr.stat[0].scale = FE_SCALE_DECIBEL;
c->cnr.stat[0].svalue = lgdt3306a_calculate_snr_x100(state) * 10;
} else {
c->cnr.len = 1;
c->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
}
}
return ret;
}