aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/vimc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/platform/vimc')
-rw-r--r--drivers/media/platform/vimc/vimc-common.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/media/platform/vimc/vimc-common.h b/drivers/media/platform/vimc/vimc-common.h
index 60ebde28f56b..43483eecb116 100644
--- a/drivers/media/platform/vimc/vimc-common.h
+++ b/drivers/media/platform/vimc/vimc-common.h
@@ -23,6 +23,32 @@
23#include <media/v4l2-device.h> 23#include <media/v4l2-device.h>
24 24
25/** 25/**
26 * struct vimc_colorimetry_clamp - Adjust colorimetry parameters
27 *
28 * @fmt: the pointer to struct v4l2_pix_format or
29 * struct v4l2_mbus_framefmt
30 *
31 * Entities must check if colorimetry given by the userspace is valid, if not
32 * then set them as DEFAULT
33 */
34#define vimc_colorimetry_clamp(fmt) \
35do { \
36 if ((fmt)->colorspace == V4L2_COLORSPACE_DEFAULT \
37 || (fmt)->colorspace > V4L2_COLORSPACE_DCI_P3) { \
38 (fmt)->colorspace = V4L2_COLORSPACE_DEFAULT; \
39 (fmt)->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; \
40 (fmt)->quantization = V4L2_QUANTIZATION_DEFAULT; \
41 (fmt)->xfer_func = V4L2_XFER_FUNC_DEFAULT; \
42 } \
43 if ((fmt)->ycbcr_enc > V4L2_YCBCR_ENC_SMPTE240M) \
44 (fmt)->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; \
45 if ((fmt)->quantization > V4L2_QUANTIZATION_LIM_RANGE) \
46 (fmt)->quantization = V4L2_QUANTIZATION_DEFAULT; \
47 if ((fmt)->xfer_func > V4L2_XFER_FUNC_SMPTE2084) \
48 (fmt)->xfer_func = V4L2_XFER_FUNC_DEFAULT; \
49} while (0)
50
51/**
26 * struct vimc_pix_map - maps media bus code with v4l2 pixel format 52 * struct vimc_pix_map - maps media bus code with v4l2 pixel format
27 * 53 *
28 * @code: media bus format code defined by MEDIA_BUS_FMT_* macros 54 * @code: media bus format code defined by MEDIA_BUS_FMT_* macros