From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.84.47 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796382721; b=OctmZbSOmTg+Ge2FUtm+ekoYrVlgr+kYFpPQLTt/iJeOrn1AMxN22j1SWHUo5Yb8yuer dcUJzg8MIYt0PJFH+/oHn1fT3SuYBtgP5HmHL1eM5BI1u7cnCDaWFpdNFNTA+jcdwKbkd fUG1RAHO38f1x4RdIbORinlJvRkBkRYsXV9kDl2pknsDtnLQGeQ92zPQ5u5GfhilI5AT0 HIcPe2eoRB8Qs7iav4ayVdVSuTJNtUXjtr5xiFWNf1OMODkJnARXfhPYBEFSxE/rDb89S AepjARRrkxOWkYvW5EpqUMyPokgrU4ej/0g1x8lNj79ESmTz9+kzNtmxpVh3clz5XgQ== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382721; h=DMARC-Filter:DKIM-Signature:Received:Received: X-MS-Exchange-Authentication-Results:Received-SPF:Received:Received: Received:From:Date:Subject:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-ID:References:In-Reply-To:To:CC: X-Mailer:X-Originating-IP:X-ClientProxiedBy:X-EOPAttributedMessage: X-MS-PublicTrafficType:X-MS-TrafficTypeDiagnostic: X-MS-Office365-Filtering-Correlation-Id:X-MS-Exchange-SenderADCheck: X-MS-Exchange-AntiSpam-Relay:X-Microsoft-Antispam: X-Microsoft-Antispam-Message-Info:X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-OriginatorOrg: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-Id: X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-Transport-CrossTenantHeadersStamped; bh=JiDGUvuCduJghKCMZ/wit9rh1F6SqrEb9KvKkmcfMYc=; b=O2NIUZB4/U1zDAWWicN7FxBWeTvpVZMQqiofF62H5aWZS3Q8bRalC5UoxHuMg4YIVfun 1aNZDUuC5rSk2fx15+Z/l/qO8XHOOG3tTKdSmbyG3nwZ0LVspip8MSNbyKH9K3aqWSnd3 Fg+3cMHsF9fLxa/wTwYCuYbCC76o6fY0WixPSq5GoTywDlJnlnRHctszY5t6z3+HwZ0dC HJ5VzUUqkT1qdrMFbUCEb9cd14ZixiG/fYUo8Pxp7JJgZQb7gcLDpHI+1UzymI+4dvLWv e/RDVpN4Muk78A4bVHyu3XgIlrpdE8UqUJw5e9ik9Ok+NJTXY+o5vaBrcy5OkiNpPeA== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=foss.st.com; spf=pass smtp.mailfrom=foss.st.com; dkim=pass header.d=foss.st.com header.i=@foss.st.com header.a=rsa-sha256 header.s=selector2 header.b=kBbi0qzD; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.84.47 Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11010047.outbound.protection.outlook.com [52.101.84.47]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 31CC7606A33B; Fri, 4 Dec 2026 11:12:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 31CC7606A33B Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foss.st.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=foss.st.com header.i=@foss.st.com header.a=rsa-sha256 header.s=selector2 header.b=kBbi0qzD ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=s+t+M2Om1qcHW2YQnKAXnXGjW8eswunol/nA0Fw+WTRmiYIkT9CTBD7/CuS4Dt/YpR7ENaHdNOyUxOZ+ptL8ajxIkq+Fc4yujyg0qOZm58AqR1tehPr6sX/uK+T3HS7MZFgr9X08uZT8dlJq9vumPb4+meMj0/DOUf0USOKPyyqVb/ytBWl60JbQE3jxw196KeFlkkIBb7lQfbQf3gJTq96IG6yaTvhlXjVauI71WJucITI1ErKzmQx6uK22h3hKpvcx0N4DzFjpHkRWXaGNH283nEKIId/q0S2oju8esJJY21v46rnAP+dKaM0wkUlEEcfl6Z95ZgBtKtrQO/33Cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JiDGUvuCduJghKCMZ/wit9rh1F6SqrEb9KvKkmcfMYc=; b=t1yVg2D6d3y/qDKXuRkIzfPq3+0vjLkxzy6uEQIZP84mJqyJ4mVABb/L8IdNV2+cqFMQFJR230gpmVFzaH5jrLR6vziThfz/MgAN1fZK+Aq7p7PfOApQ9jDElol+MkGJR8tRA9BhTKc0SypsEQEPtq6gxkO5PYJUVUNsKV95TAhED6WhFuDw0Te9Px2KTIeZnW0/hwFsYXOKuMckgOG+CEHrD7SWE0yR9eouHrxMlm/lihycpJQEV03zMF3rsb5u64xmenMITcsvHyYkIh6OgAnFfiSv9Rz9lLUmsI1MwVj1xqBSH9p0yiZtuJoUJMk+NfFmJkKQt1EZ4LAZv8p1sA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 164.130.1.60) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=foss.st.com; dmarc=fail (p=none sp=none pct=100) action=none header.from=foss.st.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JiDGUvuCduJghKCMZ/wit9rh1F6SqrEb9KvKkmcfMYc=; b=kBbi0qzDlPKVOh6OTwyD7bULsH4hPa3tThT8M05Mytk0TVwdxqixm+bW41XEUikifNvFBLFY4UQQlTONbmDlcdx0wP0gXyj6/eTxQ3WnN915u0IUTee4h9/yFXFUOWhh9kWnPKbnQVjilyzhjGOfWCGkx/TXGy5x6uhAbqK/v5FIcmjrPjCerLJqGa+kURiJs3lhyKm3IFRQ9JOUZ2T7h2Swu5XkOhjie8Pz34ndnSVtWY8RPamZwY2xjWzAT92yRmupschrwARiXVyPwyOxfJU8MQ5blxMt/dC+7y6bn1Co2se1mJVv7yRDDz2Hc2l+I6NPm6aaWYT3B98bqrIvkQ== Received: from VIXP296CA0037.AUTP296.PROD.OUTLOOK.COM (2603:10a6:800:36e::16) by AM7PR10MB3796.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:17d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.709.4; Fri, 4 Dec 2026 11:11:56 +0000 Received: from MI3PEPF00008485.eurprd02.prod.outlook.com (2603:10a6:800:36e:cafe::5d) by VIXP296CA0037.outlook.office365.com (2603:10a6:800:36e::16) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.688.13 via Frontend Transport; Fri, 4 Dec 2026 11:11:56 +0000 X-MS-Exchange-Authentication-Results: mx.microsoft.com 1; spf=fail (sender IP is 164.130.1.60) smtp.mailfrom=foss.st.com; dkim=none (message not signed) header.d=none;dmarc=fail action=none header.from=foss.st.com; Received-SPF: Fail (protection.outlook.com: domain of foss.st.com does not designate 164.130.1.60 as permitted sender) receiver=protection.outlook.com; client-ip=164.130.1.60; helo=smtpO365.st.com; Received: from smtpO365.st.com (164.130.1.60) by MI3PEPF00008485.mail.protection.outlook.com (10.167.240.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.709.6 via Frontend Transport; Fri, 4 Dec 2026 11:11:56 +0000 Received: from STKDAG1NODE2.st.com (10.75.128.133) by smtpO365.st.com (10.250.44.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.56; Fri, 4 Dec 2026 12:13:14 +0100 Received: from localhost (10.130.77.105) by STKDAG1NODE2.st.com (10.75.128.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.56; Fri, 4 Dec 2026 12:11:53 +0100 From: Alain Volmat Date: Fri, 4 Dec 2026 12:11:36 +0100 Subject: [PATCH 05/11] media: uapi: st: dcmipp: add description of ISP stats & param buffers X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-ID: <20261204-stm32mp-dcmipp-isp-stat-ctrls-v1-5-e809f8c193e6@foss.st.com> References: <20261204-stm32mp-dcmipp-isp-stat-ctrls-v1-0-e809f8c193e6@foss.st.com> In-Reply-To: <20261204-stm32mp-dcmipp-isp-stat-ctrls-v1-0-e809f8c193e6@foss.st.com> To: Hugues Fruchet , Mauro Carvalho Chehab , Maxime Coquelin , "Alexandre Torgue" CC: , , , , "Alain Volmat" X-Mailer: b4 0.15.2 X-ClientProxiedBy: STKCAS1NODE1.st.com (10.75.128.134) To STKDAG1NODE2.st.com (10.75.128.133) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MI3PEPF00008485:EE_|AM7PR10MB3796:EE_ X-MS-Office365-Filtering-Correlation-Id: e56e9fb0-faa0-425a-6f69-08df51f7687d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|23010399003|36860700016|1800799024|376014|6133799003|22082099003|18002099003|3023799007|56012099006|11063799006|261026140227099003|261026121527099003|261022075727099003|261028144727099003|261009223027099003|261102123227099003|261021121427099003|261022105027099003|10067099003; X-Microsoft-Antispam-Message-Info: urd0vR+o6psx2hR2PPEcO5VOBGtzEFfzrX5svT3i0EaZANbPCGYPZ9TxQo210S3ZE/tuFJq8Bel/SQvn8vwtQnK6V/VDG3XPgNbzRst9FCORaXKDalqDTnpzDtxQzAfp0ZHxHhdvDB+7ci2TkFDpkk1G3fDDEKEf/JMeFwkO/wIuw9GPVzsyPhcKmoFZ9/KfcwxD4bF3xiGHVBWHPSHc45OWSlgDboHck0jphUsu78mMTt4isIezvy2Pj3wPgqkIHVn4VPbwnEBZTaE84YNlw/13bSmT4Eqj02Cwv8FqyPVJFSTBjPO6PhMAwVmGPwsiyv73hGJ/PYoKPmldCUaRkYpLFsfHNCtHhSON3uIDeHPEvhAXHdQiSA02gvCUZt+x4T+N1RFUkdMiKuQtPJsVEt57o9W+0L53INM8tjmeKeF4GG6mVND98xmuA/53Kbe1rmRSesZtXLF4a7rSZ9f9T41cMtzioM6Fe+fMz3eRTogwu6pIrewCMLHnFqr2NZT3bznj04sO9OK+wWj+08Hyl3t2nSP4q8ST8oMeg+n/KPIQt+82Pj1XnU31GPTCjl0f0V1iG4poLDFBF+ka982XCsY6TQKHx+OtwHST0LCLbAXUQClw9nijue8A3gwk4HMWqyngW6hz+fNNr05JMif26w6ua4dfDoD7dVhn7xjwduJodQzg33+tlQ6DP14GcP5zk5gUjZudL8zZlqUg4uHWZA== X-Forefront-Antispam-Report: CIP:164.130.1.60;CTRY:IT;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:smtpO365.st.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(23010399003)(36860700016)(1800799024)(376014)(6133799003)(22082099003)(18002099003)(3023799007)(56012099006)(11063799006)(261026140227099003)(261026121527099003)(261022075727099003)(261028144727099003)(261009223027099003)(261102123227099003)(261021121427099003)(261022105027099003)(10067099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rHnt0RhhIEPOB6qmFyCn3RZ2c7oVITFdzdcaG19utcC28NNlQEH5oN7b6hDqtfddtBu1mmml4pc17Cags08yeUtSJnFoxI4/yGDVY1Pr+SVS3UnZ8pyifKYMJaLVgsAULonnlBdaPbn73AbXy9mPm3i7xZLyVSIRAI78cOC78NPvRkJw7RQ4wYk+bE9mU4sUMqaLsohft5RWy7vDdMfBOP22810Tv/m08lZHHiBOs61zQvJ3uCDW4a6zad5n3utL+F/2B9vG4yNYRBan6bPTHF0yUacJrwdgvm72DbnPVRbUfUJcXw11GTdFex76XirnolkPgTj3ksuUuND0iL7BUFsq1hOThzzNW85PMaaC3ZT6LnrQ/Dlei3v3+iIbhMCz1pT637XAO2GW708pfpc6cbdneVzvv9XI+y1gKZaMLxe/w4Et0/1nGWUkom7X3+LY X-OriginatorOrg: foss.st.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2026 11:11:56.1043 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e56e9fb0-faa0-425a-6f69-08df51f7687d X-MS-Exchange-CrossTenant-Id: 75e027c9-20d5-47d5-b82f-77d7cd041e8f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=75e027c9-20d5-47d5-b82f-77d7cd041e8f;Ip=[164.130.1.60];Helo=[smtpO365.st.com] X-MS-Exchange-CrossTenant-AuthSource: MI3PEPF00008485.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR10MB3796 Introduce structures used to control DCMIPP ISP as well as gather generated statistics. Signed-off-by: Alain Volmat --- MAINTAINERS | 1 + include/uapi/linux/media/st/dcmipp_config.h | 313 ++++++++++++++++++++++++++++ 2 files changed, 314 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 222b7fc2c3aa..cbf3d071801e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -16953,6 +16953,7 @@ F: Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml F: Documentation/devicetree/bindings/media/st,stm32-dcmipp.yaml F: drivers/media/platform/st/stm32/stm32-dcmi.c F: drivers/media/platform/st/stm32/stm32-dcmipp/* +F: include/uapi/linux/media/st/dcmipp_config.h MEDIA INPUT INFRASTRUCTURE (V4L/DVB) M: Mauro Carvalho Chehab diff --git a/include/uapi/linux/media/st/dcmipp_config.h b/include/uapi/linux/media/st/dcmipp_config.h index ad8d146820ea..d833ebe31d1c 100644 --- a/include/uapi/linux/media/st/dcmipp_config.h +++ b/include/uapi/linux/media/st/dcmipp_config.h @@ -10,7 +10,320 @@ #include #include +#include #define V4L2_CID_DCMIPP_PIXELPROC_GAMMA_CORRECTION_ENABLE (V4L2_CID_USER_DCMIPP_BASE + 0x0) +/** + * enum stm32_dcmipp_params_block_type - STM32 DCMIPP ISP parameters block types + * + * Block types to be used in &v4l2_isp_block_header.type of the blocks of a + * &struct v4l2_isp_buffer (parameters) queued on the isp-params device. + * Except for the DM and STAT blocks, each block can be enabled or disabled + * using the V4L2_ISP_PARAMS_FL_BLOCK_ENABLE / V4L2_ISP_PARAMS_FL_BLOCK_DISABLE + * flags. A disabled block may only contain its header. If none of these flags + * is set, the block is configured and its enable state is left unchanged. + * + * @STM32_DCMIPP_PARAMS_BLOCK_TYPE_BPR: bad pixel removal + * @STM32_DCMIPP_PARAMS_BLOCK_TYPE_BLC: black level correction + * @STM32_DCMIPP_PARAMS_BLOCK_TYPE_EX: exposure control + * @STM32_DCMIPP_PARAMS_BLOCK_TYPE_DM: demosaicing filters + * @STM32_DCMIPP_PARAMS_BLOCK_TYPE_CC: color conversion + * @STM32_DCMIPP_PARAMS_BLOCK_TYPE_CE: contrast enhancement + * @STM32_DCMIPP_PARAMS_BLOCK_TYPE_STAT: statistics extraction + */ +enum stm32_dcmipp_params_block_type { + STM32_DCMIPP_PARAMS_BLOCK_TYPE_BPR, + STM32_DCMIPP_PARAMS_BLOCK_TYPE_BLC, + STM32_DCMIPP_PARAMS_BLOCK_TYPE_EX, + STM32_DCMIPP_PARAMS_BLOCK_TYPE_DM, + STM32_DCMIPP_PARAMS_BLOCK_TYPE_CC, + STM32_DCMIPP_PARAMS_BLOCK_TYPE_CE, + STM32_DCMIPP_PARAMS_BLOCK_TYPE_STAT, +}; + +/** + * struct stm32_dcmipp_params_bpr - bad pixel removal + * + * @header: block header + * @strength: strength (aggressiveness) of the bad pixel detection (0-7) + * @reserved: reserved for future use, must be set to 0 + */ +struct stm32_dcmipp_params_bpr { + struct v4l2_isp_block_header header; + __u8 strength; + __u8 reserved[7]; +}; + +/** + * struct stm32_dcmipp_params_blc - black level correction + * + * @header: block header + * @blc_r: correction on the red component + * @blc_g: correction on the green component + * @blc_b: correction on the blue component + * @reserved: reserved for future use, must be set to 0 + */ +struct stm32_dcmipp_params_blc { + struct v4l2_isp_block_header header; + __u8 blc_r; + __u8 blc_g; + __u8 blc_b; + __u8 reserved[5]; +}; + +/** + * struct stm32_dcmipp_params_ex - exposure control + * + * @header: block header + * @shift_r: red component exposure shift (0-7) + * @mult_r: red component exposure multiplier + * @shift_g: green component exposure shift (0-7) + * @mult_g: green component exposure multiplier + * @shift_b: blue component exposure shift (0-7) + * @mult_b: blue component exposure multiplier + * @reserved: reserved for future use, must be set to 0 + */ +struct stm32_dcmipp_params_ex { + struct v4l2_isp_block_header header; + __u8 shift_r; + __u8 mult_r; + __u8 shift_g; + __u8 mult_g; + __u8 shift_b; + __u8 mult_b; + __u8 reserved[2]; +}; + +/** + * struct stm32_dcmipp_params_dm - demosaicing filters + * + * @header: block header + * @edge: strength of the edge detection (0-7) + * @lineh: strength of the horizontal line detection (0-7) + * @linev: strength of the vertical line detection (0-7) + * @peak: strength of the peak detection (0-7) + * @reserved: reserved for future use, must be set to 0 + * + * The demosaicing block enable/disable is controlled by the + * dcmipp isp subdevice depending on formats applied to it. + * This only controls the filters applied when enabled. + * + */ +struct stm32_dcmipp_params_dm { + struct v4l2_isp_block_header header; + __u8 edge; + __u8 lineh; + __u8 linev; + __u8 peak; + __u8 reserved[4]; +}; + +enum stm32_dcmipp_isp_cc_clamp { + STM32_DCMIPP_ISP_CC_CLAMP_DISABLED, + STM32_DCMIPP_ISP_CC_CLAMP_Y235_U240_V240, + STM32_DCMIPP_ISP_CC_CLAMP_YUV235, +}; + +/** + * struct stm32_dcmipp_params_cc - color conversion + * + * The matrix coefficients (@rr, @rg, @rb, @gr, @gg, @gb, @br, @bg, @bb) are + * signed 11-bit values in 2.8 fixed point format in two's complement. + * The added values (@ra, @ga, @ba) are signed 10-bit integers in two's complement. + * Bits above the 11 (respectively 10) bits of a value must be set to 0. + * + * @header: block header + * @clamp: clamp configuration (from enum stm32_dcmipp_isp_cc_clamp) + * @rr: row 1 col 1 value of the matrix + * @rg: row 1 col 2 value of the matrix + * @rb: row 1 col 3 value of the matrix + * @ra: row 1 added value of the matrix + * @gr: row 2 col 1 value of the matrix + * @gg: row 2 col 2 value of the matrix + * @gb: row 2 col 3 value of the matrix + * @ga: row 2 added value of the matrix + * @br: row 3 col 1 value of the matrix + * @bg: row 3 col 2 value of the matrix + * @bb: row 3 col 3 value of the matrix + * @ba: row 3 added value of the matrix + * @reserved: reserved for future use, must be set to 0 + */ +struct stm32_dcmipp_params_cc { + struct v4l2_isp_block_header header; + __u32 clamp; + __u16 rr; + __u16 rg; + __u16 rb; + __u16 ra; + __u16 gr; + __u16 gg; + __u16 gb; + __u16 ga; + __u16 br; + __u16 bg; + __u16 bb; + __u16 ba; + __u32 reserved; +}; + +/** + * struct stm32_dcmipp_params_ce - contrast enhancement + * + * @header: block header + * @lum: 9 elements table of luminance enhancement (value 16 is neutral) + * @reserved: reserved for future use, must be set to 0 + */ +struct stm32_dcmipp_params_ce { + struct v4l2_isp_block_header header; + __u8 lum[9]; + __u8 reserved[7]; +}; + +#define STM32_DCMIPP_ISP_STAT_PROFILE_FULL 0 +#define STM32_DCMIPP_ISP_STAT_PROFILE_AVERAGE_PRE 1 +#define STM32_DCMIPP_ISP_STAT_PROFILE_AVERAGE_POST 2 + +#define STM32_DCMIPP_ISP_STAT_AVG_FILTER_NONE 0 +#define STM32_DCMIPP_ISP_STAT_AVG_FILTER_EXCL16 1 +#define STM32_DCMIPP_ISP_STAT_AVG_FILTER_EXCL32 2 +#define STM32_DCMIPP_ISP_STAT_AVG_FILTER_EXCL64 3 + +#define STM32_DCMIPP_ISP_STAT_BIN_COMP_R 0 +#define STM32_DCMIPP_ISP_STAT_BIN_COMP_G 1 +#define STM32_DCMIPP_ISP_STAT_BIN_COMP_B 2 +#define STM32_DCMIPP_ISP_STAT_BIN_COMP_L 3 + +/** + * struct stm32_dcmipp_params_stat - statistics extraction + * + * @header: block header + * @left: left start (in pixel) of the statistics area + * @top: top start (in pixel) of the statistics area + * @width: width (in pixel) of the statistics area + * @height: height (in pixel) of the statistics area + * @profile: statistics capture profile (STM32_DCMIPP_ISP_STAT_PROFILE_*) + * FULL: average and bins, both pre and post demosaicing + * AVERAGE_PRE: average only, pre demosaicing + * AVERAGE_POST: average only, post demosaicing + * @avg_filter: filter excluding pixels from the average computation + * (STM32_DCMIPP_ISP_STAT_AVG_FILTER_*) + * @bin_comp: component used for the bins extraction + * (STM32_DCMIPP_ISP_STAT_BIN_COMP_*), L being the luminance + * @reserved: reserved for future use, must be set to 0 + * + * A width and height of 0 (together with a left and top of 0) select the + * whole frame as statistics area. + * The statistic block is always enabled hence ENABLE/DISABLE flags + * are ignored. + */ +struct stm32_dcmipp_params_stat { + struct v4l2_isp_block_header header; + __u16 left; + __u16 top; + __u16 width; + __u16 height; + __u8 profile; + __u8 avg_filter; + __u8 bin_comp; + __u8 reserved[5]; +}; + +/** + * union stm32_dcmipp_params_block - all the STM32 DCMIPP parameters blocks + * + * @header: common header of all blocks + * @bpr: bad pixel removal + * @blc: black level correction + * @ex: exposure control + * @dm: demosaicing filters + * @cc: color conversion + * @ce: contrast enhancement + * @stat: statistics extraction + */ +union stm32_dcmipp_params_block { + struct v4l2_isp_block_header header; + struct stm32_dcmipp_params_bpr bpr; + struct stm32_dcmipp_params_blc blc; + struct stm32_dcmipp_params_ex ex; + struct stm32_dcmipp_params_dm dm; + struct stm32_dcmipp_params_cc cc; + struct stm32_dcmipp_params_ce ce; + struct stm32_dcmipp_params_stat stat; +}; + +/* Maximum size of the data[] member of the parameters buffer */ +#define STM32_DCMIPP_PARAMS_MAX_SIZE \ + (sizeof(struct stm32_dcmipp_params_bpr) + \ + sizeof(struct stm32_dcmipp_params_blc) + \ + sizeof(struct stm32_dcmipp_params_ex) + \ + sizeof(struct stm32_dcmipp_params_dm) + \ + sizeof(struct stm32_dcmipp_params_cc) + \ + sizeof(struct stm32_dcmipp_params_ce) + \ + sizeof(struct stm32_dcmipp_params_stat)) + +/** + * enum stm32_dcmipp_stats_block_type - STM32 DCMIPP ISP statistics block types + * + * Block types reported in &v4l2_isp_block_header.type of the blocks of a + * &struct v4l2_isp_buffer (statistics) dequeued from the statistics device. + * + * @STM32_DCMIPP_STATS_BLOCK_TYPE_PRE: average & bins before demosaicing, only + * reported with the FULL and AVERAGE_PRE profiles + * @STM32_DCMIPP_STATS_BLOCK_TYPE_POST: average & bins after demosaicing, only + * reported with the FULL and AVERAGE_POST profiles + * @STM32_DCMIPP_STATS_BLOCK_TYPE_BPR: bad pixel count, always reported + */ +enum stm32_dcmipp_stats_block_type { + STM32_DCMIPP_STATS_BLOCK_TYPE_PRE, + STM32_DCMIPP_STATS_BLOCK_TYPE_POST, + STM32_DCMIPP_STATS_BLOCK_TYPE_BPR, +}; + +/** + * struct stm32_dcmipp_stats_avr_bins - average & bins statistics + * + * @header: block header + * @average_rgb: average value of the R/G/B components + * @bins: 12 values histogram (only valid with the FULL profile) + * @reserved: reserved for future use + */ +struct stm32_dcmipp_stats_avr_bins { + struct v4l2_isp_block_header header; + __u32 average_rgb[3]; + __u32 bins[12]; + __u32 reserved; +}; + +/** + * struct stm32_dcmipp_stats_bpr - bad pixel statistics + * + * @header: block header + * @bad_pixel_count: number of bad pixels detected in the frame + * @reserved: reserved for future use + */ +struct stm32_dcmipp_stats_bpr { + struct v4l2_isp_block_header header; + __u32 bad_pixel_count; + __u32 reserved; +}; + +/** + * union stm32_dcmipp_stats_block - all the STM32 DCMIPP statistics blocks + * + * @header: common header of all blocks + * @avr_bins: average & bins statistics + * @bpr: bad pixel statistics + */ +union stm32_dcmipp_stats_block { + struct v4l2_isp_block_header header; + struct stm32_dcmipp_stats_avr_bins avr_bins; + struct stm32_dcmipp_stats_bpr bpr; +}; + +/* Maximum size of the data[] member of the statistics buffer */ +#define STM32_DCMIPP_STATS_MAX_SIZE \ + (2 * sizeof(struct stm32_dcmipp_stats_avr_bins) + \ + sizeof(struct stm32_dcmipp_stats_bpr)) + #endif /* __UAPI_DCMIPP_CONFIG_H */ -- 2.34.1