diff options
author | Hartmut Hackmann <hartmut.hackmann@t-online.de> | 2008-04-09 22:07:11 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-04-24 13:09:44 -0400 |
commit | 9a1b04e461fc8127c902a988cd9a082ba0680b11 (patch) | |
tree | 5f09a53b458432fddba9ed871f5731a83e41f7e2 | |
parent | b37f2d6a31fc8e80c79a0a214d83b128aa796543 (diff) |
V4L/DVB (7654): tda10086: make the xtal frequency a configuration option
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>
-rw-r--r-- | drivers/media/dvb/dvb-usb/ttusb2.c | 1 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/tda10086.c | 11 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/tda10086.h | 8 | ||||
-rw-r--r-- | drivers/media/dvb/ttpci/budget.c | 1 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-dvb.c | 10 |
5 files changed, 27 insertions, 4 deletions
diff --git a/drivers/media/dvb/dvb-usb/ttusb2.c b/drivers/media/dvb/dvb-usb/ttusb2.c index 706687c78506..20ca9d9ee99b 100644 --- a/drivers/media/dvb/dvb-usb/ttusb2.c +++ b/drivers/media/dvb/dvb-usb/ttusb2.c | |||
@@ -147,6 +147,7 @@ static struct tda10086_config tda10086_config = { | |||
147 | .demod_address = 0x0e, | 147 | .demod_address = 0x0e, |
148 | .invert = 0, | 148 | .invert = 0, |
149 | .diseqc_tone = 1, | 149 | .diseqc_tone = 1, |
150 | .xtal_freq = TDA10086_XTAL_16M, | ||
150 | }; | 151 | }; |
151 | 152 | ||
152 | static int ttusb2_frontend_attach(struct dvb_usb_adapter *adap) | 153 | static int ttusb2_frontend_attach(struct dvb_usb_adapter *adap) |
diff --git a/drivers/media/dvb/frontends/tda10086.c b/drivers/media/dvb/frontends/tda10086.c index 5fc26757f393..acf1471373ca 100644 --- a/drivers/media/dvb/frontends/tda10086.c +++ b/drivers/media/dvb/frontends/tda10086.c | |||
@@ -128,10 +128,15 @@ static int tda10086_init(struct dvb_frontend* fe) | |||
128 | tda10086_write_byte(state, 0x32, 0x00); // irq off | 128 | tda10086_write_byte(state, 0x32, 0x00); // irq off |
129 | tda10086_write_byte(state, 0x31, 0x56); // setup AFC | 129 | tda10086_write_byte(state, 0x31, 0x56); // setup AFC |
130 | 130 | ||
131 | // setup PLL (assumes 16Mhz XIN) | 131 | // setup PLL (this assumes SACLK = 96MHz) |
132 | tda10086_write_byte(state, 0x55, 0x2c); // misc PLL setup | 132 | tda10086_write_byte(state, 0x55, 0x2c); // misc PLL setup |
133 | tda10086_write_byte(state, 0x3a, 0x0b); // M=12 | 133 | if (state->config->xtal_freq == TDA10086_XTAL_16M) { |
134 | tda10086_write_byte(state, 0x3b, 0x01); // P=2 | 134 | tda10086_write_byte(state, 0x3a, 0x0b); // M=12 |
135 | tda10086_write_byte(state, 0x3b, 0x01); // P=2 | ||
136 | } else { | ||
137 | tda10086_write_byte(state, 0x3a, 0x17); // M=24 | ||
138 | tda10086_write_byte(state, 0x3b, 0x00); // P=1 | ||
139 | } | ||
135 | tda10086_write_mask(state, 0x55, 0x20, 0x00); // powerup PLL | 140 | tda10086_write_mask(state, 0x55, 0x20, 0x00); // powerup PLL |
136 | 141 | ||
137 | // setup TS interface | 142 | // setup TS interface |
diff --git a/drivers/media/dvb/frontends/tda10086.h b/drivers/media/dvb/frontends/tda10086.h index 197c237e515f..f25d5ea381e5 100644 --- a/drivers/media/dvb/frontends/tda10086.h +++ b/drivers/media/dvb/frontends/tda10086.h | |||
@@ -26,6 +26,11 @@ | |||
26 | #include <linux/dvb/frontend.h> | 26 | #include <linux/dvb/frontend.h> |
27 | #include <linux/firmware.h> | 27 | #include <linux/firmware.h> |
28 | 28 | ||
29 | enum tda10086_xtal { | ||
30 | TDA10086_XTAL_16M, | ||
31 | TDA10086_XTAL_4M | ||
32 | }; | ||
33 | |||
29 | struct tda10086_config | 34 | struct tda10086_config |
30 | { | 35 | { |
31 | /* the demodulator's i2c address */ | 36 | /* the demodulator's i2c address */ |
@@ -36,6 +41,9 @@ struct tda10086_config | |||
36 | 41 | ||
37 | /* do we need the diseqc signal with carrier? */ | 42 | /* do we need the diseqc signal with carrier? */ |
38 | u8 diseqc_tone; | 43 | u8 diseqc_tone; |
44 | |||
45 | /* frequency of the reference xtal */ | ||
46 | enum tda10086_xtal xtal_freq; | ||
39 | }; | 47 | }; |
40 | 48 | ||
41 | #if defined(CONFIG_DVB_TDA10086) || (defined(CONFIG_DVB_TDA10086_MODULE) && defined(MODULE)) | 49 | #if defined(CONFIG_DVB_TDA10086) || (defined(CONFIG_DVB_TDA10086_MODULE) && defined(MODULE)) |
diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c index e36c32528e5c..7adfe17b0616 100644 --- a/drivers/media/dvb/ttpci/budget.c +++ b/drivers/media/dvb/ttpci/budget.c | |||
@@ -365,6 +365,7 @@ static struct tda10086_config tda10086_config = { | |||
365 | .demod_address = 0x0e, | 365 | .demod_address = 0x0e, |
366 | .invert = 0, | 366 | .invert = 0, |
367 | .diseqc_tone = 1, | 367 | .diseqc_tone = 1, |
368 | .xtal_freq = TDA10086_XTAL_16M, | ||
368 | }; | 369 | }; |
369 | 370 | ||
370 | static u8 read_pwm(struct budget* budget) | 371 | static u8 read_pwm(struct budget* budget) |
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c index 73154c1a0239..2d16be2259db 100644 --- a/drivers/media/video/saa7134/saa7134-dvb.c +++ b/drivers/media/video/saa7134/saa7134-dvb.c | |||
@@ -851,6 +851,14 @@ static struct tda10086_config flydvbs = { | |||
851 | .demod_address = 0x0e, | 851 | .demod_address = 0x0e, |
852 | .invert = 0, | 852 | .invert = 0, |
853 | .diseqc_tone = 0, | 853 | .diseqc_tone = 0, |
854 | .xtal_freq = TDA10086_XTAL_16M, | ||
855 | }; | ||
856 | |||
857 | static struct tda10086_config sd1878_4m = { | ||
858 | .demod_address = 0x0e, | ||
859 | .invert = 0, | ||
860 | .diseqc_tone = 0, | ||
861 | .xtal_freq = TDA10086_XTAL_4M, | ||
854 | }; | 862 | }; |
855 | 863 | ||
856 | /* ------------------------------------------------------------------ | 864 | /* ------------------------------------------------------------------ |
@@ -1206,7 +1214,7 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1206 | break; | 1214 | break; |
1207 | case SAA7134_BOARD_MD7134_BRIDGE_2: | 1215 | case SAA7134_BOARD_MD7134_BRIDGE_2: |
1208 | dev->dvb.frontend = dvb_attach(tda10086_attach, | 1216 | dev->dvb.frontend = dvb_attach(tda10086_attach, |
1209 | &flydvbs, &dev->i2c_adap); | 1217 | &sd1878_4m, &dev->i2c_adap); |
1210 | if (dev->dvb.frontend) { | 1218 | if (dev->dvb.frontend) { |
1211 | struct dvb_frontend *fe; | 1219 | struct dvb_frontend *fe; |
1212 | if (dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x60, | 1220 | if (dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x60, |