aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorOndrej Zary <linux@rainbow-software.org>2013-04-06 13:21:36 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-04-08 06:01:36 -0400
commitcdcd141c95f0c2b88e0b0869028c320cd031a23b (patch)
treec6595152b71a5aa24bdd741a606212c6e72030d8 /drivers
parent5b0e5350cecb5a370ecdaa71ac113728e36e1d55 (diff)
[media] tuner-core: Change config from unsigned int to void *
config looks like a hack that was added to tuner-core to allow some configuration of TDA8290 tuner (it's not used by any other driver). But with the new configuration options of tda8290 driver (no_i2c_gate and std_map), it's no longer sufficient. Change config to be void * instead, which allows passing tuner-dependent config struct to drivers. Also update saa7134 driver to reflect this change (no other driver uses this). Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/pci/saa7134/saa7134-cards.c40
-rw-r--r--drivers/media/pci/saa7134/saa7134.h3
-rw-r--r--drivers/media/v4l2-core/tuner-core.c20
3 files changed, 29 insertions, 34 deletions
diff --git a/drivers/media/pci/saa7134/saa7134-cards.c b/drivers/media/pci/saa7134/saa7134-cards.c
index dc68cf1070f7..29fb7a9ac2a4 100644
--- a/drivers/media/pci/saa7134/saa7134-cards.c
+++ b/drivers/media/pci/saa7134/saa7134-cards.c
@@ -2760,7 +2760,7 @@ struct saa7134_board saa7134_boards[] = {
2760 .radio_type = UNSET, 2760 .radio_type = UNSET,
2761 .tuner_addr = ADDR_UNSET, 2761 .tuner_addr = ADDR_UNSET,
2762 .radio_addr = ADDR_UNSET, 2762 .radio_addr = ADDR_UNSET,
2763 .tuner_config = 0, 2763 .tda829x_conf = { .lna_cfg = 0 },
2764 .mpeg = SAA7134_MPEG_DVB, 2764 .mpeg = SAA7134_MPEG_DVB,
2765 .gpiomask = 0x0200000, 2765 .gpiomask = 0x0200000,
2766 .inputs = {{ 2766 .inputs = {{
@@ -3291,7 +3291,7 @@ struct saa7134_board saa7134_boards[] = {
3291 .radio_type = UNSET, 3291 .radio_type = UNSET,
3292 .tuner_addr = ADDR_UNSET, 3292 .tuner_addr = ADDR_UNSET,
3293 .radio_addr = ADDR_UNSET, 3293 .radio_addr = ADDR_UNSET,
3294 .tuner_config = 1, 3294 .tda829x_conf = { .lna_cfg = 1 },
3295 .mpeg = SAA7134_MPEG_DVB, 3295 .mpeg = SAA7134_MPEG_DVB,
3296 .gpiomask = 0x000200000, 3296 .gpiomask = 0x000200000,
3297 .inputs = {{ 3297 .inputs = {{
@@ -3395,7 +3395,7 @@ struct saa7134_board saa7134_boards[] = {
3395 .radio_type = UNSET, 3395 .radio_type = UNSET,
3396 .tuner_addr = ADDR_UNSET, 3396 .tuner_addr = ADDR_UNSET,
3397 .radio_addr = ADDR_UNSET, 3397 .radio_addr = ADDR_UNSET,
3398 .tuner_config = 1, 3398 .tda829x_conf = { .lna_cfg = 1 },
3399 .mpeg = SAA7134_MPEG_DVB, 3399 .mpeg = SAA7134_MPEG_DVB,
3400 .gpiomask = 0x0200100, 3400 .gpiomask = 0x0200100,
3401 .inputs = {{ 3401 .inputs = {{
@@ -3426,7 +3426,7 @@ struct saa7134_board saa7134_boards[] = {
3426 .radio_type = UNSET, 3426 .radio_type = UNSET,
3427 .tuner_addr = ADDR_UNSET, 3427 .tuner_addr = ADDR_UNSET,
3428 .radio_addr = ADDR_UNSET, 3428 .radio_addr = ADDR_UNSET,
3429 .tuner_config = 3, 3429 .tda829x_conf = { .lna_cfg = 3 },
3430 .mpeg = SAA7134_MPEG_DVB, 3430 .mpeg = SAA7134_MPEG_DVB,
3431 .ts_type = SAA7134_MPEG_TS_SERIAL, 3431 .ts_type = SAA7134_MPEG_TS_SERIAL,
3432 .ts_force_val = 1, 3432 .ts_force_val = 1,
@@ -3459,7 +3459,7 @@ struct saa7134_board saa7134_boards[] = {
3459 .radio_type = UNSET, 3459 .radio_type = UNSET,
3460 .tuner_addr = ADDR_UNSET, 3460 .tuner_addr = ADDR_UNSET,
3461 .radio_addr = ADDR_UNSET, 3461 .radio_addr = ADDR_UNSET,
3462 .tuner_config = 3, 3462 .tda829x_conf = { .lna_cfg = 3 },
3463 .mpeg = SAA7134_MPEG_DVB, 3463 .mpeg = SAA7134_MPEG_DVB,
3464 .ts_type = SAA7134_MPEG_TS_SERIAL, 3464 .ts_type = SAA7134_MPEG_TS_SERIAL,
3465 .gpiomask = 0x0800100, /* GPIO 21 is an INPUT */ 3465 .gpiomask = 0x0800100, /* GPIO 21 is an INPUT */
@@ -3683,7 +3683,7 @@ struct saa7134_board saa7134_boards[] = {
3683 .radio_type = UNSET, 3683 .radio_type = UNSET,
3684 .tuner_addr = ADDR_UNSET, 3684 .tuner_addr = ADDR_UNSET,
3685 .radio_addr = ADDR_UNSET, 3685 .radio_addr = ADDR_UNSET,
3686 .tuner_config = 2, 3686 .tda829x_conf = { .lna_cfg = 2 },
3687 .mpeg = SAA7134_MPEG_DVB, 3687 .mpeg = SAA7134_MPEG_DVB,
3688 .gpiomask = 0x0200000, 3688 .gpiomask = 0x0200000,
3689 .inputs = {{ 3689 .inputs = {{
@@ -3736,7 +3736,7 @@ struct saa7134_board saa7134_boards[] = {
3736 .radio_type = UNSET, 3736 .radio_type = UNSET,
3737 .tuner_addr = ADDR_UNSET, 3737 .tuner_addr = ADDR_UNSET,
3738 .radio_addr = ADDR_UNSET, 3738 .radio_addr = ADDR_UNSET,
3739 .tuner_config = 2, 3739 .tda829x_conf = { .lna_cfg = 2 },
3740 .mpeg = SAA7134_MPEG_DVB, 3740 .mpeg = SAA7134_MPEG_DVB,
3741 .gpiomask = 0x0200000, 3741 .gpiomask = 0x0200000,
3742 .inputs = {{ 3742 .inputs = {{
@@ -3754,7 +3754,7 @@ struct saa7134_board saa7134_boards[] = {
3754 .radio_type = UNSET, 3754 .radio_type = UNSET,
3755 .tuner_addr = ADDR_UNSET, 3755 .tuner_addr = ADDR_UNSET,
3756 .radio_addr = ADDR_UNSET, 3756 .radio_addr = ADDR_UNSET,
3757 .tuner_config = 2, 3757 .tda829x_conf = { .lna_cfg = 2 },
3758 .gpiomask = 1 << 21, 3758 .gpiomask = 1 << 21,
3759 .mpeg = SAA7134_MPEG_DVB, 3759 .mpeg = SAA7134_MPEG_DVB,
3760 .inputs = {{ 3760 .inputs = {{
@@ -3887,7 +3887,7 @@ struct saa7134_board saa7134_boards[] = {
3887 .radio_type = UNSET, 3887 .radio_type = UNSET,
3888 .tuner_addr = ADDR_UNSET, 3888 .tuner_addr = ADDR_UNSET,
3889 .radio_addr = ADDR_UNSET, 3889 .radio_addr = ADDR_UNSET,
3890 .tuner_config = 0, 3890 .tda829x_conf = { .lna_cfg = 0 },
3891 .mpeg = SAA7134_MPEG_DVB, 3891 .mpeg = SAA7134_MPEG_DVB,
3892 .inputs = {{ 3892 .inputs = {{
3893 .name = name_tv, /* FIXME: analog tv untested */ 3893 .name = name_tv, /* FIXME: analog tv untested */
@@ -3903,7 +3903,7 @@ struct saa7134_board saa7134_boards[] = {
3903 .radio_type = UNSET, 3903 .radio_type = UNSET,
3904 .tuner_addr = ADDR_UNSET, 3904 .tuner_addr = ADDR_UNSET,
3905 .radio_addr = ADDR_UNSET, 3905 .radio_addr = ADDR_UNSET,
3906 .tuner_config = 2, 3906 .tda829x_conf = { .lna_cfg = 2 },
3907 .gpiomask = 0x020200000, 3907 .gpiomask = 0x020200000,
3908 .inputs = {{ 3908 .inputs = {{
3909 .name = name_tv, 3909 .name = name_tv,
@@ -3937,7 +3937,7 @@ struct saa7134_board saa7134_boards[] = {
3937 .radio_type = UNSET, 3937 .radio_type = UNSET,
3938 .tuner_addr = ADDR_UNSET, 3938 .tuner_addr = ADDR_UNSET,
3939 .radio_addr = ADDR_UNSET, 3939 .radio_addr = ADDR_UNSET,
3940 .tuner_config = 0, 3940 .tda829x_conf = { .lna_cfg = 0 },
3941 .gpiomask = 0x020200000, 3941 .gpiomask = 0x020200000,
3942 .inputs = {{ 3942 .inputs = {{
3943 .name = name_tv, 3943 .name = name_tv,
@@ -4737,7 +4737,7 @@ struct saa7134_board saa7134_boards[] = {
4737 .radio_type = UNSET, 4737 .radio_type = UNSET,
4738 .tuner_addr = ADDR_UNSET, 4738 .tuner_addr = ADDR_UNSET,
4739 .radio_addr = ADDR_UNSET, 4739 .radio_addr = ADDR_UNSET,
4740 .tuner_config = 2, 4740 .tda829x_conf = { .lna_cfg = 2 },
4741 .mpeg = SAA7134_MPEG_DVB, 4741 .mpeg = SAA7134_MPEG_DVB,
4742 .gpiomask = 0x0200000, 4742 .gpiomask = 0x0200000,
4743 .inputs = {{ 4743 .inputs = {{
@@ -4823,7 +4823,7 @@ struct saa7134_board saa7134_boards[] = {
4823 .radio_type = UNSET, 4823 .radio_type = UNSET,
4824 .tuner_addr = ADDR_UNSET, 4824 .tuner_addr = ADDR_UNSET,
4825 .radio_addr = ADDR_UNSET, 4825 .radio_addr = ADDR_UNSET,
4826 .tuner_config = 0, 4826 .tda829x_conf = { .lna_cfg = 0 },
4827 .mpeg = SAA7134_MPEG_DVB, 4827 .mpeg = SAA7134_MPEG_DVB,
4828 .inputs = {{ 4828 .inputs = {{
4829 .name = name_tv, 4829 .name = name_tv,
@@ -4847,7 +4847,7 @@ struct saa7134_board saa7134_boards[] = {
4847 .radio_type = UNSET, 4847 .radio_type = UNSET,
4848 .tuner_addr = ADDR_UNSET, 4848 .tuner_addr = ADDR_UNSET,
4849 .radio_addr = ADDR_UNSET, 4849 .radio_addr = ADDR_UNSET,
4850 .tuner_config = 2, 4850 .tda829x_conf = { .lna_cfg = 2 },
4851 .mpeg = SAA7134_MPEG_DVB, 4851 .mpeg = SAA7134_MPEG_DVB,
4852 .gpiomask = 0x0200000, 4852 .gpiomask = 0x0200000,
4853 .inputs = { { 4853 .inputs = { {
@@ -5057,7 +5057,7 @@ struct saa7134_board saa7134_boards[] = {
5057 .radio_type = UNSET, 5057 .radio_type = UNSET,
5058 .tuner_addr = ADDR_UNSET, 5058 .tuner_addr = ADDR_UNSET,
5059 .radio_addr = ADDR_UNSET, 5059 .radio_addr = ADDR_UNSET,
5060 .tuner_config = 2, 5060 .tda829x_conf = { .lna_cfg = 2 },
5061 .gpiomask = 1 << 21, 5061 .gpiomask = 1 << 21,
5062 .mpeg = SAA7134_MPEG_DVB, 5062 .mpeg = SAA7134_MPEG_DVB,
5063 .inputs = {{ 5063 .inputs = {{
@@ -5087,7 +5087,7 @@ struct saa7134_board saa7134_boards[] = {
5087 .radio_type = UNSET, 5087 .radio_type = UNSET,
5088 .tuner_addr = ADDR_UNSET, 5088 .tuner_addr = ADDR_UNSET,
5089 .radio_addr = ADDR_UNSET, 5089 .radio_addr = ADDR_UNSET,
5090 .tuner_config = 2, 5090 .tda829x_conf = { .lna_cfg = 2 },
5091 .gpiomask = 1 << 21, 5091 .gpiomask = 1 << 21,
5092 .mpeg = SAA7134_MPEG_DVB, 5092 .mpeg = SAA7134_MPEG_DVB,
5093 .inputs = {{ 5093 .inputs = {{
@@ -5176,7 +5176,7 @@ struct saa7134_board saa7134_boards[] = {
5176 .radio_type = UNSET, 5176 .radio_type = UNSET,
5177 .tuner_addr = ADDR_UNSET, 5177 .tuner_addr = ADDR_UNSET,
5178 .radio_addr = ADDR_UNSET, 5178 .radio_addr = ADDR_UNSET,
5179 .tuner_config = 0, 5179 .tda829x_conf = { .lna_cfg = 0 },
5180 .mpeg = SAA7134_MPEG_DVB, 5180 .mpeg = SAA7134_MPEG_DVB,
5181 .gpiomask = 0x0200000, 5181 .gpiomask = 0x0200000,
5182 .inputs = { { 5182 .inputs = { {
@@ -5406,7 +5406,7 @@ struct saa7134_board saa7134_boards[] = {
5406 .radio_type = UNSET, 5406 .radio_type = UNSET,
5407 .tuner_addr = ADDR_UNSET, 5407 .tuner_addr = ADDR_UNSET,
5408 .radio_addr = ADDR_UNSET, 5408 .radio_addr = ADDR_UNSET,
5409 .tuner_config = 0, 5409 .tda829x_conf = { .lna_cfg = 0 },
5410 .mpeg = SAA7134_MPEG_DVB, 5410 .mpeg = SAA7134_MPEG_DVB,
5411 .ts_type = SAA7134_MPEG_TS_PARALLEL, 5411 .ts_type = SAA7134_MPEG_TS_PARALLEL,
5412 .inputs = {{ 5412 .inputs = {{
@@ -5629,7 +5629,7 @@ struct saa7134_board saa7134_boards[] = {
5629 .audio_clock = 0x00187de7, 5629 .audio_clock = 0x00187de7,
5630 .tuner_type = TUNER_PHILIPS_TDA8290, 5630 .tuner_type = TUNER_PHILIPS_TDA8290,
5631 .radio_type = UNSET, 5631 .radio_type = UNSET,
5632 .tuner_config = 3, 5632 .tda829x_conf = { .lna_cfg = 3 },
5633 .tuner_addr = ADDR_UNSET, 5633 .tuner_addr = ADDR_UNSET,
5634 .radio_addr = ADDR_UNSET, 5634 .radio_addr = ADDR_UNSET,
5635 .gpiomask = 0x02050000, 5635 .gpiomask = 0x02050000,
@@ -7633,7 +7633,7 @@ static void saa7134_tuner_setup(struct saa7134_dev *dev)
7633 if ((dev->tuner_type != TUNER_ABSENT) && (dev->tuner_type != UNSET)) { 7633 if ((dev->tuner_type != TUNER_ABSENT) && (dev->tuner_type != UNSET)) {
7634 tun_setup.type = dev->tuner_type; 7634 tun_setup.type = dev->tuner_type;
7635 tun_setup.addr = dev->tuner_addr; 7635 tun_setup.addr = dev->tuner_addr;
7636 tun_setup.config = saa7134_boards[dev->board].tuner_config; 7636 tun_setup.config = &saa7134_boards[dev->board].tda829x_conf;
7637 tun_setup.tuner_callback = saa7134_tuner_callback; 7637 tun_setup.tuner_callback = saa7134_tuner_callback;
7638 7638
7639 tun_setup.mode_mask = mode_mask; 7639 tun_setup.mode_mask = mode_mask;
diff --git a/drivers/media/pci/saa7134/saa7134.h b/drivers/media/pci/saa7134/saa7134.h
index 62169dd74c6a..b90b48821104 100644
--- a/drivers/media/pci/saa7134/saa7134.h
+++ b/drivers/media/pci/saa7134/saa7134.h
@@ -45,6 +45,7 @@
45#if IS_ENABLED(CONFIG_VIDEO_SAA7134_DVB) 45#if IS_ENABLED(CONFIG_VIDEO_SAA7134_DVB)
46#include <media/videobuf-dvb.h> 46#include <media/videobuf-dvb.h>
47#endif 47#endif
48#include "tda8290.h"
48 49
49#define UNSET (-1U) 50#define UNSET (-1U)
50 51
@@ -390,7 +391,7 @@ struct saa7134_board {
390 unsigned char rds_addr; 391 unsigned char rds_addr;
391 392
392 unsigned int tda9887_conf; 393 unsigned int tda9887_conf;
393 unsigned int tuner_config; 394 struct tda829x_config tda829x_conf;
394 395
395 /* peripheral I/O */ 396 /* peripheral I/O */
396 enum saa7134_video_out video_out; 397 enum saa7134_video_out video_out;
diff --git a/drivers/media/v4l2-core/tuner-core.c b/drivers/media/v4l2-core/tuner-core.c
index cf9a9af90322..7d60c5d38ca0 100644
--- a/drivers/media/v4l2-core/tuner-core.c
+++ b/drivers/media/v4l2-core/tuner-core.c
@@ -132,7 +132,7 @@ struct tuner {
132 bool standby; /* Standby mode */ 132 bool standby; /* Standby mode */
133 133
134 unsigned int type; /* chip type id */ 134 unsigned int type; /* chip type id */
135 unsigned int config; 135 void *config;
136 const char *name; 136 const char *name;
137}; 137};
138 138
@@ -270,9 +270,8 @@ static const struct analog_demod_ops tuner_analog_ops = {
270 * @c: i2c_client descriptoy 270 * @c: i2c_client descriptoy
271 * @type: type of the tuner (e. g. tuner number) 271 * @type: type of the tuner (e. g. tuner number)
272 * @new_mode_mask: Indicates if tuner supports TV and/or Radio 272 * @new_mode_mask: Indicates if tuner supports TV and/or Radio
273 * @new_config: an optional parameter ranging from 0-255 used by 273 * @new_config: an optional parameter used by a few tuners to adjust
274 a few tuners to adjust an internal parameter, 274 internal parameters, like LNA mode
275 like LNA mode
276 * @tuner_callback: an optional function to be called when switching 275 * @tuner_callback: an optional function to be called when switching
277 * to analog mode 276 * to analog mode
278 * 277 *
@@ -280,7 +279,7 @@ static const struct analog_demod_ops tuner_analog_ops = {
280 * by tun_setup structure. It contains several per-tuner initialization "magic" 279 * by tun_setup structure. It contains several per-tuner initialization "magic"
281 */ 280 */
282static void set_type(struct i2c_client *c, unsigned int type, 281static void set_type(struct i2c_client *c, unsigned int type,
283 unsigned int new_mode_mask, unsigned int new_config, 282 unsigned int new_mode_mask, void *new_config,
284 int (*tuner_callback) (void *dev, int component, int cmd, int arg)) 283 int (*tuner_callback) (void *dev, int component, int cmd, int arg))
285{ 284{
286 struct tuner *t = to_tuner(i2c_get_clientdata(c)); 285 struct tuner *t = to_tuner(i2c_get_clientdata(c));
@@ -295,8 +294,7 @@ static void set_type(struct i2c_client *c, unsigned int type,
295 } 294 }
296 295
297 t->type = type; 296 t->type = type;
298 /* prevent invalid config values */ 297 t->config = new_config;
299 t->config = new_config < 256 ? new_config : 0;
300 if (tuner_callback != NULL) { 298 if (tuner_callback != NULL) {
301 tuner_dbg("defining GPIO callback\n"); 299 tuner_dbg("defining GPIO callback\n");
302 t->fe.callback = tuner_callback; 300 t->fe.callback = tuner_callback;
@@ -314,11 +312,8 @@ static void set_type(struct i2c_client *c, unsigned int type,
314 break; 312 break;
315 case TUNER_PHILIPS_TDA8290: 313 case TUNER_PHILIPS_TDA8290:
316 { 314 {
317 struct tda829x_config cfg = {
318 .lna_cfg = t->config,
319 };
320 if (!dvb_attach(tda829x_attach, &t->fe, t->i2c->adapter, 315 if (!dvb_attach(tda829x_attach, &t->fe, t->i2c->adapter,
321 t->i2c->addr, &cfg)) 316 t->i2c->addr, t->config))
322 goto attach_failed; 317 goto attach_failed;
323 break; 318 break;
324 } 319 }
@@ -407,7 +402,6 @@ static void set_type(struct i2c_client *c, unsigned int type,
407 case TUNER_NXP_TDA18271: 402 case TUNER_NXP_TDA18271:
408 { 403 {
409 struct tda18271_config cfg = { 404 struct tda18271_config cfg = {
410 .config = t->config,
411 .small_i2c = TDA18271_03_BYTE_CHUNK_INIT, 405 .small_i2c = TDA18271_03_BYTE_CHUNK_INIT,
412 }; 406 };
413 407
@@ -509,7 +503,7 @@ static int tuner_s_type_addr(struct v4l2_subdev *sd,
509 struct tuner *t = to_tuner(sd); 503 struct tuner *t = to_tuner(sd);
510 struct i2c_client *c = v4l2_get_subdevdata(sd); 504 struct i2c_client *c = v4l2_get_subdevdata(sd);
511 505
512 tuner_dbg("Calling set_type_addr for type=%d, addr=0x%02x, mode=0x%02x, config=0x%02x\n", 506 tuner_dbg("Calling set_type_addr for type=%d, addr=0x%02x, mode=0x%02x, config=%p\n",
513 tun_setup->type, 507 tun_setup->type,
514 tun_setup->addr, 508 tun_setup->addr,
515 tun_setup->mode_mask, 509 tun_setup->mode_mask,