blob: b1e95e4e69ba66871e96c467fd1528d7a522022f [file] [log] [blame]
From stable-bounces@linux.kernel.org Sun Oct 8 12:49:59 2006
Message-ID: <45294778.8020802@linuxtv.org>
Date: Sun, 08 Oct 2006 14:46:16 -0400
From: Yeasah Pell <yeasah@schwide.net>
To: stable@kernel.org
Cc: v4l-dvb maintainer list <v4l-dvb-maintainer@linuxtv.org>,
Yeasah Pell <yeasah@schwide.net>, linux-kernel@vger.kernel.org,
Steven Toth <stoth@hauppauge.com>
Subject: DVB: cx24123: fix PLL divisor setup
From: Yeasah Pell <yeasah@schwide.net>
The cx24109 datasheet says: "NOTE: if A=0, then N=N+1"
The current code is the result of a misinterpretation of the datasheet to
mean exactly the opposite of the requirement -- The actual value of N is 1 greater than the value written when A is 0, so 1 needs to be *subtracted*
from it to compensate.
Signed-off-by: Yeasah Pell <yeasah@schwide.net>
Signed-off-by: Steven Toth <stoth@hauppauge.com>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/media/dvb/frontends/cx24123.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- linux-2.6.17.13.orig/drivers/media/dvb/frontends/cx24123.c
+++ linux-2.6.17.13/drivers/media/dvb/frontends/cx24123.c
@@ -579,8 +579,8 @@ static int cx24123_pll_calculate(struct
ndiv = ( ((p->frequency * vco_div * 10) / (2 * XTAL / 1000)) / 32) & 0x1ff;
adiv = ( ((p->frequency * vco_div * 10) / (2 * XTAL / 1000)) % 32) & 0x1f;
- if (adiv == 0)
- ndiv++;
+ if (adiv == 0 && ndiv > 0)
+ ndiv--;
/* control bits 11, refdiv 11, charge pump polarity 1, charge pump current, ndiv, adiv */
state->pllarg = (3 << 19) | (3 << 17) | (1 << 16) | (pump << 14) | (ndiv << 5) | adiv;