aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx23885/cx23885-video.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2009-03-29 05:53:29 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:43:48 -0400
commit0d5a19f15837de69f864b2a43a93f119224d778c (patch)
tree952be3a127bdf863a7163f552e243020a44f64b1 /drivers/media/video/cx23885/cx23885-video.c
parentd35ed62704bc1d44dd4746a242e8c09f2a48fc40 (diff)
V4L/DVB (11297): cx23885: convert to v4l2_subdev.
Convert this driver to v4l2_subdev. Note that currently the only card with analog support in this driver is the HVR-1800. The analog tuner support in this driver is limited to what is needed for this board. When analog support is added for other cards, then the tuner load code will probably have to be expanded to take care of those boards. For example, there is currently no support for either radio tuners or tda9887 demods. I'd like to thank Steven Toth for testing this on his HVR-1800. Tested-by: Steven Toth <stoth@linuxtv.org> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx23885/cx23885-video.c')
-rw-r--r--drivers/media/video/cx23885/cx23885-video.c41
1 files changed, 28 insertions, 13 deletions
diff --git a/drivers/media/video/cx23885/cx23885-video.c b/drivers/media/video/cx23885/cx23885-video.c
index 1596f4ff3dfe..f0ac62c5dc83 100644
--- a/drivers/media/video/cx23885/cx23885-video.c
+++ b/drivers/media/video/cx23885/cx23885-video.c
@@ -299,11 +299,7 @@ static int cx23885_set_tvnorm(struct cx23885_dev *dev, v4l2_std_id norm)
299 299
300 dev->tvnorm = norm; 300 dev->tvnorm = norm;
301 301
302 /* Tell the analog tuner/demods */ 302 call_all(dev, tuner, s_std, norm);
303 cx23885_call_i2c_clients(&dev->i2c_bus[1], VIDIOC_S_STD, &norm);
304
305 /* Tell the internal A/V decoder */
306 cx23885_call_i2c_clients(&dev->i2c_bus[2], VIDIOC_S_STD, &norm);
307 303
308 return 0; 304 return 0;
309} 305}
@@ -410,8 +406,7 @@ static int cx23885_video_mux(struct cx23885_dev *dev, unsigned int input)
410 route.input = INPUT(input)->vmux; 406 route.input = INPUT(input)->vmux;
411 407
412 /* Tell the internal A/V decoder */ 408 /* Tell the internal A/V decoder */
413 cx23885_call_i2c_clients(&dev->i2c_bus[2], 409 v4l2_subdev_call(dev->sd_cx25840, video, s_routing, &route);
414 VIDIOC_INT_S_VIDEO_ROUTING, &route);
415 410
416 return 0; 411 return 0;
417} 412}
@@ -887,7 +882,7 @@ static int cx23885_get_control(struct cx23885_dev *dev,
887 struct v4l2_control *ctl) 882 struct v4l2_control *ctl)
888{ 883{
889 dprintk(1, "%s() calling cx25840(VIDIOC_G_CTRL)\n", __func__); 884 dprintk(1, "%s() calling cx25840(VIDIOC_G_CTRL)\n", __func__);
890 cx23885_call_i2c_clients(&dev->i2c_bus[2], VIDIOC_G_CTRL, ctl); 885 call_all(dev, core, g_ctrl, ctl);
891 return 0; 886 return 0;
892} 887}
893 888
@@ -1001,7 +996,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
1001 fh->vidq.field = f->fmt.pix.field; 996 fh->vidq.field = f->fmt.pix.field;
1002 dprintk(2, "%s() width=%d height=%d field=%d\n", __func__, 997 dprintk(2, "%s() width=%d height=%d field=%d\n", __func__,
1003 fh->width, fh->height, fh->vidq.field); 998 fh->width, fh->height, fh->vidq.field);
1004 cx23885_call_i2c_clients(&dev->i2c_bus[2], VIDIOC_S_FMT, f); 999 call_all(dev, video, s_fmt, f);
1005 return 0; 1000 return 0;
1006} 1001}
1007 1002
@@ -1281,7 +1276,7 @@ static int vidioc_g_frequency(struct file *file, void *priv,
1281 f->type = fh->radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; 1276 f->type = fh->radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
1282 f->frequency = dev->freq; 1277 f->frequency = dev->freq;
1283 1278
1284 cx23885_call_i2c_clients(&dev->i2c_bus[1], VIDIOC_G_FREQUENCY, f); 1279 call_all(dev, tuner, g_frequency, f);
1285 1280
1286 return 0; 1281 return 0;
1287} 1282}
@@ -1296,7 +1291,7 @@ static int cx23885_set_freq(struct cx23885_dev *dev, struct v4l2_frequency *f)
1296 mutex_lock(&dev->lock); 1291 mutex_lock(&dev->lock);
1297 dev->freq = f->frequency; 1292 dev->freq = f->frequency;
1298 1293
1299 cx23885_call_i2c_clients(&dev->i2c_bus[1], VIDIOC_S_FREQUENCY, f); 1294 call_all(dev, tuner, s_frequency, f);
1300 1295
1301 /* When changing channels it is required to reset TVAUDIO */ 1296 /* When changing channels it is required to reset TVAUDIO */
1302 msleep(10); 1297 msleep(10);
@@ -1330,7 +1325,7 @@ static int vidioc_g_register(struct file *file, void *fh,
1330 if (!v4l2_chip_match_host(&reg->match)) 1325 if (!v4l2_chip_match_host(&reg->match))
1331 return -EINVAL; 1326 return -EINVAL;
1332 1327
1333 cx23885_call_i2c_clients(&dev->i2c_bus[2], VIDIOC_DBG_G_REGISTER, reg); 1328 call_all(dev, core, g_register, reg);
1334 1329
1335 return 0; 1330 return 0;
1336} 1331}
@@ -1343,7 +1338,7 @@ static int vidioc_s_register(struct file *file, void *fh,
1343 if (!v4l2_chip_match_host(&reg->match)) 1338 if (!v4l2_chip_match_host(&reg->match))
1344 return -EINVAL; 1339 return -EINVAL;
1345 1340
1346 cx23885_call_i2c_clients(&dev->i2c_bus[2], VIDIOC_DBG_S_REGISTER, reg); 1341 call_all(dev, core, s_register, reg);
1347 1342
1348 return 0; 1343 return 0;
1349} 1344}
@@ -1524,6 +1519,26 @@ int cx23885_video_register(struct cx23885_dev *dev)
1524 /* Don't enable VBI yet */ 1519 /* Don't enable VBI yet */
1525 cx_set(PCI_INT_MSK, 1); 1520 cx_set(PCI_INT_MSK, 1);
1526 1521
1522 if (TUNER_ABSENT != dev->tuner_type) {
1523 struct v4l2_subdev *sd = NULL;
1524
1525 if (dev->tuner_addr)
1526 sd = v4l2_i2c_new_subdev(&dev->i2c_bus[1].i2c_adap,
1527 "tuner", "tuner", dev->tuner_addr);
1528 else
1529 sd = v4l2_i2c_new_probed_subdev(&dev->i2c_bus[1].i2c_adap,
1530 "tuner", "tuner", v4l2_i2c_tuner_addrs(ADDRS_TV));
1531 if (sd) {
1532 struct tuner_setup tun_setup;
1533
1534 tun_setup.mode_mask = T_ANALOG_TV;
1535 tun_setup.type = dev->tuner_type;
1536 tun_setup.addr = v4l2_i2c_subdev_addr(sd);
1537
1538 v4l2_subdev_call(sd, tuner, s_type_addr, &tun_setup);
1539 }
1540 }
1541
1527 1542
1528 /* register v4l devices */ 1543 /* register v4l devices */
1529 dev->video_dev = cx23885_vdev_init(dev, dev->pci, 1544 dev->video_dev = cx23885_vdev_init(dev, dev->pci,