diff options
Diffstat (limited to 'drivers/media/video/cx18/cx18-ioctl.c')
-rw-r--r-- | drivers/media/video/cx18/cx18-ioctl.c | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/drivers/media/video/cx18/cx18-ioctl.c b/drivers/media/video/cx18/cx18-ioctl.c index 7231f60a180b..017b13efc072 100644 --- a/drivers/media/video/cx18/cx18-ioctl.c +++ b/drivers/media/video/cx18/cx18-ioctl.c | |||
@@ -113,25 +113,6 @@ u16 cx18_get_service_set(struct v4l2_sliced_vbi_format *fmt) | |||
113 | return set; | 113 | return set; |
114 | } | 114 | } |
115 | 115 | ||
116 | static int cx18_cxc(struct cx18 *cx, unsigned int cmd, void *arg) | ||
117 | { | ||
118 | struct v4l2_register *regs = arg; | ||
119 | unsigned long flags; | ||
120 | |||
121 | if (!capable(CAP_SYS_ADMIN)) | ||
122 | return -EPERM; | ||
123 | if (regs->reg >= CX18_MEM_OFFSET + CX18_MEM_SIZE) | ||
124 | return -EINVAL; | ||
125 | |||
126 | spin_lock_irqsave(&cx18_cards_lock, flags); | ||
127 | if (cmd == VIDIOC_DBG_G_REGISTER) | ||
128 | regs->val = read_enc(regs->reg); | ||
129 | else | ||
130 | write_enc(regs->val, regs->reg); | ||
131 | spin_unlock_irqrestore(&cx18_cards_lock, flags); | ||
132 | return 0; | ||
133 | } | ||
134 | |||
135 | static int cx18_g_fmt_vid_cap(struct file *file, void *fh, | 116 | static int cx18_g_fmt_vid_cap(struct file *file, void *fh, |
136 | struct v4l2_format *fmt) | 117 | struct v4l2_format *fmt) |
137 | { | 118 | { |
@@ -292,6 +273,26 @@ static int cx18_g_chip_ident(struct file *file, void *fh, | |||
292 | return -EINVAL; | 273 | return -EINVAL; |
293 | } | 274 | } |
294 | 275 | ||
276 | #ifdef CONFIG_VIDEO_ADV_DEBUG | ||
277 | static int cx18_cxc(struct cx18 *cx, unsigned int cmd, void *arg) | ||
278 | { | ||
279 | struct v4l2_register *regs = arg; | ||
280 | unsigned long flags; | ||
281 | |||
282 | if (!capable(CAP_SYS_ADMIN)) | ||
283 | return -EPERM; | ||
284 | if (regs->reg >= CX18_MEM_OFFSET + CX18_MEM_SIZE) | ||
285 | return -EINVAL; | ||
286 | |||
287 | spin_lock_irqsave(&cx18_cards_lock, flags); | ||
288 | if (cmd == VIDIOC_DBG_G_REGISTER) | ||
289 | regs->val = read_enc(regs->reg); | ||
290 | else | ||
291 | write_enc(regs->val, regs->reg); | ||
292 | spin_unlock_irqrestore(&cx18_cards_lock, flags); | ||
293 | return 0; | ||
294 | } | ||
295 | |||
295 | static int cx18_g_register(struct file *file, void *fh, | 296 | static int cx18_g_register(struct file *file, void *fh, |
296 | struct v4l2_register *reg) | 297 | struct v4l2_register *reg) |
297 | { | 298 | { |
@@ -319,6 +320,7 @@ static int cx18_s_register(struct file *file, void *fh, | |||
319 | return cx18_call_i2c_client(cx, reg->match_chip, VIDIOC_DBG_S_REGISTER, | 320 | return cx18_call_i2c_client(cx, reg->match_chip, VIDIOC_DBG_S_REGISTER, |
320 | reg); | 321 | reg); |
321 | } | 322 | } |
323 | #endif | ||
322 | 324 | ||
323 | static int cx18_g_priority(struct file *file, void *fh, enum v4l2_priority *p) | 325 | static int cx18_g_priority(struct file *file, void *fh, enum v4l2_priority *p) |
324 | { | 326 | { |
@@ -810,8 +812,10 @@ void cx18_set_funcs(struct video_device *vdev) | |||
810 | vdev->vidioc_try_fmt_sliced_vbi_cap = cx18_try_fmt_sliced_vbi_cap; | 812 | vdev->vidioc_try_fmt_sliced_vbi_cap = cx18_try_fmt_sliced_vbi_cap; |
811 | vdev->vidioc_g_sliced_vbi_cap = cx18_g_sliced_vbi_cap; | 813 | vdev->vidioc_g_sliced_vbi_cap = cx18_g_sliced_vbi_cap; |
812 | vdev->vidioc_g_chip_ident = cx18_g_chip_ident; | 814 | vdev->vidioc_g_chip_ident = cx18_g_chip_ident; |
815 | #ifdef CONFIG_VIDEO_ADV_DEBUG | ||
813 | vdev->vidioc_g_register = cx18_g_register; | 816 | vdev->vidioc_g_register = cx18_g_register; |
814 | vdev->vidioc_s_register = cx18_s_register; | 817 | vdev->vidioc_s_register = cx18_s_register; |
818 | #endif | ||
815 | vdev->vidioc_default = cx18_default; | 819 | vdev->vidioc_default = cx18_default; |
816 | vdev->vidioc_queryctrl = cx18_queryctrl; | 820 | vdev->vidioc_queryctrl = cx18_queryctrl; |
817 | vdev->vidioc_querymenu = cx18_querymenu; | 821 | vdev->vidioc_querymenu = cx18_querymenu; |