From c0d7564793091ee443a25335a54f0956a53e8815 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sun, 11 May 2008 11:46:52 -0400 Subject: tda18271: add support for additional low-power standby modes From: Michael Krufky By default, the driver enters standby mode with slave tuner output loop thru enabled and xtal oscillator on. Not all designs require that slave tuner output loop thru and xtal oscillator remain active while in standby mode, so two additional standby modes have been added: - standby mode with xtal oscillator on (loop thru off) - total power off Signed-off-by: Michael Krufky --- linux/drivers/media/common/tuners/tda18271-fe.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'linux/drivers/media/common/tuners/tda18271-fe.c') diff --git a/linux/drivers/media/common/tuners/tda18271-fe.c b/linux/drivers/media/common/tuners/tda18271-fe.c index 6c71b0a16..d28454a7b 100644 --- a/linux/drivers/media/common/tuners/tda18271-fe.c +++ b/linux/drivers/media/common/tuners/tda18271-fe.c @@ -1018,9 +1018,17 @@ static int tda18271_sleep(struct dvb_frontend *fe) mutex_lock(&priv->lock); - /* standby mode w/ slave tuner output - * & loop thru & xtal oscillator on */ - ret = tda18271_set_standby_mode(fe, 1, 0, 0); + switch (priv->standby_mode) { + case TDA18271_STANDBY_POWER_OFF: + ret = tda18271_set_standby_mode(fe, 1, 1, 1); + break; + case TDA18271_STANDBY_XT_ON: + ret = tda18271_set_standby_mode(fe, 1, 1, 0); + break; + case TDA18271_STANDBY_LT_XT_ON: + default: + ret = tda18271_set_standby_mode(fe, 1, 0, 0); + } mutex_unlock(&priv->lock); @@ -1200,6 +1208,8 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr, priv->gate = (cfg) ? cfg->gate : TDA18271_GATE_AUTO; priv->role = (cfg) ? cfg->role : TDA18271_MASTER; priv->config = (cfg) ? cfg->config : 0; + priv->standby_mode = (cfg) ? + cfg->standby_mode : TDA18271_STANDBY_LT_XT_ON; /* tda18271_cal_on_startup == -1 when cal * module option is unset */ -- cgit v1.2.3 From dba8a3703b87ab030d5b6c4c5933f5aa3493e2dd Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Fri, 28 Aug 2009 17:52:26 -0400 Subject: tda18271: add debug to show which standby mode is in use From: Michael Krufky Priority: normal Signed-off-by: Michael Krufky --- linux/drivers/media/common/tuners/tda18271-fe.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'linux/drivers/media/common/tuners/tda18271-fe.c') diff --git a/linux/drivers/media/common/tuners/tda18271-fe.c b/linux/drivers/media/common/tuners/tda18271-fe.c index d28454a7b..ecb70a245 100644 --- a/linux/drivers/media/common/tuners/tda18271-fe.c +++ b/linux/drivers/media/common/tuners/tda18271-fe.c @@ -1020,13 +1020,16 @@ static int tda18271_sleep(struct dvb_frontend *fe) switch (priv->standby_mode) { case TDA18271_STANDBY_POWER_OFF: + tda_dbg("standby mode: power off\n"); ret = tda18271_set_standby_mode(fe, 1, 1, 1); break; case TDA18271_STANDBY_XT_ON: + tda_dbg("standby mode: xtal oscillator on\n"); ret = tda18271_set_standby_mode(fe, 1, 1, 0); break; case TDA18271_STANDBY_LT_XT_ON: default: + tda_dbg("standby mode: loop thru & xtal oscillator on\n"); ret = tda18271_set_standby_mode(fe, 1, 0, 0); } -- cgit v1.2.3 From c6a49f4f5a1192199df66b7c1ccfe881071ee845 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Fri, 28 Aug 2009 19:53:30 -0400 Subject: tda18271: add new standby mode: slave tuner output / loop thru on From: Michael Krufky Add new standby mode: TDA18271_STANDBY_LT_ON = slave tuner output loop thru on w/ xtal osc off Priority: normal Signed-off-by: Michael Krufky --- linux/drivers/media/common/tuners/tda18271-fe.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'linux/drivers/media/common/tuners/tda18271-fe.c') diff --git a/linux/drivers/media/common/tuners/tda18271-fe.c b/linux/drivers/media/common/tuners/tda18271-fe.c index ecb70a245..086ca7339 100644 --- a/linux/drivers/media/common/tuners/tda18271-fe.c +++ b/linux/drivers/media/common/tuners/tda18271-fe.c @@ -1027,6 +1027,10 @@ static int tda18271_sleep(struct dvb_frontend *fe) tda_dbg("standby mode: xtal oscillator on\n"); ret = tda18271_set_standby_mode(fe, 1, 1, 0); break; + case TDA18271_STANDBY_LT_ON: + tda_dbg("standby mode: slave tuner output / loop thru on\n"); + ret = tda18271_set_standby_mode(fe, 1, 0, 1); + break; case TDA18271_STANDBY_LT_XT_ON: default: tda_dbg("standby mode: loop thru & xtal oscillator on\n"); -- cgit v1.2.3 From ebef293c0b6ba62d4a02d8d46f99de346666dc20 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sat, 29 Aug 2009 15:25:37 -0400 Subject: tda18271: change output feature configuration to a bitmask From: Michael Krufky For better readability, treat the low power standby mode configuration as an output option feature configuration, and change it to a bitmask. If left unconfigured, all features will remain enabled, just as the default configuration was before these changes were introduced. Priority: normal Signed-off-by: Michael Krufky --- linux/drivers/media/common/tuners/tda18271-fe.c | 47 ++++++++++++++----------- 1 file changed, 26 insertions(+), 21 deletions(-) (limited to 'linux/drivers/media/common/tuners/tda18271-fe.c') diff --git a/linux/drivers/media/common/tuners/tda18271-fe.c b/linux/drivers/media/common/tuners/tda18271-fe.c index 086ca7339..3cd6c0e74 100644 --- a/linux/drivers/media/common/tuners/tda18271-fe.c +++ b/linux/drivers/media/common/tuners/tda18271-fe.c @@ -37,6 +37,27 @@ static LIST_HEAD(hybrid_tuner_instance_list); /*---------------------------------------------------------------------*/ +static int tda18271_toggle_output(struct dvb_frontend *fe, int standby) +{ + struct tda18271_priv *priv = fe->tuner_priv; + + int ret = tda18271_set_standby_mode(fe, standby ? 1 : 0, + priv->output_opt & TDA18271_OUTPUT_LT_OFF ? 1 : 0, + priv->output_opt & TDA18271_OUTPUT_XT_OFF ? 1 : 0); + + if (tda_fail(ret)) + goto fail; + + tda_dbg("%s mode: xtal oscillator %s, slave tuner loop thru %s\n", + standby ? "standby" : "active", + priv->output_opt & TDA18271_OUTPUT_XT_OFF ? "off" : "on", + priv->output_opt & TDA18271_OUTPUT_LT_OFF ? "off" : "on"); +fail: + return ret; +} + +/*---------------------------------------------------------------------*/ + static inline int charge_pump_source(struct dvb_frontend *fe, int force) { struct tda18271_priv *priv = fe->tuner_priv; @@ -801,7 +822,7 @@ static int tda18271_init(struct dvb_frontend *fe) mutex_lock(&priv->lock); - /* power up */ + /* full power up */ ret = tda18271_set_standby_mode(fe, 0, 0, 0); if (tda_fail(ret)) goto fail; @@ -1018,24 +1039,8 @@ static int tda18271_sleep(struct dvb_frontend *fe) mutex_lock(&priv->lock); - switch (priv->standby_mode) { - case TDA18271_STANDBY_POWER_OFF: - tda_dbg("standby mode: power off\n"); - ret = tda18271_set_standby_mode(fe, 1, 1, 1); - break; - case TDA18271_STANDBY_XT_ON: - tda_dbg("standby mode: xtal oscillator on\n"); - ret = tda18271_set_standby_mode(fe, 1, 1, 0); - break; - case TDA18271_STANDBY_LT_ON: - tda_dbg("standby mode: slave tuner output / loop thru on\n"); - ret = tda18271_set_standby_mode(fe, 1, 0, 1); - break; - case TDA18271_STANDBY_LT_XT_ON: - default: - tda_dbg("standby mode: loop thru & xtal oscillator on\n"); - ret = tda18271_set_standby_mode(fe, 1, 0, 0); - } + /* enter standby mode, with required output features enabled */ + ret = tda18271_toggle_output(fe, 1); mutex_unlock(&priv->lock); @@ -1215,8 +1220,8 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr, priv->gate = (cfg) ? cfg->gate : TDA18271_GATE_AUTO; priv->role = (cfg) ? cfg->role : TDA18271_MASTER; priv->config = (cfg) ? cfg->config : 0; - priv->standby_mode = (cfg) ? - cfg->standby_mode : TDA18271_STANDBY_LT_XT_ON; + priv->output_opt = (cfg) ? + cfg->output_opt : TDA18271_OUTPUT_LT_XT_ON; /* tda18271_cal_on_startup == -1 when cal * module option is unset */ -- cgit v1.2.3 From 0f8ff0b9984631b19106530b496b1c25651c6ef7 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sat, 29 Aug 2009 15:27:21 -0400 Subject: tda18271: move tda18271_sleep directly below tda18271_init From: Michael Krufky Priority: normal Signed-off-by: Michael Krufky --- linux/drivers/media/common/tuners/tda18271-fe.c | 30 ++++++++++++------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'linux/drivers/media/common/tuners/tda18271-fe.c') diff --git a/linux/drivers/media/common/tuners/tda18271-fe.c b/linux/drivers/media/common/tuners/tda18271-fe.c index 3cd6c0e74..0e1eea9f3 100644 --- a/linux/drivers/media/common/tuners/tda18271-fe.c +++ b/linux/drivers/media/common/tuners/tda18271-fe.c @@ -840,6 +840,21 @@ fail: return ret; } +static int tda18271_sleep(struct dvb_frontend *fe) +{ + struct tda18271_priv *priv = fe->tuner_priv; + int ret; + + mutex_lock(&priv->lock); + + /* enter standby mode, with required output features enabled */ + ret = tda18271_toggle_output(fe, 1); + + mutex_unlock(&priv->lock); + + return ret; +} + /* ------------------------------------------------------------------ */ static int tda18271_agc(struct dvb_frontend *fe) @@ -1032,21 +1047,6 @@ fail: return ret; } -static int tda18271_sleep(struct dvb_frontend *fe) -{ - struct tda18271_priv *priv = fe->tuner_priv; - int ret; - - mutex_lock(&priv->lock); - - /* enter standby mode, with required output features enabled */ - ret = tda18271_toggle_output(fe, 1); - - mutex_unlock(&priv->lock); - - return ret; -} - static int tda18271_release(struct dvb_frontend *fe) { struct tda18271_priv *priv = fe->tuner_priv; -- cgit v1.2.3 From a742aa93fac3bc19f1f9fa7d2e602d31143d0195 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sun, 30 Aug 2009 01:32:23 -0400 Subject: tda18271: move small_i2c assignment to the state config block From: Michael Krufky minor cleanup: move small_i2c assignment to the state config block Priority: normal Signed-off-by: Michael Krufky --- linux/drivers/media/common/tuners/tda18271-fe.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'linux/drivers/media/common/tuners/tda18271-fe.c') diff --git a/linux/drivers/media/common/tuners/tda18271-fe.c b/linux/drivers/media/common/tuners/tda18271-fe.c index 0e1eea9f3..3ad9f3435 100644 --- a/linux/drivers/media/common/tuners/tda18271-fe.c +++ b/linux/drivers/media/common/tuners/tda18271-fe.c @@ -1220,6 +1220,7 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr, priv->gate = (cfg) ? cfg->gate : TDA18271_GATE_AUTO; priv->role = (cfg) ? cfg->role : TDA18271_MASTER; priv->config = (cfg) ? cfg->config : 0; + priv->small_i2c = (cfg) ? cfg->small_i2c : 0; priv->output_opt = (cfg) ? cfg->output_opt : TDA18271_OUTPUT_LT_XT_ON; @@ -1239,9 +1240,6 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr, fe->tuner_priv = priv; - if (cfg) - priv->small_i2c = cfg->small_i2c; - if (tda_fail(tda18271_get_id(fe))) goto fail; -- cgit v1.2.3 From 75c4b5f8a5f960190e5f8df3d9e0fbd615313bd2 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sun, 30 Aug 2009 02:07:10 -0400 Subject: tda18271: ensure that configuration options are set for multiple instances From: Michael Krufky For the case of multiple tuner instances, ensure that non-default configuration options are saved into the driver's state. This resolves an issue where a configuration option may not be carried into the driver if the analog side of a hybrid driver initializes before the digital side. Priority: normal Signed-off-by: Michael Krufky --- linux/drivers/media/common/tuners/tda18271-fe.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'linux/drivers/media/common/tuners/tda18271-fe.c') diff --git a/linux/drivers/media/common/tuners/tda18271-fe.c b/linux/drivers/media/common/tuners/tda18271-fe.c index 3ad9f3435..56bab7c28 100644 --- a/linux/drivers/media/common/tuners/tda18271-fe.c +++ b/linux/drivers/media/common/tuners/tda18271-fe.c @@ -1259,9 +1259,19 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr, /* existing tuner instance */ fe->tuner_priv = priv; - /* allow dvb driver to override i2c gate setting */ - if ((cfg) && (cfg->gate != TDA18271_GATE_ANALOG)) - priv->gate = cfg->gate; + /* allow dvb driver to override configuration settings */ + if (cfg) { + if (cfg->gate != TDA18271_GATE_ANALOG) + priv->gate = cfg->gate; + if (cfg->role) + priv->role = cfg->role; + if (cfg->config) + priv->config = cfg->config; + if (cfg->small_i2c) + priv->small_i2c = cfg->small_i2c; + if (cfg->output_opt) + priv->output_opt = cfg->output_opt; + } break; } -- cgit v1.2.3 From 8256238d5c1cbfe2fa9d0811b307b079b99207a4 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sun, 6 Sep 2009 13:38:48 -0400 Subject: tda18271: fix comments and make tda18271_agc debug less verbose From: Michael Krufky Don't display "no agc configuration provided" unless DBG_ADV is set. Fix comments in function, tda18271_agc. This config variable is not for LNA configuration -- it is for external AGC configuration. Priority: normal Signed-off-by: Michael Krufky --- linux/drivers/media/common/tuners/tda18271-fe.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'linux/drivers/media/common/tuners/tda18271-fe.c') diff --git a/linux/drivers/media/common/tuners/tda18271-fe.c b/linux/drivers/media/common/tuners/tda18271-fe.c index 56bab7c28..ee99e7199 100644 --- a/linux/drivers/media/common/tuners/tda18271-fe.c +++ b/linux/drivers/media/common/tuners/tda18271-fe.c @@ -864,8 +864,9 @@ static int tda18271_agc(struct dvb_frontend *fe) switch (priv->config) { case 0: - /* no LNA */ - tda_dbg("no agc configuration provided\n"); + /* no external agc configuration required */ + if (tda18271_debug & DBG_ADV) + tda_dbg("no agc configuration provided\n"); break; case 3: /* switch with GPIO of saa713x */ -- cgit v1.2.3 From e11ca416da674b594917a09fbbf64a86363fda83 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 15 Sep 2009 01:09:17 -0400 Subject: tda18271: update temperature compensation calculatation formula From: Henk Vergonet Update the tda18271c2_rf_tracking_filters_correction function to include the modified temperature compensation calculatation formula as described in Rev.04 of the TDA18271HD datasheet. Priority: normal Signed-off-by: Henk Vergonet Signed-off-by: Michael Krufky --- linux/drivers/media/common/tuners/tda18271-fe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linux/drivers/media/common/tuners/tda18271-fe.c') diff --git a/linux/drivers/media/common/tuners/tda18271-fe.c b/linux/drivers/media/common/tuners/tda18271-fe.c index ee99e7199..a3e122c89 100644 --- a/linux/drivers/media/common/tuners/tda18271-fe.c +++ b/linux/drivers/media/common/tuners/tda18271-fe.c @@ -293,7 +293,7 @@ static int tda18271c2_rf_tracking_filters_correction(struct dvb_frontend *fe, tda18271_lookup_map(fe, RF_CAL_DC_OVER_DT, &freq, &dc_over_dt); /* calculate temperature compensation */ - rfcal_comp = dc_over_dt * (tm_current - priv->tm_rfcal); + rfcal_comp = dc_over_dt * (tm_current - priv->tm_rfcal) / 1000; regs[R_EB14] = approx + rfcal_comp; ret = tda18271_write_regs(fe, R_EB14, 1); -- cgit v1.2.3