diff options
author | Michael Krufky <mkrufky@linuxtv.org> | 2008-03-23 12:04:38 -0400 |
---|---|---|
committer | Michael Krufky <mkrufky@linuxtv.org> | 2008-03-23 12:04:38 -0400 |
commit | 5222ba749d4a4a2e2a744e3386d1fe1a2f55888f (patch) | |
tree | 98b565da0daeda050cba8e92c24aafcba0e15596 /linux/drivers/media/dvb/frontends | |
parent | c68c670b9d5d12a687768eb4cd2890c5ea6a8074 (diff) | |
download | mediapointer-dvb-s2-5222ba749d4a4a2e2a744e3386d1fe1a2f55888f.tar.gz mediapointer-dvb-s2-5222ba749d4a4a2e2a744e3386d1fe1a2f55888f.tar.bz2 |
tda18271: add function tda18271_charge_pump_source
From: Michael Krufky <mkrufky@linuxtv.org>
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>
Diffstat (limited to 'linux/drivers/media/dvb/frontends')
-rw-r--r-- | linux/drivers/media/dvb/frontends/tda18271-common.c | 21 | ||||
-rw-r--r-- | linux/drivers/media/dvb/frontends/tda18271-fe.c | 24 | ||||
-rw-r--r-- | linux/drivers/media/dvb/frontends/tda18271-priv.h | 7 |
3 files changed, 32 insertions, 20 deletions
diff --git a/linux/drivers/media/dvb/frontends/tda18271-common.c b/linux/drivers/media/dvb/frontends/tda18271-common.c index 3ce11df2b..43c0bec83 100644 --- a/linux/drivers/media/dvb/frontends/tda18271-common.c +++ b/linux/drivers/media/dvb/frontends/tda18271-common.c @@ -217,6 +217,21 @@ int tda18271_write_regs(struct dvb_frontend *fe, int idx, int len) /*---------------------------------------------------------------------*/ +int tda18271_charge_pump_source(struct dvb_frontend *fe, + enum tda18271_pll pll, int force) +{ + struct tda18271_priv *priv = fe->tuner_priv; + unsigned char *regs = priv->tda18271_regs; + + int r_cp = (pll == TDA18271_CAL_PLL) ? R_EB7 : R_EB4; + + regs[r_cp] &= ~0x20; + regs[r_cp] |= ((force & 1) << 5); + tda18271_write_regs(fe, r_cp, 1); + + return 0; +} + int tda18271_init_regs(struct dvb_frontend *fe) { struct tda18271_priv *priv = fe->tuner_priv; @@ -359,13 +374,11 @@ int tda18271_init_regs(struct dvb_frontend *fe) if ((priv->id) == TDA18271HDC2) { /* main pll cp source on */ - regs[R_EB4] = 0x61; - tda18271_write_regs(fe, R_EB4, 1); + tda18271_charge_pump_source(fe, TDA18271_MAIN_PLL, 1); msleep(1); /* main pll cp source off */ - regs[R_EB4] = 0x41; - tda18271_write_regs(fe, R_EB4, 1); + tda18271_charge_pump_source(fe, TDA18271_MAIN_PLL, 0); } msleep(5); /* pll locking */ diff --git a/linux/drivers/media/dvb/frontends/tda18271-fe.c b/linux/drivers/media/dvb/frontends/tda18271-fe.c index e182df32e..ef39b3216 100644 --- a/linux/drivers/media/dvb/frontends/tda18271-fe.c +++ b/linux/drivers/media/dvb/frontends/tda18271-fe.c @@ -128,24 +128,20 @@ static int tda18271_channel_configuration(struct dvb_frontend *fe, #if 1 /* main pll charge pump source */ - regs[R_EB4] |= 0x20; - tda18271_write_regs(fe, R_EB4, 1); + tda18271_charge_pump_source(fe, TDA18271_MAIN_PLL, 1); #else /* cal pll charge pump source */ - regs[R_EB7] |= 0x20; - tda18271_write_regs(fe, R_EB7, 1); + tda18271_charge_pump_source(fe, TDA18271_CAL_PLL, 1); #endif msleep(1); #if 1 /* normal operation for the main pll */ - regs[R_EB4] &= ~0x20; - tda18271_write_regs(fe, R_EB4, 1); + tda18271_charge_pump_source(fe, TDA18271_MAIN_PLL, 0); #else /* normal operation for the cal pll */ - regs[R_EB7] &= ~0x20; - tda18271_write_regs(fe, R_EB7, 1); + tda18271_charge_pump_source(fe, TDA18271_CAL_PLL, 0); #endif msleep(20); @@ -305,12 +301,10 @@ static int tda18271_calibrate_rf(struct dvb_frontend *fe, u32 freq) tda18271_write_regs(fe, R_EB13, 1); /* main pll charge pump source */ - regs[R_EB4] |= 0x20; - tda18271_write_regs(fe, R_EB4, 1); + tda18271_charge_pump_source(fe, TDA18271_MAIN_PLL, 1); /* cal pll charge pump source */ - regs[R_EB7] |= 0x20; - tda18271_write_regs(fe, R_EB7, 1); + tda18271_charge_pump_source(fe, TDA18271_CAL_PLL, 1); /* force dcdc converter to 0 V */ regs[R_EB14] = 0x00; @@ -348,12 +342,10 @@ static int tda18271_calibrate_rf(struct dvb_frontend *fe, u32 freq) /* --------------------------------------------------------------- */ /* normal operation for the main pll */ - regs[R_EB4] &= ~0x20; - tda18271_write_regs(fe, R_EB4, 1); + tda18271_charge_pump_source(fe, TDA18271_MAIN_PLL, 0); /* normal operation for the cal pll */ - regs[R_EB7] &= ~0x20; - tda18271_write_regs(fe, R_EB7, 1); + tda18271_charge_pump_source(fe, TDA18271_CAL_PLL, 0); msleep(10); /* plls locking */ diff --git a/linux/drivers/media/dvb/frontends/tda18271-priv.h b/linux/drivers/media/dvb/frontends/tda18271-priv.h index 85eb24af7..a1273d97d 100644 --- a/linux/drivers/media/dvb/frontends/tda18271-priv.h +++ b/linux/drivers/media/dvb/frontends/tda18271-priv.h @@ -91,6 +91,11 @@ struct tda18271_rf_tracking_filter_cal { int rf_b2; }; +enum tda18271_pll { + TDA18271_MAIN_PLL, + TDA18271_CAL_PLL, +}; + enum tda18271_mode { TDA18271_ANALOG, TDA18271_DIGITAL, @@ -197,6 +202,8 @@ extern int tda18271_read_extended(struct dvb_frontend *fe); extern int tda18271_write_regs(struct dvb_frontend *fe, int idx, int len); extern int tda18271_init_regs(struct dvb_frontend *fe); +extern int tda18271_charge_pump_source(struct dvb_frontend *fe, + enum tda18271_pll pll, int force); extern int tda18271_set_standby_mode(struct dvb_frontend *fe, int sm, int sm_lt, int sm_xt); |