summaryrefslogtreecommitdiff
path: root/drivers/media/dvb-frontends/ts2020.c
diff options
context:
space:
mode:
authorAntti Palosaari <crope@iki.fi>2015-03-26 10:49:17 -0300
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-06-10 10:55:58 -0300
commit2ca58f45cc986952dc2b2942fb170d9d7644735a (patch)
treed6de2e07785dedcc983047b6e6f4e5ef368d0f18 /drivers/media/dvb-frontends/ts2020.c
parentaf9d52555304979c7a3ce254e026bc76bd878f74 (diff)
[media] ts2020: improve filter limit calc
* We don't need calculate channel bandwidth from symbol rate as it is calculated by DVB core. * Use clamp() to force upper/lower limit of filter 3dB frequency. Upper limit should never exceeded 40MHz (80MHz BW) in any case, though... Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/dvb-frontends/ts2020.c')
-rw-r--r--drivers/media/dvb-frontends/ts2020.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/media/dvb-frontends/ts2020.c b/drivers/media/dvb-frontends/ts2020.c
index bc48388906d3..590f7e1b56f3 100644
--- a/drivers/media/dvb-frontends/ts2020.c
+++ b/drivers/media/dvb-frontends/ts2020.c
@@ -233,7 +233,6 @@ static int ts2020_set_params(struct dvb_frontend *fe)
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
struct ts2020_priv *priv = fe->tuner_priv;
int ret;
- u32 symbol_rate = (c->symbol_rate / 1000);
u32 f3db, gdiv28;
u16 u16tmp, value, lpf_coeff;
u8 buf[3], reg10, lpf_mxdiv, mlpf_max, mlpf_min, nlpf;
@@ -312,12 +311,9 @@ static int ts2020_set_params(struct dvb_frontend *fe)
value = ts2020_readreg(fe, 0x26);
- f3db = (symbol_rate * 135) / 200 + 2000;
- f3db += FREQ_OFFSET_LOW_SYM_RATE;
- if (f3db < 7000)
- f3db = 7000;
- if (f3db > 40000)
- f3db = 40000;
+ f3db = (c->bandwidth_hz / 1000 / 2) + 2000;
+ f3db += FREQ_OFFSET_LOW_SYM_RATE; /* FIXME: ~always too wide filter */
+ f3db = clamp(f3db, 7000U, 40000U);
gdiv28 = gdiv28 * 207 / (value * 2 + 151);
mlpf_max = gdiv28 * 135 / 100;