diff options
author | Jemma Denson <jdenson@gmail.com> | 2015-05-05 16:59:27 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-05-18 16:36:38 -0300 |
commit | 9fc18f18a568a944e93de6f6c2148a688623429b (patch) | |
tree | 8c03d664f180deaab8f05371eaf40425eb82f4f4 /drivers/media/dvb-frontends/cx24120.c | |
parent | c84251bb122d6abcb0178f2c922f9ef51740e7ad (diff) |
[media] cx24120: Add DVBv5 signal strength stats
Add new get_stats function, called from read_status, for
collecting DVBv5 stats into the frontend cache. Only signal
strength for now, can add others later.
Not currently marked as available, future patch will enable.
Signed-off-by: Jemma Denson <jdenson@gmail.com>
Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/dvb-frontends/cx24120.c')
-rw-r--r-- | drivers/media/dvb-frontends/cx24120.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/media/dvb-frontends/cx24120.c b/drivers/media/dvb-frontends/cx24120.c index 8238f80ea98e..ff16611b5eb4 100644 --- a/drivers/media/dvb-frontends/cx24120.c +++ b/drivers/media/dvb-frontends/cx24120.c @@ -615,6 +615,32 @@ static int cx24120_send_diseqc_msg(struct dvb_frontend *fe, return -ETIMEDOUT; } +static void cx24120_get_stats(struct cx24120_state *state, fe_status_t status) +{ + struct dvb_frontend *fe = &state->frontend; + struct dtv_frontend_properties *c = &fe->dtv_property_cache; + int ret; + u16 u16tmp; + + dev_dbg(&state->i2c->dev, "%s()\n", __func__); + + /* signal strength */ + if (status & FE_HAS_SIGNAL) { + ret = cx24120_read_signal_strength(fe, &u16tmp); + if (ret != 0) + return; + + c->strength.stat[0].scale = FE_SCALE_RELATIVE; + c->strength.stat[0].uvalue = u16tmp; + } else { + c->strength.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + } + + /* FIXME: add CNR */ + + /* FIXME: add UCB/BER */ +} + static void cx24120_set_clock_ratios(struct dvb_frontend *fe); /* Read current tuning status */ @@ -643,6 +669,8 @@ static int cx24120_read_status(struct dvb_frontend *fe, fe_status_t *status) * Other cx241xx drivers have this slightly * different */ + cx24120_get_stats(state, *status); + /* Set the clock once tuned in */ if (state->need_clock_set && *status & FE_HAS_LOCK) { /* Set clock ratios */ |