Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: uapi: Introduce V4L2 generic ISP types

Introduce v4l2-isp.h in the Linux kernel uAPI.

The header includes types for generic ISP configuration parameters
and will be extended in the future with support for generic ISP statistics
formats.

Generic ISP parameters support is provided by introducing two new
types that represent an extensible and versioned buffer of ISP
configuration parameters.

The v4l2_params_buffer represents the container for the ISP
configuration data block. The generic type is defined with a 0-sized
data member that the ISP driver implementations shall properly size
according to their capabilities. The v4l2_params_block_header structure
represents the header to be prepend to each ISP configuration block.

Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Michael Riesch <michael.riesch@collabora.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>

authored by

Jacopo Mondi and committed by
Hans Verkuil
e36dbd1c d363bdfa

+108
+6
MAINTAINERS
··· 26885 26885 F: drivers/media/i2c/vd56g3.c 26886 26886 F: drivers/media/i2c/vgxy61.c 26887 26887 26888 + V4L2 GENERIC ISP PARAMETERS AND STATISTIC FORMATS 26889 + M: Jacopo Mondi <jacopo.mondi@ideasonboard.com> 26890 + L: linux-media@vger.kernel.org 26891 + S: Maintained 26892 + F: include/uapi/linux/media/v4l2-isp.h 26893 + 26888 26894 VF610 NAND DRIVER 26889 26895 M: Stefan Agner <stefan@agner.ch> 26890 26896 L: linux-mtd@lists.infradead.org
+102
include/uapi/linux/media/v4l2-isp.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 + /* 3 + * Video4Linux2 generic ISP parameters and statistics support 4 + * 5 + * Copyright (C) 2025 Ideas On Board Oy 6 + * Author: Jacopo Mondi <jacopo.mondi@ideasonboard.com> 7 + */ 8 + 9 + #ifndef _UAPI_V4L2_ISP_H_ 10 + #define _UAPI_V4L2_ISP_H_ 11 + 12 + #include <linux/stddef.h> 13 + #include <linux/types.h> 14 + 15 + /** 16 + * enum v4l2_isp_params_version - V4L2 ISP parameters versioning 17 + * 18 + * @V4L2_ISP_PARAMS_VERSION_V0: First version of the V4L2 ISP parameters format 19 + * (for compatibility) 20 + * @V4L2_ISP_PARAMS_VERSION_V1: First version of the V4L2 ISP parameters format 21 + * 22 + * V0 and V1 are identical in order to support drivers compatible with the V4L2 23 + * ISP parameters format already upstreamed which use either 0 or 1 as their 24 + * versioning identifier. Both V0 and V1 refers to the first version of the 25 + * V4L2 ISP parameters format. 26 + * 27 + * Future revisions of the V4L2 ISP parameters format should start from the 28 + * value of 2. 29 + */ 30 + enum v4l2_isp_params_version { 31 + V4L2_ISP_PARAMS_VERSION_V0 = 0, 32 + V4L2_ISP_PARAMS_VERSION_V1 33 + }; 34 + 35 + #define V4L2_ISP_PARAMS_FL_BLOCK_DISABLE (1U << 0) 36 + #define V4L2_ISP_PARAMS_FL_BLOCK_ENABLE (1U << 1) 37 + 38 + /* 39 + * Reserve the first 8 bits for V4L2_ISP_PARAMS_FL_* flag. 40 + * 41 + * Driver-specific flags should be defined as: 42 + * #define DRIVER_SPECIFIC_FLAG0 ((1U << V4L2_ISP_PARAMS_FL_DRIVER_FLAGS(0)) 43 + * #define DRIVER_SPECIFIC_FLAG1 ((1U << V4L2_ISP_PARAMS_FL_DRIVER_FLAGS(1)) 44 + */ 45 + #define V4L2_ISP_PARAMS_FL_DRIVER_FLAGS(n) ((n) + 8) 46 + 47 + /** 48 + * struct v4l2_isp_params_block_header - V4L2 extensible parameters block header 49 + * @type: The parameters block type (driver-specific) 50 + * @flags: A bitmask of block flags (driver-specific) 51 + * @size: Size (in bytes) of the parameters block, including this header 52 + * 53 + * This structure represents the common part of all the ISP configuration 54 + * blocks. Each parameters block shall embed an instance of this structure type 55 + * as its first member, followed by the block-specific configuration data. 56 + * 57 + * The @type field is an ISP driver-specific value that identifies the block 58 + * type. The @size field specifies the size of the parameters block. 59 + * 60 + * The @flags field is a bitmask of per-block flags V4L2_PARAMS_ISP_FL_* and 61 + * driver-specific flags specified by the driver header. 62 + */ 63 + struct v4l2_isp_params_block_header { 64 + __u16 type; 65 + __u16 flags; 66 + __u32 size; 67 + } __attribute__((aligned(8))); 68 + 69 + /** 70 + * struct v4l2_isp_params_buffer - V4L2 extensible parameters configuration 71 + * @version: The parameters buffer version (driver-specific) 72 + * @data_size: The configuration data effective size, excluding this header 73 + * @data: The configuration data 74 + * 75 + * This structure contains the configuration parameters of the ISP algorithms, 76 + * serialized by userspace into a data buffer. Each configuration parameter 77 + * block is represented by a block-specific structure which contains a 78 + * :c:type:`v4l2_isp_params_block_header` entry as first member. Userspace 79 + * populates the @data buffer with configuration parameters for the blocks that 80 + * it intends to configure. As a consequence, the data buffer effective size 81 + * changes according to the number of ISP blocks that userspace intends to 82 + * configure and is set by userspace in the @data_size field. 83 + * 84 + * The parameters buffer is versioned by the @version field to allow modifying 85 + * and extending its definition. Userspace shall populate the @version field to 86 + * inform the driver about the version it intends to use. The driver will parse 87 + * and handle the @data buffer according to the data layout specific to the 88 + * indicated version and return an error if the desired version is not 89 + * supported. 90 + * 91 + * For each ISP block that userspace wants to configure, a block-specific 92 + * structure is appended to the @data buffer, one after the other without gaps 93 + * in between. Userspace shall populate the @data_size field with the effective 94 + * size, in bytes, of the @data buffer. 95 + */ 96 + struct v4l2_isp_params_buffer { 97 + __u32 version; 98 + __u32 data_size; 99 + __u8 data[] __counted_by(data_size); 100 + }; 101 + 102 + #endif /* _UAPI_V4L2_ISP_H_ */