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/tuner-core.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/tuner-core.c')
-rw-r--r-- | drivers/media/video/tuner-core.c | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index e56a41941489..5f8bffc8209b 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c | |||
@@ -78,23 +78,17 @@ MODULE_LICENSE("GPL"); | |||
78 | 78 | ||
79 | /* ---------------------------------------------------------------------- */ | 79 | /* ---------------------------------------------------------------------- */ |
80 | 80 | ||
81 | static void fe_set_freq(struct dvb_frontend *fe, unsigned int freq) | 81 | static void fe_set_params(struct dvb_frontend *fe, |
82 | struct analog_parameters *params) | ||
82 | { | 83 | { |
83 | struct dvb_tuner_ops *fe_tuner_ops = &fe->ops.tuner_ops; | 84 | struct dvb_tuner_ops *fe_tuner_ops = &fe->ops.tuner_ops; |
84 | struct tuner *t = fe->analog_demod_priv; | 85 | struct tuner *t = fe->analog_demod_priv; |
85 | 86 | ||
86 | struct analog_parameters params = { | ||
87 | .frequency = freq, | ||
88 | .mode = t->mode, | ||
89 | .audmode = t->audmode, | ||
90 | .std = t->std | ||
91 | }; | ||
92 | |||
93 | if (NULL == fe_tuner_ops->set_analog_params) { | 87 | if (NULL == fe_tuner_ops->set_analog_params) { |
94 | tuner_warn("Tuner frontend module has no way to set freq\n"); | 88 | tuner_warn("Tuner frontend module has no way to set freq\n"); |
95 | return; | 89 | return; |
96 | } | 90 | } |
97 | fe_tuner_ops->set_analog_params(fe, ¶ms); | 91 | fe_tuner_ops->set_analog_params(fe, params); |
98 | } | 92 | } |
99 | 93 | ||
100 | static void fe_release(struct dvb_frontend *fe) | 94 | static void fe_release(struct dvb_frontend *fe) |
@@ -136,8 +130,7 @@ static int fe_has_signal(struct dvb_frontend *fe) | |||
136 | static void tuner_status(struct dvb_frontend *fe); | 130 | static void tuner_status(struct dvb_frontend *fe); |
137 | 131 | ||
138 | static struct analog_tuner_ops tuner_core_ops = { | 132 | static struct analog_tuner_ops tuner_core_ops = { |
139 | .set_tv_freq = fe_set_freq, | 133 | .set_params = fe_set_params, |
140 | .set_radio_freq = fe_set_freq, | ||
141 | .standby = fe_standby, | 134 | .standby = fe_standby, |
142 | .release = fe_release, | 135 | .release = fe_release, |
143 | .has_signal = fe_has_signal, | 136 | .has_signal = fe_has_signal, |
@@ -150,11 +143,17 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq) | |||
150 | struct tuner *t = i2c_get_clientdata(c); | 143 | struct tuner *t = i2c_get_clientdata(c); |
151 | struct analog_tuner_ops *ops = t->fe.ops.analog_demod_ops; | 144 | struct analog_tuner_ops *ops = t->fe.ops.analog_demod_ops; |
152 | 145 | ||
146 | struct analog_parameters params = { | ||
147 | .mode = t->mode, | ||
148 | .audmode = t->audmode, | ||
149 | .std = t->std | ||
150 | }; | ||
151 | |||
153 | if (t->type == UNSET) { | 152 | if (t->type == UNSET) { |
154 | tuner_warn ("tuner type not set\n"); | 153 | tuner_warn ("tuner type not set\n"); |
155 | return; | 154 | return; |
156 | } | 155 | } |
157 | if ((NULL == ops) || (NULL == ops->set_tv_freq)) { | 156 | if ((NULL == ops) || (NULL == ops->set_params)) { |
158 | tuner_warn ("Tuner has no way to set tv freq\n"); | 157 | tuner_warn ("Tuner has no way to set tv freq\n"); |
159 | return; | 158 | return; |
160 | } | 159 | } |
@@ -169,7 +168,9 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq) | |||
169 | else | 168 | else |
170 | freq = tv_range[1] * 16; | 169 | freq = tv_range[1] * 16; |
171 | } | 170 | } |
172 | ops->set_tv_freq(&t->fe, freq); | 171 | params.frequency = freq; |
172 | |||
173 | ops->set_params(&t->fe, ¶ms); | ||
173 | } | 174 | } |
174 | 175 | ||
175 | static void set_radio_freq(struct i2c_client *c, unsigned int freq) | 176 | static void set_radio_freq(struct i2c_client *c, unsigned int freq) |
@@ -177,11 +178,17 @@ static void set_radio_freq(struct i2c_client *c, unsigned int freq) | |||
177 | struct tuner *t = i2c_get_clientdata(c); | 178 | struct tuner *t = i2c_get_clientdata(c); |
178 | struct analog_tuner_ops *ops = t->fe.ops.analog_demod_ops; | 179 | struct analog_tuner_ops *ops = t->fe.ops.analog_demod_ops; |
179 | 180 | ||
181 | struct analog_parameters params = { | ||
182 | .mode = t->mode, | ||
183 | .audmode = t->audmode, | ||
184 | .std = t->std | ||
185 | }; | ||
186 | |||
180 | if (t->type == UNSET) { | 187 | if (t->type == UNSET) { |
181 | tuner_warn ("tuner type not set\n"); | 188 | tuner_warn ("tuner type not set\n"); |
182 | return; | 189 | return; |
183 | } | 190 | } |
184 | if ((NULL == ops) || (NULL == ops->set_radio_freq)) { | 191 | if ((NULL == ops) || (NULL == ops->set_params)) { |
185 | tuner_warn ("tuner has no way to set radio frequency\n"); | 192 | tuner_warn ("tuner has no way to set radio frequency\n"); |
186 | return; | 193 | return; |
187 | } | 194 | } |
@@ -196,8 +203,9 @@ static void set_radio_freq(struct i2c_client *c, unsigned int freq) | |||
196 | else | 203 | else |
197 | freq = radio_range[1] * 16000; | 204 | freq = radio_range[1] * 16000; |
198 | } | 205 | } |
206 | params.frequency = freq; | ||
199 | 207 | ||
200 | ops->set_radio_freq(&t->fe, freq); | 208 | ops->set_params(&t->fe, ¶ms); |
201 | } | 209 | } |
202 | 210 | ||
203 | static void set_freq(struct i2c_client *c, unsigned long freq) | 211 | static void set_freq(struct i2c_client *c, unsigned long freq) |
@@ -359,8 +367,7 @@ static void set_type(struct i2c_client *c, unsigned int type, | |||
359 | 367 | ||
360 | ops = t->fe.ops.analog_demod_ops; | 368 | ops = t->fe.ops.analog_demod_ops; |
361 | 369 | ||
362 | if (((NULL == ops) || | 370 | if (((NULL == ops) || (NULL == ops->set_params)) && |
363 | ((NULL == ops->set_tv_freq) && (NULL == ops->set_radio_freq))) && | ||
364 | (fe_tuner_ops->set_analog_params)) { | 371 | (fe_tuner_ops->set_analog_params)) { |
365 | strlcpy(t->i2c->name, fe_tuner_ops->info.name, | 372 | strlcpy(t->i2c->name, fe_tuner_ops->info.name, |
366 | sizeof(t->i2c->name)); | 373 | sizeof(t->i2c->name)); |