diff mbox

[4/4] cxd2841er: adjust the dB scale for DVB-C

Message ID 2a0edab5ab7b0e0743b04a64c935d798d3930856.1467381792.git.mchehab@s-opensource.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mauro Carvalho Chehab July 1, 2016, 2:03 p.m. UTC
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 | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

Abylai Ospan July 14, 2016, 8:25 p.m. UTC | #1
Hello Mauro,

Acked-by: Abylay Ospan <aospan@netup.ru>

I have checked values with reference signal from my modulator for
DVB-C. Formula is working fine. Thanks !


2016-07-01 10:03 GMT-04:00 Mauro Carvalho Chehab <mchehab@s-opensource.com>:
> 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 | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/dvb-frontends/cxd2841er.c b/drivers/media/dvb-frontends/cxd2841er.c
> index e2f3ea55897b..6c660761563d 100644
> --- a/drivers/media/dvb-frontends/cxd2841er.c
> +++ b/drivers/media/dvb-frontends/cxd2841er.c
> @@ -1746,8 +1746,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(
> --
> 2.7.4
>
diff mbox

Patch

diff --git a/drivers/media/dvb-frontends/cxd2841er.c b/drivers/media/dvb-frontends/cxd2841er.c
index e2f3ea55897b..6c660761563d 100644
--- a/drivers/media/dvb-frontends/cxd2841er.c
+++ b/drivers/media/dvb-frontends/cxd2841er.c
@@ -1746,8 +1746,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(