Commit dbbff48f authored by Trent Piepho's avatar Trent Piepho Committed by Mauro Carvalho Chehab

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: default avatarTrent Piepho <xyzzy@speakeasy.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 758117c2
...@@ -1385,6 +1385,32 @@ static int vidioc_s_frequency (struct file *file, void *priv, ...@@ -1385,6 +1385,32 @@ static int vidioc_s_frequency (struct file *file, void *priv,
cx88_set_freq (core,f); cx88_set_freq (core,f);
} }
#ifdef CONFIG_VIDEO_ADV_DEBUG
static int vidioc_g_register (struct file *file, void *fh,
struct v4l2_register *reg)
{
struct cx88_core *core = ((struct cx8800_fh*)fh)->dev->core;
if (reg->i2c_id != 0)
return -EINVAL;
/* cx2388x has a 24-bit register space */
reg->val = cx_read(reg->reg&0xffffff);
return 0;
}
static int vidioc_s_register (struct file *file, void *fh,
struct v4l2_register *reg)
{
struct cx88_core *core = ((struct cx8800_fh*)fh)->dev->core;
if (reg->i2c_id != 0)
return -EINVAL;
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
cx_write(reg->reg&0xffffff, reg->val);
return 0;
}
#endif
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
/* RADIO ESPECIFIC IOCTLS */ /* RADIO ESPECIFIC IOCTLS */
...@@ -1656,8 +1682,12 @@ static struct video_device cx8800_video_template = ...@@ -1656,8 +1682,12 @@ static struct video_device cx8800_video_template =
.vidioc_s_tuner = vidioc_s_tuner, .vidioc_s_tuner = vidioc_s_tuner,
.vidioc_g_frequency = vidioc_g_frequency, .vidioc_g_frequency = vidioc_g_frequency,
.vidioc_s_frequency = vidioc_s_frequency, .vidioc_s_frequency = vidioc_s_frequency,
#ifdef CONFIG_VIDEO_ADV_DEBUG
.vidioc_g_register = vidioc_g_register,
.vidioc_s_register = vidioc_s_register,
#endif
.tvnorms = CX88_NORMS, .tvnorms = CX88_NORMS,
.current_norm = V4L2_STD_NTSC_M, .current_norm = V4L2_STD_NTSC_M,
}; };
static const struct file_operations radio_fops = static const struct file_operations radio_fops =
......
...@@ -1453,6 +1453,22 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, ...@@ -1453,6 +1453,22 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
ret=vfd->vidioc_log_status(file, fh); ret=vfd->vidioc_log_status(file, fh);
break; break;
} }
#ifdef CONFIG_VIDEO_ADV_DEBUG
case VIDIOC_INT_G_REGISTER:
{
struct v4l2_register *p=arg;
if (vfd->vidioc_g_register)
ret=vfd->vidioc_g_register(file, fh, p);
break;
}
case VIDIOC_INT_S_REGISTER:
{
struct v4l2_register *p=arg;
if (vfd->vidioc_s_register)
ret=vfd->vidioc_s_register(file, fh, p);
break;
}
#endif
} /* switch */ } /* switch */
if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) { if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) {
......
...@@ -77,6 +77,9 @@ int v4l_compat_translate_ioctl(struct inode *inode, struct file *file, ...@@ -77,6 +77,9 @@ int v4l_compat_translate_ioctl(struct inode *inode, struct file *file,
extern long v4l_compat_ioctl32(struct file *file, unsigned int cmd, extern long v4l_compat_ioctl32(struct file *file, unsigned int cmd,
unsigned long arg); unsigned long arg);
/* Forward definition of v4l2-common.h defined structure */
struct v4l2_register;
/* /*
* Newer version of video_device, handled by videodev2.c * Newer version of video_device, handled by videodev2.c
* This version moves redundant code from video device code to * This version moves redundant code from video device code to
...@@ -296,6 +299,15 @@ struct video_device ...@@ -296,6 +299,15 @@ struct video_device
int (*vidioc_log_status) (struct file *file, void *fh); int (*vidioc_log_status) (struct file *file, void *fh);
/* Debugging ioctls */
#ifdef CONFIG_VIDEO_ADV_DEBUG
int (*vidioc_g_register) (struct file *file, void *fh,
struct v4l2_register *reg);
int (*vidioc_s_register) (struct file *file, void *fh,
struct v4l2_register *reg);
#endif
#ifdef OBSOLETE_OWNER /* to be removed soon */ #ifdef OBSOLETE_OWNER /* to be removed soon */
/* obsolete -- fops->owner is used instead */ /* obsolete -- fops->owner is used instead */
struct module *owner; struct module *owner;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment