aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@kernellabs.com>2009-08-29 15:25:37 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-09-18 23:13:43 -0400
commit4240b460f0dbb4bf4e3f64e6abd423f476012756 (patch)
tree8b71544047d7da38864b55d0f9f84e75f9dad400
parent2dfca76303937f256e11754a716eb198b22afdd5 (diff)
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: Michael Krufky <mkrufky@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/common/tuners/tda18271-fe.c47
-rw-r--r--drivers/media/common/tuners/tda18271-priv.h2
-rw-r--r--drivers/media/common/tuners/tda18271.h21
3 files changed, 36 insertions, 34 deletions
diff --git a/drivers/media/common/tuners/tda18271-fe.c b/drivers/media/common/tuners/tda18271-fe.c
index 9dcbdb17f745..f6328bf3121e 100644
--- a/drivers/media/common/tuners/tda18271-fe.c
+++ b/drivers/media/common/tuners/tda18271-fe.c
@@ -36,6 +36,27 @@ static LIST_HEAD(hybrid_tuner_instance_list);
36 36
37/*---------------------------------------------------------------------*/ 37/*---------------------------------------------------------------------*/
38 38
39static int tda18271_toggle_output(struct dvb_frontend *fe, int standby)
40{
41 struct tda18271_priv *priv = fe->tuner_priv;
42
43 int ret = tda18271_set_standby_mode(fe, standby ? 1 : 0,
44 priv->output_opt & TDA18271_OUTPUT_LT_OFF ? 1 : 0,
45 priv->output_opt & TDA18271_OUTPUT_XT_OFF ? 1 : 0);
46
47 if (tda_fail(ret))
48 goto fail;
49
50 tda_dbg("%s mode: xtal oscillator %s, slave tuner loop thru %s\n",
51 standby ? "standby" : "active",
52 priv->output_opt & TDA18271_OUTPUT_XT_OFF ? "off" : "on",
53 priv->output_opt & TDA18271_OUTPUT_LT_OFF ? "off" : "on");
54fail:
55 return ret;
56}
57
58/*---------------------------------------------------------------------*/
59
39static inline int charge_pump_source(struct dvb_frontend *fe, int force) 60static inline int charge_pump_source(struct dvb_frontend *fe, int force)
40{ 61{
41 struct tda18271_priv *priv = fe->tuner_priv; 62 struct tda18271_priv *priv = fe->tuner_priv;
@@ -800,7 +821,7 @@ static int tda18271_init(struct dvb_frontend *fe)
800 821
801 mutex_lock(&priv->lock); 822 mutex_lock(&priv->lock);
802 823
803 /* power up */ 824 /* full power up */
804 ret = tda18271_set_standby_mode(fe, 0, 0, 0); 825 ret = tda18271_set_standby_mode(fe, 0, 0, 0);
805 if (tda_fail(ret)) 826 if (tda_fail(ret))
806 goto fail; 827 goto fail;
@@ -1017,24 +1038,8 @@ static int tda18271_sleep(struct dvb_frontend *fe)
1017 1038
1018 mutex_lock(&priv->lock); 1039 mutex_lock(&priv->lock);
1019 1040
1020 switch (priv->standby_mode) { 1041 /* enter standby mode, with required output features enabled */
1021 case TDA18271_STANDBY_POWER_OFF: 1042 ret = tda18271_toggle_output(fe, 1);
1022 tda_dbg("standby mode: power off\n");
1023 ret = tda18271_set_standby_mode(fe, 1, 1, 1);
1024 break;
1025 case TDA18271_STANDBY_XT_ON:
1026 tda_dbg("standby mode: xtal oscillator on\n");
1027 ret = tda18271_set_standby_mode(fe, 1, 1, 0);
1028 break;
1029 case TDA18271_STANDBY_LT_ON:
1030 tda_dbg("standby mode: slave tuner output / loop thru on\n");
1031 ret = tda18271_set_standby_mode(fe, 1, 0, 1);
1032 break;
1033 case TDA18271_STANDBY_LT_XT_ON:
1034 default:
1035 tda_dbg("standby mode: loop thru & xtal oscillator on\n");
1036 ret = tda18271_set_standby_mode(fe, 1, 0, 0);
1037 }
1038 1043
1039 mutex_unlock(&priv->lock); 1044 mutex_unlock(&priv->lock);
1040 1045
@@ -1214,8 +1219,8 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,
1214 priv->gate = (cfg) ? cfg->gate : TDA18271_GATE_AUTO; 1219 priv->gate = (cfg) ? cfg->gate : TDA18271_GATE_AUTO;
1215 priv->role = (cfg) ? cfg->role : TDA18271_MASTER; 1220 priv->role = (cfg) ? cfg->role : TDA18271_MASTER;
1216 priv->config = (cfg) ? cfg->config : 0; 1221 priv->config = (cfg) ? cfg->config : 0;
1217 priv->standby_mode = (cfg) ? 1222 priv->output_opt = (cfg) ?
1218 cfg->standby_mode : TDA18271_STANDBY_LT_XT_ON; 1223 cfg->output_opt : TDA18271_OUTPUT_LT_XT_ON;
1219 1224
1220 /* tda18271_cal_on_startup == -1 when cal 1225 /* tda18271_cal_on_startup == -1 when cal
1221 * module option is unset */ 1226 * module option is unset */
diff --git a/drivers/media/common/tuners/tda18271-priv.h b/drivers/media/common/tuners/tda18271-priv.h
index 8c5fabcf5a29..2bee229acd91 100644
--- a/drivers/media/common/tuners/tda18271-priv.h
+++ b/drivers/media/common/tuners/tda18271-priv.h
@@ -108,7 +108,7 @@ struct tda18271_priv {
108 enum tda18271_role role; 108 enum tda18271_role role;
109 enum tda18271_i2c_gate gate; 109 enum tda18271_i2c_gate gate;
110 enum tda18271_ver id; 110 enum tda18271_ver id;
111 enum tda18271_standby_mode standby_mode; 111 enum tda18271_output_options output_opt;
112 112
113 unsigned int config; /* interface to saa713x / tda829x */ 113 unsigned int config; /* interface to saa713x / tda829x */
114 unsigned int tm_rfcal; 114 unsigned int tm_rfcal;
diff --git a/drivers/media/common/tuners/tda18271.h b/drivers/media/common/tuners/tda18271.h
index bf6ba099a6bb..323f2912128d 100644
--- a/drivers/media/common/tuners/tda18271.h
+++ b/drivers/media/common/tuners/tda18271.h
@@ -67,18 +67,15 @@ enum tda18271_i2c_gate {
67 TDA18271_GATE_DIGITAL, 67 TDA18271_GATE_DIGITAL,
68}; 68};
69 69
70enum tda18271_standby_mode { 70enum tda18271_output_options {
71 /* slave tuner output & loop thru & xtal oscillator on */ 71 /* slave tuner output & loop thru & xtal oscillator always on */
72 TDA18271_STANDBY_LT_XT_ON = 0, 72 TDA18271_OUTPUT_LT_XT_ON = 0,
73 73
74 /* xtal oscillator on */ 74 /* slave tuner output loop thru off */
75 TDA18271_STANDBY_XT_ON, 75 TDA18271_OUTPUT_LT_OFF = 1,
76 76
77 /* slave tuner output / loop thru on */ 77 /* xtal oscillator off */
78 TDA18271_STANDBY_LT_ON, 78 TDA18271_OUTPUT_XT_OFF = 2,
79
80 /* power off */
81 TDA18271_STANDBY_POWER_OFF,
82}; 79};
83 80
84struct tda18271_config { 81struct tda18271_config {
@@ -91,8 +88,8 @@ struct tda18271_config {
91 /* use i2c gate provided by analog or digital demod */ 88 /* use i2c gate provided by analog or digital demod */
92 enum tda18271_i2c_gate gate; 89 enum tda18271_i2c_gate gate;
93 90
94 /* allow lower power standby modes */ 91 /* output options that can be disabled */
95 enum tda18271_standby_mode standby_mode; 92 enum tda18271_output_options output_opt;
96 93
97 /* force rf tracking filter calibration on startup */ 94 /* force rf tracking filter calibration on startup */
98 unsigned int rf_cal_on_startup:1; 95 unsigned int rf_cal_on_startup:1;