summaryrefslogtreecommitdiff
path: root/drivers/media/v4l2-core/v4l2-subdev.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2018-02-03 08:24:44 -0500
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2018-02-26 09:33:39 -0500
commitf437a7cb87b2814bba4f334fe97d0f02e7ed6079 (patch)
tree4ae1c1b18af732473e3ead3bc530bd4036e9ec8d /drivers/media/v4l2-core/v4l2-subdev.c
parent3103c7b4ad08d813ec5c8187f7a9ddea55acf027 (diff)
downloadlwn-f437a7cb87b2814bba4f334fe97d0f02e7ed6079.tar.gz
lwn-f437a7cb87b2814bba4f334fe97d0f02e7ed6079.zip
media: v4l2-subdev: implement VIDIOC_DBG_G_CHIP_INFO ioctl
The VIDIOC_DBG_G/S_REGISTER ioctls imply that VIDIOC_DBG_G_CHIP_INFO is also present, since without that you cannot use v4l2-dbg. Just like the implementation in v4l2-ioctl.c this can be implemented in the core and no drivers need to be modified. It also makes it possible for v4l2-compliance to properly test the VIDIOC_DBG_G/S_REGISTER ioctls. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/v4l2-core/v4l2-subdev.c')
-rw-r--r--drivers/media/v4l2-core/v4l2-subdev.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
index ec0bd6411aa7..f9eed938d348 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -263,6 +263,19 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
return -EPERM;
return v4l2_subdev_call(sd, core, s_register, p);
}
+ case VIDIOC_DBG_G_CHIP_INFO:
+ {
+ struct v4l2_dbg_chip_info *p = arg;
+
+ if (p->match.type != V4L2_CHIP_MATCH_SUBDEV || p->match.addr)
+ return -EINVAL;
+ if (sd->ops->core && sd->ops->core->s_register)
+ p->flags |= V4L2_CHIP_FL_WRITABLE;
+ if (sd->ops->core && sd->ops->core->g_register)
+ p->flags |= V4L2_CHIP_FL_READABLE;
+ strlcpy(p->name, sd->name, sizeof(p->name));
+ return 0;
+ }
#endif
case VIDIOC_LOG_STATUS: {