V4L/DVB (5323): Updated support for tuner callbacks
This change supplies a more generic version of the tuner callback.
The tuner struct now has a function pointer
int (*tuner_callback) (void *dev, int command, int arg)
additionally to a int config parameter.
both can be set through the TUNER_SET_TYPE_ADDR client call.
Note that the meaning of the parameters depend on the tuner type.
Signed-off-by: Hartmut Hackmann <hartmut.hackmann@t-online.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index 522ec1c..b8c38a0 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -145,7 +145,7 @@
static void set_type(struct i2c_client *c, unsigned int type,
unsigned int new_mode_mask, unsigned int new_config,
- tuner_gpio_func_t gpio_func)
+ int (*tuner_callback) (void *dev, int command,int arg))
{
struct tuner *t = i2c_get_clientdata(c);
unsigned char buffer[4];
@@ -169,16 +169,16 @@
}
t->type = type;
+ t->config = new_config;
+ if (tuner_callback != NULL) {
+ tuner_dbg("defining GPIO callback\n");
+ t->tuner_callback = tuner_callback;
+ }
switch (t->type) {
case TUNER_MT2032:
microtune_init(c);
break;
case TUNER_PHILIPS_TDA8290:
- t->config = new_config;
- if (gpio_func != NULL) {
- tuner_dbg("Defining GPIO function\n");
- t->gpio_func = gpio_func;
- }
tda8290_init(c);
break;
case TUNER_TEA5767:
@@ -244,7 +244,7 @@
(t->mode_mask & tun_setup->mode_mask))) ||
(tun_setup->addr == c->addr)) {
set_type(c, tun_setup->type, tun_setup->mode_mask,
- tun_setup->config, tun_setup->gpio_func);
+ tun_setup->config, tun_setup->tuner_callback);
}
}
@@ -503,7 +503,7 @@
register_client:
tuner_info("chip found @ 0x%x (%s)\n", addr << 1, adap->name);
i2c_attach_client (&t->i2c);
- set_type (&t->i2c,t->type, t->mode_mask, t->config, t->gpio_func);
+ set_type (&t->i2c,t->type, t->mode_mask, t->config, t->tuner_callback);
return 0;
}