diff options
author | Matthias Schwarzott <zzam@gentoo.org> | 2017-11-05 17:25:09 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-12-12 13:52:58 +0300 |
commit | 2e687a6d3da813dea908e55bef325526ce644fea (patch) | |
tree | e23be3cb1d73f632e5dd62c56b6db615250991f3 /drivers/media/dvb-frontends | |
parent | 964b372740ad5f92c12220ebbb03b04a6cdf0435 (diff) | |
download | linux-2e687a6d3da813dea908e55bef325526ce644fea.tar.xz |
media: si2165: add DVBv3 wrapper for C/N statistics
Add read_snr function that reads from property cache to support DVBv3.
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')
-rw-r--r-- | drivers/media/dvb-frontends/si2165.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/media/dvb-frontends/si2165.c b/drivers/media/dvb-frontends/si2165.c index 1cd2120f5dc4..ceb5a2bb0dea 100644 --- a/drivers/media/dvb-frontends/si2165.c +++ b/drivers/media/dvb-frontends/si2165.c @@ -794,6 +794,17 @@ static int si2165_read_status(struct dvb_frontend *fe, enum fe_status *status) return 0; } +static int si2165_read_snr(struct dvb_frontend *fe, u16 *snr) +{ + struct dtv_frontend_properties *c = &fe->dtv_property_cache; + + if (c->cnr.stat[0].scale == FE_SCALE_DECIBEL) + *snr = div_s64(c->cnr.stat[0].svalue, 100); + else + *snr = 0; + return 0; +} + static int si2165_set_oversamp(struct si2165_state *state, u32 dvb_rate) { u64 oversamp; @@ -1111,6 +1122,7 @@ static const struct dvb_frontend_ops si2165_ops = { .set_frontend = si2165_set_frontend, .read_status = si2165_read_status, + .read_snr = si2165_read_snr, }; static int si2165_probe(struct i2c_client *client, |