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.51 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796382735; b=lvN7M32eYfb6FGQmjY0NjBV2449Zsf1Spv25IANHoh1yBrPjp2NpCtOB1G6F6u7zWPdW betAL1Ms9KYqmF8nzgbQAYgg0UmqltApDhOJaqAa5s/+BCHZF7L2jHoRsBs0U3A/8X0L9 LsFQdJ5vRQnO38XjMUU6GBc4SntFcgjDRg33CvBePgdF5IhjTK7kfxefduV/XhL/x6UiA k09AAjpKBpplx6p72kGdbHNYKnd1Jhy5zpUmozlkZzMC/E1F6o4Lk8ewYXbqcMq17kY2S upWJcFqGTPZfYHJTEIKeQToVYN3jfjETy/SVXmUzvLSfRas4ELN+ZUSkYs3CHLPG0BA== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382735; 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=Tc5U3mEdcgvst48seaiwXkY34i6dOfE9L+Hh0jvRoIg=; b=sNO2JNGAIkne4qYJoldboC8wQRx3zbwiJkZQjp4O2zHyxD6vxAwhE1xD8aUlKFHnTM2Y KLM0rXWpvRtYdbw5ZjaVgrD1OdtjHLPBw36Gv/fy9G+DJOD5G8Z+2HjRZzXQVAQcRVE4n yTNsFnIn4gFwjxlqC8moQ6o01/UOuDucsqrfJ118rLl6yULSOFvWqMGnGFgvd8cEZbbME kb/SRltDMFnetlHD52g6sk2YrGJueM540QfMAd247KS4JxSFOEdn/YQpdEUXxX212f0/Q UoGuWy2XtsqNtLlYzBXQJFCfcot2iIj+UYWRMRCarRxV5NKdr/Cxz3vd3LVmGFkTl6w== 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=aqe5+Uzx; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.84.51 Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11010051.outbound.protection.outlook.com [52.101.84.51]) (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 11FC8606A6A9; Fri, 4 Dec 2026 11:12:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 11FC8606A6A9 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=aqe5+Uzx ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Prvb6CYCAL1sqtevE0ZjmBsleoBX5ud5sRhPCEpPY4EguPp0Tf90hH+H03/mhV4EzcOBk/1qt7iPvCHxTBXMGAr838kes461lW+AjHf3EQOcj3hWTBBx3QbJgQ2R1ZDHiiBglF4m3MSt1GRbaHi+0AfsCr2uRb3rNOo0aSxzsA85+vLvKi9gcYqcrK8TqjXkbNqp+ZsEzZjOd9bEqMJZchCQZzVhqF8UpLprTbOpwkmqcAyGtiodI2eI3OaGEgYFUF9mzBdIpHSj11638V2XIC2g7HNXwqTFsD9EJhMPSLZ8phjf+I+zd7EWJq5C7I5sZDZiectVWdxkDXOKaUQ7Fw== 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=Tc5U3mEdcgvst48seaiwXkY34i6dOfE9L+Hh0jvRoIg=; b=ZKtTF9vWI7uso69OOdf9nY/Q8kVbEMRnAYuRDZM35JhAHSgodsaB4ZCV+ayUMyd5p+pZ+3NnOHoNdSkNmD3//Vha8eTGb9MvTVoTUu19C7TPXiXWvn226ekApCAuKgWPgdeQvrwNF5o+MxVp07sY2J/c1VCqjPbjzIiXaxsOH19tpM3C4ZuNr4E8osPIPpyaHT9s/OVm+oxmjxjxjfaIVypHxyL9+hnLdWtlvXwHD1ajElAiHDbydqEUEmevsptZ6Y7j96WU2/qxw3BYlMvt1Wv1gcONI3NFgGjqDxzsG97r15X1uQpirt6NqPawXbZWK5cbg/o/SDaswuvD7auDrQ== 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=Tc5U3mEdcgvst48seaiwXkY34i6dOfE9L+Hh0jvRoIg=; b=aqe5+Uzx1ttFpehvgbdzb1i21jq1udGzXbngKN5vAbFZG3C80wxPOb56M29ciaSjA2aosKG5YSXihRln1o0S8Iqu6fzth89lGfGNMGCOu42lTERyLndu9oRF5yJMMWNCKhPysBI49VtsZ2OYL+2dUqyVAeqRolSwzjoJznXzRKlg4C5CY8EG7qky/bqlnU2JJqYxyfppj/tTXkVPglHKdhTL4Qz6Ny2JzE4v78DX6peSlQLy2xoh6DBd4opVd08iVZhuv/lO1EuDqdxIY4wJTQL9y2ImQe3egbWuLf4F9EY2o3keiTyVzExx80cIYhc6cWewu7K7glVhPF6Uyr90Lw== Received: from VIXP296CA0036.AUTP296.PROD.OUTLOOK.COM (2603:10a6:800:36e::18) by AS2PR10MB7371.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:605::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.709.6; Fri, 4 Dec 2026 11:11:55 +0000 Received: from MI3PEPF00008485.eurprd02.prod.outlook.com (2603:10a6:800:36e:cafe::4a) by VIXP296CA0036.outlook.office365.com (2603:10a6:800:36e::18) 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:55 +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:55 +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:13 +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:52 +0100 From: Alain Volmat Date: Fri, 4 Dec 2026 12:11:34 +0100 Subject: [PATCH 03/11] media: stm32: dcmipp: isp: keep a frame sequence counter at isp level 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-3-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_|AS2PR10MB7371:EE_ X-MS-Office365-Filtering-Correlation-Id: 6252acae-2daa-466c-005f-08df51f767e5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700016|23010399003|82310400026|1800799024|261026121527099003|261102130727099003|261021121427099003|10067099003|56012099006|261009223027099003|261102123227099003|261009221227099003|261022105027099003|261028144727099003|261022075727099003|261026140227099003|261021123027099003|11063799006|18002099003|22082099003|3023799007; X-Microsoft-Antispam-Message-Info: 3jO2dyX9Rcge8I2Xl8kVADyXpybGPqxPFzMGjI9vS/kH3FbYUfj8HCukvN/RFi+vB0hAVrlmV8pBdDgbcM8BjwJDfFlJjwHkZIIc5WQ0rtXAevChBRtWXVfA5ljklttjVTc+GyvtIFh0tuodp+V2MPrDddiIochfr771172ACIMXIykqhVK77SNNtVsRHlcutR7OYYZlnd5reeySNNw6fbbLxkNbCG6WPVmll8lwT3C7OIsbMLpKPJiHAGT4EN1TviRi3dFMbbC5DYIyr0s4zuVeq5ncLK7yD3VwU9hQrxrOQ0jdCGHV2fQxUuc0RB037aM31H/LScoe5miOT0qPWgmRWP697Ro72pyIS8kzPf712rBaBNwH95NpWJLNF9LIzXFz3L5Se4X/DigWXlQJo345RvJlqN2ZvnxoqSWNEClfjZAYDp8LI0uQL48jN7kkDq6l5MsjwAMtNauGoJ9tlOdd9H8M8I5CWQA6E2x7cZ+hBXYZ5h5/XOr2dGecpIAke6LfqfC0/iljjbfH/7+z0wdUJngs8/hEQD1/lQ6LaoXsZCjUE+n+xr0exSM6LYErOSe1BSqwJqMBlsNi9XtcpR1SH1hKy5fGb5CUnW4v3+W2xk+7HeAOHpRig57AffsDthmk7PEr4gH/ecAfoqTjVVPFBwx+cJihM2UZn2u3jECBst0pyqRxpUVuE19aHMjD24AYzPzYsc7Oh17zei8S4g== 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)(376014)(36860700016)(23010399003)(82310400026)(1800799024)(261026121527099003)(261102130727099003)(261021121427099003)(10067099003)(56012099006)(261009223027099003)(261102123227099003)(261009221227099003)(261022105027099003)(261028144727099003)(261022075727099003)(261026140227099003)(261021123027099003)(11063799006)(18002099003)(22082099003)(3023799007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: uALInuBFOK2v175uX/3uuDpJuJsal1m2rmEldLnSb6C2BapBwc9nfEvo1vEPOXIt3InkLaFf2Aa4lB41yUMeddoUW7T6AZHvxP51ZoNWlvglEHgl+eQHXjZKoVy8Trp8q7RNs24huuQ5HIjf8Pg/5VxOKiQ1wYvawjcOYo3Rl8Rge563BrM3UG+mY0bo00eD6aJhPdp2CUV9/jQkZ71WV/ySMJVBOirTVlaSbA/3LBYBVhjm33Yw++gWjTzIFI5VdnvuJNEAd1tfyaQdCPaF98MwgpR1u8urgiXw1f3fKNn2oZHwfp3L18EO5J/uBTWjR0ayJSEPEcPX3E2qEaauLCwB3IlZ8DHDFj9kn0ibujP0s2zNSAaJnX5YNYA7u9Ap4dlJISKM8MFxY4an5BuJzSQnNa73QkOsGwhH8L7+opPMKCW5zHxnZFXedQoq0g/d X-OriginatorOrg: foss.st.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2026 11:11:55.1070 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6252acae-2daa-466c-005f-08df51f767e5 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: AS2PR10MB7371 In preparation of the introduction of ISP statistics and control, add frame counting at the ISP subdev level so that this becomes the reference for pipe1 (and pipe2 when fed from the ISP) as well as ISP statistics and parameter video devices. Export the helper dcmipp_isp_is_aux_output_enabled so that other entities can query whether the ISP feeds the aux pipe. Signed-off-by: Alain Volmat --- .../platform/st/stm32/stm32-dcmipp/dcmipp-common.h | 5 ++++ .../platform/st/stm32/stm32-dcmipp/dcmipp-isp.c | 31 +++++++++++++++++++--- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-common.h b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-common.h index aa32b64acf52..442d4c90e591 100644 --- a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-common.h +++ b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-common.h @@ -264,6 +264,10 @@ struct dcmipp_isp_device { struct device *dev; void __iomem *regs; + + u32 frame_sequence; + + u32 vsync_mask; }; struct dcmipp_pixelproc_device { @@ -396,6 +400,7 @@ void dcmipp_capture_ent_release(struct dcmipp_ent_device *ved); struct dcmipp_ent_device *dcmipp_isp_ent_init(const char *entity_name, struct dcmipp_device *dcmipp); void dcmipp_isp_ent_release(struct dcmipp_ent_device *ved); +bool dcmipp_isp_is_aux_output_enabled(struct dcmipp_isp_device *isp); struct dcmipp_ent_device * dcmipp_pixelproc_ent_init(const char *entity_name, struct dcmipp_device *dcmipp); diff --git a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-isp.c b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-isp.c index d8ce12a2cbcb..dfa3e27a02ee 100644 --- a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-isp.c +++ b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-isp.c @@ -37,6 +37,9 @@ #define DCMIPP_P1DMCR_TYPE_GBRG 0x2 #define DCMIPP_P1DMCR_TYPE_BGGR 0x3 +#define DCMIPP_CMSR2_P1VSYNCF BIT(18) +#define DCMIPP_CMSR2_P2VSYNCF BIT(26) + #define ISP_MEDIA_BUS_SINK_FMT_DEFAULT MEDIA_BUS_FMT_RGB565_1X16 #define ISP_MEDIA_BUS_SRC_FMT_DEFAULT MEDIA_BUS_FMT_RGB888_1X24 @@ -302,7 +305,7 @@ static void dcmipp_isp_config_demosaicing(struct dcmipp_isp_device *isp, reg_set(isp, DCMIPP_P1DMCR, val); } -static bool dcmipp_isp_is_aux_output_enabled(struct dcmipp_isp_device *isp) +bool dcmipp_isp_is_aux_output_enabled(struct dcmipp_isp_device *isp) { struct media_link *link; @@ -356,10 +359,13 @@ static int dcmipp_isp_enable_streams(struct v4l2_subdev *sd, s_subdev = media_entity_to_v4l2_subdev(s_pad->entity); /* Check if link between ISP & Pipe2 postproc is enabled */ - if (dcmipp_isp_is_aux_output_enabled(isp)) + isp->vsync_mask = DCMIPP_CMSR2_P1VSYNCF; + if (dcmipp_isp_is_aux_output_enabled(isp)) { reg_clear(isp, DCMIPP_P1FSCR, DCMIPP_P1FSCR_PIPEDIFF); - else + isp->vsync_mask |= DCMIPP_CMSR2_P2VSYNCF; + } else { reg_set(isp, DCMIPP_P1FSCR, DCMIPP_P1FSCR_PIPEDIFF); + } /* Configure Statistic Removal */ crop = v4l2_subdev_state_get_crop(state, DCMIPP_ISP_PAD_SINK_VIDEO); @@ -374,6 +380,9 @@ static int dcmipp_isp_enable_streams(struct v4l2_subdev *sd, /* Configure Demosaicing */ dcmipp_isp_config_demosaicing(isp, state); + /* First VSYNC will increment the counter, making first frame 0 */ + isp->frame_sequence = U32_MAX; + ret = v4l2_subdev_enable_streams(s_subdev, s_pad->index, BIT_ULL(0)); if (ret < 0) { dev_err(isp->dev, @@ -459,6 +468,20 @@ void dcmipp_isp_ent_release(struct dcmipp_ent_device *ved) dcmipp_ent_sd_unregister(ved, &isp->sd); } +static irqreturn_t dcmipp_isp_irq_callback(int irq, void *arg) +{ + struct dcmipp_isp_device *isp = + container_of(arg, struct dcmipp_isp_device, ved); + + if (!v4l2_subdev_is_streaming(&isp->sd) || + !(isp->ved.cmsr2 & isp->vsync_mask)) + return IRQ_HANDLED; + + isp->frame_sequence++; + + return IRQ_HANDLED; +} + struct dcmipp_ent_device *dcmipp_isp_ent_init(const char *entity_name, struct dcmipp_device *dcmipp) { @@ -482,7 +505,7 @@ struct dcmipp_ent_device *dcmipp_isp_ent_init(const char *entity_name, MEDIA_ENT_F_PROC_VIDEO_PIXEL_FORMATTER, ARRAY_SIZE(pads_flag), pads_flag, &dcmipp_isp_int_ops, &dcmipp_isp_ops, - NULL, NULL); + dcmipp_isp_irq_callback, NULL); if (ret) { kfree(isp); return ERR_PTR(ret); -- 2.34.1