summaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb-frontends/drxk_hard.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2013-03-20 12:57:42 +0100
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-03-21 14:27:21 +0100
commit340e76965c868caa645268d2d36edb89af801fa4 (patch)
treec2112d0fa7ea267d0a60ee7911ff090d77ff480f /drivers/media/dvb-frontends/drxk_hard.c
parent[media] drxk: use a better calculus for RF strength (diff)
downloadlinux-340e76965c868caa645268d2d36edb89af801fa4.tar.xz
linux-340e76965c868caa645268d2d36edb89af801fa4.zip
[media] drxk: Fix bogus signal strength indicator
The DVBv3 signal strength indicator is bogus: it doesn't range from 0 to 65535 as it would be expected. Also, 0 means the max signal strength. Now that a better way to estimate it was added, use the new way. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb-frontends/drxk_hard.c')
-rw-r--r--drivers/media/dvb-frontends/drxk_hard.c33
1 files changed, 3 insertions, 30 deletions
diff --git a/drivers/media/dvb-frontends/drxk_hard.c b/drivers/media/dvb-frontends/drxk_hard.c
index 6e250533b628..fc93bd396cf4 100644
--- a/drivers/media/dvb-frontends/drxk_hard.c
+++ b/drivers/media/dvb-frontends/drxk_hard.c
@@ -2490,32 +2490,6 @@ error:
return status;
}
-static int ReadIFAgc(struct drxk_state *state, u32 *pValue)
-{
- u16 agcDacLvl;
- int status;
- u16 Level = 0;
-
- dprintk(1, "\n");
-
- status = read16(state, IQM_AF_AGC_IF__A, &agcDacLvl);
- if (status < 0) {
- printk(KERN_ERR "drxk: Error %d on %s\n", status, __func__);
- return status;
- }
-
- *pValue = 0;
-
- if (agcDacLvl > DRXK_AGC_DAC_OFFSET)
- Level = agcDacLvl - DRXK_AGC_DAC_OFFSET;
- if (Level < 14000)
- *pValue = (14000 - Level) / 4;
- else
- *pValue = 0;
-
- return status;
-}
-
static int GetQAMSignalToNoise(struct drxk_state *state,
s32 *pSignalToNoise)
{
@@ -6484,7 +6458,7 @@ static int get_strength(struct drxk_state *state, u64 *strength)
* If it can't be measured (AGC is disabled), just show 100%.
*/
if (totalGain > 0)
- *strength = (65535UL * atten / totalGain);
+ *strength = (65535UL * atten / totalGain / 100);
else
*strength = 65535;
@@ -6633,7 +6607,7 @@ static int drxk_read_signal_strength(struct dvb_frontend *fe,
u16 *strength)
{
struct drxk_state *state = fe->demodulator_priv;
- u32 val = 0;
+ struct dtv_frontend_properties *c = &fe->dtv_property_cache;
dprintk(1, "\n");
@@ -6642,8 +6616,7 @@ static int drxk_read_signal_strength(struct dvb_frontend *fe,
if (state->m_DrxkState == DRXK_UNINITIALIZED)
return -EAGAIN;
- ReadIFAgc(state, &val);
- *strength = val & 0xffff;
+ *strength = c->strength.stat[0].uvalue;
return 0;
}