[PATCH] cx24123 mis-tunes for certain frequencies

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I finally tracked down the cause of the weird mis-tunings I've seen occasionally with my cx24123-based card -- you can find border cases where one frequency would tune fine, +1MHz would be a totally different transport, but +2MHz would be back to the correct transport, etc.

It comes back to the PLL divisor setup -- the cx24109 datasheet says this:

NOTE: if A=0, then N=N+1

and the implementation interpreted that as this:

if (adiv == 0)
   ndiv++;

which seems reasonable at first glance, but it's exactly the opposite of what is required -- the datasheet means that 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.

Simple patch attached which eliminates the weird mis-tunings.

Signed-off-by: Yeasah Pell <yeasah at schwide dot net>

diff -r 323d46fbb593 linux/drivers/media/dvb/frontends/cx24123.c
--- a/linux/drivers/media/dvb/frontends/cx24123.c	Wed Aug 23 18:21:35 2006 -0300
+++ b/linux/drivers/media/dvb/frontends/cx24123.c	Sat Sep 16 23:06:15 2006 -0400
@@ -564,8 +562,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;
_______________________________________________
linux-dvb mailing list
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux