diff options
author | Michael Krufky <mkrufky@linuxtv.org> | 2007-12-08 23:06:30 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-01-26 00:03:27 +0300 |
commit | c7919d520f4c9a064ae14bc4dd170c4c12ead2af (patch) | |
tree | a7cbff8f2a09c710942783a84cb44098ed1507d8 /drivers/media/video/tuner-core.c | |
parent | 6881647cce09931f3d787ab83b5250436427ceb9 (diff) | |
download | linux-c7919d520f4c9a064ae14bc4dd170c4c12ead2af.tar.xz |
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"); /* ---------------------------------------------------------------------- */ -static void fe_set_freq(struct dvb_frontend *fe, unsigned int freq) +static void fe_set_params(struct dvb_frontend *fe, + struct analog_parameters *params) { struct dvb_tuner_ops *fe_tuner_ops = &fe->ops.tuner_ops; struct tuner *t = fe->analog_demod_priv; - struct analog_parameters params = { - .frequency = freq, - .mode = t->mode, - .audmode = t->audmode, - .std = t->std - }; - if (NULL == fe_tuner_ops->set_analog_params) { tuner_warn("Tuner frontend module has no way to set freq\n"); return; } - fe_tuner_ops->set_analog_params(fe, ¶ms); + fe_tuner_ops->set_analog_params(fe, params); } static void fe_release(struct dvb_frontend *fe) @@ -136,8 +130,7 @@ static int fe_has_signal(struct dvb_frontend *fe) static void tuner_status(struct dvb_frontend *fe); static struct analog_tuner_ops tuner_core_ops = { - .set_tv_freq = fe_set_freq, - .set_radio_freq = fe_set_freq, + .set_params = fe_set_params, .standby = fe_standby, .release = fe_release, .has_signal = fe_has_signal, @@ -150,11 +143,17 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq) struct tuner *t = i2c_get_clientdata(c); struct analog_tuner_ops *ops = t->fe.ops.analog_demod_ops; + struct analog_parameters params = { + .mode = t->mode, + .audmode = t->audmode, + .std = t->std + }; + if (t->type == UNSET) { tuner_warn ("tuner type not set\n"); return; } - if ((NULL == ops) || (NULL == ops->set_tv_freq)) { + if ((NULL == ops) || (NULL == ops->set_params)) { tuner_warn ("Tuner has no way to set tv freq\n"); return; } @@ -169,7 +168,9 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq) else freq = tv_range[1] * 16; } - ops->set_tv_freq(&t->fe, freq); + params.frequency = freq; + + ops->set_params(&t->fe, ¶ms); } 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) struct tuner *t = i2c_get_clientdata(c); struct analog_tuner_ops *ops = t->fe.ops.analog_demod_ops; + struct analog_parameters params = { + .mode = t->mode, + .audmode = t->audmode, + .std = t->std + }; + if (t->type == UNSET) { tuner_warn ("tuner type not set\n"); return; } - if ((NULL == ops) || (NULL == ops->set_radio_freq)) { + if ((NULL == ops) || (NULL == ops->set_params)) { tuner_warn ("tuner has no way to set radio frequency\n"); return; } @@ -196,8 +203,9 @@ static void set_radio_freq(struct i2c_client *c, unsigned int freq) else freq = radio_range[1] * 16000; } + params.frequency = freq; - ops->set_radio_freq(&t->fe, freq); + ops->set_params(&t->fe, ¶ms); } 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, ops = t->fe.ops.analog_demod_ops; - if (((NULL == ops) || - ((NULL == ops->set_tv_freq) && (NULL == ops->set_radio_freq))) && + if (((NULL == ops) || (NULL == ops->set_params)) && (fe_tuner_ops->set_analog_params)) { strlcpy(t->i2c->name, fe_tuner_ops->info.name, sizeof(t->i2c->name)); |