summaryrefslogtreecommitdiff
path: root/drivers/media/dvb-frontends/rtl2830.c
diff options
context:
space:
mode:
authorAntti Palosaari <crope@iki.fi>2014-12-09 16:20:01 +0300
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-02-02 22:55:28 +0300
commitd512e286512c38e8921317c3a2c772559a91a636 (patch)
tree0856b5d9b2ceb4a99c560474593334a0ab59d00c /drivers/media/dvb-frontends/rtl2830.c
parent5bb11ca5864a2d4a91b0aa972bae7011314fdffc (diff)
downloadlinux-d512e286512c38e8921317c3a2c772559a91a636.tar.xz
[media] rtl2830: wrap DVBv5 signal strength to DVBv3
Change legacy DVBv3 signal strength to return values calculated by DVBv5 statistics. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/dvb-frontends/rtl2830.c')
-rw-r--r--drivers/media/dvb-frontends/rtl2830.c27
1 files changed, 4 insertions, 23 deletions
diff --git a/drivers/media/dvb-frontends/rtl2830.c b/drivers/media/dvb-frontends/rtl2830.c
index 147b3a6898e1..a02ccdf2fda0 100644
--- a/drivers/media/dvb-frontends/rtl2830.c
+++ b/drivers/media/dvb-frontends/rtl2830.c
@@ -623,33 +623,14 @@ static int rtl2830_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)
static int rtl2830_read_signal_strength(struct dvb_frontend *fe, u16 *strength)
{
- struct i2c_client *client = fe->demodulator_priv;
- struct rtl2830_dev *dev = i2c_get_clientdata(client);
- int ret;
- u8 buf[2];
- u16 if_agc_raw, if_agc;
-
- if (dev->sleeping)
- return 0;
-
- ret = rtl2830_rd_regs(client, 0x359, buf, 2);
- if (ret)
- goto err;
-
- if_agc_raw = (buf[0] << 8 | buf[1]) & 0x3fff;
+ struct dtv_frontend_properties *c = &fe->dtv_property_cache;
- if (if_agc_raw & (1 << 9))
- if_agc = -(~(if_agc_raw - 1) & 0x1ff);
+ if (c->strength.stat[0].scale == FE_SCALE_RELATIVE)
+ *strength = c->strength.stat[0].uvalue;
else
- if_agc = if_agc_raw;
-
- *strength = (u8)(55 - if_agc / 182);
- *strength |= *strength << 8;
+ *strength = 0;
return 0;
-err:
- dev_dbg(&client->dev, "failed=%d\n", ret);
- return ret;
}
static struct dvb_frontend_ops rtl2830_ops = {