diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-03-20 07:57:42 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-03-21 09:27:21 -0400 |
commit | 340e76965c868caa645268d2d36edb89af801fa4 (patch) | |
tree | c2112d0fa7ea267d0a60ee7911ff090d77ff480f | |
parent | 59a7a23c4755f12757fe17234c693188a9e6bcf5 (diff) |
[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>
-rw-r--r-- | drivers/media/dvb-frontends/drxk_hard.c | 33 |
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: | |||
2490 | return status; | 2490 | return status; |
2491 | } | 2491 | } |
2492 | 2492 | ||
2493 | static int ReadIFAgc(struct drxk_state *state, u32 *pValue) | ||
2494 | { | ||
2495 | u16 agcDacLvl; | ||
2496 | int status; | ||
2497 | u16 Level = 0; | ||
2498 | |||
2499 | dprintk(1, "\n"); | ||
2500 | |||
2501 | status = read16(state, IQM_AF_AGC_IF__A, &agcDacLvl); | ||
2502 | if (status < 0) { | ||
2503 | printk(KERN_ERR "drxk: Error %d on %s\n", status, __func__); | ||
2504 | return status; | ||
2505 | } | ||
2506 | |||
2507 | *pValue = 0; | ||
2508 | |||
2509 | if (agcDacLvl > DRXK_AGC_DAC_OFFSET) | ||
2510 | Level = agcDacLvl - DRXK_AGC_DAC_OFFSET; | ||
2511 | if (Level < 14000) | ||
2512 | *pValue = (14000 - Level) / 4; | ||
2513 | else | ||
2514 | *pValue = 0; | ||
2515 | |||
2516 | return status; | ||
2517 | } | ||
2518 | |||
2519 | static int GetQAMSignalToNoise(struct drxk_state *state, | 2493 | static int GetQAMSignalToNoise(struct drxk_state *state, |
2520 | s32 *pSignalToNoise) | 2494 | s32 *pSignalToNoise) |
2521 | { | 2495 | { |
@@ -6484,7 +6458,7 @@ static int get_strength(struct drxk_state *state, u64 *strength) | |||
6484 | * If it can't be measured (AGC is disabled), just show 100%. | 6458 | * If it can't be measured (AGC is disabled), just show 100%. |
6485 | */ | 6459 | */ |
6486 | if (totalGain > 0) | 6460 | if (totalGain > 0) |
6487 | *strength = (65535UL * atten / totalGain); | 6461 | *strength = (65535UL * atten / totalGain / 100); |
6488 | else | 6462 | else |
6489 | *strength = 65535; | 6463 | *strength = 65535; |
6490 | 6464 | ||
@@ -6633,7 +6607,7 @@ static int drxk_read_signal_strength(struct dvb_frontend *fe, | |||
6633 | u16 *strength) | 6607 | u16 *strength) |
6634 | { | 6608 | { |
6635 | struct drxk_state *state = fe->demodulator_priv; | 6609 | struct drxk_state *state = fe->demodulator_priv; |
6636 | u32 val = 0; | 6610 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; |
6637 | 6611 | ||
6638 | dprintk(1, "\n"); | 6612 | dprintk(1, "\n"); |
6639 | 6613 | ||
@@ -6642,8 +6616,7 @@ static int drxk_read_signal_strength(struct dvb_frontend *fe, | |||
6642 | if (state->m_DrxkState == DRXK_UNINITIALIZED) | 6616 | if (state->m_DrxkState == DRXK_UNINITIALIZED) |
6643 | return -EAGAIN; | 6617 | return -EAGAIN; |
6644 | 6618 | ||
6645 | ReadIFAgc(state, &val); | 6619 | *strength = c->strength.stat[0].uvalue; |
6646 | *strength = val & 0xffff; | ||
6647 | return 0; | 6620 | return 0; |
6648 | } | 6621 | } |
6649 | 6622 | ||