From 72459008a1643c4804ee6688426d7c29a66a545b Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sun, 16 Dec 2007 17:27:23 -0500 Subject: tuner: add set_config to struct analog_tuner_ops From: Michael Krufky Signed-off-by: Michael Krufky --- linux/drivers/media/video/tuner-core.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'linux/drivers/media/video/tuner-core.c') diff --git a/linux/drivers/media/video/tuner-core.c b/linux/drivers/media/video/tuner-core.c index 479afb1f6..47aafed34 100644 --- a/linux/drivers/media/video/tuner-core.c +++ b/linux/drivers/media/video/tuner-core.c @@ -183,6 +183,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 +203,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 }; -- cgit v1.2.3 From e204914b6924b0eda3d4a8adbe8334c5ed27d457 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sun, 16 Dec 2007 17:53:32 -0500 Subject: tuner: convert tda9887 to use TUNER_SET_CONFIG From: Michael Krufky Use TUNER_SET_CONFIG to set configuration in tda9887's private state structure, rather than storing tda9887-specific configuration within struct tuner. Update handling of TUNER_SET_CONFIG by tuner-core, to call &t->fe.ops.analog_demod_ops rather than &t->fe.ops.tuner_ops analog_demod_ops.set_config passes the request to tuner_ops.set_config, so this does not break other drivers. Signed-off-by: Michael Krufky --- linux/drivers/media/video/tuner-core.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'linux/drivers/media/video/tuner-core.c') diff --git a/linux/drivers/media/video/tuner-core.c b/linux/drivers/media/video/tuner-core.c index 47aafed34..5b5a38eaf 100644 --- a/linux/drivers/media/video/tuner-core.c +++ b/linux/drivers/media/video/tuner-core.c @@ -877,25 +877,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 --- */ -- cgit v1.2.3 From 29f28adf65d38e079fc3f90a62920be6f9b27d0b Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sun, 16 Dec 2007 18:11:46 -0500 Subject: tda9887: remove dependency on struct tuner From: Michael Krufky Signed-off-by: Michael Krufky --- linux/drivers/media/video/tuner-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linux/drivers/media/video/tuner-core.c') diff --git a/linux/drivers/media/video/tuner-core.c b/linux/drivers/media/video/tuner-core.c index 5b5a38eaf..45b955c3c 100644 --- a/linux/drivers/media/video/tuner-core.c +++ b/linux/drivers/media/video/tuner-core.c @@ -437,7 +437,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); -- cgit v1.2.3 From 792fe12a080524a1a417780cc115efe7384a3223 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sun, 16 Dec 2007 20:02:26 -0500 Subject: tuner: remove struct tuner from tuner-driver.h From: Michael Krufky struct tuner holds state for tuner-core, only -- move it into tuner-core.c Signed-off-by: Michael Krufky --- linux/drivers/media/video/tuner-core.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'linux/drivers/media/video/tuner-core.c') diff --git a/linux/drivers/media/video/tuner-core.c b/linux/drivers/media/video/tuner-core.c index 45b955c3c..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)) -- cgit v1.2.3