diff options
author | Hartmut Hackmann <hartmut.hackmann@t-online.de> | 2007-04-27 11:31:12 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-04-27 14:43:31 -0400 |
commit | de956c1e0f89413a3837b642d592e2dff3e3eb78 (patch) | |
tree | 71f803d3854d497e63dbe728695250b16c0e0b18 /drivers/media | |
parent | b8195946228c749702dfe5995b98516ea4b04cdc (diff) |
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: Hartmut Hackmann <hartmut.hackmann@t-online.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/saa7134/saa7134-cards.c | 3 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-i2c.c | 2 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134.h | 1 | ||||
-rw-r--r-- | drivers/media/video/tuner-core.c | 24 |
4 files changed, 21 insertions, 9 deletions
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 89f32107f46b..4399d1371cc1 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c | |||
@@ -2543,11 +2543,12 @@ struct saa7134_board saa7134_boards[] = { | |||
2543 | .name = "Philips Tiger reference design", | 2543 | .name = "Philips Tiger reference design", |
2544 | .audio_clock = 0x00187de7, | 2544 | .audio_clock = 0x00187de7, |
2545 | .tuner_type = TUNER_PHILIPS_TDA8290, | 2545 | .tuner_type = TUNER_PHILIPS_TDA8290, |
2546 | .tuner_config = 0, | ||
2546 | .radio_type = UNSET, | 2547 | .radio_type = UNSET, |
2547 | .tuner_addr = ADDR_UNSET, | 2548 | .tuner_addr = ADDR_UNSET, |
2548 | .radio_addr = ADDR_UNSET, | 2549 | .radio_addr = ADDR_UNSET, |
2549 | .mpeg = SAA7134_MPEG_DVB, | 2550 | .mpeg = SAA7134_MPEG_DVB, |
2550 | .gpiomask = 1 << 21, | 2551 | .gpiomask = 0x0200000, |
2551 | .inputs = {{ | 2552 | .inputs = {{ |
2552 | .name = name_tv, | 2553 | .name = name_tv, |
2553 | .vmux = 1, | 2554 | .vmux = 1, |
diff --git a/drivers/media/video/saa7134/saa7134-i2c.c b/drivers/media/video/saa7134/saa7134-i2c.c index cce8da6a4f94..62c107e7759d 100644 --- a/drivers/media/video/saa7134/saa7134-i2c.c +++ b/drivers/media/video/saa7134/saa7134-i2c.c | |||
@@ -370,6 +370,8 @@ static int attach_inform(struct i2c_client *client) | |||
370 | 370 | ||
371 | tun_setup.type = tuner; | 371 | tun_setup.type = tuner; |
372 | tun_setup.addr = saa7134_boards[dev->board].tuner_addr; | 372 | tun_setup.addr = saa7134_boards[dev->board].tuner_addr; |
373 | tun_setup.config = saa7134_boards[dev->board].tuner_config; | ||
374 | tun_setup.gpio_func = (tuner_gpio_func_t) saa7134_set_gpio; | ||
373 | 375 | ||
374 | if ((tun_setup.addr == ADDR_UNSET)||(tun_setup.addr == client->addr)) { | 376 | if ((tun_setup.addr == ADDR_UNSET)||(tun_setup.addr == client->addr)) { |
375 | 377 | ||
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index 7b5ae194bb11..303c0806df91 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h | |||
@@ -280,6 +280,7 @@ struct saa7134_board { | |||
280 | unsigned char radio_addr; | 280 | unsigned char radio_addr; |
281 | 281 | ||
282 | unsigned int tda9887_conf; | 282 | unsigned int tda9887_conf; |
283 | unsigned int tuner_config; | ||
283 | 284 | ||
284 | /* peripheral I/O */ | 285 | /* peripheral I/O */ |
285 | enum saa7134_video_out video_out; | 286 | enum saa7134_video_out video_out; |
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 15dbc6bf42a7..522ec1c35b8c 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c | |||
@@ -144,7 +144,8 @@ static void set_freq(struct i2c_client *c, unsigned long freq) | |||
144 | } | 144 | } |
145 | 145 | ||
146 | static void set_type(struct i2c_client *c, unsigned int type, | 146 | static void set_type(struct i2c_client *c, unsigned int type, |
147 | unsigned int new_mode_mask) | 147 | unsigned int new_mode_mask, unsigned int new_config, |
148 | tuner_gpio_func_t gpio_func) | ||
148 | { | 149 | { |
149 | struct tuner *t = i2c_get_clientdata(c); | 150 | struct tuner *t = i2c_get_clientdata(c); |
150 | unsigned char buffer[4]; | 151 | unsigned char buffer[4]; |
@@ -173,6 +174,11 @@ static void set_type(struct i2c_client *c, unsigned int type, | |||
173 | microtune_init(c); | 174 | microtune_init(c); |
174 | break; | 175 | break; |
175 | case TUNER_PHILIPS_TDA8290: | 176 | case TUNER_PHILIPS_TDA8290: |
177 | t->config = new_config; | ||
178 | if (gpio_func != NULL) { | ||
179 | tuner_dbg("Defining GPIO function\n"); | ||
180 | t->gpio_func = gpio_func; | ||
181 | } | ||
176 | tda8290_init(c); | 182 | tda8290_init(c); |
177 | break; | 183 | break; |
178 | case TUNER_TEA5767: | 184 | case TUNER_TEA5767: |
@@ -234,10 +240,11 @@ static void set_addr(struct i2c_client *c, struct tuner_setup *tun_setup) | |||
234 | 240 | ||
235 | tuner_dbg("set addr for type %i\n", t->type); | 241 | tuner_dbg("set addr for type %i\n", t->type); |
236 | 242 | ||
237 | if ( t->type == UNSET && ((tun_setup->addr == ADDR_UNSET && | 243 | if ( (t->type == UNSET && ((tun_setup->addr == ADDR_UNSET) && |
238 | (t->mode_mask & tun_setup->mode_mask)) || | 244 | (t->mode_mask & tun_setup->mode_mask))) || |
239 | tun_setup->addr == c->addr)) { | 245 | (tun_setup->addr == c->addr)) { |
240 | set_type(c, tun_setup->type, tun_setup->mode_mask); | 246 | set_type(c, tun_setup->type, tun_setup->mode_mask, |
247 | tun_setup->config, tun_setup->gpio_func); | ||
241 | } | 248 | } |
242 | } | 249 | } |
243 | 250 | ||
@@ -496,7 +503,7 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind) | |||
496 | register_client: | 503 | register_client: |
497 | tuner_info("chip found @ 0x%x (%s)\n", addr << 1, adap->name); | 504 | tuner_info("chip found @ 0x%x (%s)\n", addr << 1, adap->name); |
498 | i2c_attach_client (&t->i2c); | 505 | i2c_attach_client (&t->i2c); |
499 | set_type (&t->i2c,t->type, t->mode_mask); | 506 | set_type (&t->i2c,t->type, t->mode_mask, t->config, t->gpio_func); |
500 | return 0; | 507 | return 0; |
501 | } | 508 | } |
502 | 509 | ||
@@ -576,10 +583,11 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
576 | switch (cmd) { | 583 | switch (cmd) { |
577 | /* --- configuration --- */ | 584 | /* --- configuration --- */ |
578 | case TUNER_SET_TYPE_ADDR: | 585 | case TUNER_SET_TYPE_ADDR: |
579 | tuner_dbg ("Calling set_type_addr for type=%d, addr=0x%02x, mode=0x%02x\n", | 586 | tuner_dbg ("Calling set_type_addr for type=%d, addr=0x%02x, mode=0x%02x, config=0x%02x\n", |
580 | ((struct tuner_setup *)arg)->type, | 587 | ((struct tuner_setup *)arg)->type, |
581 | ((struct tuner_setup *)arg)->addr, | 588 | ((struct tuner_setup *)arg)->addr, |
582 | ((struct tuner_setup *)arg)->mode_mask); | 589 | ((struct tuner_setup *)arg)->mode_mask, |
590 | ((struct tuner_setup *)arg)->config); | ||
583 | 591 | ||
584 | set_addr(client, (struct tuner_setup *)arg); | 592 | set_addr(client, (struct tuner_setup *)arg); |
585 | break; | 593 | break; |