aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2011-02-14 15:53:12 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-03-21 19:32:03 -0400
commit2d351df443b0b324a440b5fd053074562d36a7f5 (patch)
tree911ffeb44059127e4524898bddfc82cb50822fb5
parent0ae79d993cd5ce425bedebcbd2f8c4fa310acfe6 (diff)
[media] Remove the remaining usages for T_STANDBY
tda9887 used to use the T_STANDBY type internally, while tea5761 used it to put the device to sleep. Fix the code for it to work properly with the tuner core changes and remove this flag from tuner.h. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/common/tuners/tda9887.c9
-rw-r--r--drivers/media/common/tuners/tea5761.c33
-rw-r--r--include/media/tuner.h12
3 files changed, 35 insertions, 19 deletions
diff --git a/drivers/media/common/tuners/tda9887.c b/drivers/media/common/tuners/tda9887.c
index bf14bd79e2fc..cdb645d57438 100644
--- a/drivers/media/common/tuners/tda9887.c
+++ b/drivers/media/common/tuners/tda9887.c
@@ -36,6 +36,8 @@ struct tda9887_priv {
36 unsigned int mode; 36 unsigned int mode;
37 unsigned int audmode; 37 unsigned int audmode;
38 v4l2_std_id std; 38 v4l2_std_id std;
39
40 bool standby;
39}; 41};
40 42
41/* ---------------------------------------------------------------------- */ 43/* ---------------------------------------------------------------------- */
@@ -568,7 +570,7 @@ static void tda9887_configure(struct dvb_frontend *fe)
568 tda9887_do_config(fe); 570 tda9887_do_config(fe);
569 tda9887_set_insmod(fe); 571 tda9887_set_insmod(fe);
570 572
571 if (priv->mode == T_STANDBY) 573 if (priv->standby)
572 priv->data[1] |= cForcedMuteAudioON; 574 priv->data[1] |= cForcedMuteAudioON;
573 575
574 tuner_dbg("writing: b=0x%02x c=0x%02x e=0x%02x\n", 576 tuner_dbg("writing: b=0x%02x c=0x%02x e=0x%02x\n",
@@ -616,7 +618,7 @@ static void tda9887_standby(struct dvb_frontend *fe)
616{ 618{
617 struct tda9887_priv *priv = fe->analog_demod_priv; 619 struct tda9887_priv *priv = fe->analog_demod_priv;
618 620
619 priv->mode = T_STANDBY; 621 priv->standby = true;
620 622
621 tda9887_configure(fe); 623 tda9887_configure(fe);
622} 624}
@@ -626,6 +628,7 @@ static void tda9887_set_params(struct dvb_frontend *fe,
626{ 628{
627 struct tda9887_priv *priv = fe->analog_demod_priv; 629 struct tda9887_priv *priv = fe->analog_demod_priv;
628 630
631 priv->standby = false;
629 priv->mode = params->mode; 632 priv->mode = params->mode;
630 priv->audmode = params->audmode; 633 priv->audmode = params->audmode;
631 priv->std = params->std; 634 priv->std = params->std;
@@ -686,7 +689,7 @@ struct dvb_frontend *tda9887_attach(struct dvb_frontend *fe,
686 return NULL; 689 return NULL;
687 case 1: 690 case 1:
688 fe->analog_demod_priv = priv; 691 fe->analog_demod_priv = priv;
689 priv->mode = T_STANDBY; 692 priv->standby = true;
690 tuner_info("tda988[5/6/7] found\n"); 693 tuner_info("tda988[5/6/7] found\n");
691 break; 694 break;
692 default: 695 default:
diff --git a/drivers/media/common/tuners/tea5761.c b/drivers/media/common/tuners/tea5761.c
index 925399dffbed..bf78cb9fc52c 100644
--- a/drivers/media/common/tuners/tea5761.c
+++ b/drivers/media/common/tuners/tea5761.c
@@ -23,6 +23,7 @@ struct tea5761_priv {
23 struct tuner_i2c_props i2c_props; 23 struct tuner_i2c_props i2c_props;
24 24
25 u32 frequency; 25 u32 frequency;
26 bool standby;
26}; 27};
27 28
28/*****************************************************************************/ 29/*****************************************************************************/
@@ -135,18 +136,19 @@ static void tea5761_status_dump(unsigned char *buffer)
135} 136}
136 137
137/* Freq should be specifyed at 62.5 Hz */ 138/* Freq should be specifyed at 62.5 Hz */
138static int set_radio_freq(struct dvb_frontend *fe, 139static int __set_radio_freq(struct dvb_frontend *fe,
139 struct analog_parameters *params) 140 unsigned int freq,
141 bool mono)
140{ 142{
141 struct tea5761_priv *priv = fe->tuner_priv; 143 struct tea5761_priv *priv = fe->tuner_priv;
142 unsigned int frq = params->frequency; 144 unsigned int frq = freq;
143 unsigned char buffer[7] = {0, 0, 0, 0, 0, 0, 0 }; 145 unsigned char buffer[7] = {0, 0, 0, 0, 0, 0, 0 };
144 unsigned div; 146 unsigned div;
145 int rc; 147 int rc;
146 148
147 tuner_dbg("radio freq counter %d\n", frq); 149 tuner_dbg("radio freq counter %d\n", frq);
148 150
149 if (params->mode == T_STANDBY) { 151 if (priv->standby) {
150 tuner_dbg("TEA5761 set to standby mode\n"); 152 tuner_dbg("TEA5761 set to standby mode\n");
151 buffer[5] |= TEA5761_TNCTRL_MU; 153 buffer[5] |= TEA5761_TNCTRL_MU;
152 } else { 154 } else {
@@ -154,7 +156,7 @@ static int set_radio_freq(struct dvb_frontend *fe,
154 } 156 }
155 157
156 158
157 if (params->audmode == V4L2_TUNER_MODE_MONO) { 159 if (mono) {
158 tuner_dbg("TEA5761 set to mono\n"); 160 tuner_dbg("TEA5761 set to mono\n");
159 buffer[5] |= TEA5761_TNCTRL_MST; 161 buffer[5] |= TEA5761_TNCTRL_MST;
160 } else { 162 } else {
@@ -176,6 +178,26 @@ static int set_radio_freq(struct dvb_frontend *fe,
176 return 0; 178 return 0;
177} 179}
178 180
181static int set_radio_freq(struct dvb_frontend *fe,
182 struct analog_parameters *params)
183{
184 struct tea5761_priv *priv = fe->analog_demod_priv;
185
186 priv->standby = false;
187
188 return __set_radio_freq(fe, params->frequency,
189 params->audmode == V4L2_TUNER_MODE_MONO);
190}
191
192static int set_radio_sleep(struct dvb_frontend *fe)
193{
194 struct tea5761_priv *priv = fe->analog_demod_priv;
195
196 priv->standby = true;
197
198 return __set_radio_freq(fe, priv->frequency, false);
199}
200
179static int tea5761_read_status(struct dvb_frontend *fe, char *buffer) 201static int tea5761_read_status(struct dvb_frontend *fe, char *buffer)
180{ 202{
181 struct tea5761_priv *priv = fe->tuner_priv; 203 struct tea5761_priv *priv = fe->tuner_priv;
@@ -284,6 +306,7 @@ static struct dvb_tuner_ops tea5761_tuner_ops = {
284 .name = "tea5761", // Philips TEA5761HN FM Radio 306 .name = "tea5761", // Philips TEA5761HN FM Radio
285 }, 307 },
286 .set_analog_params = set_radio_freq, 308 .set_analog_params = set_radio_freq,
309 .sleep = set_radio_sleep,
287 .release = tea5761_release, 310 .release = tea5761_release,
288 .get_frequency = tea5761_get_frequency, 311 .get_frequency = tea5761_get_frequency,
289 .get_status = tea5761_get_status, 312 .get_status = tea5761_get_status,
diff --git a/include/media/tuner.h b/include/media/tuner.h
index 1d596427d124..32dfd5f33cd7 100644
--- a/include/media/tuner.h
+++ b/include/media/tuner.h
@@ -21,6 +21,7 @@
21 21
22#ifndef _TUNER_H 22#ifndef _TUNER_H
23#define _TUNER_H 23#define _TUNER_H
24#ifdef __KERNEL__
24 25
25#include <linux/videodev2.h> 26#include <linux/videodev2.h>
26 27
@@ -157,13 +158,10 @@
157#define TDA9887_GAIN_NORMAL (1<<20) 158#define TDA9887_GAIN_NORMAL (1<<20)
158#define TDA9887_RIF_41_3 (1<<21) /* radio IF1 41.3 vs 33.3 */ 159#define TDA9887_RIF_41_3 (1<<21) /* radio IF1 41.3 vs 33.3 */
159 160
160#ifdef __KERNEL__
161
162enum tuner_mode { 161enum tuner_mode {
163 T_RADIO = 1 << V4L2_TUNER_RADIO, 162 T_RADIO = 1 << V4L2_TUNER_RADIO,
164 T_ANALOG_TV = 1 << V4L2_TUNER_ANALOG_TV, 163 T_ANALOG_TV = 1 << V4L2_TUNER_ANALOG_TV,
165 T_DIGITAL_TV = 1 << V4L2_TUNER_DIGITAL_TV, 164 T_DIGITAL_TV = 1 << V4L2_TUNER_DIGITAL_TV,
166 T_STANDBY = 1 << 31
167}; 165};
168 166
169/* Older boards only had a single tuner device. Nowadays multiple tuner 167/* Older boards only had a single tuner device. Nowadays multiple tuner
@@ -193,11 +191,3 @@ struct tuner_setup {
193#endif /* __KERNEL__ */ 191#endif /* __KERNEL__ */
194 192
195#endif /* _TUNER_H */ 193#endif /* _TUNER_H */
196
197/*
198 * Overrides for Emacs so that we follow Linus's tabbing style.
199 * ---------------------------------------------------------------------------
200 * Local variables:
201 * c-basic-offset: 8
202 * End:
203 */