Devices with xc5000 provide the signal strength value in dBm.
So, provide it with the proper scale to userspace.

Signed-off-by: Mauro Carvalho Chehab <mche...@s-opensource.com>
---
 drivers/media/dvb-frontends/au8522_dig.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/media/dvb-frontends/au8522_dig.c 
b/drivers/media/dvb-frontends/au8522_dig.c
index 22d837494cc7..518040228064 100644
--- a/drivers/media/dvb-frontends/au8522_dig.c
+++ b/drivers/media/dvb-frontends/au8522_dig.c
@@ -744,6 +744,15 @@ static void au8522_get_stats(struct dvb_frontend *fe, enum 
fe_status status)
                        fe->ops.i2c_gate_ctrl(fe, 0);
                if (ret < 0)
                        state->strength = 0;
+
+               /*
+                * FIXME: As this frontend is used only with au0828, and,
+                * currently, the tuner is eiter xc5000 or tda18271, and
+                * only the first implements get_rf_strength(), we'll assume
+                * that the strength will be returned in dB.
+                */
+               c->strength.stat[0].svalue = 35000 - 1000 * (65535 - 
state->strength) / 256;
+               c->strength.stat[0].scale = FE_SCALE_DECIBEL;
        } else {
                u32 tmp;
                /*
@@ -769,9 +778,9 @@ static void au8522_get_stats(struct dvb_frontend *fe, enum 
fe_status status)
                        state->strength = 0xffff;
                else
                        state->strength = tmp / 8960;
+               c->strength.stat[0].uvalue = state->strength;
+               c->strength.stat[0].scale = FE_SCALE_RELATIVE;
        }
-       c->strength.stat[0].scale = FE_SCALE_RELATIVE;
-       c->strength.stat[0].uvalue = state->strength;
 
        /* Read UCB blocks */
        if (!(status & FE_HAS_LOCK)) {
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to