mirror of
https://github.com/torvalds/linux.git
synced 2024-12-20 01:52:13 +00:00
[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>
This commit is contained in:
parent
5bb11ca586
commit
d512e28651
@ -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)
|
static int rtl2830_read_signal_strength(struct dvb_frontend *fe, u16 *strength)
|
||||||
{
|
{
|
||||||
struct i2c_client *client = fe->demodulator_priv;
|
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
|
||||||
struct rtl2830_dev *dev = i2c_get_clientdata(client);
|
|
||||||
int ret;
|
|
||||||
u8 buf[2];
|
|
||||||
u16 if_agc_raw, if_agc;
|
|
||||||
|
|
||||||
if (dev->sleeping)
|
if (c->strength.stat[0].scale == FE_SCALE_RELATIVE)
|
||||||
return 0;
|
*strength = c->strength.stat[0].uvalue;
|
||||||
|
|
||||||
ret = rtl2830_rd_regs(client, 0x359, buf, 2);
|
|
||||||
if (ret)
|
|
||||||
goto err;
|
|
||||||
|
|
||||||
if_agc_raw = (buf[0] << 8 | buf[1]) & 0x3fff;
|
|
||||||
|
|
||||||
if (if_agc_raw & (1 << 9))
|
|
||||||
if_agc = -(~(if_agc_raw - 1) & 0x1ff);
|
|
||||||
else
|
else
|
||||||
if_agc = if_agc_raw;
|
*strength = 0;
|
||||||
|
|
||||||
*strength = (u8)(55 - if_agc / 182);
|
|
||||||
*strength |= *strength << 8;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
err:
|
|
||||||
dev_dbg(&client->dev, "failed=%d\n", ret);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct dvb_frontend_ops rtl2830_ops = {
|
static struct dvb_frontend_ops rtl2830_ops = {
|
||||||
|
Loading…
Reference in New Issue
Block a user