From fb74f961ab068c4db2f72b886517a9606b74a0e8 Mon Sep 17 00:00:00 2001 From: Holger Waechtler Date: Fri, 28 Mar 2003 14:02:43 +0000 Subject: optimized PLL code --- linux/drivers/media/dvb/frontends/grundig_29504-401.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'linux/drivers/media/dvb') diff --git a/linux/drivers/media/dvb/frontends/grundig_29504-401.c b/linux/drivers/media/dvb/frontends/grundig_29504-401.c index eef107bc9..eb1eda396 100644 --- a/linux/drivers/media/dvb/frontends/grundig_29504-401.c +++ b/linux/drivers/media/dvb/frontends/grundig_29504-401.c @@ -29,6 +29,7 @@ #include #include +#include "compat.h" #include "dvb_frontend.h" static int debug = 0; @@ -101,27 +102,33 @@ int tsa5060_write (struct dvb_i2c_bus *i2c, u8 data [4]) /** * set up the downconverter frequency divisor for a * reference clock comparision frequency of 166666 Hz. - * frequency offset is 36000000 Hz. + * frequency offset is 36125000 Hz. */ static int tsa5060_set_tv_freq (struct dvb_i2c_bus *i2c, u32 freq) { u32 div; u8 buf [4]; - u8 cfg; + u8 cfg, cpump, band_select; - div = (36000000 + freq) / 166666; + div = (36125000 + freq) / 166666; cfg = 0x88; + cpump = div < 175000 ? 2 : div < 390000 ? 1 : + div < 470000 ? 2 : div < 750000 ? 1 : 3; + + band_select = div < 175000 ? 0x0e : div < 470000 ? 0x05 : 0x03; + buf [0] = (div >> 8) & 0x7f; buf [1] = div & 0xff; buf [2] = ((div >> 10) & 0x60) | cfg; - buf [3] = 0xc0; + buf [3] = cpump | band_select; - return tsa5060_write (i2c, buf); + return tsa5060_write(i2c, buf); } + static void apply_tps (struct dvb_i2c_bus *i2c) { -- cgit v1.2.3