Add VIDIOC_SUBDEV_QUERYCAP
Subsystems (2)
v3 cover Add VIDIOC_SUBDEV_QUERYCAP
From: Hans Verkuil <[email protected]>
This patch series adds the VIDIOC_SUBDEV_QUERYCAP ioctl for v4l-subdev devices as discussed during the ELC in San Jose and as discussed here:
http://www.spinics.net/lists/linux-media/msg88009.html
This patch series returns to the v1 patch series, but it drops the pads field and the VIDIOC_QUERYCAP changes.
This should hopefully make this a minimal uncontroversial implementation that I can finally start using in the v4l2-compliance utility.
Ideally I'd like to have a link back to the media controller, which is what the v2 patch series was all about, but not everyone agrees so I will probably require that when v4l2-compliance is called for a v4l-subdev node you also have to provide the MC device node.
Regards,
Hans
Hans Verkuil (2):
v4l2-subdev: add VIDIOC_SUBDEV_QUERYCAP ioctl
DocBook/media: document VIDIOC_SUBDEV_QUERYCAP
Documentation/DocBook/media/v4l/v4l2.xml | 1 + .../DocBook/media/v4l/vidioc-subdev-querycap.xml | 133 +++++++++++++++++++++ drivers/media/v4l2-core/v4l2-subdev.c | 17 +++ include/uapi/linux/v4l2-subdev.h | 18 +++ 4 files changed, 169 insertions(+) create mode 100644 Documentation/DocBook/media/v4l/vidioc-subdev-querycap.xml
Signature · 1 line
2.1.4
RFC PATCH v3 1/2 v4l2-subdev: add VIDIOC_SUBDEV_QUERYCAP ioctl
From: Hans Verkuil <[email protected]>
While normal video/radio/vbi/swradio nodes have a proper QUERYCAP ioctl that apps can call to determine that it is indeed a V4L2 device, there is currently no equivalent for v4l-subdev nodes. Adding this ioctl will solve that, and it will allow utilities like v4l2-compliance to be used with these devices as well.
SUBDEV_QUERYCAP currently returns the version, device_caps and the entity_id of the subdevice (if there is any).
--- drivers/media/v4l2-core/v4l2-subdev.c | 17 +++++++++++++++++ include/uapi/linux/v4l2-subdev.h | 18 ++++++++++++++++++ 2 files changed, 35 insertions(+)
drivers/media/v4l2-core/v4l2-subdev.c +17 -0
@@ -25,6 +25,7 @@#include <linux/types.h> #include <linux/videodev2.h> #include <linux/export.h> +#include <linux/version.h> #include <media/v4l2-ctrls.h> #include <media/v4l2-device.h>
@@ -187,6 +188,22 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)#endif switch (cmd) { +case VIDIOC_SUBDEV_QUERYCAP : { +struct v4l2_subdev_capability *cap = arg; + + cap->version =LINUX_VERSION_CODE ; + cap->device_caps =0 ; + cap->entity_id =0 ; +#if defined(CONFIG_MEDIA_CONTROLLER ) +if (sd->entity.parent) { + cap->device_caps =V4L2_SUBDEV_CAP_ENTITY ; + cap->entity_id = sd->entity.id; + } +#endif +memset (cap->reserved,0 ,sizeof (cap->reserved)); +break ; + } +case VIDIOC_QUERYCTRL :return v4l2_queryctrl (vfh->ctrl_handler, arg);
include/uapi/linux/v4l2-subdev.h +18 -0
@@ -154,9 +154,27 @@ struct v4l2_subdev_selection {__u32 reserved[8 ]; }; +/** +* struct v4l2_subdev_capability - subdev capabilities +* @version: the kernel version +* @device_caps: the subdev capabilities +* @entity_id: the entity ID if V4L2_SUBDEV_CAP_ENTITY is set +* @reserved: for future use, set to zero for now +*/ +struct v4l2_subdev_capability { +__u32 version; +__u32 device_caps; +__u32 entity_id; +__u32 reserved[29 ]; +}; + +/* This v4l2_subdev is also a media entity and the entity_id field is valid */ +#define V4L2_SUBDEV_CAP_ENTITY (1 << 0) +/* Backwards compatibility define --- to be removed */ #define v4l2_subdev_edid v4l2_edid +#define VIDIOC_SUBDEV_QUERYCAP _IOR('V', 0, struct v4l2_subdev_capability)#define VIDIOC_SUBDEV_G_FMT _IOWR('V', 4, struct v4l2_subdev_format)#define VIDIOC_SUBDEV_S_FMT _IOWR('V', 5, struct v4l2_subdev_format)#define VIDIOC_SUBDEV_G_FRAME_INTERVAL _IOWR('V', 21, struct v4l2_subdev_frame_interval)
Signature · 1 line
2.1.4
RFC PATCH v3 2/2 DocBook/media: document VIDIOC_SUBDEV_QUERYCAP
In reply to Hans VerkuilFrom: Hans Verkuil <[email protected]>
Add documentation for the new VIDIOC_SUBDEV_QUERYCAP ioctl.
--- Documentation/DocBook/media/v4l/v4l2.xml | 1 + .../DocBook/media/v4l/vidioc-subdev-querycap.xml | 133 +++++++++++++++++++++ 2 files changed, 134 insertions(+) create mode 100644 Documentation/DocBook/media/v4l/vidioc-subdev-querycap.xml
Documentation/DocBook/media/v4l/v4l2.xml +1 -0
@@ -669,6 +669,7 @@ and discussions on the V4L mailing list.</revremark> &sub-subdev-g-fmt; &sub-subdev-g-frame-interval; &sub-subdev-g-selection; + &sub-subdev-querycap; &sub-subscribe-event; <!-- End of ioctls. --> &sub-mmap;
Documentation/DocBook/media/v4l/vidioc-subdev-querycap.xml new file +133 -0
133 lines not on this page · raw message
Signature · 1 line
2.1.4