summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/tuner-core.c
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2007-12-08 15:06:30 -0500
committerMichael Krufky <mkrufky@linuxtv.org>2007-12-08 15:06:30 -0500
commit017775baf90cbd3c43a14e4d10e00e1aca9f98f2 (patch)
treefbf6c16cc47c1ef61a50941a0d99d9606b3952ab /linux/drivers/media/video/tuner-core.c
parent9cb13d03db18063f6095559ae6578d2c264f3499 (diff)
downloadmediapointer-dvb-s2-017775baf90cbd3c43a14e4d10e00e1aca9f98f2.tar.gz
mediapointer-dvb-s2-017775baf90cbd3c43a14e4d10e00e1aca9f98f2.tar.bz2
tuner: combine set_tv_freq and set_radio_freq into a single set_params method
From: Michael Krufky <mkrufky@linuxtv.org> 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>
Diffstat (limited to 'linux/drivers/media/video/tuner-core.c')
-rw-r--r--linux/drivers/media/video/tuner-core.c41
1 files changed, 24 insertions, 17 deletions
diff --git a/linux/drivers/media/video/tuner-core.c b/linux/drivers/media/video/tuner-core.c
index 0b3bc1c91..df65efd46 100644
--- a/linux/drivers/media/video/tuner-core.c
+++ b/linux/drivers/media/video/tuner-core.c
@@ -107,23 +107,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, &params);
+ fe_tuner_ops->set_analog_params(fe, params);
}
static void fe_release(struct dvb_frontend *fe)
@@ -165,8 +159,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,
@@ -179,11 +172,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;
}
@@ -198,7 +197,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, &params);
}
static void set_radio_freq(struct i2c_client *c, unsigned int freq)
@@ -206,11 +207,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;
}
@@ -225,8 +232,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, &params);
}
static void set_freq(struct i2c_client *c, unsigned long freq)
@@ -388,8 +396,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));