]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
V4L/DVB (7654): tda10086: make the xtal frequency a configuration option
authorHartmut Hackmann <hartmut.hackmann@t-online.de>
Thu, 10 Apr 2008 02:07:11 +0000 (23:07 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Thu, 24 Apr 2008 17:09:44 +0000 (14:09 -0300)
Some DVB-S boards, i.e. with the SD1878 tuner, use a 4 MHz reference frequency.
This reqires a different setup of the clock PLL.
This patch adds an enum to the tda10086_config struct and sets the proper
values for the boards.

This patch also fixes the DVB-S section of the MD7134_BRIDGE_2

Signed-off-by: Hartmut Hackmann <hartmut.hackmann@t-online.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/dvb/dvb-usb/ttusb2.c
drivers/media/dvb/frontends/tda10086.c
drivers/media/dvb/frontends/tda10086.h
drivers/media/dvb/ttpci/budget.c
drivers/media/video/saa7134/saa7134-dvb.c

index 706687c78506e8d34a7231671bf7107bac431b15..20ca9d9ee99b23aedb60d3ecf3e892c5d9ae71a5 100644 (file)
@@ -147,6 +147,7 @@ static struct tda10086_config tda10086_config = {
        .demod_address = 0x0e,
        .invert = 0,
        .diseqc_tone = 1,
+       .xtal_freq = TDA10086_XTAL_16M,
 };
 
 static int ttusb2_frontend_attach(struct dvb_usb_adapter *adap)
index 5fc26757f393c0bad22955a695ea4990fb80842c..acf1471373cad3365c9b4c11834e7ea60b98d60e 100644 (file)
@@ -128,10 +128,15 @@ static int tda10086_init(struct dvb_frontend* fe)
        tda10086_write_byte(state, 0x32, 0x00); // irq off
        tda10086_write_byte(state, 0x31, 0x56); // setup AFC
 
-       // setup PLL (assumes 16Mhz XIN)
+       // setup PLL (this assumes SACLK = 96MHz)
        tda10086_write_byte(state, 0x55, 0x2c); // misc PLL setup
-       tda10086_write_byte(state, 0x3a, 0x0b); // M=12
-       tda10086_write_byte(state, 0x3b, 0x01); // P=2
+       if (state->config->xtal_freq == TDA10086_XTAL_16M) {
+               tda10086_write_byte(state, 0x3a, 0x0b); // M=12
+               tda10086_write_byte(state, 0x3b, 0x01); // P=2
+       } else {
+               tda10086_write_byte(state, 0x3a, 0x17); // M=24
+               tda10086_write_byte(state, 0x3b, 0x00); // P=1
+       }
        tda10086_write_mask(state, 0x55, 0x20, 0x00); // powerup PLL
 
        // setup TS interface
index 197c237e515f09a1d0e0d1a39f59aa5373d7967a..f25d5ea381e52fef0c1fe20ebc8f944a227da6d9 100644 (file)
 #include <linux/dvb/frontend.h>
 #include <linux/firmware.h>
 
+enum tda10086_xtal {
+       TDA10086_XTAL_16M,
+       TDA10086_XTAL_4M
+};
+
 struct tda10086_config
 {
        /* the demodulator's i2c address */
@@ -36,6 +41,9 @@ struct tda10086_config
 
        /* do we need the diseqc signal with carrier? */
        u8 diseqc_tone;
+
+       /* frequency of the reference xtal */
+       enum tda10086_xtal xtal_freq;
 };
 
 #if defined(CONFIG_DVB_TDA10086) || (defined(CONFIG_DVB_TDA10086_MODULE) && defined(MODULE))
index e36c32528e5c60067ee2225571b5cd39eb47d35c..7adfe17b06160d95c7ddd81c1b7db5988e94ad75 100644 (file)
@@ -365,6 +365,7 @@ static struct tda10086_config tda10086_config = {
        .demod_address = 0x0e,
        .invert = 0,
        .diseqc_tone = 1,
+       .xtal_freq = TDA10086_XTAL_16M,
 };
 
 static u8 read_pwm(struct budget* budget)
index 73154c1a0239cf7aef24290ac621a5ff60a3e632..2d16be2259dbb6182b10d84b54585bfc66e81ed5 100644 (file)
@@ -851,6 +851,14 @@ static struct tda10086_config flydvbs = {
        .demod_address = 0x0e,
        .invert = 0,
        .diseqc_tone = 0,
+       .xtal_freq = TDA10086_XTAL_16M,
+};
+
+static struct tda10086_config sd1878_4m = {
+       .demod_address = 0x0e,
+       .invert = 0,
+       .diseqc_tone = 0,
+       .xtal_freq = TDA10086_XTAL_4M,
 };
 
 /* ------------------------------------------------------------------
@@ -1206,7 +1214,7 @@ static int dvb_init(struct saa7134_dev *dev)
                break;
        case SAA7134_BOARD_MD7134_BRIDGE_2:
                dev->dvb.frontend = dvb_attach(tda10086_attach,
-                                               &flydvbs, &dev->i2c_adap);
+                                               &sd1878_4m, &dev->i2c_adap);
                if (dev->dvb.frontend) {
                        struct dvb_frontend *fe;
                        if (dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x60,