]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[media] cxd2841er: adjust the dB scale for DVB-C
authorMauro Carvalho Chehab <mchehab@s-opensource.com>
Fri, 1 Jul 2016 14:03:16 +0000 (11:03 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Sat, 16 Jul 2016 09:56:03 +0000 (06:56 -0300)
Instead of using a relative frequency range, calibrate it to
show the results in dB. The callibration was done getting
samples with a signal generated from -50dBm to -12dBm,
incremented in steps of 0.5 dB, using 3 frequencies:
175 MHz, 410 MHz and 800 MHz. The modulated signal was
using QAM64, and it was used a linear interpolation of all
the results.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/dvb-frontends/cxd2841er.c

index 2a698711d25bf3e7a3e673aedc413327c18997f6..95d82c4445e2029a316c3d23f954da628888fa4e 100644 (file)
@@ -1768,8 +1768,13 @@ static void cxd2841er_read_signal_strength(struct dvb_frontend *fe)
        case SYS_DVBC_ANNEX_A:
                strength = cxd2841er_read_agc_gain_t_t2(priv,
                                                        p->delivery_system);
-               p->strength.stat[0].scale = FE_SCALE_RELATIVE;
-               p->strength.stat[0].uvalue = strength;
+               p->strength.stat[0].scale = FE_SCALE_DECIBEL;
+               /*
+                * Formula was empirically determinated via linear regression,
+                * using frequencies: 175 MHz, 410 MHz and 800 MHz, and a
+                * stream modulated with QAM64
+                */
+               p->strength.stat[0].uvalue = ((s32)strength) * 4045 / 1000 - 85224;
                break;
        case SYS_ISDBT:
                strength = 65535 - cxd2841er_read_agc_gain_i(