summaryrefslogtreecommitdiff
path: root/drivers/media/usb/uvc/uvc_driver.c
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <guennadi.liakhovetski@intel.com>2017-12-06 18:15:40 +0300
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2018-01-04 14:41:47 +0300
commit088ead25524583e2200aa99111bea2f66a86545a (patch)
tree39118e9e19ec50e11c16583cb502b2097a6a96dc /drivers/media/usb/uvc/uvc_driver.c
parent3bc85817d7982ed53fbc9b150b0205beff68ca5c (diff)
downloadlinux-088ead25524583e2200aa99111bea2f66a86545a.tar.xz
media: uvcvideo: Add a metadata device node
Some UVC video cameras contain metadata in their payload headers. This patch extracts that data, adding more clock synchronisation information, on both bulk and isochronous endpoints and makes it available to the user space on a separate video node, using the V4L2_CAP_META_CAPTURE capability and the V4L2_BUF_TYPE_META_CAPTURE buffer queue type. By default, only the V4L2_META_FMT_UVC pixel format is available from those nodes. However, cameras can be added to the device ID table to additionally specify their own metadata format, in which case that format will also become available from the metadata node. [Use put_unaligned instead of __put_unaligned_cpu64] [Use put_unaligned for the sof field as well] Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@intel.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/usb/uvc/uvc_driver.c')
-rw-r--r--drivers/media/usb/uvc/uvc_driver.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index 1509bbc77a2f..2886c100abf2 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -1883,6 +1883,7 @@ static void uvc_unregister_video(struct uvc_device *dev)
continue;
video_unregister_device(&stream->vdev);
+ video_unregister_device(&stream->meta.vdev);
uvc_debugfs_cleanup_stream(stream);
}
@@ -1930,6 +1931,9 @@ int uvc_register_video_device(struct uvc_device *dev,
case V4L2_BUF_TYPE_VIDEO_OUTPUT:
vdev->device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING;
break;
+ case V4L2_BUF_TYPE_META_CAPTURE:
+ vdev->device_caps = V4L2_CAP_META_CAPTURE | V4L2_CAP_STREAMING;
+ break;
}
strlcpy(vdev->name, dev->name, sizeof vdev->name);
@@ -1965,7 +1969,8 @@ static int uvc_register_video(struct uvc_device *dev,
}
if (stream->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
- stream->chain->caps |= V4L2_CAP_VIDEO_CAPTURE;
+ stream->chain->caps |= V4L2_CAP_VIDEO_CAPTURE
+ | V4L2_CAP_META_CAPTURE;
else
stream->chain->caps |= V4L2_CAP_VIDEO_OUTPUT;
@@ -2003,6 +2008,11 @@ static int uvc_register_terms(struct uvc_device *dev,
if (ret < 0)
return ret;
+ /* Register a metadata node, but ignore a possible failure,
+ * complete registration of video nodes anyway.
+ */
+ uvc_meta_register(stream);
+
term->vdev = &stream->vdev;
}
@@ -2037,6 +2047,7 @@ static int uvc_register_chains(struct uvc_device *dev)
struct uvc_device_info {
u32 quirks;
+ u32 meta_format;
};
static int uvc_probe(struct usb_interface *intf,
@@ -2074,6 +2085,8 @@ static int uvc_probe(struct usb_interface *intf,
dev->intfnum = intf->cur_altsetting->desc.bInterfaceNumber;
dev->quirks = (uvc_quirks_param == -1)
? quirks : uvc_quirks_param;
+ if (info)
+ dev->meta_format = info->meta_format;
if (udev->product != NULL)
strlcpy(dev->name, udev->product, sizeof dev->name);