diff options
author | Andreas Regel <andreas.regel@gmx.de> | 2009-11-13 18:22:02 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-12-05 18:41:31 -0200 |
commit | 7c236e37dd027c0bf35ffbda8de03cbe0c6a750d (patch) | |
tree | 9124117cc1cc292513b823b466d91d41eddec13e /drivers/media/dvb/frontends/stv6110x.c | |
parent | 7b035da93eb6ba839b39c61c5d993365ae308684 (diff) | |
download | lwn-7c236e37dd027c0bf35ffbda8de03cbe0c6a750d.tar.gz lwn-7c236e37dd027c0bf35ffbda8de03cbe0c6a750d.zip |
V4L/DVB (13360): stv090x: fix the calculation of the r divider in stv6110x_set_frequency
It had always the value 3 no matter what frequency was given.
Signed-off-by: Andreas Regel <andreas.regel@gmx.de>
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/frontends/stv6110x.c')
-rw-r--r-- | drivers/media/dvb/frontends/stv6110x.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/media/dvb/frontends/stv6110x.c b/drivers/media/dvb/frontends/stv6110x.c index 3d8a2e01c9c4..bcfcb652464c 100644 --- a/drivers/media/dvb/frontends/stv6110x.c +++ b/drivers/media/dvb/frontends/stv6110x.c @@ -95,7 +95,7 @@ static int stv6110x_set_frequency(struct dvb_frontend *fe, u32 frequency) { struct stv6110x_state *stv6110x = fe->tuner_priv; u32 rDiv, divider; - s32 pVal, pCalc, rDivOpt = 0; + s32 pVal, pCalc, rDivOpt = 0, pCalcOpt = 1000; u8 i; STV6110x_SETFIELD(stv6110x_regs[STV6110x_CTRL1], CTRL1_K, (REFCLOCK_MHz - 16)); @@ -121,8 +121,10 @@ static int stv6110x_set_frequency(struct dvb_frontend *fe, u32 frequency) for (rDiv = 0; rDiv <= 3; rDiv++) { pCalc = (REFCLOCK_kHz / 100) / R_DIV(rDiv); - if ((abs((s32)(pCalc - pVal))) < (abs((s32)(1000 - pVal)))) + if ((abs((s32)(pCalc - pVal))) < (abs((s32)(pCalcOpt - pVal)))) rDivOpt = rDiv; + + pCalcOpt = (REFCLOCK_kHz / 100) / R_DIV(rDivOpt); } divider = (frequency * R_DIV(rDivOpt) * pVal) / REFCLOCK_kHz; |