Commit 4efb0ca5 authored by Michael Krufky's avatar Michael Krufky Committed by Mauro Carvalho Chehab

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: default avatarMichael Krufky <mkrufky@linuxtv.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 40194b2b
...@@ -217,6 +217,21 @@ int tda18271_write_regs(struct dvb_frontend *fe, int idx, int len) ...@@ -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) int tda18271_init_regs(struct dvb_frontend *fe)
{ {
struct tda18271_priv *priv = fe->tuner_priv; struct tda18271_priv *priv = fe->tuner_priv;
...@@ -359,13 +374,11 @@ int tda18271_init_regs(struct dvb_frontend *fe) ...@@ -359,13 +374,11 @@ int tda18271_init_regs(struct dvb_frontend *fe)
if ((priv->id) == TDA18271HDC2) { if ((priv->id) == TDA18271HDC2) {
/* main pll cp source on */ /* main pll cp source on */
regs[R_EB4] = 0x61; tda18271_charge_pump_source(fe, TDA18271_MAIN_PLL, 1);
tda18271_write_regs(fe, R_EB4, 1);
msleep(1); msleep(1);
/* main pll cp source off */ /* main pll cp source off */
regs[R_EB4] = 0x41; tda18271_charge_pump_source(fe, TDA18271_MAIN_PLL, 0);
tda18271_write_regs(fe, R_EB4, 1);
} }
msleep(5); /* pll locking */ msleep(5); /* pll locking */
......
...@@ -119,14 +119,12 @@ static int tda18271_channel_configuration(struct dvb_frontend *fe, ...@@ -119,14 +119,12 @@ static int tda18271_channel_configuration(struct dvb_frontend *fe,
tda18271_write_regs(fe, R_TM, 7); tda18271_write_regs(fe, R_TM, 7);
/* main pll charge pump source */ /* main pll charge pump source */
regs[R_EB4] |= 0x20; tda18271_charge_pump_source(fe, TDA18271_MAIN_PLL, 1);
tda18271_write_regs(fe, R_EB4, 1);
msleep(1); msleep(1);
/* normal operation for the main pll */ /* normal operation for the main pll */
regs[R_EB4] &= ~0x20; tda18271_charge_pump_source(fe, TDA18271_MAIN_PLL, 0);
tda18271_write_regs(fe, R_EB4, 1);
msleep(20); msleep(20);
...@@ -285,12 +283,10 @@ static int tda18271_calibrate_rf(struct dvb_frontend *fe, u32 freq) ...@@ -285,12 +283,10 @@ static int tda18271_calibrate_rf(struct dvb_frontend *fe, u32 freq)
tda18271_write_regs(fe, R_EB13, 1); tda18271_write_regs(fe, R_EB13, 1);
/* main pll charge pump source */ /* main pll charge pump source */
regs[R_EB4] |= 0x20; tda18271_charge_pump_source(fe, TDA18271_MAIN_PLL, 1);
tda18271_write_regs(fe, R_EB4, 1);
/* cal pll charge pump source */ /* cal pll charge pump source */
regs[R_EB7] |= 0x20; tda18271_charge_pump_source(fe, TDA18271_CAL_PLL, 1);
tda18271_write_regs(fe, R_EB7, 1);
/* force dcdc converter to 0 V */ /* force dcdc converter to 0 V */
regs[R_EB14] = 0x00; regs[R_EB14] = 0x00;
...@@ -328,12 +324,10 @@ static int tda18271_calibrate_rf(struct dvb_frontend *fe, u32 freq) ...@@ -328,12 +324,10 @@ static int tda18271_calibrate_rf(struct dvb_frontend *fe, u32 freq)
/* --------------------------------------------------------------- */ /* --------------------------------------------------------------- */
/* normal operation for the main pll */ /* normal operation for the main pll */
regs[R_EB4] &= ~0x20; tda18271_charge_pump_source(fe, TDA18271_MAIN_PLL, 0);
tda18271_write_regs(fe, R_EB4, 1);
/* normal operation for the cal pll */ /* normal operation for the cal pll */
regs[R_EB7] &= ~0x20; tda18271_charge_pump_source(fe, TDA18271_CAL_PLL, 0);
tda18271_write_regs(fe, R_EB7, 1);
msleep(10); /* plls locking */ msleep(10); /* plls locking */
......
...@@ -86,6 +86,11 @@ struct tda18271_rf_tracking_filter_cal { ...@@ -86,6 +86,11 @@ struct tda18271_rf_tracking_filter_cal {
int rf_b2; int rf_b2;
}; };
enum tda18271_pll {
TDA18271_MAIN_PLL,
TDA18271_CAL_PLL,
};
enum tda18271_mode { enum tda18271_mode {
TDA18271_ANALOG, TDA18271_ANALOG,
TDA18271_DIGITAL, TDA18271_DIGITAL,
...@@ -188,6 +193,8 @@ extern int tda18271_read_extended(struct dvb_frontend *fe); ...@@ -188,6 +193,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_write_regs(struct dvb_frontend *fe, int idx, int len);
extern int tda18271_init_regs(struct dvb_frontend *fe); 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, extern int tda18271_set_standby_mode(struct dvb_frontend *fe,
int sm, int sm_lt, int sm_xt); int sm, int sm_lt, int sm_xt);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment