[media] af9033: return 0.1 dB DVBv3 SNR for AF9030 family
Previous patch changed both AF9030 and IT9130 SNR reporting from dB to relative. Restore AF9030 to old behavior as it has been always returning 0.1 dB value. Leave IT9130 relative as old IT9130 was returning relative values. Cc: Bimow Chen <Bimow.Chen@ite.com.tw> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
This commit is contained in:
parent
6d03f6a875
commit
c3a80cd024
|
@ -854,26 +854,33 @@ static int af9033_read_snr(struct dvb_frontend *fe, u16 *snr)
|
||||||
|
|
||||||
/* use DVBv5 CNR */
|
/* use DVBv5 CNR */
|
||||||
if (c->cnr.stat[0].scale == FE_SCALE_DECIBEL) {
|
if (c->cnr.stat[0].scale == FE_SCALE_DECIBEL) {
|
||||||
*snr = div_s64(c->cnr.stat[0].svalue, 1000);
|
/* Return 0.1 dB for AF9030 and 0-0xffff for IT9130. */
|
||||||
|
if (dev->is_af9035) {
|
||||||
|
/* 1000x => 10x (0.1 dB) */
|
||||||
|
*snr = div_s64(c->cnr.stat[0].svalue, 100);
|
||||||
|
} else {
|
||||||
|
/* 1000x => 1x (1 dB) */
|
||||||
|
*snr = div_s64(c->cnr.stat[0].svalue, 1000);
|
||||||
|
|
||||||
/* read current modulation */
|
/* read current modulation */
|
||||||
ret = af9033_rd_reg(dev, 0x80f903, &u8tmp);
|
ret = af9033_rd_reg(dev, 0x80f903, &u8tmp);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
/* scale value to 0x0000-0xffff */
|
/* scale value to 0x0000-0xffff */
|
||||||
switch ((u8tmp >> 0) & 3) {
|
switch ((u8tmp >> 0) & 3) {
|
||||||
case 0:
|
case 0:
|
||||||
*snr = *snr * 0xFFFF / 23;
|
*snr = *snr * 0xffff / 23;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
*snr = *snr * 0xFFFF / 26;
|
*snr = *snr * 0xffff / 26;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
*snr = *snr * 0xFFFF / 32;
|
*snr = *snr * 0xffff / 32;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
goto err;
|
goto err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
*snr = 0;
|
*snr = 0;
|
||||||
|
|
Loading…
Reference in New Issue