diff options
author | Michael Krufky <mkrufky@linuxtv.org> | 2007-12-08 15:06:30 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-01-25 16:03:27 -0500 |
commit | c7919d520f4c9a064ae14bc4dd170c4c12ead2af (patch) | |
tree | a7cbff8f2a09c710942783a84cb44098ed1507d8 /drivers/media/video/tda8290.c | |
parent | 6881647cce09931f3d787ab83b5250436427ceb9 (diff) |
V4L/DVB (6783): tuner: combine set_tv_freq and set_radio_freq into a single set_params method
We can tell whether we are tuning television or radio by testing for
struct analog_parameters *params->mode == V4L2_TUNER_RADIO
There is no longer any need for separate set_tv_freq and
set_radio_freq functions in the analog tuner demodulator modules.
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/tda8290.c')
-rw-r--r-- | drivers/media/video/tda8290.c | 53 |
1 files changed, 20 insertions, 33 deletions
diff --git a/drivers/media/video/tda8290.c b/drivers/media/video/tda8290.c index d5517bcf6ffe..245b202560b5 100644 --- a/drivers/media/video/tda8290.c +++ b/drivers/media/video/tda8290.c | |||
@@ -110,31 +110,32 @@ static int tda8295_i2c_bridge(struct dvb_frontend *fe, int close) | |||
110 | 110 | ||
111 | /*---------------------------------------------------------------------*/ | 111 | /*---------------------------------------------------------------------*/ |
112 | 112 | ||
113 | static void set_audio(struct dvb_frontend *fe) | 113 | static void set_audio(struct dvb_frontend *fe, |
114 | struct analog_parameters *params) | ||
114 | { | 115 | { |
115 | struct tda8290_priv *priv = fe->analog_demod_priv; | 116 | struct tda8290_priv *priv = fe->analog_demod_priv; |
116 | struct tuner *t = priv->t; | 117 | struct tuner *t = priv->t; |
117 | char* mode; | 118 | char* mode; |
118 | 119 | ||
119 | if (t->std & V4L2_STD_MN) { | 120 | if (params->std & V4L2_STD_MN) { |
120 | priv->tda8290_easy_mode = 0x01; | 121 | priv->tda8290_easy_mode = 0x01; |
121 | mode = "MN"; | 122 | mode = "MN"; |
122 | } else if (t->std & V4L2_STD_B) { | 123 | } else if (params->std & V4L2_STD_B) { |
123 | priv->tda8290_easy_mode = 0x02; | 124 | priv->tda8290_easy_mode = 0x02; |
124 | mode = "B"; | 125 | mode = "B"; |
125 | } else if (t->std & V4L2_STD_GH) { | 126 | } else if (params->std & V4L2_STD_GH) { |
126 | priv->tda8290_easy_mode = 0x04; | 127 | priv->tda8290_easy_mode = 0x04; |
127 | mode = "GH"; | 128 | mode = "GH"; |
128 | } else if (t->std & V4L2_STD_PAL_I) { | 129 | } else if (params->std & V4L2_STD_PAL_I) { |
129 | priv->tda8290_easy_mode = 0x08; | 130 | priv->tda8290_easy_mode = 0x08; |
130 | mode = "I"; | 131 | mode = "I"; |
131 | } else if (t->std & V4L2_STD_DK) { | 132 | } else if (params->std & V4L2_STD_DK) { |
132 | priv->tda8290_easy_mode = 0x10; | 133 | priv->tda8290_easy_mode = 0x10; |
133 | mode = "DK"; | 134 | mode = "DK"; |
134 | } else if (t->std & V4L2_STD_SECAM_L) { | 135 | } else if (params->std & V4L2_STD_SECAM_L) { |
135 | priv->tda8290_easy_mode = 0x20; | 136 | priv->tda8290_easy_mode = 0x20; |
136 | mode = "L"; | 137 | mode = "L"; |
137 | } else if (t->std & V4L2_STD_SECAM_LC) { | 138 | } else if (params->std & V4L2_STD_SECAM_LC) { |
138 | priv->tda8290_easy_mode = 0x40; | 139 | priv->tda8290_easy_mode = 0x40; |
139 | mode = "LC"; | 140 | mode = "LC"; |
140 | } else { | 141 | } else { |
@@ -145,7 +146,8 @@ static void set_audio(struct dvb_frontend *fe) | |||
145 | tuner_dbg("setting tda829x to system %s\n", mode); | 146 | tuner_dbg("setting tda829x to system %s\n", mode); |
146 | } | 147 | } |
147 | 148 | ||
148 | static void tda8290_set_freq(struct dvb_frontend *fe, unsigned int freq) | 149 | static void tda8290_set_params(struct dvb_frontend *fe, |
150 | struct analog_parameters *params) | ||
149 | { | 151 | { |
150 | struct tda8290_priv *priv = fe->analog_demod_priv; | 152 | struct tda8290_priv *priv = fe->analog_demod_priv; |
151 | struct tuner *t = priv->t; | 153 | struct tuner *t = priv->t; |
@@ -172,14 +174,7 @@ static void tda8290_set_freq(struct dvb_frontend *fe, unsigned int freq) | |||
172 | pll_stat; | 174 | pll_stat; |
173 | int i; | 175 | int i; |
174 | 176 | ||
175 | struct analog_parameters params = { | 177 | set_audio(fe, params); |
176 | .frequency = freq, | ||
177 | .mode = t->mode, | ||
178 | .audmode = t->audmode, | ||
179 | .std = t->std | ||
180 | }; | ||
181 | |||
182 | set_audio(fe); | ||
183 | 178 | ||
184 | tuner_dbg("tda827xa config is 0x%02x\n", t->config); | 179 | tuner_dbg("tda827xa config is 0x%02x\n", t->config); |
185 | tuner_i2c_xfer_send(&priv->i2c_props, easy_mode, 2); | 180 | tuner_i2c_xfer_send(&priv->i2c_props, easy_mode, 2); |
@@ -200,7 +195,7 @@ static void tda8290_set_freq(struct dvb_frontend *fe, unsigned int freq) | |||
200 | tda8290_i2c_bridge(fe, 1); | 195 | tda8290_i2c_bridge(fe, 1); |
201 | 196 | ||
202 | if (fe->ops.tuner_ops.set_analog_params) | 197 | if (fe->ops.tuner_ops.set_analog_params) |
203 | fe->ops.tuner_ops.set_analog_params(fe, ¶ms); | 198 | fe->ops.tuner_ops.set_analog_params(fe, params); |
204 | 199 | ||
205 | for (i = 0; i < 3; i++) { | 200 | for (i = 0; i < 3; i++) { |
206 | tuner_i2c_xfer_send(&priv->i2c_props, &addr_pll_stat, 1); | 201 | tuner_i2c_xfer_send(&priv->i2c_props, &addr_pll_stat, 1); |
@@ -363,23 +358,17 @@ static int tda8295_has_signal(struct dvb_frontend *fe) | |||
363 | 358 | ||
364 | /*---------------------------------------------------------------------*/ | 359 | /*---------------------------------------------------------------------*/ |
365 | 360 | ||
366 | static void tda8295_set_freq(struct dvb_frontend *fe, unsigned int freq) | 361 | static void tda8295_set_params(struct dvb_frontend *fe, |
362 | struct analog_parameters *params) | ||
367 | { | 363 | { |
368 | struct tda8290_priv *priv = fe->analog_demod_priv; | 364 | struct tda8290_priv *priv = fe->analog_demod_priv; |
369 | struct tuner *t = priv->t; | 365 | struct tuner *t = priv->t; |
370 | 366 | ||
371 | unsigned char blanking_mode[] = { 0x1d, 0x00 }; | 367 | unsigned char blanking_mode[] = { 0x1d, 0x00 }; |
372 | 368 | ||
373 | struct analog_parameters params = { | 369 | set_audio(fe, params); |
374 | .frequency = freq, | ||
375 | .mode = t->mode, | ||
376 | .audmode = t->audmode, | ||
377 | .std = t->std | ||
378 | }; | ||
379 | |||
380 | set_audio(fe); | ||
381 | 370 | ||
382 | tuner_dbg("%s: freq = %d\n", __FUNCTION__, freq); | 371 | tuner_dbg("%s: freq = %d\n", __FUNCTION__, params->frequency); |
383 | 372 | ||
384 | tda8295_power(fe, 1); | 373 | tda8295_power(fe, 1); |
385 | tda8295_agc1_out(fe, 1); | 374 | tda8295_agc1_out(fe, 1); |
@@ -396,7 +385,7 @@ static void tda8295_set_freq(struct dvb_frontend *fe, unsigned int freq) | |||
396 | tda8295_i2c_bridge(fe, 1); | 385 | tda8295_i2c_bridge(fe, 1); |
397 | 386 | ||
398 | if (fe->ops.tuner_ops.set_analog_params) | 387 | if (fe->ops.tuner_ops.set_analog_params) |
399 | fe->ops.tuner_ops.set_analog_params(fe, ¶ms); | 388 | fe->ops.tuner_ops.set_analog_params(fe, params); |
400 | 389 | ||
401 | if (priv->cfg.agcf) | 390 | if (priv->cfg.agcf) |
402 | priv->cfg.agcf(fe); | 391 | priv->cfg.agcf(fe); |
@@ -673,8 +662,7 @@ static int tda8295_probe(struct tuner_i2c_props *i2c_props) | |||
673 | } | 662 | } |
674 | 663 | ||
675 | static struct analog_tuner_ops tda8290_tuner_ops = { | 664 | static struct analog_tuner_ops tda8290_tuner_ops = { |
676 | .set_tv_freq = tda8290_set_freq, | 665 | .set_params = tda8290_set_params, |
677 | .set_radio_freq = tda8290_set_freq, | ||
678 | .has_signal = tda8290_has_signal, | 666 | .has_signal = tda8290_has_signal, |
679 | .standby = tda8290_standby, | 667 | .standby = tda8290_standby, |
680 | .release = tda829x_release, | 668 | .release = tda829x_release, |
@@ -682,8 +670,7 @@ static struct analog_tuner_ops tda8290_tuner_ops = { | |||
682 | }; | 670 | }; |
683 | 671 | ||
684 | static struct analog_tuner_ops tda8295_tuner_ops = { | 672 | static struct analog_tuner_ops tda8295_tuner_ops = { |
685 | .set_tv_freq = tda8295_set_freq, | 673 | .set_params = tda8295_set_params, |
686 | .set_radio_freq = tda8295_set_freq, | ||
687 | .has_signal = tda8295_has_signal, | 674 | .has_signal = tda8295_has_signal, |
688 | .standby = tda8295_standby, | 675 | .standby = tda8295_standby, |
689 | .release = tda829x_release, | 676 | .release = tda829x_release, |