{"id":24122,"url":"https://patchwork.libcamera.org/api/patches/24122/?format=json","web_url":"https://patchwork.libcamera.org/patch/24122/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20250815102945.1602071-13-stefan.klug@ideasonboard.com>","date":"2025-08-15T10:29:32","name":"[v3,12/19] include: linux: Partially update linux headers from v6.16-rc1-310-gd968e50b5c26","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"6b5c21d1b9fbcd15e7dbcdffe8e801cc9de8b82b","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/people/184/?format=json","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/24122/mbox/","series":[{"id":5382,"url":"https://patchwork.libcamera.org/api/series/5382/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5382","date":"2025-08-15T10:29:20","name":"Implement WDR algorithm","version":3,"mbox":"https://patchwork.libcamera.org/series/5382/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/24122/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/24122/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 69FD8BDCC1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 15 Aug 2025 10:30:31 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1EDF76926A;\n\tFri, 15 Aug 2025 12:30:31 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8310B6925A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 15 Aug 2025 12:30:28 +0200 (CEST)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:83d1:ae5d:93a6:6837])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id A4AFE56D;\n\tFri, 15 Aug 2025 12:29:33 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"ZWix8vcj\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1755253773;\n\tbh=dlJwPe7tBTRARBlNRzxYi//ezIHFoDMb7a1Qcoyo+qo=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=ZWix8vcjY75TD2IxA0myAk0sGJLkBasRjKhuNkaGJdYCJvzCMDeLbCqLY6SAVCKoK\n\t94q+LnrYGD4qhZMhhvhjyEJWsioR+dsfV4szdl22PGra3jsoJM3gMDD/CHlWoyLLJp\n\tfRDDdTFXG9evDWj2zq2BGkTsvwhw2vvPdgiR0Ti8=","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>","Subject":"[PATCH v3 12/19] include: linux: Partially update linux headers from\n\tv6.16-rc1-310-gd968e50b5c26","Date":"Fri, 15 Aug 2025 12:29:32 +0200","Message-ID":"<20250815102945.1602071-13-stefan.klug@ideasonboard.com>","X-Mailer":"git-send-email 2.48.1","In-Reply-To":"<20250815102945.1602071-1-stefan.klug@ideasonboard.com>","References":"<20250815102945.1602071-1-stefan.klug@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Update rkisp1-config.h and v4l2-controls.h from the next branch of\nhttps://gitlab.freedesktop.org/linux-media/media-committers.git to\ninclude the WDR related updates. The rest was left as is to minimize the\nrisk of issues due to last minute changes in the upstream process.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n\n---\n\nChanges in v3:\n- Limit changes to the bare minimum required for rkisp1\n\nChanges in v2:\n- Updated headers from linux-media next branch\n---\n include/linux/rkisp1-config.h | 108 +++++++++++++++++++++++++++++++++-\n include/linux/v4l2-controls.h |   6 ++\n 2 files changed, 112 insertions(+), 2 deletions(-)","diff":"diff --git a/include/linux/rkisp1-config.h b/include/linux/rkisp1-config.h\nindex edbc6cb65d1c..d323bfa72d8e 100644\n--- a/include/linux/rkisp1-config.h\n+++ b/include/linux/rkisp1-config.h\n@@ -169,6 +169,13 @@\n  */\n #define RKISP1_CIF_ISP_COMPAND_NUM_POINTS\t64\n \n+/*\n+ * Wide Dynamic Range\n+ */\n+#define RKISP1_CIF_ISP_WDR_CURVE_NUM_INTERV\t32\n+#define RKISP1_CIF_ISP_WDR_CURVE_NUM_COEFF\t(RKISP1_CIF_ISP_WDR_CURVE_NUM_INTERV + 1)\n+#define RKISP1_CIF_ISP_WDR_CURVE_NUM_DY_REGS\t4\n+\n /*\n  * Measurement types\n  */\n@@ -889,6 +896,72 @@ struct rkisp1_cif_isp_compand_curve_config {\n \t__u32 y[RKISP1_CIF_ISP_COMPAND_NUM_POINTS];\n };\n \n+/**\n+ * struct rkisp1_cif_isp_wdr_tone_curve - Tone mapping curve definition for WDR.\n+ *\n+ * @dY: the dYn increments for horizontal (input) axis of the tone curve.\n+ *      each 3-bit dY value represents an increment of 2**(value+3).\n+ *      dY[0] bits 0:2 is increment dY1, bit 3 unused\n+ *      dY[0] bits 4:6 is increment dY2, bit 7 unused\n+ *      ...\n+ *      dY[0] bits 28:30 is increment dY8, bit 31 unused\n+ *      ... and so on till dY[3] bits 28:30 is increment dY32, bit 31 unused.\n+ * @ym: the Ym values for the vertical (output) axis of the tone curve.\n+ *      each value is 13 bit.\n+ */\n+struct rkisp1_cif_isp_wdr_tone_curve {\n+\t__u32 dY[RKISP1_CIF_ISP_WDR_CURVE_NUM_DY_REGS];\n+\t__u16 ym[RKISP1_CIF_ISP_WDR_CURVE_NUM_COEFF];\n+};\n+\n+/**\n+ * struct rkisp1_cif_isp_wdr_iref_config - Illumination reference config for WDR.\n+ *\n+ * Use illumination reference value as described below, instead of only the\n+ * luminance (Y) value for tone mapping and gain calculations:\n+ * IRef = (rgb_factor * RGBMax_tr + (8 - rgb_factor) * Y)/8\n+ *\n+ * @rgb_factor: defines how much influence the RGBmax approach has in\n+ *              comparison to Y (valid values are 0..8).\n+ * @use_y9_8: use Y*9/8 for maximum value calculation along with the\n+ *            default of R, G, B for noise reduction.\n+ * @use_rgb7_8: decrease RGBMax by 7/8 for noise reduction.\n+ * @disable_transient: disable transient calculation between Y and RGBY_max.\n+ */\n+struct rkisp1_cif_isp_wdr_iref_config {\n+\t__u8 rgb_factor;\n+\t__u8 use_y9_8;\n+\t__u8 use_rgb7_8;\n+\t__u8 disable_transient;\n+};\n+\n+/**\n+ * struct rkisp1_cif_isp_wdr_config - Configuration for wide dynamic range.\n+ *\n+ * @tone_curve: tone mapping curve.\n+ * @iref_config: illumination reference configuration. (when use_iref is true)\n+ * @rgb_offset: RGB offset value for RGB operation mode. (12 bits)\n+ * @luma_offset: luminance offset value for RGB operation mode. (12 bits)\n+ * @dmin_thresh: lower threshold for deltaMin value. (12 bits)\n+ * @dmin_strength: strength factor for deltaMin. (valid range is 0x00..0x10)\n+ * @use_rgb_colorspace: use RGB instead of luminance/chrominance colorspace.\n+ * @bypass_chroma_mapping: disable chrominance mapping (only valid if\n+ *                         use_rgb_colorspace = 0)\n+ * @use_iref: use illumination reference instead of Y for tone mapping\n+ *            and gain calculations.\n+ */\n+struct rkisp1_cif_isp_wdr_config {\n+\tstruct rkisp1_cif_isp_wdr_tone_curve tone_curve;\n+\tstruct rkisp1_cif_isp_wdr_iref_config iref_config;\n+\t__u16 rgb_offset;\n+\t__u16 luma_offset;\n+\t__u16 dmin_thresh;\n+\t__u8 dmin_strength;\n+\t__u8 use_rgb_colorspace;\n+\t__u8 bypass_chroma_mapping;\n+\t__u8 use_iref;\n+};\n+\n /*---------- PART2: Measurement Statistics ------------*/\n \n /**\n@@ -1059,6 +1132,7 @@ struct rkisp1_stat_buffer {\n  * @RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_BLS: BLS in the compand block\n  * @RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_EXPAND: Companding expand curve\n  * @RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_COMPRESS: Companding compress curve\n+ * @RKISP1_EXT_PARAMS_BLOCK_TYPE_WDR: Wide dynamic range\n  */\n enum rkisp1_ext_params_block_type {\n \tRKISP1_EXT_PARAMS_BLOCK_TYPE_BLS,\n@@ -1081,11 +1155,15 @@ enum rkisp1_ext_params_block_type {\n \tRKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_BLS,\n \tRKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_EXPAND,\n \tRKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_COMPRESS,\n+\tRKISP1_EXT_PARAMS_BLOCK_TYPE_WDR,\n };\n \n #define RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE\t(1U << 0)\n #define RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE\t(1U << 1)\n \n+/* A bitmask of parameters blocks supported on the current hardware. */\n+#define RKISP1_CID_SUPPORTED_PARAMS_BLOCKS\t(V4L2_CID_USER_RKISP1_BASE + 0x01)\n+\n /**\n  * struct rkisp1_ext_params_block_header - RkISP1 extensible parameters block\n  *\t\t\t\t\t   header\n@@ -1460,6 +1538,23 @@ struct rkisp1_ext_params_compand_curve_config {\n \tstruct rkisp1_cif_isp_compand_curve_config config;\n } __attribute__((aligned(8)));\n \n+/**\n+ * struct rkisp1_ext_params_wdr_config - RkISP1 extensible params\n+ *                                       Wide dynamic range config\n+ *\n+ * RkISP1 extensible parameters WDR block.\n+ * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_WDR`\n+ *\n+ * @header: The RkISP1 extensible parameters header, see\n+ *\t    :c:type:`rkisp1_ext_params_block_header`\n+ * @config: WDR configuration, see\n+ *\t    :c:type:`rkisp1_cif_isp_wdr_config`\n+ */\n+struct rkisp1_ext_params_wdr_config {\n+\tstruct rkisp1_ext_params_block_header header;\n+\tstruct rkisp1_cif_isp_wdr_config config;\n+} __attribute__((aligned(8)));\n+\n /*\n  * The rkisp1_ext_params_compand_curve_config structure is counted twice as it\n  * is used for both the COMPAND_EXPAND and COMPAND_COMPRESS block types.\n@@ -1484,7 +1579,8 @@ struct rkisp1_ext_params_compand_curve_config {\n \tsizeof(struct rkisp1_ext_params_afc_config)\t\t\t+\\\n \tsizeof(struct rkisp1_ext_params_compand_bls_config)\t\t+\\\n \tsizeof(struct rkisp1_ext_params_compand_curve_config)\t\t+\\\n-\tsizeof(struct rkisp1_ext_params_compand_curve_config))\n+\tsizeof(struct rkisp1_ext_params_compand_curve_config)\t\t+\\\n+\tsizeof(struct rkisp1_ext_params_wdr_config))\n \n /**\n  * enum rksip1_ext_param_buffer_version - RkISP1 extensible parameters version\n@@ -1520,6 +1616,14 @@ enum rksip1_ext_param_buffer_version {\n  * V4L2 control. If such control is not available, userspace should assume only\n  * RKISP1_EXT_PARAM_BUFFER_V1 is supported by the driver.\n  *\n+ * The read-only V4L2 control ``RKISP1_CID_SUPPORTED_PARAMS_BLOCKS`` can be used\n+ * to query the blocks supported by the device. It contains a bitmask where each\n+ * bit represents the availability of the corresponding entry from the\n+ * :c:type:`rkisp1_ext_params_block_type` enum. The current and default values\n+ * of the control represents the blocks supported by the device instance, while\n+ * the maximum value represents the blocks supported by the kernel driver,\n+ * independently of the device instance.\n+ *\n  * For each ISP block that userspace wants to configure, a block-specific\n  * structure is appended to the @data buffer, one after the other without gaps\n  * in between nor overlaps. Userspace shall populate the @data_size field with\n@@ -1528,7 +1632,7 @@ enum rksip1_ext_param_buffer_version {\n  * The expected memory layout of the parameters buffer is::\n  *\n  *\t+-------------------- struct rkisp1_ext_params_cfg -------------------+\n- *\t| version = RKISP_EXT_PARAMS_BUFFER_V1;                               |\n+ *\t| version = RKISP1_EXT_PARAM_BUFFER_V1;                               |\n  *\t| data_size = sizeof(struct rkisp1_ext_params_bls_config)             |\n  *\t|           + sizeof(struct rkisp1_ext_params_dpcc_config);           |\n  *\t| +------------------------- data  ---------------------------------+ |\ndiff --git a/include/linux/v4l2-controls.h b/include/linux/v4l2-controls.h\nindex 882a81805783..4cfae0414894 100644\n--- a/include/linux/v4l2-controls.h\n+++ b/include/linux/v4l2-controls.h\n@@ -217,6 +217,12 @@ enum v4l2_colorfx {\n  */\n #define V4L2_CID_USER_THP7312_BASE\t\t(V4L2_CID_USER_BASE + 0x11c0)\n \n+/*\n+ * The base for Rockchip ISP1 driver controls.\n+ * We reserve 16 controls for this driver.\n+ */\n+#define V4L2_CID_USER_RKISP1_BASE\t\t(V4L2_CID_USER_BASE + 0x1220)\n+\n /* MPEG-class control IDs */\n /* The MPEG controls are applicable to all codec controls\n  * and the 'MPEG' part of the define is historical */\n","prefixes":["v3","12/19"]}