summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/tuner-core.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/video/tuner-core.c')
-rw-r--r--linux/drivers/media/video/tuner-core.c49
1 files changed, 39 insertions, 10 deletions
diff --git a/linux/drivers/media/video/tuner-core.c b/linux/drivers/media/video/tuner-core.c
index 479afb1f6..73976746b 100644
--- a/linux/drivers/media/video/tuner-core.c
+++ b/linux/drivers/media/video/tuner-core.c
@@ -41,6 +41,27 @@
#define PREFIX t->i2c->driver->driver.name
#endif
+struct tuner {
+ /* device */
+ struct dvb_frontend fe;
+ struct i2c_client *i2c;
+ struct list_head list;
+ unsigned int using_v4l2:1;
+
+ /* keep track of the current settings */
+ v4l2_std_id std;
+ unsigned int tv_freq;
+ unsigned int radio_freq;
+ unsigned int audmode;
+
+ unsigned int mode;
+ unsigned int mode_mask; /* Combination of allowable modes */
+
+ unsigned int type; /* chip type id */
+ unsigned int config;
+ int (*tuner_callback) (void *dev, int command, int arg);
+};
+
/* standard i2c insmod options */
static unsigned short normal_i2c[] = {
#if defined(CONFIG_TUNER_TEA5761) || (defined(CONFIG_TUNER_TEA5761_MODULE) && defined(MODULE))
@@ -183,6 +204,19 @@ static int fe_has_signal(struct dvb_frontend *fe)
return strength;
}
+static int fe_set_config(struct dvb_frontend *fe, void *priv_cfg)
+{
+ struct dvb_tuner_ops *fe_tuner_ops = &fe->ops.tuner_ops;
+ struct tuner *t = fe->analog_demod_priv;
+
+ if (fe_tuner_ops->set_config)
+ return fe_tuner_ops->set_config(fe, priv_cfg);
+
+ tuner_warn("Tuner frontend module has no way to set config\n");
+
+ return 0;
+}
+
static void tuner_status(struct dvb_frontend *fe);
static struct analog_tuner_ops tuner_core_ops = {
@@ -190,6 +224,7 @@ static struct analog_tuner_ops tuner_core_ops = {
.standby = fe_standby,
.release = fe_release,
.has_signal = fe_has_signal,
+ .set_config = fe_set_config,
.tuner_status = tuner_status
};
@@ -423,7 +458,7 @@ static void set_type(struct i2c_client *c, unsigned int type,
break;
}
case TUNER_TDA9887:
- tda9887_attach(t);
+ tda9887_attach(&t->fe, t->i2c->adapter, t->i2c->addr);
break;
default:
attach_simple_tuner(t);
@@ -863,25 +898,19 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
#endif
case TUNER_SET_CONFIG:
{
- struct dvb_tuner_ops *fe_tuner_ops = &t->fe.ops.tuner_ops;
+ struct analog_tuner_ops *ops = t->fe.ops.analog_demod_ops;
struct v4l2_priv_tun_config *cfg = arg;
if (t->type != cfg->tuner)
break;
- if (t->type == TUNER_TDA9887) {
- t->tda9887_config = *(unsigned int *)cfg->priv;
- set_freq(client, t->tv_freq);
- break;
- }
-
- if (NULL == fe_tuner_ops->set_config) {
+ if ((NULL == ops) || (NULL == ops->set_config)) {
tuner_warn("Tuner frontend module has no way to "
"set config\n");
break;
}
- fe_tuner_ops->set_config(&t->fe, cfg->priv);
+ ops->set_config(&t->fe, cfg->priv);
break;
}
/* --- v4l ioctls --- */