aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/saa7134
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/media/video/saa7134
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/media/video/saa7134')
-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
4 files changed, 44 insertions, 13 deletions
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 }