aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2007-10-18 18:56:47 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-01-25 16:00:54 -0500
commit7f1711234e6a21c153e892758d9d82c333ab37ac (patch)
tree19281fdae9f51a25c119dccf54515192614b242f /drivers
parent2d94dfc8c38edf63e91e48fd55c3a8822b6a9ced (diff)
V4L/DVB (6384): Replace TDA9887_SET_CONFIG by TUNER_SET_CONFIG
Currently, the only tuner-specific device that allows special configurations is tda9887. However, tea5767 also may require some special configurations (for example, to specify a different Xtal freq). This patch replaces TDA9887_SET_CONFIG by a more generic internal ioctl (TUNER_SET_CONFIG). The newer one allows specifying what tuner is appliable to a configuration set, and allows an arbitrary configuration struct. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/dvb/dvb-core/dvb_frontend.h3
-rw-r--r--drivers/media/video/bt8xx/bttv-cards.c8
-rw-r--r--drivers/media/video/cx88/cx88-i2c.c10
-rw-r--r--drivers/media/video/em28xx/em28xx-i2c.c8
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c5
-rw-r--r--drivers/media/video/saa7134/saa7134-cards.c13
-rw-r--r--drivers/media/video/saa7134/saa7134-dvb.c19
-rw-r--r--drivers/media/video/saa7134/saa7134-i2c.c13
-rw-r--r--drivers/media/video/saa7134/saa7134-video.c12
-rw-r--r--drivers/media/video/tuner-core.c23
-rw-r--r--drivers/media/video/tuner-simple.c15
-rw-r--r--drivers/media/video/v4l2-common.c2
12 files changed, 101 insertions, 30 deletions
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.h b/drivers/media/dvb/dvb-core/dvb_frontend.h
index a5262e852c82..c49fa049717e 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.h
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.h
@@ -84,6 +84,9 @@ struct dvb_tuner_ops {
84 /** This is support for demods like the mt352 - fills out the supplied buffer with what to write. */ 84 /** This is support for demods like the mt352 - fills out the supplied buffer with what to write. */
85 int (*calc_regs)(struct dvb_frontend *fe, struct dvb_frontend_parameters *p, u8 *buf, int buf_len); 85 int (*calc_regs)(struct dvb_frontend *fe, struct dvb_frontend_parameters *p, u8 *buf, int buf_len);
86 86
87 /** This is to allow setting tuner-specific configs */
88 int (*set_config)(struct dvb_frontend *fe, void *priv_cfg);
89
87 int (*get_frequency)(struct dvb_frontend *fe, u32 *frequency); 90 int (*get_frequency)(struct dvb_frontend *fe, u32 *frequency);
88 int (*get_bandwidth)(struct dvb_frontend *fe, u32 *bandwidth); 91 int (*get_bandwidth)(struct dvb_frontend *fe, u32 *bandwidth);
89 92
diff --git a/drivers/media/video/bt8xx/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c
index 585d1ef95afd..4f91f98db37b 100644
--- a/drivers/media/video/bt8xx/bttv-cards.c
+++ b/drivers/media/video/bt8xx/bttv-cards.c
@@ -3574,8 +3574,12 @@ void __devinit bttv_init_card2(struct bttv *btv)
3574 } 3574 }
3575 3575
3576 if (btv->tda9887_conf) { 3576 if (btv->tda9887_conf) {
3577 bttv_call_i2c_clients(btv, TDA9887_SET_CONFIG, 3577 struct v4l2_priv_tun_config tda9887_cfg;
3578 &btv->tda9887_conf); 3578
3579 tda9887_cfg.tuner = TUNER_TDA9887;
3580 tda9887_cfg.priv = &btv->tda9887_conf;
3581
3582 bttv_call_i2c_clients(btv, TUNER_SET_CONFIG, &tda9887_cfg);
3579 } 3583 }
3580 3584
3581 btv->svhs = bttv_tvcards[btv->c.type].svhs; 3585 btv->svhs = bttv_tvcards[btv->c.type].svhs;
diff --git a/drivers/media/video/cx88/cx88-i2c.c b/drivers/media/video/cx88/cx88-i2c.c
index c8b1c50625f4..937497c86247 100644
--- a/drivers/media/video/cx88/cx88-i2c.c
+++ b/drivers/media/video/cx88/cx88-i2c.c
@@ -127,8 +127,14 @@ static int attach_inform(struct i2c_client *client)
127 } 127 }
128 } 128 }
129 129
130 if (core->board.tda9887_conf) 130 if (core->board.tda9887_conf) {
131 client->driver->command(client, TDA9887_SET_CONFIG, &core->board.tda9887_conf); 131 struct v4l2_priv_tun_config tda9887_cfg;
132
133 tda9887_cfg.tuner = TUNER_TDA9887;
134 tda9887_cfg.priv = &core->board.tda9887_conf;
135
136 client->driver->command(client, TUNER_SET_CONFIG, &tda9887_cfg);
137 }
132 return 0; 138 return 0;
133} 139}
134 140
diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c
index e3a4aa7a9df4..e48191fb1dde 100644
--- a/drivers/media/video/em28xx/em28xx-i2c.c
+++ b/drivers/media/video/em28xx/em28xx-i2c.c
@@ -421,6 +421,8 @@ static int attach_inform(struct i2c_client *client)
421 case 0x96: 421 case 0x96:
422 case 0x94: 422 case 0x94:
423 { 423 {
424 struct v4l2_priv_tun_config tda9887_cfg;
425
424 struct tuner_setup tun_setup; 426 struct tuner_setup tun_setup;
425 427
426 tun_setup.mode_mask = T_ANALOG_TV | T_RADIO; 428 tun_setup.mode_mask = T_ANALOG_TV | T_RADIO;
@@ -428,7 +430,11 @@ static int attach_inform(struct i2c_client *client)
428 tun_setup.addr = client->addr; 430 tun_setup.addr = client->addr;
429 431
430 em28xx_i2c_call_clients(dev, TUNER_SET_TYPE_ADDR, &tun_setup); 432 em28xx_i2c_call_clients(dev, TUNER_SET_TYPE_ADDR, &tun_setup);
431 em28xx_i2c_call_clients(dev, TDA9887_SET_CONFIG, &dev->tda9887_conf); 433
434 tda9887_cfg.tuner = TUNER_TDA9887;
435 tda9887_cfg.priv = &dev->tda9887_conf;
436 em28xx_i2c_call_clients(dev, TUNER_SET_CONFIG,
437 &tda9887_cfg);
432 break; 438 break;
433 } 439 }
434 case 0x42: 440 case 0x42:
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index 0906bc5766cc..bb0933f9d84c 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -186,11 +186,6 @@ static void em28xx_config_i2c(struct em28xx *dev)
186 f.frequency = 9076; /* FIXME:remove magic number */ 186 f.frequency = 9076; /* FIXME:remove magic number */
187 dev->ctl_freq = f.frequency; 187 dev->ctl_freq = f.frequency;
188 em28xx_i2c_call_clients(dev, VIDIOC_S_FREQUENCY, &f); 188 em28xx_i2c_call_clients(dev, VIDIOC_S_FREQUENCY, &f);
189
190 /* configure tda9887 */
191
192
193/* em28xx_i2c_call_clients(dev,VIDIOC_S_STD,&dev->tvnorm->id); */
194} 189}
195 190
196/* 191/*
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
index 98c1b084a716..78d7d7059a9e 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -4570,8 +4570,17 @@ int saa7134_board_init2(struct saa7134_dev *dev)
4570 4570
4571 printk(KERN_INFO "%s Tuner type is %d\n", dev->name, dev->tuner_type); 4571 printk(KERN_INFO "%s Tuner type is %d\n", dev->name, dev->tuner_type);
4572 if (dev->tuner_type == TUNER_PHILIPS_FMD1216ME_MK3) { 4572 if (dev->tuner_type == TUNER_PHILIPS_FMD1216ME_MK3) {
4573 dev->tda9887_conf = TDA9887_PRESENT | TDA9887_PORT1_ACTIVE | TDA9887_PORT2_ACTIVE; 4573 struct v4l2_priv_tun_config tda9887_cfg;
4574 saa7134_i2c_call_clients(dev,TDA9887_SET_CONFIG, &dev->tda9887_conf); 4574
4575 tda9887_cfg.tuner = TUNER_TDA9887;
4576 tda9887_cfg.priv = &dev->tda9887_conf;
4577
4578 dev->tda9887_conf = TDA9887_PRESENT |
4579 TDA9887_PORT1_ACTIVE |
4580 TDA9887_PORT2_ACTIVE;
4581
4582 saa7134_i2c_call_clients(dev, TUNER_SET_CONFIG,
4583 &tda9887_cfg);
4575 } 4584 }
4576 4585
4577 tun_setup.mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV; 4586 tun_setup.mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV;
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
index e1ab099ec4c6..a9ca5730826f 100644
--- a/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/drivers/media/video/saa7134/saa7134-dvb.c
@@ -1073,14 +1073,21 @@ static int dvb_init(struct saa7134_dev *dev)
1073 1073
1074static int dvb_fini(struct saa7134_dev *dev) 1074static int dvb_fini(struct saa7134_dev *dev)
1075{ 1075{
1076 static int on = TDA9887_PRESENT | TDA9887_PORT2_INACTIVE; 1076 /* FIXME: I suspect that this code is bogus, since the entry for
1077 Pinnacle 300I DVB-T PAL already defines the proper init to allow
1078 the detection of mt2032 (TDA9887_PORT2_INACTIVE)
1079 */
1080 if (dev->board == SAA7134_BOARD_PINNACLE_300I_DVBT_PAL) {
1081 struct v4l2_priv_tun_config tda9887_cfg;
1082 static int on = TDA9887_PRESENT | TDA9887_PORT2_INACTIVE;
1083
1084 tda9887_cfg.tuner = TUNER_TDA9887;
1085 tda9887_cfg.priv = &on;
1077 1086
1078 switch (dev->board) {
1079 case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL:
1080 /* otherwise we don't detect the tuner on next insmod */ 1087 /* otherwise we don't detect the tuner on next insmod */
1081 saa7134_i2c_call_clients(dev,TDA9887_SET_CONFIG,&on); 1088 saa7134_i2c_call_clients(dev, TUNER_SET_CONFIG, &tda9887_cfg);
1082 break; 1089 }
1083 }; 1090
1084 videobuf_dvb_unregister(&dev->dvb); 1091 videobuf_dvb_unregister(&dev->dvb);
1085 return 0; 1092 return 0;
1086} 1093}
diff --git a/drivers/media/video/saa7134/saa7134-i2c.c b/drivers/media/video/saa7134/saa7134-i2c.c
index 6deaad1a5480..800b397f8f16 100644
--- a/drivers/media/video/saa7134/saa7134-i2c.c
+++ b/drivers/media/video/saa7134/saa7134-i2c.c
@@ -323,7 +323,6 @@ static int attach_inform(struct i2c_client *client)
323{ 323{
324 struct saa7134_dev *dev = client->adapter->algo_data; 324 struct saa7134_dev *dev = client->adapter->algo_data;
325 int tuner = dev->tuner_type; 325 int tuner = dev->tuner_type;
326 int conf = dev->tda9887_conf;
327 struct tuner_setup tun_setup; 326 struct tuner_setup tun_setup;
328 327
329 d1printk( "%s i2c attach [addr=0x%x,client=%s]\n", 328 d1printk( "%s i2c attach [addr=0x%x,client=%s]\n",
@@ -360,7 +359,6 @@ static int attach_inform(struct i2c_client *client)
360 } 359 }
361 360
362 if (tuner != UNSET) { 361 if (tuner != UNSET) {
363
364 tun_setup.type = tuner; 362 tun_setup.type = tuner;
365 tun_setup.addr = saa7134_boards[dev->board].tuner_addr; 363 tun_setup.addr = saa7134_boards[dev->board].tuner_addr;
366 tun_setup.config = saa7134_boards[dev->board].tuner_config; 364 tun_setup.config = saa7134_boards[dev->board].tuner_config;
@@ -372,9 +370,18 @@ static int attach_inform(struct i2c_client *client)
372 370
373 client->driver->command(client,TUNER_SET_TYPE_ADDR, &tun_setup); 371 client->driver->command(client,TUNER_SET_TYPE_ADDR, &tun_setup);
374 } 372 }
373
374 if (tuner == TUNER_TDA9887) {
375 struct v4l2_priv_tun_config tda9887_cfg;
376
377 tda9887_cfg.tuner = TUNER_TDA9887;
378 tda9887_cfg.priv = &dev->tda9887_conf;
379
380 client->driver->command(client, TUNER_SET_CONFIG,
381 &tda9887_cfg);
382 }
375 } 383 }
376 384
377 client->driver->command(client, TDA9887_SET_CONFIG, &conf);
378 385
379 return 0; 386 return 0;
380} 387}
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c
index 6396d9b5c063..2c1d56ab2f2a 100644
--- a/drivers/media/video/saa7134/saa7134-video.c
+++ b/drivers/media/video/saa7134/saa7134-video.c
@@ -1236,16 +1236,24 @@ static int set_control(struct saa7134_dev *dev, struct saa7134_fh *fh,
1236 restart_overlay = 1; 1236 restart_overlay = 1;
1237 break; 1237 break;
1238 case V4L2_CID_PRIVATE_AUTOMUTE: 1238 case V4L2_CID_PRIVATE_AUTOMUTE:
1239 {
1240 struct v4l2_priv_tun_config tda9887_cfg;
1241
1242 tda9887_cfg.tuner = TUNER_TDA9887;
1243 tda9887_cfg.priv = &dev->tda9887_conf;
1244
1239 dev->ctl_automute = c->value; 1245 dev->ctl_automute = c->value;
1240 if (dev->tda9887_conf) { 1246 if (dev->tda9887_conf) {
1241 if (dev->ctl_automute) 1247 if (dev->ctl_automute)
1242 dev->tda9887_conf |= TDA9887_AUTOMUTE; 1248 dev->tda9887_conf |= TDA9887_AUTOMUTE;
1243 else 1249 else
1244 dev->tda9887_conf &= ~TDA9887_AUTOMUTE; 1250 dev->tda9887_conf &= ~TDA9887_AUTOMUTE;
1245 saa7134_i2c_call_clients(dev, TDA9887_SET_CONFIG, 1251
1246 &dev->tda9887_conf); 1252 saa7134_i2c_call_clients(dev, TUNER_SET_CONFIG,
1253 &tda9887_cfg);
1247 } 1254 }
1248 break; 1255 break;
1256 }
1249 default: 1257 default:
1250 return -EINVAL; 1258 return -EINVAL;
1251 } 1259 }
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index 9e99f3636d3d..d1d6c664bb09 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -889,14 +889,29 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
889 return 0; 889 return 0;
890 } 890 }
891#endif 891#endif
892 case TDA9887_SET_CONFIG: 892 case TUNER_SET_CONFIG:
893 if (t->type == TUNER_TDA9887) { 893 {
894 int *i = arg; 894 struct dvb_tuner_ops *fe_tuner_ops = &t->fe.ops.tuner_ops;
895 struct v4l2_priv_tun_config *cfg = arg;
896
897 if (t->type != cfg->tuner)
898 break;
895 899
896 t->tda9887_config = *i; 900 if (t->type == TUNER_TDA9887) {
901 t->tda9887_config = *(unsigned int *)cfg->priv;
897 set_freq(client, t->tv_freq); 902 set_freq(client, t->tv_freq);
903 break;
898 } 904 }
905
906 if (NULL == fe_tuner_ops->set_config) {
907 tuner_warn("Tuner frontend module has no way to "
908 "set config\n");
909 break;
910 }
911 fe_tuner_ops->set_config(&t->fe, cfg->priv);
912
899 break; 913 break;
914 }
900 /* --- v4l ioctls --- */ 915 /* --- v4l ioctls --- */
901 /* take care: bttv does userspace copying, we'll get a 916 /* take care: bttv does userspace copying, we'll get a
902 kernel pointer here... */ 917 kernel pointer here... */
diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c
index 7b93d3b1f4c6..eec13cb6cd6f 100644
--- a/drivers/media/video/tuner-simple.c
+++ b/drivers/media/video/tuner-simple.c
@@ -355,10 +355,14 @@ static int simple_set_tv_freq(struct dvb_frontend *fe,
355 } 355 }
356 priv->last_div = div; 356 priv->last_div = div;
357 if (t_params->has_tda9887) { 357 if (t_params->has_tda9887) {
358 struct v4l2_priv_tun_config tda9887_cfg;
358 int config = 0; 359 int config = 0;
359 int is_secam_l = (params->std & (V4L2_STD_SECAM_L | V4L2_STD_SECAM_LC)) && 360 int is_secam_l = (params->std & (V4L2_STD_SECAM_L | V4L2_STD_SECAM_LC)) &&
360 !(params->std & ~(V4L2_STD_SECAM_L | V4L2_STD_SECAM_LC)); 361 !(params->std & ~(V4L2_STD_SECAM_L | V4L2_STD_SECAM_LC));
361 362
363 tda9887_cfg.tuner = TUNER_TDA9887;
364 tda9887_cfg.priv = &config;
365
362 if (params->std == V4L2_STD_SECAM_LC) { 366 if (params->std == V4L2_STD_SECAM_LC) {
363 if (t_params->port1_active ^ t_params->port1_invert_for_secam_lc) 367 if (t_params->port1_active ^ t_params->port1_invert_for_secam_lc)
364 config |= TDA9887_PORT1_ACTIVE; 368 config |= TDA9887_PORT1_ACTIVE;
@@ -391,7 +395,8 @@ static int simple_set_tv_freq(struct dvb_frontend *fe,
391 } 395 }
392 if (t_params->default_pll_gating_18) 396 if (t_params->default_pll_gating_18)
393 config |= TDA9887_GATING_18; 397 config |= TDA9887_GATING_18;
394 i2c_clients_command(priv->i2c_props.adap, TDA9887_SET_CONFIG, &config); 398 i2c_clients_command(priv->i2c_props.adap, TUNER_SET_CONFIG,
399 &tda9887_cfg);
395 } 400 }
396 tuner_dbg("tv 0x%02x 0x%02x 0x%02x 0x%02x\n", 401 tuner_dbg("tv 0x%02x 0x%02x 0x%02x 0x%02x\n",
397 buffer[0],buffer[1],buffer[2],buffer[3]); 402 buffer[0],buffer[1],buffer[2],buffer[3]);
@@ -534,6 +539,11 @@ static int simple_set_radio_freq(struct dvb_frontend *fe,
534 539
535 if (t_params->has_tda9887) { 540 if (t_params->has_tda9887) {
536 int config = 0; 541 int config = 0;
542 struct v4l2_priv_tun_config tda9887_cfg;
543
544 tda9887_cfg.tuner = TUNER_TDA9887;
545 tda9887_cfg.priv = &config;
546
537 if (t_params->port1_active && !t_params->port1_fm_high_sensitivity) 547 if (t_params->port1_active && !t_params->port1_fm_high_sensitivity)
538 config |= TDA9887_PORT1_ACTIVE; 548 config |= TDA9887_PORT1_ACTIVE;
539 if (t_params->port2_active && !t_params->port2_fm_high_sensitivity) 549 if (t_params->port2_active && !t_params->port2_fm_high_sensitivity)
@@ -546,7 +556,8 @@ static int simple_set_radio_freq(struct dvb_frontend *fe,
546 config |= TDA9887_GAIN_NORMAL; 556 config |= TDA9887_GAIN_NORMAL;
547 if (t_params->radio_if == 2) 557 if (t_params->radio_if == 2)
548 config |= TDA9887_RIF_41_3; 558 config |= TDA9887_RIF_41_3;
549 i2c_clients_command(priv->i2c_props.adap, TDA9887_SET_CONFIG, &config); 559 i2c_clients_command(priv->i2c_props.adap, TUNER_SET_CONFIG,
560 &tda9887_cfg);
550 } 561 }
551 if (4 != (rc = tuner_i2c_xfer_send(&priv->i2c_props,buffer,4))) 562 if (4 != (rc = tuner_i2c_xfer_send(&priv->i2c_props,buffer,4)))
552 tuner_warn("i2c i/o error: rc == %d (should be 4)\n",rc); 563 tuner_warn("i2c i/o error: rc == %d (should be 4)\n",rc);
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c
index 1141b4bf41ce..a4d68d3ba5e4 100644
--- a/drivers/media/video/v4l2-common.c
+++ b/drivers/media/video/v4l2-common.c
@@ -400,7 +400,7 @@ static const char *v4l2_int_ioctls[] = {
400 400
401 [_IOC_NR(TUNER_SET_TYPE_ADDR)] = "TUNER_SET_TYPE_ADDR", 401 [_IOC_NR(TUNER_SET_TYPE_ADDR)] = "TUNER_SET_TYPE_ADDR",
402 [_IOC_NR(TUNER_SET_STANDBY)] = "TUNER_SET_STANDBY", 402 [_IOC_NR(TUNER_SET_STANDBY)] = "TUNER_SET_STANDBY",
403 [_IOC_NR(TDA9887_SET_CONFIG)] = "TDA9887_SET_CONFIG", 403 [_IOC_NR(TUNER_SET_CONFIG)] = "TUNER_SET_CONFIG",
404 404
405 [_IOC_NR(VIDIOC_INT_S_TUNER_MODE)] = "VIDIOC_INT_S_TUNER_MODE", 405 [_IOC_NR(VIDIOC_INT_S_TUNER_MODE)] = "VIDIOC_INT_S_TUNER_MODE",
406 [_IOC_NR(VIDIOC_INT_RESET)] = "VIDIOC_INT_RESET", 406 [_IOC_NR(VIDIOC_INT_RESET)] = "VIDIOC_INT_RESET",