aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorIgor M. Liplianin <liplianin@netup.ru>2009-10-27 13:59:53 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-12-05 15:41:25 -0500
commit502cd96d5b0714e0ab022766014f58b0684699a8 (patch)
tree6fbed7b6d477ee61badd79dcff0fdf0091a1c97a /drivers/media
parent29372a8daec4c1dca83e294006488b1d47dd965c (diff)
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>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb/frontends/stv0900_core.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/drivers/media/dvb/frontends/stv0900_core.c b/drivers/media/dvb/frontends/stv0900_core.c
index c8c72f56fdd9..11dbe942aa41 100644
--- a/drivers/media/dvb/frontends/stv0900_core.c
+++ b/drivers/media/dvb/frontends/stv0900_core.c
@@ -599,6 +599,8 @@ static s32 stv0900_get_rf_level(struct stv0900_internal *i_params,
599 break; 599 break;
600 } 600 }
601 601
602 dprintk("%s: AGC Gain = 0x%x\n", __func__, agc_gain);
603
602 imin = 0; 604 imin = 0;
603 imax = lookup->size - 1; 605 imax = lookup->size - 1;
604 if (INRANGE(lookup->table[imin].regval, agc_gain, lookup->table[imax].regval)) { 606 if (INRANGE(lookup->table[imin].regval, agc_gain, lookup->table[imax].regval)) {
@@ -634,7 +636,14 @@ static int stv0900_read_signal_strength(struct dvb_frontend *fe, u16 *strength)
634 s32 rflevel = stv0900_get_rf_level(internal, &stv0900_rf, 636 s32 rflevel = stv0900_get_rf_level(internal, &stv0900_rf,
635 state->demod); 637 state->demod);
636 638
637 *strength = (rflevel + 100) * (16383 / 105); 639 rflevel = (rflevel + 100) * (65535 / 70);
640 if (rflevel < 0)
641 rflevel = 0;
642
643 if (rflevel > 65535)
644 rflevel = 65535;
645
646 *strength = rflevel;
638 647
639 return 0; 648 return 0;
640} 649}
@@ -709,6 +718,8 @@ static s32 stv0900_carr_get_quality(struct dvb_frontend *fe,
709 } 718 }
710 } 719 }
711 720
721 dprintk("%s: Quality = %d\n", __func__, c_n);
722
712 return c_n; 723 return c_n;
713} 724}
714 725
@@ -752,10 +763,16 @@ static int stv0900_read_ucblocks(struct dvb_frontend *fe, u32 * ucblocks)
752 763
753static int stv0900_read_snr(struct dvb_frontend *fe, u16 *snr) 764static int stv0900_read_snr(struct dvb_frontend *fe, u16 *snr)
754{ 765{
755 *snr = stv0900_carr_get_quality(fe, 766 s32 snrlcl = stv0900_carr_get_quality(fe,
756 (const struct stv0900_table *)&stv0900_s2_cn); 767 (const struct stv0900_table *)&stv0900_s2_cn);
757 *snr += 30; 768 snrlcl = (snrlcl + 30) * 384;
758 *snr *= (16383 / 1030); 769 if (snrlcl < 0)
770 snrlcl = 0;
771
772 if (snrlcl > 65535)
773 snrlcl = 65535;
774
775 *snr = snrlcl;
759 776
760 return 0; 777 return 0;
761} 778}