提交 de956c1e 编写于 作者: H Hartmut Hackmann 提交者: Mauro Carvalho Chehab

V4L/DVB (5313): Added a config entry and a gpio function pointer to tuner struct

These entries mainly are to support configurations of the tda827x
silicon tuner with a preamplifier.
The values can be set throgh the attach inform or through
the extended TUNER_SET_TYPE_ADDR client call. The function pointer
will only be updated if the parameter is not NULL.
Since a typecast is necessary to set the pointer, i added a typedef for
this pointer (tuner_gpio_func_t) in tuner.h
Signed-off-by: NHartmut Hackmann <hartmut.hackmann@t-online.de>
Signed-off-by: NMauro Carvalho Chehab <mchehab@infradead.org>
上级 b8195946
...@@ -2543,11 +2543,12 @@ struct saa7134_board saa7134_boards[] = { ...@@ -2543,11 +2543,12 @@ struct saa7134_board saa7134_boards[] = {
.name = "Philips Tiger reference design", .name = "Philips Tiger reference design",
.audio_clock = 0x00187de7, .audio_clock = 0x00187de7,
.tuner_type = TUNER_PHILIPS_TDA8290, .tuner_type = TUNER_PHILIPS_TDA8290,
.tuner_config = 0,
.radio_type = UNSET, .radio_type = UNSET,
.tuner_addr = ADDR_UNSET, .tuner_addr = ADDR_UNSET,
.radio_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET,
.mpeg = SAA7134_MPEG_DVB, .mpeg = SAA7134_MPEG_DVB,
.gpiomask = 1 << 21, .gpiomask = 0x0200000,
.inputs = {{ .inputs = {{
.name = name_tv, .name = name_tv,
.vmux = 1, .vmux = 1,
......
...@@ -370,6 +370,8 @@ static int attach_inform(struct i2c_client *client) ...@@ -370,6 +370,8 @@ static int attach_inform(struct i2c_client *client)
tun_setup.type = tuner; tun_setup.type = tuner;
tun_setup.addr = saa7134_boards[dev->board].tuner_addr; tun_setup.addr = saa7134_boards[dev->board].tuner_addr;
tun_setup.config = saa7134_boards[dev->board].tuner_config;
tun_setup.gpio_func = (tuner_gpio_func_t) saa7134_set_gpio;
if ((tun_setup.addr == ADDR_UNSET)||(tun_setup.addr == client->addr)) { if ((tun_setup.addr == ADDR_UNSET)||(tun_setup.addr == client->addr)) {
......
...@@ -280,6 +280,7 @@ struct saa7134_board { ...@@ -280,6 +280,7 @@ struct saa7134_board {
unsigned char radio_addr; unsigned char radio_addr;
unsigned int tda9887_conf; unsigned int tda9887_conf;
unsigned int tuner_config;
/* peripheral I/O */ /* peripheral I/O */
enum saa7134_video_out video_out; enum saa7134_video_out video_out;
......
...@@ -144,7 +144,8 @@ static void set_freq(struct i2c_client *c, unsigned long freq) ...@@ -144,7 +144,8 @@ static void set_freq(struct i2c_client *c, unsigned long freq)
} }
static void set_type(struct i2c_client *c, unsigned int type, static void set_type(struct i2c_client *c, unsigned int type,
unsigned int new_mode_mask) unsigned int new_mode_mask, unsigned int new_config,
tuner_gpio_func_t gpio_func)
{ {
struct tuner *t = i2c_get_clientdata(c); struct tuner *t = i2c_get_clientdata(c);
unsigned char buffer[4]; unsigned char buffer[4];
...@@ -173,6 +174,11 @@ static void set_type(struct i2c_client *c, unsigned int type, ...@@ -173,6 +174,11 @@ static void set_type(struct i2c_client *c, unsigned int type,
microtune_init(c); microtune_init(c);
break; break;
case TUNER_PHILIPS_TDA8290: 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); tda8290_init(c);
break; break;
case TUNER_TEA5767: case TUNER_TEA5767:
...@@ -234,10 +240,11 @@ static void set_addr(struct i2c_client *c, struct tuner_setup *tun_setup) ...@@ -234,10 +240,11 @@ static void set_addr(struct i2c_client *c, struct tuner_setup *tun_setup)
tuner_dbg("set addr for type %i\n", t->type); tuner_dbg("set addr for type %i\n", t->type);
if ( t->type == UNSET && ((tun_setup->addr == ADDR_UNSET && if ( (t->type == UNSET && ((tun_setup->addr == ADDR_UNSET) &&
(t->mode_mask & tun_setup->mode_mask)) || (t->mode_mask & tun_setup->mode_mask))) ||
tun_setup->addr == c->addr)) { (tun_setup->addr == c->addr)) {
set_type(c, tun_setup->type, tun_setup->mode_mask); set_type(c, tun_setup->type, tun_setup->mode_mask,
tun_setup->config, tun_setup->gpio_func);
} }
} }
...@@ -496,7 +503,7 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind) ...@@ -496,7 +503,7 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
register_client: register_client:
tuner_info("chip found @ 0x%x (%s)\n", addr << 1, adap->name); tuner_info("chip found @ 0x%x (%s)\n", addr << 1, adap->name);
i2c_attach_client (&t->i2c); i2c_attach_client (&t->i2c);
set_type (&t->i2c,t->type, t->mode_mask); set_type (&t->i2c,t->type, t->mode_mask, t->config, t->gpio_func);
return 0; return 0;
} }
...@@ -576,10 +583,11 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) ...@@ -576,10 +583,11 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
switch (cmd) { switch (cmd) {
/* --- configuration --- */ /* --- configuration --- */
case TUNER_SET_TYPE_ADDR: case TUNER_SET_TYPE_ADDR:
tuner_dbg ("Calling set_type_addr for type=%d, addr=0x%02x, mode=0x%02x\n", tuner_dbg ("Calling set_type_addr for type=%d, addr=0x%02x, mode=0x%02x, config=0x%02x\n",
((struct tuner_setup *)arg)->type, ((struct tuner_setup *)arg)->type,
((struct tuner_setup *)arg)->addr, ((struct tuner_setup *)arg)->addr,
((struct tuner_setup *)arg)->mode_mask); ((struct tuner_setup *)arg)->mode_mask,
((struct tuner_setup *)arg)->config);
set_addr(client, (struct tuner_setup *)arg); set_addr(client, (struct tuner_setup *)arg);
break; break;
......
...@@ -173,10 +173,15 @@ enum tuner_mode { ...@@ -173,10 +173,15 @@ enum tuner_mode {
when the tuner is set to TV mode. when the tuner is set to TV mode.
*/ */
/* allows to access the GPIOs of the host (pci bridge) */
typedef void (*tuner_gpio_func_t) (void *dev, int bit_no,int value);
struct tuner_setup { struct tuner_setup {
unsigned short addr; /* I2C address */ unsigned short addr; /* I2C address */
unsigned int type; /* Tuner type */ unsigned int type; /* Tuner type */
unsigned int mode_mask; /* Allowed tuner modes */ unsigned int mode_mask; /* Allowed tuner modes */
unsigned int config; /* configuraion for more complex tuners */
tuner_gpio_func_t gpio_func;
}; };
struct tuner { struct tuner {
...@@ -210,6 +215,8 @@ struct tuner { ...@@ -210,6 +215,8 @@ struct tuner {
unsigned char tda827x_addr; unsigned char tda827x_addr;
unsigned char tda827x_ver; unsigned char tda827x_ver;
unsigned int sgIF; unsigned int sgIF;
unsigned int config;
tuner_gpio_func_t gpio_func;
/* function ptrs */ /* function ptrs */
void (*set_tv_freq)(struct i2c_client *c, unsigned int freq); void (*set_tv_freq)(struct i2c_client *c, unsigned int freq);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册