aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/em28xx/em28xx-video.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/em28xx/em28xx-video.c')
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c78
1 files changed, 39 insertions, 39 deletions
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index 575472f1e702..6c09a37e4048 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -49,7 +49,7 @@
49 "Sascha Sommer <saschasommer@freenet.de>" 49 "Sascha Sommer <saschasommer@freenet.de>"
50 50
51#define DRIVER_DESC "Empia em28xx based USB video device driver" 51#define DRIVER_DESC "Empia em28xx based USB video device driver"
52#define EM28XX_VERSION_CODE KERNEL_VERSION(0, 1, 1) 52#define EM28XX_VERSION_CODE KERNEL_VERSION(0, 1, 2)
53 53
54#define em28xx_videodbg(fmt, arg...) do {\ 54#define em28xx_videodbg(fmt, arg...) do {\
55 if (video_debug) \ 55 if (video_debug) \
@@ -400,7 +400,7 @@ buffer_setup(struct videobuf_queue *vq, unsigned int *count, unsigned int *size)
400 f.frequency = dev->ctl_freq; 400 f.frequency = dev->ctl_freq;
401 f.type = fh->radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; 401 f.type = fh->radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
402 402
403 em28xx_i2c_call_clients(dev, VIDIOC_S_FREQUENCY, &f); 403 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, &f);
404 404
405 return 0; 405 return 0;
406} 406}
@@ -526,25 +526,25 @@ static void video_mux(struct em28xx *dev, int index)
526 if (!dev->ctl_aoutput) 526 if (!dev->ctl_aoutput)
527 dev->ctl_aoutput = EM28XX_AOUT_MASTER; 527 dev->ctl_aoutput = EM28XX_AOUT_MASTER;
528 528
529 em28xx_i2c_call_clients(dev, VIDIOC_INT_S_VIDEO_ROUTING, &route); 529 v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_routing, &route);
530 530
531 if (dev->board.has_msp34xx) { 531 if (dev->board.has_msp34xx) {
532 if (dev->i2s_speed) { 532 if (dev->i2s_speed) {
533 em28xx_i2c_call_clients(dev, VIDIOC_INT_I2S_CLOCK_FREQ, 533 v4l2_device_call_all(&dev->v4l2_dev, 0, audio,
534 &dev->i2s_speed); 534 s_i2s_clock_freq, dev->i2s_speed);
535 } 535 }
536 route.input = dev->ctl_ainput; 536 route.input = dev->ctl_ainput;
537 route.output = MSP_OUTPUT(MSP_SC_IN_DSP_SCART1); 537 route.output = MSP_OUTPUT(MSP_SC_IN_DSP_SCART1);
538
538 /* Note: this is msp3400 specific */ 539 /* Note: this is msp3400 specific */
539 em28xx_i2c_call_clients(dev, VIDIOC_INT_S_AUDIO_ROUTING, 540 v4l2_device_call_all(&dev->v4l2_dev, 0, audio, s_routing, &route);
540 &route);
541 } 541 }
542 542
543 if (dev->board.adecoder != EM28XX_NOADECODER) { 543 if (dev->board.adecoder != EM28XX_NOADECODER) {
544 route.input = dev->ctl_ainput; 544 route.input = dev->ctl_ainput;
545 route.output = dev->ctl_aoutput; 545 route.output = dev->ctl_aoutput;
546 em28xx_i2c_call_clients(dev, VIDIOC_INT_S_AUDIO_ROUTING, 546
547 &route); 547 v4l2_device_call_all(&dev->v4l2_dev, 0, audio, s_routing, &route);
548 } 548 }
549 549
550 em28xx_audio_analog_set(dev); 550 em28xx_audio_analog_set(dev);
@@ -829,7 +829,7 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *norm)
829 get_scale(dev, dev->width, dev->height, &dev->hscale, &dev->vscale); 829 get_scale(dev, dev->width, dev->height, &dev->hscale, &dev->vscale);
830 830
831 em28xx_resolution_set(dev); 831 em28xx_resolution_set(dev);
832 em28xx_i2c_call_clients(dev, VIDIOC_S_STD, &dev->norm); 832 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_std, dev->norm);
833 833
834 mutex_unlock(&dev->lock); 834 mutex_unlock(&dev->lock);
835 return 0; 835 return 0;
@@ -995,8 +995,9 @@ static int vidioc_queryctrl(struct file *file, void *priv,
995 } 995 }
996 } 996 }
997 } 997 }
998
998 mutex_lock(&dev->lock); 999 mutex_lock(&dev->lock);
999 em28xx_i2c_call_clients(dev, VIDIOC_QUERYCTRL, qc); 1000 v4l2_device_call_all(&dev->v4l2_dev, 0, core, queryctrl, qc);
1000 mutex_unlock(&dev->lock); 1001 mutex_unlock(&dev->lock);
1001 1002
1002 if (qc->type) 1003 if (qc->type)
@@ -1020,11 +1021,11 @@ static int vidioc_g_ctrl(struct file *file, void *priv,
1020 mutex_lock(&dev->lock); 1021 mutex_lock(&dev->lock);
1021 1022
1022 if (dev->board.has_msp34xx) 1023 if (dev->board.has_msp34xx)
1023 em28xx_i2c_call_clients(dev, VIDIOC_G_CTRL, ctrl); 1024 v4l2_device_call_all(&dev->v4l2_dev, 0, core, g_ctrl, ctrl);
1024 else { 1025 else {
1025 rc = em28xx_get_ctrl(dev, ctrl); 1026 rc = em28xx_get_ctrl(dev, ctrl);
1026 if (rc < 0) { 1027 if (rc < 0) {
1027 em28xx_i2c_call_clients(dev, VIDIOC_G_CTRL, ctrl); 1028 v4l2_device_call_all(&dev->v4l2_dev, 0, core, g_ctrl, ctrl);
1028 rc = 0; 1029 rc = 0;
1029 } 1030 }
1030 } 1031 }
@@ -1048,7 +1049,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
1048 mutex_lock(&dev->lock); 1049 mutex_lock(&dev->lock);
1049 1050
1050 if (dev->board.has_msp34xx) 1051 if (dev->board.has_msp34xx)
1051 em28xx_i2c_call_clients(dev, VIDIOC_S_CTRL, ctrl); 1052 v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_ctrl, ctrl);
1052 else { 1053 else {
1053 rc = 1; 1054 rc = 1;
1054 for (i = 0; i < ARRAY_SIZE(em28xx_qctrl); i++) { 1055 for (i = 0; i < ARRAY_SIZE(em28xx_qctrl); i++) {
@@ -1067,7 +1068,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
1067 1068
1068 /* Control not found - try to send it to the attached devices */ 1069 /* Control not found - try to send it to the attached devices */
1069 if (rc == 1) { 1070 if (rc == 1) {
1070 em28xx_i2c_call_clients(dev, VIDIOC_S_CTRL, ctrl); 1071 v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_ctrl, ctrl);
1071 rc = 0; 1072 rc = 0;
1072 } 1073 }
1073 1074
@@ -1092,10 +1093,9 @@ static int vidioc_g_tuner(struct file *file, void *priv,
1092 strcpy(t->name, "Tuner"); 1093 strcpy(t->name, "Tuner");
1093 1094
1094 mutex_lock(&dev->lock); 1095 mutex_lock(&dev->lock);
1095 1096 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, g_tuner, t);
1096 em28xx_i2c_call_clients(dev, VIDIOC_G_TUNER, t);
1097
1098 mutex_unlock(&dev->lock); 1097 mutex_unlock(&dev->lock);
1098
1099 return 0; 1099 return 0;
1100} 1100}
1101 1101
@@ -1114,10 +1114,9 @@ static int vidioc_s_tuner(struct file *file, void *priv,
1114 return -EINVAL; 1114 return -EINVAL;
1115 1115
1116 mutex_lock(&dev->lock); 1116 mutex_lock(&dev->lock);
1117 1117 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_tuner, t);
1118 em28xx_i2c_call_clients(dev, VIDIOC_S_TUNER, t);
1119
1120 mutex_unlock(&dev->lock); 1118 mutex_unlock(&dev->lock);
1119
1121 return 0; 1120 return 0;
1122} 1121}
1123 1122
@@ -1157,7 +1156,7 @@ static int vidioc_s_frequency(struct file *file, void *priv,
1157 mutex_lock(&dev->lock); 1156 mutex_lock(&dev->lock);
1158 1157
1159 dev->ctl_freq = f->frequency; 1158 dev->ctl_freq = f->frequency;
1160 em28xx_i2c_call_clients(dev, VIDIOC_S_FREQUENCY, f); 1159 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, f);
1161 1160
1162 mutex_unlock(&dev->lock); 1161 mutex_unlock(&dev->lock);
1163 1162
@@ -1186,7 +1185,7 @@ static int vidioc_g_chip_ident(struct file *file, void *priv,
1186 chip->ident = V4L2_IDENT_NONE; 1185 chip->ident = V4L2_IDENT_NONE;
1187 chip->revision = 0; 1186 chip->revision = 0;
1188 1187
1189 em28xx_i2c_call_clients(dev, VIDIOC_DBG_G_CHIP_IDENT, chip); 1188 v4l2_device_call_all(&dev->v4l2_dev, 0, core, g_chip_ident, chip);
1190 1189
1191 return 0; 1190 return 0;
1192} 1191}
@@ -1211,7 +1210,7 @@ static int vidioc_g_register(struct file *file, void *priv,
1211 reg->size = 1; 1210 reg->size = 1;
1212 return 0; 1211 return 0;
1213 case V4L2_CHIP_MATCH_I2C_DRIVER: 1212 case V4L2_CHIP_MATCH_I2C_DRIVER:
1214 em28xx_i2c_call_clients(dev, VIDIOC_DBG_G_REGISTER, reg); 1213 v4l2_device_call_all(&dev->v4l2_dev, 0, core, g_register, reg);
1215 return 0; 1214 return 0;
1216 case V4L2_CHIP_MATCH_I2C_ADDR: 1215 case V4L2_CHIP_MATCH_I2C_ADDR:
1217 /* Not supported yet */ 1216 /* Not supported yet */
@@ -1263,7 +1262,7 @@ static int vidioc_s_register(struct file *file, void *priv,
1263 1262
1264 return rc; 1263 return rc;
1265 case V4L2_CHIP_MATCH_I2C_DRIVER: 1264 case V4L2_CHIP_MATCH_I2C_DRIVER:
1266 em28xx_i2c_call_clients(dev, VIDIOC_DBG_S_REGISTER, reg); 1265 v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_register, reg);
1267 return 0; 1266 return 0;
1268 case V4L2_CHIP_MATCH_I2C_ADDR: 1267 case V4L2_CHIP_MATCH_I2C_ADDR:
1269 /* Not supported yet */ 1268 /* Not supported yet */
@@ -1406,13 +1405,13 @@ static int vidioc_g_fmt_sliced_vbi_cap(struct file *file, void *priv,
1406 mutex_lock(&dev->lock); 1405 mutex_lock(&dev->lock);
1407 1406
1408 f->fmt.sliced.service_set = 0; 1407 f->fmt.sliced.service_set = 0;
1409 1408 v4l2_device_call_all(&dev->v4l2_dev, 0, video, g_fmt, f);
1410 em28xx_i2c_call_clients(dev, VIDIOC_G_FMT, f);
1411 1409
1412 if (f->fmt.sliced.service_set == 0) 1410 if (f->fmt.sliced.service_set == 0)
1413 rc = -EINVAL; 1411 rc = -EINVAL;
1414 1412
1415 mutex_unlock(&dev->lock); 1413 mutex_unlock(&dev->lock);
1414
1416 return rc; 1415 return rc;
1417} 1416}
1418 1417
@@ -1428,7 +1427,7 @@ static int vidioc_try_set_sliced_vbi_cap(struct file *file, void *priv,
1428 return rc; 1427 return rc;
1429 1428
1430 mutex_lock(&dev->lock); 1429 mutex_lock(&dev->lock);
1431 em28xx_i2c_call_clients(dev, VIDIOC_G_FMT, f); 1430 v4l2_device_call_all(&dev->v4l2_dev, 0, video, g_fmt, f);
1432 mutex_unlock(&dev->lock); 1431 mutex_unlock(&dev->lock);
1433 1432
1434 if (f->fmt.sliced.service_set == 0) 1433 if (f->fmt.sliced.service_set == 0)
@@ -1532,7 +1531,7 @@ static int radio_g_tuner(struct file *file, void *priv,
1532 t->type = V4L2_TUNER_RADIO; 1531 t->type = V4L2_TUNER_RADIO;
1533 1532
1534 mutex_lock(&dev->lock); 1533 mutex_lock(&dev->lock);
1535 em28xx_i2c_call_clients(dev, VIDIOC_G_TUNER, t); 1534 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, g_tuner, t);
1536 mutex_unlock(&dev->lock); 1535 mutex_unlock(&dev->lock);
1537 1536
1538 return 0; 1537 return 0;
@@ -1567,7 +1566,7 @@ static int radio_s_tuner(struct file *file, void *priv,
1567 return -EINVAL; 1566 return -EINVAL;
1568 1567
1569 mutex_lock(&dev->lock); 1568 mutex_lock(&dev->lock);
1570 em28xx_i2c_call_clients(dev, VIDIOC_S_TUNER, t); 1569 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_tuner, t);
1571 mutex_unlock(&dev->lock); 1570 mutex_unlock(&dev->lock);
1572 1571
1573 return 0; 1572 return 0;
@@ -1655,7 +1654,7 @@ static int em28xx_v4l2_open(struct file *filp)
1655 } 1654 }
1656 if (fh->radio) { 1655 if (fh->radio) {
1657 em28xx_videodbg("video_open: setting radio device\n"); 1656 em28xx_videodbg("video_open: setting radio device\n");
1658 em28xx_i2c_call_clients(dev, AUDC_SET_RADIO, NULL); 1657 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_radio);
1659 } 1658 }
1660 1659
1661 dev->users++; 1660 dev->users++;
@@ -1738,7 +1737,7 @@ static int em28xx_v4l2_close(struct file *filp)
1738 } 1737 }
1739 1738
1740 /* Save some power by putting tuner to sleep */ 1739 /* Save some power by putting tuner to sleep */
1741 em28xx_i2c_call_clients(dev, TUNER_SET_STANDBY, NULL); 1740 v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_standby, 0);
1742 1741
1743 /* do this before setting alternate! */ 1742 /* do this before setting alternate! */
1744 em28xx_uninit_isoc(dev); 1743 em28xx_uninit_isoc(dev);
@@ -1959,11 +1958,12 @@ static struct video_device *em28xx_vdev_init(struct em28xx *dev,
1959 vfd = video_device_alloc(); 1958 vfd = video_device_alloc();
1960 if (NULL == vfd) 1959 if (NULL == vfd)
1961 return NULL; 1960 return NULL;
1962 *vfd = *template; 1961
1963 vfd->minor = -1; 1962 *vfd = *template;
1964 vfd->parent = &dev->udev->dev; 1963 vfd->minor = -1;
1965 vfd->release = video_device_release; 1964 vfd->v4l2_dev = &dev->v4l2_dev;
1966 vfd->debug = video_debug; 1965 vfd->release = video_device_release;
1966 vfd->debug = video_debug;
1967 1967
1968 snprintf(vfd->name, sizeof(vfd->name), "%s %s", 1968 snprintf(vfd->name, sizeof(vfd->name), "%s %s",
1969 dev->name, type_name); 1969 dev->name, type_name);