STB0899 fix sinal quality values

This commit is contained in:
chemstar 2013-01-09 19:39:54 +01:00
parent 8adf9394c7
commit 368d60116d

View File

@ -0,0 +1,61 @@
--- linux-3.6.11/drivers/media/dvb/frontends/stb0899_drv.c 2012-12-31 08:29:52.975869000 +0100
+++ linux-3.6.11.patch/drivers/media/dvb/frontends/stb0899_drv.c 2012-12-31 08:39:29.963853000 +0100
@@ -971,6 +971,16 @@
*strength = stb0899_table_lookup(stb0899_dvbsrf_tab, ARRAY_SIZE(stb0899_dvbsrf_tab) - 1, val);
*strength += 750;
+
+ const int MIN_STRENGTH_DVBS = 0;
+ const int MAX_STRENGTH_DVBS = 680;
+ if (*strength < MIN_STRENGTH_DVBS)
+ *strength = 0;
+ else if(*strength > MAX_STRENGTH_DVBS)
+ *strength = 0xFFFF;
+ else
+ *strength = (*strength - MIN_STRENGTH_DVBS) * 0xFFFF / (MAX_STRENGTH_DVBS - MIN_STRENGTH_DVBS);
+
dprintk(state->verbose, FE_DEBUG, 1, "AGCIQVALUE = 0x%02x, C = %d * 0.1 dBm",
val & 0xff, *strength);
}
@@ -983,6 +993,7 @@
*strength = stb0899_table_lookup(stb0899_dvbs2rf_tab, ARRAY_SIZE(stb0899_dvbs2rf_tab) - 1, val);
*strength += 950;
+ *strength = *strength << 4;
dprintk(state->verbose, FE_DEBUG, 1, "IF_AGC_GAIN = 0x%04x, C = %d * 0.1 dBm",
val & 0x3fff, *strength);
}
@@ -1016,6 +1027,16 @@
val = MAKEWORD16(buf[0], buf[1]);
*snr = stb0899_table_lookup(stb0899_cn_tab, ARRAY_SIZE(stb0899_cn_tab) - 1, val);
+
+ const int MIN_SNR_DVBS = 0;
+ const int MAX_SNR_DVBS = 200;
+ if (*snr < MIN_SNR_DVBS)
+ *snr = 0;
+ else if(*snr > MAX_SNR_DVBS)
+ *snr = 0xFFFF;
+ else
+ *snr = (*snr - MIN_SNR_DVBS) * 0xFFFF / (MAX_SNR_DVBS - MIN_SNR_DVBS);
+
dprintk(state->verbose, FE_DEBUG, 1, "NIR = 0x%02x%02x = %u, C/N = %d * 0.1 dBm\n",
buf[0], buf[1], val, *snr);
}
@@ -1040,6 +1061,16 @@
val = (quantn - estn) / 10;
}
*snr = val;
+
+ const int MIN_SNR_DVBS2 = 10;
+ const int MAX_SNR_DVBS2 = 70;
+ if (*snr < MIN_SNR_DVBS2)
+ *snr = 0;
+ else if(*snr > MAX_SNR_DVBS2)
+ *snr = 0xFFFF;
+ else
+ *snr = (*snr - MIN_SNR_DVBS2) * 0xFFFF / (MAX_SNR_DVBS2 - MIN_SNR_DVBS2);
+
dprintk(state->verbose, FE_DEBUG, 1, "Es/N0 quant = %d (%d) estimate = %u (%d), C/N = %d * 0.1 dBm",
quant, quantn, est, estn, val);
}