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.66.26 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796382722; b=sOd0WNPPf7DDvzPR4epgYfQZTMIx/7qwR4lRXgLHHQGddnIc+eAfAeaxDalllC/fCoOe DSwhPkvI6IpTbTlBlskxUJe57bE7SXXxSId5bbgM8RpGQRqid3Ooub3h8+IX/kbaNzEJJ ZuZZF7I82o/Cp6XxeR7XhTWWlymLmIpSnosgnbd7kKeujC3AZz9bsLeGvt88DSRsxSGHR 5wc70VU7fQMxNMEE/JnHqVKbnQIGwVoh1qTr3Yp3tKl0bKHYJAog5osgJzXLKnmGFrVa/ tWl3YSHnxUSwlz/mRXmafBzzo4YqCDafAs/rXJdJLV6sPnHOH9zt/FWBZPBMvLdgedQ== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382722; 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=eqVwinD7Rcz6PmsLuiVBUVHx+WI3zLkLfXTtERQqIyY=; b=1CSCtg2epZlxZuPhGK2xS2bcBzYp+dfemG/wF5YAZPibzD2R/nhe4kkTabCuqEn90LKI mShjT2tCWw2ylNFbLAgD24OfQVR1tXP+xCrEAMW+SDhMxDIGOdB63KXwvj4q1TCxG4a6f HEl40eANjf2GcKa4hrSlukk/o/QuqD8FEcFmSo1wB1DF2CEFD6QMekY42FUojfg9a7e61 UN14lJ5ARRiijLkupBecS1+foCnEALVoMWbqfHjMc2hcRd0QGh+4HPFes8MDwtHVhsKLt cfkuwXOM72N2fuE9OayOm2KdgN3atr+NqYaauNVVJuySA7FXwLEpfV6btmJYmq4xT9Q== 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=MVvPMPjw; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.66.26 Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11012026.outbound.protection.outlook.com [52.101.66.26]) (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 C0130606A689; Fri, 4 Dec 2026 11:12:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C0130606A689 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=MVvPMPjw ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ruwcJi2A2ZCIDNrCnd6kBrcjJ3WfxXUcZX9KRAan7JGiVwEyc7WZVNMBp4LoeBNwbtqqj5v9I57PgOeUseudPHp+xPIdTDilO3rFnYco3nnaYZf2J4nsgV1fsQ15sjPY7IP0AHUBzUJm4Y9MRrxPQ3N/a12mLAZS3STJu6kjCpyWk46Qup0ADlabdRGI9nT1LjpLeWI9d++2Re9oMQxtaHj4acDgMzG/H6JCKiod5AMMahZmLWS48UYuj1UfMCFFvWVNX3zGSqCta7FDpfiTDa02BMXzy2hF6nBwnqnnlcupQlWRHX79jEnJOR+tgxvfNu3YLagILrL9kOZwabSJYQ== 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=eqVwinD7Rcz6PmsLuiVBUVHx+WI3zLkLfXTtERQqIyY=; b=SqgKAsh/aB5ZgddSWN2AL+fbqSYFIUYPNKcCn5mixw9SIbbAI5EciuISGJmCTlXzCuHh6fEIUrpSeMLtDBJx80LcXsaKN4GbH/LJqmY32PVvLarDuUZ9wog8wXV23A7a+AzvHP0Q6jC7E43i/BphaPCam0dd4uAMng5uZRWag07YXF9ZLOA1y+NLvjKr/vWvcpO+nlN/vGAvOqezusv8qQgHDnN420NmvpaxP03TUbqxvTots5kvIuznqPeTL+8n4WkSWCtCWq0bNDOo/RkaClgaOjOs5j1O88XflOwpoSIeR+nIjKWRFkw1GbDBDK77AHnFoSYQRUlRQSszLR4ZsA== 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=eqVwinD7Rcz6PmsLuiVBUVHx+WI3zLkLfXTtERQqIyY=; b=MVvPMPjwJZ/gkIagiZGx9prZb7L8FOb8VZLS7EF7KiheGkR75ggqXWgDiGkz65Q79IS2/0raqDnn6JCap35OIcXYF4hzLQjg/aKXhJkguZqz9ng9xrl0puJoLzGcuGZZMgZPO+5onAH7r7wAR8bJElQF63w5uCHhuhhqibg7gQ4GzZV2t2iHAh8TbLxMSU0/+HcTTh37c4XhxheS1RvVFbd+xqZIyzlmjEUcOi/0QffBysK+RbSbASRRclTEj2Wf5Cv5ECZuHE6Qmw86+tRDS1AqbQR3VU2R0uyVKkdb6rlVzsMCquvn9w3tmoV9VB1VoMGoKIjfSd3RpLCEQRxd6Q== Received: from VIXP296CA0031.AUTP296.PROD.OUTLOOK.COM (2603:10a6:800:36e::6) by AS8PR10MB7159.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:61d::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.709.7; Fri, 4 Dec 2026 11:11:52 +0000 Received: from MI3PEPF00008485.eurprd02.prod.outlook.com (2603:10a6:800:36e:cafe::94) by VIXP296CA0031.outlook.office365.com (2603:10a6:800:36e::6) 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:52 +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:52 +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:12 +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:51 +0100 From: Alain Volmat Date: Fri, 4 Dec 2026 12:11:32 +0100 Subject: [PATCH 01/11] media: stm32: dcmipp: add entity pointers into dcmipp-common.h 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-1-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_|AS8PR10MB7159:EE_ X-MS-Office365-Filtering-Correlation-Id: e151cff7-0ff4-4b6e-ec25-08df51f76631 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700016|23010399003|1800799024|376014|82310400026|10067099003|261026121527099003|56012099006|261026140227099003|261022105027099003|261022075727099003|261022113327099003|261009223027099003|261009221227099003|261021121427099003|261021123027099003|261102123227099003|261028144727099003|18002099003|22082099003|11063799006; X-Microsoft-Antispam-Message-Info: QrMOrDpInBMz3SYBcLnB0LvjJij3uVkuVPn90SAoZqaASYFoy7fvA+qxeq46+h3dsco90Hr3ZnBObjogOrqXpmxen0n/xe32TsTee6IWwYvMdP+Y7M+xMzCv54HEZh1dVQPHZ1OuyjSvWkvoz6tBaJ0wFtsCxEOwn9KpYKQGFPu/uNi7pJFkf700VS3B8inBNglizjswQ2MzihaElmGUL+U7Zlu3z+lA/AQQe8E9YTf4QZgdqZnUY6m1z6WD0ma7rQoTKTL5+dUBgTqGlrMUifRLbqZRLJMbmW+97/MXeZsT9IBAC7fstc/rYRDkQEXVbckk1jv9HlXxoyPhlPX5EsnZ+tU7qCEcHPS0yjpiZ0cwPuruag4ojWNkh5iwypo9AnZakJ70TZJxstnl3dCLSApgGw162fjdLa+DF3JOwE6IPTVcWcV+z6t/Opnp2WuUv84f5u1DxzBRujlEstjz/TIiyJz500F1i3COwYRMwGbmWxWIEDIY2J6qGbjbjnIiEmJZunPqak2rVLGVDKiIeH/1iI7algCebahJ3mpETYtRPa/71d6O1+ioFhGBXZiCMAJ/Fx9M0z/xLTK49bVOQ6Q5HvPnKg6dV0Zm+bBQlW83tc8N1fyUKYnYXTHZSZ2y7YHVjt9shXGVRPSQgbX8W9+quWwFETFZ7MvC80q2nWOmty+C0a6ajxni02yZKBbFh5Jbh50cmBw8pHtvjMkEOg== 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)(36860700016)(23010399003)(1800799024)(376014)(82310400026)(10067099003)(261026121527099003)(56012099006)(261026140227099003)(261022105027099003)(261022075727099003)(261022113327099003)(261009223027099003)(261009221227099003)(261021121427099003)(261021123027099003)(261102123227099003)(261028144727099003)(18002099003)(22082099003)(11063799006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Xx9YjjcZjlPPzJ/MyRfyUjCjbiBI3gJR2RBgcJGap2qgG+jW9bnTVVr7yoE7sBM4HJcwUakOuF+d+Te8CxG4L7pK6egecEK/jMz0IpdU00aqQKpEMwW7GiCmZhjcyvOdvpDBOrNetNARxYH+17ZObkq/Zcip9gbDnk/6d1vjCsYtDgpEQgOwdPvXsRFudOGH7taQPPc3N4c8m7eFeBcDGHeW5LWMYyIDjOGEcyEbZdn/cQZ3YbGhSTMCXQvfF7kZ++2xKlh+4QrgETXr00TRe9xQa9hMoXSD+rKySb66m8U2EFHqZfvK3JenyyOZQb4c/35Cf7Guv7PCjxxIlBqrhrlizsAv0NtUXtadsDf/fxORiIVrac7mv+j0SSUR97kbapElXRNC7Ca4MYwpPtg5rcBkXh4Ev9t4dsmF3SyvpKBk+7fMxPx+4U7Jgzc3E4RM X-OriginatorOrg: foss.st.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2026 11:11:52.0830 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e151cff7-0ff4-4b6e-ec25-08df51f76631 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: AS8PR10MB7159 Add typed pointers to each entity private structure into struct dcmipp_device. Each entity sets its pointer upon init and clears it upon release. Signed-off-by: Alain Volmat --- .../st/stm32/stm32-dcmipp/dcmipp-byteproc.c | 9 +- .../st/stm32/stm32-dcmipp/dcmipp-capture.c | 53 +--------- .../platform/st/stm32/stm32-dcmipp/dcmipp-common.h | 110 +++++++++++++++++++++ .../platform/st/stm32/stm32-dcmipp/dcmipp-input.c | 9 +- .../platform/st/stm32/stm32-dcmipp/dcmipp-isp.c | 10 +- .../st/stm32/stm32-dcmipp/dcmipp-pixelproc.c | 14 +-- 6 files changed, 121 insertions(+), 84 deletions(-) diff --git a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-byteproc.c b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-byteproc.c index 346cfddcf229..94488c3b9cbf 100644 --- a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-byteproc.c +++ b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-byteproc.c @@ -96,13 +96,6 @@ dcmipp_byteproc_pix_map_by_code(u32 code) return NULL; } -struct dcmipp_byteproc_device { - struct dcmipp_ent_device ved; - struct v4l2_subdev sd; - struct device *dev; - void __iomem *regs; -}; - static const struct v4l2_mbus_framefmt fmt_default = { .width = DCMIPP_FMT_WIDTH_DEFAULT, .height = DCMIPP_FMT_HEIGHT_DEFAULT, @@ -584,6 +577,7 @@ void dcmipp_byteproc_ent_release(struct dcmipp_ent_device *ved) struct dcmipp_byteproc_device *byteproc = container_of(ved, struct dcmipp_byteproc_device, ved); + ved->dcmipp->byteproc = NULL; dcmipp_ent_sd_unregister(ved, &byteproc->sd); } @@ -619,6 +613,7 @@ dcmipp_byteproc_ent_init(const char *entity_name, byteproc->ved.dcmipp = dcmipp; byteproc->dev = dcmipp->dev; + dcmipp->byteproc = byteproc; return &byteproc->ved; } diff --git a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-capture.c b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-capture.c index fe7767f908b7..4d35372c292b 100644 --- a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-capture.c +++ b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-capture.c @@ -187,56 +187,6 @@ struct dcmipp_buf { struct list_head list; }; -struct dcmipp_capture_device { - struct dcmipp_ent_device ved; - struct video_device vdev; - struct device *dev; - struct v4l2_pix_format format; - struct vb2_queue queue; - struct list_head buffers; - /* - * Protects concurrent calls of buf queue / irq handler - * and buffer handling related variables / lists - */ - spinlock_t irqlock; - /* mutex used as vdev and queue lock */ - struct mutex lock; - u32 sequence; - struct v4l2_subdev *s_subdev; - u32 s_subdev_pad_nb; - - enum dcmipp_state state; - - /* - * DCMIPP driver is handling 2 buffers - * active: buffer into which DCMIPP is currently writing into - * next: buffer given to the DCMIPP and which will become - * automatically active on next VSYNC - */ - struct dcmipp_buf *active, *next; - - void __iomem *regs; - - int pipe_id; - - const struct dcmipp_capture_pix_map *pix_map; - unsigned int pix_map_array_size; - - u32 cmsr2; - - struct { - u32 errors; - u32 limit; - u32 overrun; - u32 buffers; - u32 vsync; - u32 frame; - u32 it; - u32 underrun; - u32 nactive; - } count; -}; - static const struct dcmipp_capture_pix_map * dcmipp_capture_pix_map_by_pixelformat(struct dcmipp_capture_device *vcap, u32 pixelformat) @@ -888,6 +838,7 @@ void dcmipp_capture_ent_release(struct dcmipp_ent_device *ved) struct dcmipp_capture_device *vcap = container_of(ved, struct dcmipp_capture_device, ved); + ved->dcmipp->capture[vcap->pipe_id] = NULL; media_entity_cleanup(ved->ent); vb2_video_unregister_device(&vcap->vdev); } @@ -1243,6 +1194,8 @@ struct dcmipp_ent_device *dcmipp_capture_ent_init(const char *entity_name, goto err_clean_m_ent; } + dcmipp->capture[vcap->pipe_id] = vcap; + return &vcap->ved; err_clean_m_ent: 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 007912c3a7f8..aa32b64acf52 100644 --- a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-common.h +++ b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-common.h @@ -14,8 +14,10 @@ #include #include #include +#include #include #include +#include #define DCMIPP_PDEV_NAME "dcmipp" @@ -58,6 +60,14 @@ do { \ (fmt)->xfer_func = DCMIPP_XFER_FUNC_DEFAULT; \ } while (0) +#define DCMIPP_NUM_PIPES 3 + +struct dcmipp_inp_device; +struct dcmipp_byteproc_device; +struct dcmipp_capture_device; +struct dcmipp_isp_device; +struct dcmipp_pixelproc_device; + struct dcmipp_device { /* The platform device */ struct platform_device pdev; @@ -81,6 +91,18 @@ struct dcmipp_device { /* Entities */ struct dcmipp_ent_device **entity; + /* + * Pointers to the entity private structures, allowing each entity to + * access data of other entities of the pipeline. Pointers are NULL + * for entities not present on a given DCMIPP variant. Arrays are + * indexed by pipe id (pixelproc[0] is hence always NULL). + */ + struct dcmipp_inp_device *input; + struct dcmipp_byteproc_device *byteproc; + struct dcmipp_capture_device *capture[DCMIPP_NUM_PIPES]; + struct dcmipp_isp_device *isp; + struct dcmipp_pixelproc_device *pixelproc[DCMIPP_NUM_PIPES]; + struct v4l2_async_notifier notifier; }; @@ -168,6 +190,94 @@ enum dcmipp_state { DCMIPP_RUNNING, }; +/* Entity private structures */ +struct dcmipp_buf; +struct dcmipp_capture_pix_map; + +struct dcmipp_inp_device { + struct dcmipp_ent_device ved; + struct v4l2_subdev sd; + struct device *dev; + void __iomem *regs; +}; + +struct dcmipp_byteproc_device { + struct dcmipp_ent_device ved; + struct v4l2_subdev sd; + struct device *dev; + void __iomem *regs; +}; + +struct dcmipp_capture_device { + struct dcmipp_ent_device ved; + struct video_device vdev; + struct device *dev; + struct v4l2_pix_format format; + struct vb2_queue queue; + struct list_head buffers; + /* + * Protects concurrent calls of buf queue / irq handler + * and buffer handling related variables / lists + */ + spinlock_t irqlock; + /* mutex used as vdev and queue lock */ + struct mutex lock; + u32 sequence; + struct v4l2_subdev *s_subdev; + u32 s_subdev_pad_nb; + + enum dcmipp_state state; + + /* + * DCMIPP driver is handling 2 buffers + * active: buffer into which DCMIPP is currently writing into + * next: buffer given to the DCMIPP and which will become + * automatically active on next VSYNC + */ + struct dcmipp_buf *active, *next; + + void __iomem *regs; + + int pipe_id; + + const struct dcmipp_capture_pix_map *pix_map; + unsigned int pix_map_array_size; + + u32 cmsr2; + + struct { + u32 errors; + u32 limit; + u32 overrun; + u32 buffers; + u32 vsync; + u32 frame; + u32 it; + u32 underrun; + u32 nactive; + } count; +}; + +struct dcmipp_isp_device { + struct dcmipp_ent_device ved; + struct v4l2_subdev sd; + struct device *dev; + + void __iomem *regs; +}; + +struct dcmipp_pixelproc_device { + struct dcmipp_ent_device ved; + struct v4l2_subdev sd; + struct device *dev; + bool streaming; + + void __iomem *regs; + struct v4l2_ctrl_handler ctrls; + + u32 pipe_id; +}; + /** * dcmipp_pads_init - initialize pads * diff --git a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-input.c b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-input.c index e66a9456deb6..28f1e63c5cad 100644 --- a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-input.c +++ b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-input.c @@ -176,13 +176,6 @@ static inline const struct dcmipp_inp_pix_map *dcmipp_inp_pix_map_by_code return NULL; } -struct dcmipp_inp_device { - struct dcmipp_ent_device ved; - struct v4l2_subdev sd; - struct device *dev; - void __iomem *regs; -}; - static const struct v4l2_mbus_framefmt fmt_default = { .width = DCMIPP_FMT_WIDTH_DEFAULT, .height = DCMIPP_FMT_HEIGHT_DEFAULT, @@ -549,6 +542,7 @@ void dcmipp_inp_ent_release(struct dcmipp_ent_device *ved) struct dcmipp_inp_device *inp = container_of(ved, struct dcmipp_inp_device, ved); + ved->dcmipp->input = NULL; dcmipp_ent_sd_unregister(ved, &inp->sd); } @@ -588,6 +582,7 @@ struct dcmipp_ent_device *dcmipp_inp_ent_init(const char *entity_name, } inp->dev = dev; + dcmipp->input = inp; return &inp->ved; } 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 088301c20547..2ddb1e27c5bb 100644 --- a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-isp.c +++ b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-isp.c @@ -40,14 +40,6 @@ #define ISP_MEDIA_BUS_SINK_FMT_DEFAULT MEDIA_BUS_FMT_RGB565_1X16 #define ISP_MEDIA_BUS_SRC_FMT_DEFAULT MEDIA_BUS_FMT_RGB888_1X24 -struct dcmipp_isp_device { - struct dcmipp_ent_device ved; - struct v4l2_subdev sd; - struct device *dev; - - void __iomem *regs; -}; - static const struct v4l2_mbus_framefmt fmt_default = { .width = DCMIPP_FMT_WIDTH_DEFAULT, .height = DCMIPP_FMT_HEIGHT_DEFAULT, @@ -454,6 +446,7 @@ void dcmipp_isp_ent_release(struct dcmipp_ent_device *ved) struct dcmipp_isp_device *isp = container_of(ved, struct dcmipp_isp_device, ved); + ved->dcmipp->isp = NULL; dcmipp_ent_sd_unregister(ved, &isp->sd); } @@ -488,6 +481,7 @@ struct dcmipp_ent_device *dcmipp_isp_ent_init(const char *entity_name, isp->ved.dcmipp = dcmipp; isp->dev = dcmipp->dev; + dcmipp->isp = isp; return &isp->ved; } diff --git a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-pixelproc.c b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-pixelproc.c index 7d8e5f0863bf..883c6895de05 100644 --- a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-pixelproc.c +++ b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-pixelproc.c @@ -348,18 +348,6 @@ to_cconv_range(struct v4l2_mbus_framefmt *fmt) #define RANGE_STR(range) ((range) == RANGE_FULL ? "full" : "limited") -struct dcmipp_pixelproc_device { - struct dcmipp_ent_device ved; - struct v4l2_subdev sd; - struct device *dev; - bool streaming; - - void __iomem *regs; - struct v4l2_ctrl_handler ctrls; - - u32 pipe_id; -}; - static const struct v4l2_mbus_framefmt fmt_default = { .width = DCMIPP_FMT_WIDTH_DEFAULT, .height = DCMIPP_FMT_HEIGHT_DEFAULT, @@ -864,6 +852,7 @@ void dcmipp_pixelproc_ent_release(struct dcmipp_ent_device *ved) struct dcmipp_pixelproc_device *pixelproc = container_of(ved, struct dcmipp_pixelproc_device, ved); + ved->dcmipp->pixelproc[pixelproc->pipe_id] = NULL; dcmipp_ent_sd_unregister(ved, &pixelproc->sd); } @@ -930,6 +919,7 @@ dcmipp_pixelproc_ent_init(const char *entity_name, goto err_ctrl_handler_free; pixelproc->ved.dcmipp = dcmipp; + dcmipp->pixelproc[pixelproc->pipe_id] = pixelproc; return &pixelproc->ved; -- 2.34.1