public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [2.6.17.y PATCH 2/2] cx24123: fix PLL divisor setup
@ 2006-10-08 18:46 Michael Krufky
  0 siblings, 0 replies; only message in thread
From: Michael Krufky @ 2006-10-08 18:46 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, v4l-dvb maintainer list, Yeasah Pell, Steven Toth

>From df9b6db4d2168cd82f8590d2f9a2d3580cdf7233 Mon Sep 17 00:00:00 2001
From: Yeasah Pell <yeasah@schwide.net>
Date: Tue, 3 Oct 2006 21:57:08 -0400
Subject: [PATCH] cx24123: fix PLL divisor setup

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>
---
 drivers/media/dvb/frontends/cx24123.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/dvb/frontends/cx24123.c b/drivers/media/dvb/frontends/cx24123.c
index 691dc84..afb08ff 100644
--- a/drivers/media/dvb/frontends/cx24123.c
+++ b/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;

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2006-10-08 18:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-08 18:46 [2.6.17.y PATCH 2/2] cx24123: fix PLL divisor setup Michael Krufky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox