diff options
author | Trent Piepho <xyzzy@speakeasy.org> | 2007-01-22 21:31:53 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-02-21 10:34:54 -0500 |
commit | dbbff48f39263f7e5c96a55624da87879de2bf71 (patch) | |
tree | 8baff62c9a7235bc1578952907f5ae6f271afe41 | |
parent | 758117c25b65ed5fa502c13f3cdf040a8f954161 (diff) |
V4L/DVB (5144): Restore VIDIOC_INT_[SG]_REGISTER calls
Add support for these ioctls to the video_ioctl2 system and the cx88
driver.
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r-- | drivers/media/video/cx88/cx88-video.c | 32 | ||||
-rw-r--r-- | drivers/media/video/videodev.c | 16 | ||||
-rw-r--r-- | include/media/v4l2-dev.h | 12 |
3 files changed, 59 insertions, 1 deletions
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index 360046e1d6be..ee8cbd33cfc1 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c | |||
@@ -1385,6 +1385,32 @@ static int vidioc_s_frequency (struct file *file, void *priv, | |||
1385 | cx88_set_freq (core,f); | 1385 | cx88_set_freq (core,f); |
1386 | } | 1386 | } |
1387 | 1387 | ||
1388 | #ifdef CONFIG_VIDEO_ADV_DEBUG | ||
1389 | static int vidioc_g_register (struct file *file, void *fh, | ||
1390 | struct v4l2_register *reg) | ||
1391 | { | ||
1392 | struct cx88_core *core = ((struct cx8800_fh*)fh)->dev->core; | ||
1393 | |||
1394 | if (reg->i2c_id != 0) | ||
1395 | return -EINVAL; | ||
1396 | /* cx2388x has a 24-bit register space */ | ||
1397 | reg->val = cx_read(reg->reg&0xffffff); | ||
1398 | return 0; | ||
1399 | } | ||
1400 | |||
1401 | static int vidioc_s_register (struct file *file, void *fh, | ||
1402 | struct v4l2_register *reg) | ||
1403 | { | ||
1404 | struct cx88_core *core = ((struct cx8800_fh*)fh)->dev->core; | ||
1405 | |||
1406 | if (reg->i2c_id != 0) | ||
1407 | return -EINVAL; | ||
1408 | if (!capable(CAP_SYS_ADMIN)) | ||
1409 | return -EPERM; | ||
1410 | cx_write(reg->reg&0xffffff, reg->val); | ||
1411 | return 0; | ||
1412 | } | ||
1413 | #endif | ||
1388 | 1414 | ||
1389 | /* ----------------------------------------------------------- */ | 1415 | /* ----------------------------------------------------------- */ |
1390 | /* RADIO ESPECIFIC IOCTLS */ | 1416 | /* RADIO ESPECIFIC IOCTLS */ |
@@ -1656,8 +1682,12 @@ static struct video_device cx8800_video_template = | |||
1656 | .vidioc_s_tuner = vidioc_s_tuner, | 1682 | .vidioc_s_tuner = vidioc_s_tuner, |
1657 | .vidioc_g_frequency = vidioc_g_frequency, | 1683 | .vidioc_g_frequency = vidioc_g_frequency, |
1658 | .vidioc_s_frequency = vidioc_s_frequency, | 1684 | .vidioc_s_frequency = vidioc_s_frequency, |
1685 | #ifdef CONFIG_VIDEO_ADV_DEBUG | ||
1686 | .vidioc_g_register = vidioc_g_register, | ||
1687 | .vidioc_s_register = vidioc_s_register, | ||
1688 | #endif | ||
1659 | .tvnorms = CX88_NORMS, | 1689 | .tvnorms = CX88_NORMS, |
1660 | .current_norm = V4L2_STD_NTSC_M, | 1690 | .current_norm = V4L2_STD_NTSC_M, |
1661 | }; | 1691 | }; |
1662 | 1692 | ||
1663 | static const struct file_operations radio_fops = | 1693 | static const struct file_operations radio_fops = |
diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c index a786c1f5b960..4b5d5f771e4c 100644 --- a/drivers/media/video/videodev.c +++ b/drivers/media/video/videodev.c | |||
@@ -1453,6 +1453,22 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, | |||
1453 | ret=vfd->vidioc_log_status(file, fh); | 1453 | ret=vfd->vidioc_log_status(file, fh); |
1454 | break; | 1454 | break; |
1455 | } | 1455 | } |
1456 | #ifdef CONFIG_VIDEO_ADV_DEBUG | ||
1457 | case VIDIOC_INT_G_REGISTER: | ||
1458 | { | ||
1459 | struct v4l2_register *p=arg; | ||
1460 | if (vfd->vidioc_g_register) | ||
1461 | ret=vfd->vidioc_g_register(file, fh, p); | ||
1462 | break; | ||
1463 | } | ||
1464 | case VIDIOC_INT_S_REGISTER: | ||
1465 | { | ||
1466 | struct v4l2_register *p=arg; | ||
1467 | if (vfd->vidioc_s_register) | ||
1468 | ret=vfd->vidioc_s_register(file, fh, p); | ||
1469 | break; | ||
1470 | } | ||
1471 | #endif | ||
1456 | } /* switch */ | 1472 | } /* switch */ |
1457 | 1473 | ||
1458 | if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) { | 1474 | if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) { |
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h index fb96472a1bd3..46eb71f5653c 100644 --- a/include/media/v4l2-dev.h +++ b/include/media/v4l2-dev.h | |||
@@ -77,6 +77,9 @@ int v4l_compat_translate_ioctl(struct inode *inode, struct file *file, | |||
77 | extern long v4l_compat_ioctl32(struct file *file, unsigned int cmd, | 77 | extern long v4l_compat_ioctl32(struct file *file, unsigned int cmd, |
78 | unsigned long arg); | 78 | unsigned long arg); |
79 | 79 | ||
80 | /* Forward definition of v4l2-common.h defined structure */ | ||
81 | struct v4l2_register; | ||
82 | |||
80 | /* | 83 | /* |
81 | * Newer version of video_device, handled by videodev2.c | 84 | * Newer version of video_device, handled by videodev2.c |
82 | * This version moves redundant code from video device code to | 85 | * This version moves redundant code from video device code to |
@@ -296,6 +299,15 @@ struct video_device | |||
296 | int (*vidioc_log_status) (struct file *file, void *fh); | 299 | int (*vidioc_log_status) (struct file *file, void *fh); |
297 | 300 | ||
298 | 301 | ||
302 | /* Debugging ioctls */ | ||
303 | #ifdef CONFIG_VIDEO_ADV_DEBUG | ||
304 | int (*vidioc_g_register) (struct file *file, void *fh, | ||
305 | struct v4l2_register *reg); | ||
306 | int (*vidioc_s_register) (struct file *file, void *fh, | ||
307 | struct v4l2_register *reg); | ||
308 | #endif | ||
309 | |||
310 | |||
299 | #ifdef OBSOLETE_OWNER /* to be removed soon */ | 311 | #ifdef OBSOLETE_OWNER /* to be removed soon */ |
300 | /* obsolete -- fops->owner is used instead */ | 312 | /* obsolete -- fops->owner is used instead */ |
301 | struct module *owner; | 313 | struct module *owner; |