Commit 3af26c8d authored by Michael Krufky's avatar Michael Krufky Committed by Mauro Carvalho Chehab

V4L/DVB (12864): tda18271: change output feature configuration to a bitmask

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.
Signed-off-by: default avatarMichael Krufky <mkrufky@kernellabs.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent d8eae580
...@@ -36,6 +36,27 @@ static LIST_HEAD(hybrid_tuner_instance_list); ...@@ -36,6 +36,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) static inline int charge_pump_source(struct dvb_frontend *fe, int force)
{ {
struct tda18271_priv *priv = fe->tuner_priv; struct tda18271_priv *priv = fe->tuner_priv;
...@@ -800,7 +821,7 @@ static int tda18271_init(struct dvb_frontend *fe) ...@@ -800,7 +821,7 @@ static int tda18271_init(struct dvb_frontend *fe)
mutex_lock(&priv->lock); mutex_lock(&priv->lock);
/* power up */ /* full power up */
ret = tda18271_set_standby_mode(fe, 0, 0, 0); ret = tda18271_set_standby_mode(fe, 0, 0, 0);
if (tda_fail(ret)) if (tda_fail(ret))
goto fail; goto fail;
...@@ -1017,24 +1038,8 @@ static int tda18271_sleep(struct dvb_frontend *fe) ...@@ -1017,24 +1038,8 @@ static int tda18271_sleep(struct dvb_frontend *fe)
mutex_lock(&priv->lock); mutex_lock(&priv->lock);
switch (priv->standby_mode) { /* enter standby mode, with required output features enabled */
case TDA18271_STANDBY_POWER_OFF: ret = tda18271_toggle_output(fe, 1);
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);
}
mutex_unlock(&priv->lock); mutex_unlock(&priv->lock);
...@@ -1214,8 +1219,8 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr, ...@@ -1214,8 +1219,8 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,
priv->gate = (cfg) ? cfg->gate : TDA18271_GATE_AUTO; priv->gate = (cfg) ? cfg->gate : TDA18271_GATE_AUTO;
priv->role = (cfg) ? cfg->role : TDA18271_MASTER; priv->role = (cfg) ? cfg->role : TDA18271_MASTER;
priv->config = (cfg) ? cfg->config : 0; priv->config = (cfg) ? cfg->config : 0;
priv->standby_mode = (cfg) ? priv->output_opt = (cfg) ?
cfg->standby_mode : TDA18271_STANDBY_LT_XT_ON; cfg->output_opt : TDA18271_OUTPUT_LT_XT_ON;
/* tda18271_cal_on_startup == -1 when cal /* tda18271_cal_on_startup == -1 when cal
* module option is unset */ * module option is unset */
......
...@@ -108,7 +108,7 @@ struct tda18271_priv { ...@@ -108,7 +108,7 @@ struct tda18271_priv {
enum tda18271_role role; enum tda18271_role role;
enum tda18271_i2c_gate gate; enum tda18271_i2c_gate gate;
enum tda18271_ver id; enum tda18271_ver id;
enum tda18271_standby_mode standby_mode; enum tda18271_output_options output_opt;
unsigned int config; /* interface to saa713x / tda829x */ unsigned int config; /* interface to saa713x / tda829x */
unsigned int tm_rfcal; unsigned int tm_rfcal;
......
...@@ -67,18 +67,15 @@ enum tda18271_i2c_gate { ...@@ -67,18 +67,15 @@ enum tda18271_i2c_gate {
TDA18271_GATE_DIGITAL, TDA18271_GATE_DIGITAL,
}; };
enum tda18271_standby_mode { enum tda18271_output_options {
/* slave tuner output & loop thru & xtal oscillator on */ /* slave tuner output & loop thru & xtal oscillator always on */
TDA18271_STANDBY_LT_XT_ON = 0, TDA18271_OUTPUT_LT_XT_ON = 0,
/* xtal oscillator on */ /* slave tuner output loop thru off */
TDA18271_STANDBY_XT_ON, TDA18271_OUTPUT_LT_OFF = 1,
/* slave tuner output / loop thru on */ /* xtal oscillator off */
TDA18271_STANDBY_LT_ON, TDA18271_OUTPUT_XT_OFF = 2,
/* power off */
TDA18271_STANDBY_POWER_OFF,
}; };
struct tda18271_config { struct tda18271_config {
...@@ -91,8 +88,8 @@ struct tda18271_config { ...@@ -91,8 +88,8 @@ struct tda18271_config {
/* use i2c gate provided by analog or digital demod */ /* use i2c gate provided by analog or digital demod */
enum tda18271_i2c_gate gate; enum tda18271_i2c_gate gate;
/* allow lower power standby modes */ /* output options that can be disabled */
enum tda18271_standby_mode standby_mode; enum tda18271_output_options output_opt;
/* force rf tracking filter calibration on startup */ /* force rf tracking filter calibration on startup */
unsigned int rf_cal_on_startup:1; unsigned int rf_cal_on_startup:1;
......
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