aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2008-04-22 13:46:23 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-04-24 13:07:55 -0400
commit4efb0ca5d00f2c7a8bf9632556a4b4330cf409c5 (patch)
tree4ce1c38c66a64c590ef06403e6a38e2be7175772 /drivers/media
parent40194b2b1bdd01358c1e9b5a9b8dd78390cc05f7 (diff)
V4L/DVB (7435): tda18271: add function tda18271_charge_pump_source
Force the main pll charge pump or cal pll charge pump to source current to the main pll loop filter or cal pll loop filter, respectively. Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb/frontends/tda18271-common.c21
-rw-r--r--drivers/media/dvb/frontends/tda18271-fe.c18
-rw-r--r--drivers/media/dvb/frontends/tda18271-priv.h7
3 files changed, 30 insertions, 16 deletions
diff --git a/drivers/media/dvb/frontends/tda18271-common.c b/drivers/media/dvb/frontends/tda18271-common.c
index 84d430c52854..e27a7620a32f 100644
--- a/drivers/media/dvb/frontends/tda18271-common.c
+++ b/drivers/media/dvb/frontends/tda18271-common.c
@@ -217,6 +217,21 @@ int tda18271_write_regs(struct dvb_frontend *fe, int idx, int len)
217 217
218/*---------------------------------------------------------------------*/ 218/*---------------------------------------------------------------------*/
219 219
220int tda18271_charge_pump_source(struct dvb_frontend *fe,
221 enum tda18271_pll pll, int force)
222{
223 struct tda18271_priv *priv = fe->tuner_priv;
224 unsigned char *regs = priv->tda18271_regs;
225
226 int r_cp = (pll == TDA18271_CAL_PLL) ? R_EB7 : R_EB4;
227
228 regs[r_cp] &= ~0x20;
229 regs[r_cp] |= ((force & 1) << 5);
230 tda18271_write_regs(fe, r_cp, 1);
231
232 return 0;
233}
234
220int tda18271_init_regs(struct dvb_frontend *fe) 235int tda18271_init_regs(struct dvb_frontend *fe)
221{ 236{
222 struct tda18271_priv *priv = fe->tuner_priv; 237 struct tda18271_priv *priv = fe->tuner_priv;
@@ -359,13 +374,11 @@ int tda18271_init_regs(struct dvb_frontend *fe)
359 374
360 if ((priv->id) == TDA18271HDC2) { 375 if ((priv->id) == TDA18271HDC2) {
361 /* main pll cp source on */ 376 /* main pll cp source on */
362 regs[R_EB4] = 0x61; 377 tda18271_charge_pump_source(fe, TDA18271_MAIN_PLL, 1);
363 tda18271_write_regs(fe, R_EB4, 1);
364 msleep(1); 378 msleep(1);
365 379
366 /* main pll cp source off */ 380 /* main pll cp source off */
367 regs[R_EB4] = 0x41; 381 tda18271_charge_pump_source(fe, TDA18271_MAIN_PLL, 0);
368 tda18271_write_regs(fe, R_EB4, 1);
369 } 382 }
370 383
371 msleep(5); /* pll locking */ 384 msleep(5); /* pll locking */
diff --git a/drivers/media/dvb/frontends/tda18271-fe.c b/drivers/media/dvb/frontends/tda18271-fe.c
index b3b0425dbbed..46905a773e46 100644
--- a/drivers/media/dvb/frontends/tda18271-fe.c
+++ b/drivers/media/dvb/frontends/tda18271-fe.c
@@ -119,14 +119,12 @@ static int tda18271_channel_configuration(struct dvb_frontend *fe,
119 tda18271_write_regs(fe, R_TM, 7); 119 tda18271_write_regs(fe, R_TM, 7);
120 120
121 /* main pll charge pump source */ 121 /* main pll charge pump source */
122 regs[R_EB4] |= 0x20; 122 tda18271_charge_pump_source(fe, TDA18271_MAIN_PLL, 1);
123 tda18271_write_regs(fe, R_EB4, 1);
124 123
125 msleep(1); 124 msleep(1);
126 125
127 /* normal operation for the main pll */ 126 /* normal operation for the main pll */
128 regs[R_EB4] &= ~0x20; 127 tda18271_charge_pump_source(fe, TDA18271_MAIN_PLL, 0);
129 tda18271_write_regs(fe, R_EB4, 1);
130 128
131 msleep(20); 129 msleep(20);
132 130
@@ -285,12 +283,10 @@ static int tda18271_calibrate_rf(struct dvb_frontend *fe, u32 freq)
285 tda18271_write_regs(fe, R_EB13, 1); 283 tda18271_write_regs(fe, R_EB13, 1);
286 284
287 /* main pll charge pump source */ 285 /* main pll charge pump source */
288 regs[R_EB4] |= 0x20; 286 tda18271_charge_pump_source(fe, TDA18271_MAIN_PLL, 1);
289 tda18271_write_regs(fe, R_EB4, 1);
290 287
291 /* cal pll charge pump source */ 288 /* cal pll charge pump source */
292 regs[R_EB7] |= 0x20; 289 tda18271_charge_pump_source(fe, TDA18271_CAL_PLL, 1);
293 tda18271_write_regs(fe, R_EB7, 1);
294 290
295 /* force dcdc converter to 0 V */ 291 /* force dcdc converter to 0 V */
296 regs[R_EB14] = 0x00; 292 regs[R_EB14] = 0x00;
@@ -328,12 +324,10 @@ static int tda18271_calibrate_rf(struct dvb_frontend *fe, u32 freq)
328 /* --------------------------------------------------------------- */ 324 /* --------------------------------------------------------------- */
329 325
330 /* normal operation for the main pll */ 326 /* normal operation for the main pll */
331 regs[R_EB4] &= ~0x20; 327 tda18271_charge_pump_source(fe, TDA18271_MAIN_PLL, 0);
332 tda18271_write_regs(fe, R_EB4, 1);
333 328
334 /* normal operation for the cal pll */ 329 /* normal operation for the cal pll */
335 regs[R_EB7] &= ~0x20; 330 tda18271_charge_pump_source(fe, TDA18271_CAL_PLL, 0);
336 tda18271_write_regs(fe, R_EB7, 1);
337 331
338 msleep(10); /* plls locking */ 332 msleep(10); /* plls locking */
339 333
diff --git a/drivers/media/dvb/frontends/tda18271-priv.h b/drivers/media/dvb/frontends/tda18271-priv.h
index ecb588e5f7d5..2a37f794e1b6 100644
--- a/drivers/media/dvb/frontends/tda18271-priv.h
+++ b/drivers/media/dvb/frontends/tda18271-priv.h
@@ -86,6 +86,11 @@ struct tda18271_rf_tracking_filter_cal {
86 int rf_b2; 86 int rf_b2;
87}; 87};
88 88
89enum tda18271_pll {
90 TDA18271_MAIN_PLL,
91 TDA18271_CAL_PLL,
92};
93
89enum tda18271_mode { 94enum tda18271_mode {
90 TDA18271_ANALOG, 95 TDA18271_ANALOG,
91 TDA18271_DIGITAL, 96 TDA18271_DIGITAL,
@@ -188,6 +193,8 @@ extern int tda18271_read_extended(struct dvb_frontend *fe);
188extern int tda18271_write_regs(struct dvb_frontend *fe, int idx, int len); 193extern int tda18271_write_regs(struct dvb_frontend *fe, int idx, int len);
189extern int tda18271_init_regs(struct dvb_frontend *fe); 194extern int tda18271_init_regs(struct dvb_frontend *fe);
190 195
196extern int tda18271_charge_pump_source(struct dvb_frontend *fe,
197 enum tda18271_pll pll, int force);
191extern int tda18271_set_standby_mode(struct dvb_frontend *fe, 198extern int tda18271_set_standby_mode(struct dvb_frontend *fe,
192 int sm, int sm_lt, int sm_xt); 199 int sm, int sm_lt, int sm_xt);
193 200