diff options
author | Jose Alberto Reguero <jareguero@telefonica.net> | 2011-08-08 06:35:35 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-08-27 10:44:49 -0400 |
commit | c9f88aa976b79a26561fb7754a1e0e00ff7626fe (patch) | |
tree | 2fc06e5847a87b337ff503a0515b675832a5940f /drivers/media/dvb/frontends | |
parent | 84b271488dcd2499e9d2c7cfa2abacfd4c5cd744 (diff) |
[media] ttusb2: add support for the dvb-t part of CT-3650 v3
Signed-off-by: Jose Alberto Reguero <jareguero@telefonica.net>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/frontends')
-rw-r--r-- | drivers/media/dvb/frontends/tda10048.c | 37 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/tda10048.h | 8 |
2 files changed, 33 insertions, 12 deletions
diff --git a/drivers/media/dvb/frontends/tda10048.c b/drivers/media/dvb/frontends/tda10048.c index 93f6a75c238e..7f105946a434 100644 --- a/drivers/media/dvb/frontends/tda10048.c +++ b/drivers/media/dvb/frontends/tda10048.c | |||
@@ -206,15 +206,16 @@ static struct init_tab { | |||
206 | static struct pll_tab { | 206 | static struct pll_tab { |
207 | u32 clk_freq_khz; | 207 | u32 clk_freq_khz; |
208 | u32 if_freq_khz; | 208 | u32 if_freq_khz; |
209 | u8 m, n, p; | ||
210 | } pll_tab[] = { | 209 | } pll_tab[] = { |
211 | { TDA10048_CLK_4000, TDA10048_IF_36130, 10, 0, 0 }, | 210 | { TDA10048_CLK_4000, TDA10048_IF_36130 }, |
212 | { TDA10048_CLK_16000, TDA10048_IF_3300, 10, 3, 0 }, | 211 | { TDA10048_CLK_16000, TDA10048_IF_3300 }, |
213 | { TDA10048_CLK_16000, TDA10048_IF_3500, 10, 3, 0 }, | 212 | { TDA10048_CLK_16000, TDA10048_IF_3500 }, |
214 | { TDA10048_CLK_16000, TDA10048_IF_3800, 10, 3, 0 }, | 213 | { TDA10048_CLK_16000, TDA10048_IF_3800 }, |
215 | { TDA10048_CLK_16000, TDA10048_IF_4000, 10, 3, 0 }, | 214 | { TDA10048_CLK_16000, TDA10048_IF_4000 }, |
216 | { TDA10048_CLK_16000, TDA10048_IF_4300, 10, 3, 0 }, | 215 | { TDA10048_CLK_16000, TDA10048_IF_4300 }, |
217 | { TDA10048_CLK_16000, TDA10048_IF_36130, 10, 3, 0 }, | 216 | { TDA10048_CLK_16000, TDA10048_IF_4500 }, |
217 | { TDA10048_CLK_16000, TDA10048_IF_5000 }, | ||
218 | { TDA10048_CLK_16000, TDA10048_IF_36130 }, | ||
218 | }; | 219 | }; |
219 | 220 | ||
220 | static int tda10048_writereg(struct tda10048_state *state, u8 reg, u8 data) | 221 | static int tda10048_writereg(struct tda10048_state *state, u8 reg, u8 data) |
@@ -460,9 +461,6 @@ static int tda10048_set_if(struct dvb_frontend *fe, enum fe_bandwidth bw) | |||
460 | 461 | ||
461 | state->freq_if_hz = pll_tab[i].if_freq_khz * 1000; | 462 | state->freq_if_hz = pll_tab[i].if_freq_khz * 1000; |
462 | state->xtal_hz = pll_tab[i].clk_freq_khz * 1000; | 463 | state->xtal_hz = pll_tab[i].clk_freq_khz * 1000; |
463 | state->pll_mfactor = pll_tab[i].m; | ||
464 | state->pll_nfactor = pll_tab[i].n; | ||
465 | state->pll_pfactor = pll_tab[i].p; | ||
466 | break; | 464 | break; |
467 | } | 465 | } |
468 | } | 466 | } |
@@ -781,6 +779,10 @@ static int tda10048_init(struct dvb_frontend *fe) | |||
781 | 779 | ||
782 | dprintk(1, "%s()\n", __func__); | 780 | dprintk(1, "%s()\n", __func__); |
783 | 781 | ||
782 | /* PLL */ | ||
783 | init_tab[4].data = (u8)(state->pll_mfactor); | ||
784 | init_tab[5].data = (u8)(state->pll_nfactor) | 0x40; | ||
785 | |||
784 | /* Apply register defaults */ | 786 | /* Apply register defaults */ |
785 | for (i = 0; i < ARRAY_SIZE(init_tab); i++) | 787 | for (i = 0; i < ARRAY_SIZE(init_tab); i++) |
786 | tda10048_writereg(state, init_tab[i].reg, init_tab[i].data); | 788 | tda10048_writereg(state, init_tab[i].reg, init_tab[i].data); |
@@ -1123,7 +1125,7 @@ struct dvb_frontend *tda10048_attach(const struct tda10048_config *config, | |||
1123 | /* setup the state and clone the config */ | 1125 | /* setup the state and clone the config */ |
1124 | memcpy(&state->config, config, sizeof(*config)); | 1126 | memcpy(&state->config, config, sizeof(*config)); |
1125 | state->i2c = i2c; | 1127 | state->i2c = i2c; |
1126 | state->fwloaded = 0; | 1128 | state->fwloaded = config->no_firmware; |
1127 | state->bandwidth = BANDWIDTH_8_MHZ; | 1129 | state->bandwidth = BANDWIDTH_8_MHZ; |
1128 | 1130 | ||
1129 | /* check if the demod is present */ | 1131 | /* check if the demod is present */ |
@@ -1135,6 +1137,17 @@ struct dvb_frontend *tda10048_attach(const struct tda10048_config *config, | |||
1135 | sizeof(struct dvb_frontend_ops)); | 1137 | sizeof(struct dvb_frontend_ops)); |
1136 | state->frontend.demodulator_priv = state; | 1138 | state->frontend.demodulator_priv = state; |
1137 | 1139 | ||
1140 | /* set pll */ | ||
1141 | if (config->set_pll) { | ||
1142 | state->pll_mfactor = config->pll_m; | ||
1143 | state->pll_nfactor = config->pll_n; | ||
1144 | state->pll_pfactor = config->pll_p; | ||
1145 | } else { | ||
1146 | state->pll_mfactor = 10; | ||
1147 | state->pll_nfactor = 3; | ||
1148 | state->pll_pfactor = 0; | ||
1149 | } | ||
1150 | |||
1138 | /* Establish any defaults the the user didn't pass */ | 1151 | /* Establish any defaults the the user didn't pass */ |
1139 | tda10048_establish_defaults(&state->frontend); | 1152 | tda10048_establish_defaults(&state->frontend); |
1140 | 1153 | ||
diff --git a/drivers/media/dvb/frontends/tda10048.h b/drivers/media/dvb/frontends/tda10048.h index 8828ceaf74bb..fb2ef5ac9487 100644 --- a/drivers/media/dvb/frontends/tda10048.h +++ b/drivers/media/dvb/frontends/tda10048.h | |||
@@ -51,6 +51,7 @@ struct tda10048_config { | |||
51 | #define TDA10048_IF_4300 4300 | 51 | #define TDA10048_IF_4300 4300 |
52 | #define TDA10048_IF_4500 4500 | 52 | #define TDA10048_IF_4500 4500 |
53 | #define TDA10048_IF_4750 4750 | 53 | #define TDA10048_IF_4750 4750 |
54 | #define TDA10048_IF_5000 5000 | ||
54 | #define TDA10048_IF_36130 36130 | 55 | #define TDA10048_IF_36130 36130 |
55 | u16 dtv6_if_freq_khz; | 56 | u16 dtv6_if_freq_khz; |
56 | u16 dtv7_if_freq_khz; | 57 | u16 dtv7_if_freq_khz; |
@@ -62,6 +63,13 @@ struct tda10048_config { | |||
62 | 63 | ||
63 | /* Disable I2C gate access */ | 64 | /* Disable I2C gate access */ |
64 | u8 disable_gate_access; | 65 | u8 disable_gate_access; |
66 | |||
67 | bool no_firmware; | ||
68 | |||
69 | bool set_pll; | ||
70 | u8 pll_m; | ||
71 | u8 pll_p; | ||
72 | u8 pll_n; | ||
65 | }; | 73 | }; |
66 | 74 | ||
67 | #if defined(CONFIG_DVB_TDA10048) || \ | 75 | #if defined(CONFIG_DVB_TDA10048) || \ |