aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx231xx/cx231xx-video.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/cx231xx/cx231xx-video.c')
-rw-r--r--drivers/media/video/cx231xx/cx231xx-video.c64
1 files changed, 27 insertions, 37 deletions
diff --git a/drivers/media/video/cx231xx/cx231xx-video.c b/drivers/media/video/cx231xx/cx231xx-video.c
index 606f80129ffb..65430ecc180c 100644
--- a/drivers/media/video/cx231xx/cx231xx-video.c
+++ b/drivers/media/video/cx231xx/cx231xx-video.c
@@ -704,7 +704,7 @@ buffer_setup(struct videobuf_queue *vq, unsigned int *count, unsigned int *size)
704 f.frequency = dev->ctl_freq; 704 f.frequency = dev->ctl_freq;
705 f.type = fh->radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; 705 f.type = fh->radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
706 706
707 cx231xx_i2c_call_clients(&dev->i2c_bus[1], VIDIOC_S_FREQUENCY, &f); 707 call_all(dev, tuner, s_frequency, &f);
708 708
709 return 0; 709 return 0;
710} 710}
@@ -830,8 +830,7 @@ void video_mux(struct cx231xx *dev, int index)
830 830
831 cx231xx_set_video_input_mux(dev, index); 831 cx231xx_set_video_input_mux(dev, index);
832 832
833 cx231xx_i2c_call_clients(&dev->i2c_bus[0], VIDIOC_INT_S_VIDEO_ROUTING, 833 cx25840_call(dev, video, s_routing, &route);
834 &route);
835 834
836 cx231xx_set_audio_input(dev, dev->ctl_ainput); 835 cx231xx_set_audio_input(dev, dev->ctl_ainput);
837 836
@@ -1045,7 +1044,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
1045 dev->format = fmt; 1044 dev->format = fmt;
1046 get_scale(dev, dev->width, dev->height, &dev->hscale, &dev->vscale); 1045 get_scale(dev, dev->width, dev->height, &dev->hscale, &dev->vscale);
1047 1046
1048 cx231xx_i2c_call_clients(&dev->i2c_bus[0], VIDIOC_S_FMT, f); 1047 call_all(dev, video, s_fmt, f);
1049 1048
1050 /* Set the correct alternate setting for this resolution */ 1049 /* Set the correct alternate setting for this resolution */
1051 cx231xx_resolution_set(dev); 1050 cx231xx_resolution_set(dev);
@@ -1064,7 +1063,7 @@ static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id * id)
1064 return 0; 1063 return 0;
1065} 1064}
1066 1065
1067static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id * norm) 1066static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *norm)
1068{ 1067{
1069 struct cx231xx_fh *fh = priv; 1068 struct cx231xx_fh *fh = priv;
1070 struct cx231xx *dev = fh->dev; 1069 struct cx231xx *dev = fh->dev;
@@ -1090,7 +1089,7 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id * norm)
1090 dev->height = f.fmt.pix.height; 1089 dev->height = f.fmt.pix.height;
1091 get_scale(dev, dev->width, dev->height, &dev->hscale, &dev->vscale); 1090 get_scale(dev, dev->width, dev->height, &dev->hscale, &dev->vscale);
1092 1091
1093 cx231xx_i2c_call_clients(&dev->i2c_bus[0], VIDIOC_S_STD, &dev->norm); 1092 call_all(dev, tuner, s_std, dev->norm);
1094 1093
1095 mutex_unlock(&dev->lock); 1094 mutex_unlock(&dev->lock);
1096 1095
@@ -1244,7 +1243,7 @@ static int vidioc_queryctrl(struct file *file, void *priv,
1244 *qc = cx231xx_ctls[i].v; 1243 *qc = cx231xx_ctls[i].v;
1245 1244
1246 mutex_lock(&dev->lock); 1245 mutex_lock(&dev->lock);
1247 cx231xx_i2c_call_clients(&dev->i2c_bus[0], VIDIOC_QUERYCTRL, qc); 1246 call_all(dev, core, queryctrl, qc);
1248 mutex_unlock(&dev->lock); 1247 mutex_unlock(&dev->lock);
1249 1248
1250 if (qc->type) 1249 if (qc->type)
@@ -1265,9 +1264,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv,
1265 return rc; 1264 return rc;
1266 1265
1267 mutex_lock(&dev->lock); 1266 mutex_lock(&dev->lock);
1268 1267 call_all(dev, core, g_ctrl, ctrl);
1269 cx231xx_i2c_call_clients(&dev->i2c_bus[0], VIDIOC_G_CTRL, ctrl);
1270
1271 mutex_unlock(&dev->lock); 1268 mutex_unlock(&dev->lock);
1272 return rc; 1269 return rc;
1273} 1270}
@@ -1284,9 +1281,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
1284 return rc; 1281 return rc;
1285 1282
1286 mutex_lock(&dev->lock); 1283 mutex_lock(&dev->lock);
1287 1284 call_all(dev, core, s_ctrl, ctrl);
1288 cx231xx_i2c_call_clients(&dev->i2c_bus[0], VIDIOC_S_CTRL, ctrl);
1289
1290 mutex_unlock(&dev->lock); 1285 mutex_unlock(&dev->lock);
1291 return rc; 1286 return rc;
1292} 1287}
@@ -1328,9 +1323,7 @@ static int vidioc_s_tuner(struct file *file, void *priv, struct v4l2_tuner *t)
1328 return -EINVAL; 1323 return -EINVAL;
1329#if 0 1324#if 0
1330 mutex_lock(&dev->lock); 1325 mutex_lock(&dev->lock);
1331 1326 call_all(dev, tuner, s_tuner, t);
1332 cx231xx_i2c_call_clients(&dev->i2c_bus[1], VIDIOC_S_TUNER, t);
1333
1334 mutex_unlock(&dev->lock); 1327 mutex_unlock(&dev->lock);
1335#endif 1328#endif
1336 return 0; 1329 return 0;
@@ -1346,7 +1339,7 @@ static int vidioc_g_frequency(struct file *file, void *priv,
1346 f->type = fh->radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; 1339 f->type = fh->radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
1347 f->frequency = dev->ctl_freq; 1340 f->frequency = dev->ctl_freq;
1348 1341
1349 cx231xx_i2c_call_clients(&dev->i2c_bus[1], VIDIOC_G_FREQUENCY, f); 1342 call_all(dev, tuner, g_frequency, f);
1350 1343
1351 mutex_unlock(&dev->lock); 1344 mutex_unlock(&dev->lock);
1352 1345
@@ -1382,10 +1375,8 @@ static int vidioc_s_frequency(struct file *file, void *priv,
1382 if (dev->tuner_type == TUNER_XC5000) { 1375 if (dev->tuner_type == TUNER_XC5000) {
1383 if (dev->cx231xx_set_analog_freq != NULL) 1376 if (dev->cx231xx_set_analog_freq != NULL)
1384 dev->cx231xx_set_analog_freq(dev, f->frequency); 1377 dev->cx231xx_set_analog_freq(dev, f->frequency);
1385 } else { 1378 } else
1386 cx231xx_i2c_call_clients(&dev->i2c_bus[1], 1379 call_all(dev, tuner, s_frequency, f);
1387 VIDIOC_S_FREQUENCY, f);
1388 }
1389 1380
1390 mutex_unlock(&dev->lock); 1381 mutex_unlock(&dev->lock);
1391 1382
@@ -1467,8 +1458,7 @@ static int vidioc_g_register(struct file *file, void *priv,
1467 return ret < 0 ? ret : 0; 1458 return ret < 0 ? ret : 0;
1468 1459
1469 case V4L2_CHIP_MATCH_I2C_DRIVER: 1460 case V4L2_CHIP_MATCH_I2C_DRIVER:
1470 cx231xx_i2c_call_clients(&dev->i2c_bus[0], 1461 call_all(dev, core, g_register, reg);
1471 VIDIOC_DBG_G_REGISTER, reg);
1472 return 0; 1462 return 0;
1473 case V4L2_CHIP_MATCH_I2C_ADDR: 1463 case V4L2_CHIP_MATCH_I2C_ADDR:
1474 /* Not supported yet */ 1464 /* Not supported yet */
@@ -1479,7 +1469,7 @@ static int vidioc_g_register(struct file *file, void *priv,
1479 } 1469 }
1480 1470
1481 mutex_lock(&dev->lock); 1471 mutex_lock(&dev->lock);
1482 cx231xx_i2c_call_clients(&dev->i2c_bus[0], VIDIOC_DBG_G_REGISTER, reg); 1472 call_all(dev, core, g_register, reg);
1483 mutex_unlock(&dev->lock); 1473 mutex_unlock(&dev->lock);
1484 1474
1485 return ret; 1475 return ret;
@@ -1562,9 +1552,7 @@ static int vidioc_s_register(struct file *file, void *priv,
1562 } 1552 }
1563 1553
1564 mutex_lock(&dev->lock); 1554 mutex_lock(&dev->lock);
1565 1555 call_all(dev, core, s_register, reg);
1566 cx231xx_i2c_call_clients(&dev->i2c_bus[0], VIDIOC_DBG_S_REGISTER, reg);
1567
1568 mutex_unlock(&dev->lock); 1556 mutex_unlock(&dev->lock);
1569 1557
1570 return ret; 1558 return ret;
@@ -1608,6 +1596,8 @@ static int vidioc_streamon(struct file *file, void *priv,
1608 if (likely(rc >= 0)) 1596 if (likely(rc >= 0))
1609 rc = videobuf_streamon(&fh->vb_vidq); 1597 rc = videobuf_streamon(&fh->vb_vidq);
1610 1598
1599 call_all(dev, video, s_stream, 1);
1600
1611 mutex_unlock(&dev->lock); 1601 mutex_unlock(&dev->lock);
1612 1602
1613 return rc; 1603 return rc;
@@ -1632,6 +1622,8 @@ static int vidioc_streamoff(struct file *file, void *priv,
1632 1622
1633 mutex_lock(&dev->lock); 1623 mutex_lock(&dev->lock);
1634 1624
1625 cx25840_call(dev, video, s_stream, 0);
1626
1635 videobuf_streamoff(&fh->vb_vidq); 1627 videobuf_streamoff(&fh->vb_vidq);
1636 res_free(fh); 1628 res_free(fh);
1637 1629
@@ -1648,7 +1640,7 @@ static int vidioc_querycap(struct file *file, void *priv,
1648 1640
1649 strlcpy(cap->driver, "cx231xx", sizeof(cap->driver)); 1641 strlcpy(cap->driver, "cx231xx", sizeof(cap->driver));
1650 strlcpy(cap->card, cx231xx_boards[dev->model].name, sizeof(cap->card)); 1642 strlcpy(cap->card, cx231xx_boards[dev->model].name, sizeof(cap->card));
1651 strlcpy(cap->bus_info, dev_name(&dev->udev->dev), 1643 strlcpy(cap->bus_info, dev->v4l2_dev.name,
1652 sizeof(cap->bus_info)); 1644 sizeof(cap->bus_info));
1653 1645
1654 cap->version = CX231XX_VERSION_CODE; 1646 cap->version = CX231XX_VERSION_CODE;
@@ -1696,7 +1688,7 @@ static int vidioc_g_fmt_sliced_vbi_cap(struct file *file, void *priv,
1696 1688
1697 f->fmt.sliced.service_set = 0; 1689 f->fmt.sliced.service_set = 0;
1698 1690
1699 cx231xx_i2c_call_clients(&dev->i2c_bus[0], VIDIOC_G_FMT, f); 1691 call_all(dev, video, g_fmt, f);
1700 1692
1701 if (f->fmt.sliced.service_set == 0) 1693 if (f->fmt.sliced.service_set == 0)
1702 rc = -EINVAL; 1694 rc = -EINVAL;
@@ -1717,7 +1709,7 @@ static int vidioc_try_set_sliced_vbi_cap(struct file *file, void *priv,
1717 return rc; 1709 return rc;
1718 1710
1719 mutex_lock(&dev->lock); 1711 mutex_lock(&dev->lock);
1720 cx231xx_i2c_call_clients(&dev->i2c_bus[0], VIDIOC_G_FMT, f); 1712 call_all(dev, video, g_fmt, f);
1721 mutex_unlock(&dev->lock); 1713 mutex_unlock(&dev->lock);
1722 1714
1723 if (f->fmt.sliced.service_set == 0) 1715 if (f->fmt.sliced.service_set == 0)
@@ -1872,7 +1864,7 @@ static int radio_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t)
1872 t->type = V4L2_TUNER_RADIO; 1864 t->type = V4L2_TUNER_RADIO;
1873 1865
1874 mutex_lock(&dev->lock); 1866 mutex_lock(&dev->lock);
1875 cx231xx_i2c_call_clients(&dev->i2c_bus[1], VIDIOC_G_TUNER, t); 1867 call_all(dev, tuner, s_tuner, t);
1876 mutex_unlock(&dev->lock); 1868 mutex_unlock(&dev->lock);
1877 1869
1878 return 0; 1870 return 0;
@@ -1905,7 +1897,7 @@ static int radio_s_tuner(struct file *file, void *priv, struct v4l2_tuner *t)
1905 return -EINVAL; 1897 return -EINVAL;
1906 1898
1907 mutex_lock(&dev->lock); 1899 mutex_lock(&dev->lock);
1908 cx231xx_i2c_call_clients(&dev->i2c_bus[1], VIDIOC_S_TUNER, t); 1900 call_all(dev, tuner, s_tuner, t);
1909 mutex_unlock(&dev->lock); 1901 mutex_unlock(&dev->lock);
1910 1902
1911 return 0; 1903 return 0;
@@ -2011,8 +2003,7 @@ static int cx231xx_v4l2_open(struct file *filp)
2011 2003
2012 /* cx231xx_start_radio(dev); */ 2004 /* cx231xx_start_radio(dev); */
2013 2005
2014 cx231xx_i2c_call_clients(&dev->i2c_bus[1], AUDC_SET_RADIO, 2006 call_all(dev, tuner, s_radio);
2015 NULL);
2016 } 2007 }
2017 2008
2018 dev->users++; 2009 dev->users++;
@@ -2135,8 +2126,7 @@ static int cx231xx_v4l2_close(struct file *filp)
2135 } 2126 }
2136 2127
2137 /* Save some power by putting tuner to sleep */ 2128 /* Save some power by putting tuner to sleep */
2138 cx231xx_i2c_call_clients(&dev->i2c_bus[1], TUNER_SET_STANDBY, 2129 call_all(dev, core, s_standby, 0);
2139 NULL);
2140 2130
2141 /* do this before setting alternate! */ 2131 /* do this before setting alternate! */
2142 cx231xx_uninit_isoc(dev); 2132 cx231xx_uninit_isoc(dev);
@@ -2350,7 +2340,7 @@ static struct video_device *cx231xx_vdev_init(struct cx231xx *dev,
2350 2340
2351 *vfd = *template; 2341 *vfd = *template;
2352 vfd->minor = -1; 2342 vfd->minor = -1;
2353 vfd->parent = &dev->udev->dev; 2343 vfd->v4l2_dev = &dev->v4l2_dev;
2354 vfd->release = video_device_release; 2344 vfd->release = video_device_release;
2355 vfd->debug = video_debug; 2345 vfd->debug = video_debug;
2356 2346