Skip to content

Commit

Permalink
V4L/DVB (7435): tda18271: add function tda18271_charge_pump_source
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Michael Krufky authored and Mauro Carvalho Chehab committed Apr 24, 2008
1 parent 40194b2 commit 4efb0ca
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 16 deletions.
21 changes: 17 additions & 4 deletions drivers/media/dvb/frontends/tda18271-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 */
Expand Down
18 changes: 6 additions & 12 deletions drivers/media/dvb/frontends/tda18271-fe.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,12 @@ static int tda18271_channel_configuration(struct dvb_frontend *fe,
tda18271_write_regs(fe, R_TM, 7);

/* 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);

msleep(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);

msleep(20);

Expand Down Expand Up @@ -285,12 +283,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;
Expand Down Expand Up @@ -328,12 +324,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 */

Expand Down
7 changes: 7 additions & 0 deletions drivers/media/dvb/frontends/tda18271-priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,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,
Expand Down Expand Up @@ -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_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);

Expand Down

0 comments on commit 4efb0ca

Please sign in to comment.