summaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorJemma Denson <jdenson@gmail.com>2015-05-05 18:09:45 -0300
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-05-18 16:39:19 -0300
commitb0cdf1a16f4058ac1c6c595455f276c5e3c54db3 (patch)
tree319d93a084e06ab5f6e78c0d5bef43ff6d1a63a7 /drivers/media
parent34ce475d3272f3645561eb67048faf5537bae621 (diff)
[media] cx24120: Improve cooked signal strength value
Algorithm copied from cx24117.c - it seems to work. Showing 95% on a signal I know to be somewhere around 74dBuV. [mchehab@osg.samsung.net: merged two patches, to avoid breaking compilation] 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')
-rw-r--r--drivers/media/dvb-frontends/cx24120.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/media/dvb-frontends/cx24120.c b/drivers/media/dvb-frontends/cx24120.c
index eecfe2284c91..acdda036fe13 100644
--- a/drivers/media/dvb-frontends/cx24120.c
+++ b/drivers/media/dvb-frontends/cx24120.c
@@ -608,8 +608,8 @@ static void cx24120_get_stats(struct cx24120_state *state)
struct dvb_frontend *fe = &state->frontend;
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
struct cx24120_cmd cmd;
- int ret, sigstr_h, sigstr_l;
- u16 u16tmp;
+ int ret;
+ u16 sig;
dev_dbg(&state->i2c->dev, "%s()\n", __func__);
@@ -626,18 +626,18 @@ static void cx24120_get_stats(struct cx24120_state *state)
}
/* raw */
- sigstr_h = (cx24120_readreg(state, CX24120_REG_SIGSTR_H) >> 6) << 8;
- sigstr_l = cx24120_readreg(state, CX24120_REG_SIGSTR_L);
- dev_dbg(&state->i2c->dev, "%s: Signal strength from firmware= 0x%x\n",
- __func__, (sigstr_h | sigstr_l));
+ sig = cx24120_readreg(state, CX24120_REG_SIGSTR_H) >> 6;
+ sig = sig << 8;
+ sig |= cx24120_readreg(state, CX24120_REG_SIGSTR_L);
+ dev_dbg(&state->i2c->dev,
+ "%s: Signal strength from firmware= 0x%x\n",
+ __func__, sig);
/* cooked */
- u16tmp = ((sigstr_h | sigstr_l) << 5) & 0x0000ffff;
- dev_dbg(&state->i2c->dev, "%s: Signal strength= 0x%x\n",
- __func__, u16tmp);
+ sig = -100 * sig + 94324;
c->strength.stat[0].scale = FE_SCALE_RELATIVE;
- c->strength.stat[0].uvalue = u16tmp;
+ c->strength.stat[0].uvalue = sig;
} else {
c->strength.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
}