mirror of
https://github.com/torvalds/linux.git
synced 2024-11-14 16:12:02 +00:00
2d83eb5d24
Since v4l2_fill_fmtdesc will be called in the ioctl v4l_enum_fmt anyway. We can set the format description and compressed flag from v4l_fill_fmtdesc and can remove the extra name field in uvc_format_desc. Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Tested-by: Daniel Scally <dan.scally@ideasonboard.com> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Link: https://lore.kernel.org/r/20230126231456.3402323-6-m.grzeschik@pengutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
184 lines
3.3 KiB
C
184 lines
3.3 KiB
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/module.h>
|
|
#include <linux/string.h>
|
|
#include <linux/types.h>
|
|
#include <linux/usb/uvc.h>
|
|
#include <linux/videodev2.h>
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Video formats
|
|
*/
|
|
|
|
static const struct uvc_format_desc uvc_fmts[] = {
|
|
{
|
|
.guid = UVC_GUID_FORMAT_YUY2,
|
|
.fcc = V4L2_PIX_FMT_YUYV,
|
|
},
|
|
{
|
|
.guid = UVC_GUID_FORMAT_YUY2_ISIGHT,
|
|
.fcc = V4L2_PIX_FMT_YUYV,
|
|
},
|
|
{
|
|
.guid = UVC_GUID_FORMAT_NV12,
|
|
.fcc = V4L2_PIX_FMT_NV12,
|
|
},
|
|
{
|
|
.guid = UVC_GUID_FORMAT_MJPEG,
|
|
.fcc = V4L2_PIX_FMT_MJPEG,
|
|
},
|
|
{
|
|
.guid = UVC_GUID_FORMAT_YV12,
|
|
.fcc = V4L2_PIX_FMT_YVU420,
|
|
},
|
|
{
|
|
.guid = UVC_GUID_FORMAT_I420,
|
|
.fcc = V4L2_PIX_FMT_YUV420,
|
|
},
|
|
{
|
|
.guid = UVC_GUID_FORMAT_M420,
|
|
.fcc = V4L2_PIX_FMT_M420,
|
|
},
|
|
{
|
|
.guid = UVC_GUID_FORMAT_UYVY,
|
|
.fcc = V4L2_PIX_FMT_UYVY,
|
|
},
|
|
{
|
|
.guid = UVC_GUID_FORMAT_Y800,
|
|
.fcc = V4L2_PIX_FMT_GREY,
|
|
},
|
|
{
|
|
.guid = UVC_GUID_FORMAT_Y8,
|
|
.fcc = V4L2_PIX_FMT_GREY,
|
|
},
|
|
{
|
|
.guid = UVC_GUID_FORMAT_D3DFMT_L8,
|
|
.fcc = V4L2_PIX_FMT_GREY,
|
|
},
|
|
{
|
|
.guid = UVC_GUID_FORMAT_KSMEDIA_L8_IR,
|
|
.fcc = V4L2_PIX_FMT_GREY,
|
|
},
|
|
{
|
|
.guid = UVC_GUID_FORMAT_Y10,
|
|
.fcc = V4L2_PIX_FMT_Y10,
|
|
},
|
|
{
|
|
.guid = UVC_GUID_FORMAT_Y12,
|
|
.fcc = V4L2_PIX_FMT_Y12,
|
|
},
|
|
{
|
|
.guid = UVC_GUID_FORMAT_Y16,
|
|
.fcc = V4L2_PIX_FMT_Y16,
|
|
},
|
|
{
|
|
.guid = UVC_GUID_FORMAT_BY8,
|
|
.fcc = V4L2_PIX_FMT_SBGGR8,
|
|
},
|
|
{
|
|
.guid = UVC_GUID_FORMAT_BA81,
|
|
.fcc = V4L2_PIX_FMT_SBGGR8,
|
|
},
|
|
{
|
|
.guid = UVC_GUID_FORMAT_GBRG,
|
|
.fcc = V4L2_PIX_FMT_SGBRG8,
|
|
},
|
|
{
|
|
.guid = UVC_GUID_FORMAT_GRBG,
|
|
.fcc = V4L2_PIX_FMT_SGRBG8,
|
|
},
|
|
{
|
|
.guid = UVC_GUID_FORMAT_RGGB,
|
|
.fcc = V4L2_PIX_FMT_SRGGB8,
|
|
},
|
|
{
|
|
.guid = UVC_GUID_FORMAT_RGBP,
|
|
.fcc = V4L2_PIX_FMT_RGB565,
|
|
},
|
|
{
|
|
.guid = UVC_GUID_FORMAT_BGR3,
|
|
.fcc = V4L2_PIX_FMT_BGR24,
|
|
},
|
|
{
|
|
.guid = UVC_GUID_FORMAT_BGR4,
|
|
.fcc = V4L2_PIX_FMT_XBGR32,
|
|
},
|
|
{
|
|
.guid = UVC_GUID_FORMAT_H264,
|
|
.fcc = V4L2_PIX_FMT_H264,
|
|
},
|
|
{
|
|
.guid = UVC_GUID_FORMAT_H265,
|
|
.fcc = V4L2_PIX_FMT_HEVC,
|
|
},
|
|
{
|
|
.guid = UVC_GUID_FORMAT_Y8I,
|
|
.fcc = V4L2_PIX_FMT_Y8I,
|
|
},
|
|
{
|
|
.guid = UVC_GUID_FORMAT_Y12I,
|
|
.fcc = V4L2_PIX_FMT_Y12I,
|
|
},
|
|
{
|
|
.guid = UVC_GUID_FORMAT_Z16,
|
|
.fcc = V4L2_PIX_FMT_Z16,
|
|
},
|
|
{
|
|
.guid = UVC_GUID_FORMAT_RW10,
|
|
.fcc = V4L2_PIX_FMT_SRGGB10P,
|
|
},
|
|
{
|
|
.guid = UVC_GUID_FORMAT_BG16,
|
|
.fcc = V4L2_PIX_FMT_SBGGR16,
|
|
},
|
|
{
|
|
.guid = UVC_GUID_FORMAT_GB16,
|
|
.fcc = V4L2_PIX_FMT_SGBRG16,
|
|
},
|
|
{
|
|
.guid = UVC_GUID_FORMAT_RG16,
|
|
.fcc = V4L2_PIX_FMT_SRGGB16,
|
|
},
|
|
{
|
|
.guid = UVC_GUID_FORMAT_GR16,
|
|
.fcc = V4L2_PIX_FMT_SGRBG16,
|
|
},
|
|
{
|
|
.guid = UVC_GUID_FORMAT_INVZ,
|
|
.fcc = V4L2_PIX_FMT_Z16,
|
|
},
|
|
{
|
|
.guid = UVC_GUID_FORMAT_INVI,
|
|
.fcc = V4L2_PIX_FMT_Y10,
|
|
},
|
|
{
|
|
.guid = UVC_GUID_FORMAT_INZI,
|
|
.fcc = V4L2_PIX_FMT_INZI,
|
|
},
|
|
{
|
|
.guid = UVC_GUID_FORMAT_CNF4,
|
|
.fcc = V4L2_PIX_FMT_CNF4,
|
|
},
|
|
{
|
|
.guid = UVC_GUID_FORMAT_HEVC,
|
|
.fcc = V4L2_PIX_FMT_HEVC,
|
|
},
|
|
};
|
|
|
|
const struct uvc_format_desc *uvc_format_by_guid(const u8 guid[16])
|
|
{
|
|
unsigned int len = ARRAY_SIZE(uvc_fmts);
|
|
unsigned int i;
|
|
|
|
for (i = 0; i < len; ++i) {
|
|
if (memcmp(guid, uvc_fmts[i].guid, 16) == 0)
|
|
return &uvc_fmts[i];
|
|
}
|
|
|
|
return NULL;
|
|
}
|
|
EXPORT_SYMBOL_GPL(uvc_format_by_guid);
|
|
|
|
MODULE_LICENSE("GPL");
|