V4L/DVB (13337): Change str snr scale for stv0900/903 and Netup Dual DVB-S2 card.

Signed-off-by: Igor M. Liplianin <liplianin@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
diff --git a/drivers/media/dvb/frontends/stv0900_core.c b/drivers/media/dvb/frontends/stv0900_core.c
index c8c72f5..11dbe94 100644
--- a/drivers/media/dvb/frontends/stv0900_core.c
+++ b/drivers/media/dvb/frontends/stv0900_core.c
@@ -599,6 +599,8 @@
 			break;
 		}
 
+	dprintk("%s: AGC Gain = 0x%x\n", __func__, agc_gain);
+
 		imin = 0;
 		imax = lookup->size - 1;
 		if (INRANGE(lookup->table[imin].regval, agc_gain, lookup->table[imax].regval)) {
@@ -634,7 +636,14 @@
 	s32 rflevel = stv0900_get_rf_level(internal, &stv0900_rf,
 								state->demod);
 
-	*strength = (rflevel + 100) * (16383 / 105);
+	rflevel = (rflevel + 100) * (65535 / 70);
+	if (rflevel < 0)
+		rflevel = 0;
+
+	if (rflevel > 65535)
+		rflevel = 65535;
+
+	*strength = rflevel;
 
 	return 0;
 }
@@ -709,6 +718,8 @@
 		}
 	}
 
+	dprintk("%s: Quality = %d\n", __func__, c_n);
+
 	return c_n;
 }
 
@@ -752,10 +763,16 @@
 
 static int stv0900_read_snr(struct dvb_frontend *fe, u16 *snr)
 {
-	*snr = stv0900_carr_get_quality(fe,
+	s32 snrlcl = stv0900_carr_get_quality(fe,
 			(const struct stv0900_table *)&stv0900_s2_cn);
-	*snr += 30;
-	*snr *= (16383 / 1030);
+	snrlcl = (snrlcl + 30) * 384;
+	if (snrlcl < 0)
+		snrlcl = 0;
+
+	if (snrlcl > 65535)
+		snrlcl = 65535;
+
+	*snr = snrlcl;
 
 	return 0;
 }