Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 174088
b: refs/heads/master
c: 7c236e3
h: refs/heads/master
v: v3
  • Loading branch information
Andreas Regel authored and Mauro Carvalho Chehab committed Dec 5, 2009
1 parent 887e94c commit 8a5fcf5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7b035da93eb6ba839b39c61c5d993365ae308684
refs/heads/master: 7c236e37dd027c0bf35ffbda8de03cbe0c6a750d
6 changes: 4 additions & 2 deletions trunk/drivers/media/dvb/frontends/stv6110x.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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;
Expand Down

0 comments on commit 8a5fcf5

Please sign in to comment.