diff options
author | Michael Krufky <mkrufky@linuxtv.org> | 2008-03-23 12:41:37 -0400 |
---|---|---|
committer | Michael Krufky <mkrufky@linuxtv.org> | 2008-03-23 12:41:37 -0400 |
commit | fdb9cd2ea4cac90bbcb4c8d222a94969097ce770 (patch) | |
tree | a5012e51818090e67fc09bf8727c02d7660a9713 /linux | |
parent | 5222ba749d4a4a2e2a744e3386d1fe1a2f55888f (diff) | |
download | mediapointer-dvb-s2-fdb9cd2ea4cac90bbcb4c8d222a94969097ce770.tar.gz mediapointer-dvb-s2-fdb9cd2ea4cac90bbcb4c8d222a94969097ce770.tar.bz2 |
tda18271: add basic support for slave tuner configurations
From: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Diffstat (limited to 'linux')
-rw-r--r-- | linux/drivers/media/dvb/frontends/tda18271-fe.c | 61 | ||||
-rw-r--r-- | linux/drivers/media/dvb/frontends/tda18271-priv.h | 1 | ||||
-rw-r--r-- | linux/drivers/media/dvb/frontends/tda18271.h | 8 |
3 files changed, 44 insertions, 26 deletions
diff --git a/linux/drivers/media/dvb/frontends/tda18271-fe.c b/linux/drivers/media/dvb/frontends/tda18271-fe.c index ef39b3216..211f9a36d 100644 --- a/linux/drivers/media/dvb/frontends/tda18271-fe.c +++ b/linux/drivers/media/dvb/frontends/tda18271-fe.c @@ -37,6 +37,15 @@ static LIST_HEAD(hybrid_tuner_instance_list); /*---------------------------------------------------------------------*/ +static inline int charge_pump_source(struct dvb_frontend *fe, int force) +{ + struct tda18271_priv *priv = fe->tuner_priv; + return tda18271_charge_pump_source(fe, + (priv->role == TDA18271_SLAVE) ? + TDA18271_CAL_PLL : + TDA18271_MAIN_PLL, force); +} + static int tda18271_channel_configuration(struct dvb_frontend *fe, struct tda18271_std_map_item *map, u32 freq, u32 bw) @@ -98,8 +107,14 @@ static int tda18271_channel_configuration(struct dvb_frontend *fe, /* dual tuner and agc1 extra configuration */ - /* main vco when Master, cal vco when slave */ - regs[R_EB1] |= 0x04; /* FIXME: assumes master */ + switch (priv->role) { + case TDA18271_MASTER: + regs[R_EB1] |= 0x04; /* main vco */ + break; + case TDA18271_SLAVE: + regs[R_EB1] &= ~0x04; /* cal vco */ + break; + } /* agc1 always active */ regs[R_EB1] &= ~0x02; @@ -113,36 +128,29 @@ static int tda18271_channel_configuration(struct dvb_frontend *fe, N = map->if_freq * 1000 + freq; -#if 1 - /* FIXME: assumes master */ - tda18271_calc_main_pll(fe, N); - tda18271_write_regs(fe, R_MPD, 4); -#else - /* slave */ - tda18271_calc_cal_pll(fe, N); - tda18271_write_regs(fe, R_CPD, 4); - regs[R_MPD] = regs[R_CPD]; -#endif + switch (priv->role) { + case TDA18271_MASTER: + tda18271_calc_main_pll(fe, N); + tda18271_write_regs(fe, R_MPD, 4); + break; + case TDA18271_SLAVE: + tda18271_calc_cal_pll(fe, N); + tda18271_write_regs(fe, R_CPD, 4); + + regs[R_MPD] = regs[R_CPD] & 0x7f; + tda18271_write_regs(fe, R_MPD, 1); + break; + } tda18271_write_regs(fe, R_TM, 7); -#if 1 - /* main pll charge pump source */ - tda18271_charge_pump_source(fe, TDA18271_MAIN_PLL, 1); -#else - /* cal pll charge pump source */ - tda18271_charge_pump_source(fe, TDA18271_CAL_PLL, 1); -#endif + /* force charge pump source */ + charge_pump_source(fe, 1); msleep(1); -#if 1 - /* normal operation for the main pll */ - tda18271_charge_pump_source(fe, TDA18271_MAIN_PLL, 0); -#else - /* normal operation for the cal pll */ - tda18271_charge_pump_source(fe, TDA18271_CAL_PLL, 0); -#endif + /* return pll to normal operation */ + charge_pump_source(fe, 0); msleep(20); @@ -1076,6 +1084,7 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr, case 1: /* new tuner instance */ priv->gate = (cfg) ? cfg->gate : TDA18271_GATE_AUTO; + priv->role = (cfg) ? cfg->role : TDA18271_MASTER; priv->cal_initialized = false; mutex_init(&priv->lock); diff --git a/linux/drivers/media/dvb/frontends/tda18271-priv.h b/linux/drivers/media/dvb/frontends/tda18271-priv.h index a1273d97d..808b89c40 100644 --- a/linux/drivers/media/dvb/frontends/tda18271-priv.h +++ b/linux/drivers/media/dvb/frontends/tda18271-priv.h @@ -115,6 +115,7 @@ struct tda18271_priv { struct tuner_i2c_props i2c_props; enum tda18271_mode mode; + enum tda18271_role role; enum tda18271_i2c_gate gate; enum tda18271_ver id; diff --git a/linux/drivers/media/dvb/frontends/tda18271.h b/linux/drivers/media/dvb/frontends/tda18271.h index 44d41dce9..b547318c9 100644 --- a/linux/drivers/media/dvb/frontends/tda18271.h +++ b/linux/drivers/media/dvb/frontends/tda18271.h @@ -56,6 +56,11 @@ struct tda18271_std_map { struct tda18271_std_map_item qam_8; }; +enum tda18271_role { + TDA18271_MASTER = 0, + TDA18271_SLAVE, +}; + enum tda18271_i2c_gate { TDA18271_GATE_AUTO = 0, TDA18271_GATE_ANALOG, @@ -66,6 +71,9 @@ struct tda18271_config { /* override default if freq / std settings (optional) */ struct tda18271_std_map *std_map; + /* master / slave tuner: master uses main pll, slave uses cal pll */ + enum tda18271_role role; + /* use i2c gate provided by analog or digital demod */ enum tda18271_i2c_gate gate; |