From patchwork Wed Jan 8 13:16:04 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alain Volmat X-Patchwork-Id: 13930915 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6C67AE77188 for ; Wed, 8 Jan 2025 13:34:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References :Message-ID:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Wj89DE0wTJdp2wyTEZQwobNPweMsiKJIaFrQ1faSRt4=; b=BFEA1DssPdxUnGlPWXgvtjjn61 IFHW/B89kDP5AmsA+XTect8OfMUFr5uvmVGfIWj02MwCA8PuYS1i0SJ+XO99CXzaHEBX2v917NeGf SquQr1YaeG1aVngALfl1h2oemAiWk7zfHWlvA1cRcI+fI4ubo007aokCFuCVtHe5bRtNH1VQd4XKv JVTb6Bom6SB4eZFoGQMK5cxE6EqwxFn5xiXjPQ5bmBidy8VEe+MUqCmbNJKa9ULBUCyNq/iaIkdlm J2cQIUdNT4TO1kQVWkUMgNOh9FGEJ5jFf/2+d4gX4X6g/AqVgoWtftI2J1HWofeOlxQ6ffI1K0Fmm uo1upwdg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVWCY-00000008d0u-378S; Wed, 08 Jan 2025 13:34:26 +0000 Received: from mx08-00178001.pphosted.com ([91.207.212.93] helo=mx07-00178001.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVVwp-00000008ZuH-0Y7H for linux-arm-kernel@lists.infradead.org; Wed, 08 Jan 2025 13:18:15 +0000 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5089S71c008374; Wed, 8 Jan 2025 14:18:02 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=selector1; bh= Wj89DE0wTJdp2wyTEZQwobNPweMsiKJIaFrQ1faSRt4=; b=SGmP1VTI879B4DYB Lxfmnfb0LNkZ+qOZAFgx4s1/7LpBjeP6jJ/DnLvf3//pjOPjY2BqmVuiGOWztO7f QIDGFOSXvRoAD07rcr4jcnIqwtNnLt6eOTV20Y2Q3k9TZ9jkrtOPkq6+ADCgxyM0 R1JCI5+PazrY8CBRQr+WsrnhO2hKHOJVHE2VZ/O9Z+X1u8vOBTVnUxaFeFsKi/HL 4bMCFYaReNvNOJvoeMIQmGN0TBwWtWnUYUiRVZ9tvL9cO6eAX/tZTBqlKNd5Cznc ifXZGYNDm193CeaI6ZxLdPc3T8UCkMUT3ROYbI3Mi2MLHJmkkLg+pTxGjkOxlfyu 03A63Q== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 441m7t9md7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Jan 2025 14:18:02 +0100 (CET) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id B6BE640047; Wed, 8 Jan 2025 14:17:00 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 04DCE2795F1; Wed, 8 Jan 2025 14:16:11 +0100 (CET) Received: from localhost (10.252.31.140) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Wed, 8 Jan 2025 14:16:10 +0100 From: Alain Volmat Date: Wed, 8 Jan 2025 14:16:04 +0100 Subject: [PATCH v2 1/8] dt-bindings: media: clarify stm32 csi & simplify example MIME-Version: 1.0 Message-ID: <20250108-csi_dcmipp_mp25_enhancements-v2-1-05808ce50e41@foss.st.com> References: <20250108-csi_dcmipp_mp25_enhancements-v2-0-05808ce50e41@foss.st.com> In-Reply-To: <20250108-csi_dcmipp_mp25_enhancements-v2-0-05808ce50e41@foss.st.com> To: Hugues Fruchet , Mauro Carvalho Chehab , Maxime Coquelin , Alexandre Torgue , Hans Verkuil , Sakari Ailus , Rob Herring , Krzysztof Kozlowski , Conor Dooley CC: , , , , , Alain Volmat X-Mailer: b4 0.14.1 X-Originating-IP: [10.252.31.140] X-ClientProxiedBy: EQNCAS1NODE4.st.com (10.75.129.82) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250108_051811_579639_3A5DB52F X-CRM114-Status: GOOD ( 11.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Clarify the description of the stm32 CSI by mentioning CSI-2 and D-PHY. Remove the bus-type property from the example since this CSI has a D-PHY, which is the only bus-type option, making this property redundant. Signed-off-by: Alain Volmat --- v2: clarify commit message related to bus-type property removal within the example --- Documentation/devicetree/bindings/media/st,stm32mp25-csi.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/media/st,stm32mp25-csi.yaml b/Documentation/devicetree/bindings/media/st,stm32mp25-csi.yaml index 33bedfe41924..e9fa3cfea5d2 100644 --- a/Documentation/devicetree/bindings/media/st,stm32mp25-csi.yaml +++ b/Documentation/devicetree/bindings/media/st,stm32mp25-csi.yaml @@ -7,8 +7,8 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# title: STMicroelectronics STM32 CSI controller description: - The STM32 CSI controller allows connecting a CSI based - camera to the DCMIPP camera pipeline. + The STM32 CSI controller, coupled with a D-PHY allows connecting a CSI-2 + based camera to the DCMIPP camera pipeline. maintainers: - Alain Volmat @@ -109,7 +109,6 @@ examples: endpoint { remote-endpoint = <&imx335_ep>; data-lanes = <1 2>; - bus-type = ; }; }; From patchwork Wed Jan 8 13:16:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alain Volmat X-Patchwork-Id: 13930912 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A110AE77188 for ; Wed, 8 Jan 2025 13:31:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References :Message-ID:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=WMhEQ5FyK9OrG4uMjs+kjYbwMOyJiryWj2ETzJ64ZW8=; b=4wiMgco4h3yBF/ZKQl2hCNPXha GFmywFl/cTmss7ChMfiJTdwrlRQXYZNiWKPdlshGtcfChxYQ69VCNBFU/btE3oSSnQt89EsjBIMAh N7/6XnAYA2z6bfpk7aBQLhB9EWY5Lmgrd+mYa5vzWwXi7CnA5mTAUcHE1z56065zMKwf05kJ9dCYH nR5zpdHWNB2wiBd3xrvrCii7Ciaddv4A9m+Cr8Emt3tu81/feynNhMNSxh5+gyReGe5/VwnS2+RPI axBu+PxXQaSN77t0NjAd9E0IHziDVgOqYk2bAaOEtgabDQcpoN1B3ljkomO4kS4oG3DniqgOemFNJ QbjB8WHQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVW91-00000008cMT-3ZNG; Wed, 08 Jan 2025 13:30:47 +0000 Received: from mx08-00178001.pphosted.com ([91.207.212.93] helo=mx07-00178001.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVVwp-00000008ZuJ-0fir for linux-arm-kernel@lists.infradead.org; Wed, 08 Jan 2025 13:18:12 +0000 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5089S8OV008424; Wed, 8 Jan 2025 14:18:02 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=selector1; bh= WMhEQ5FyK9OrG4uMjs+kjYbwMOyJiryWj2ETzJ64ZW8=; b=3z0BD2Q001meWpkk X5ESTUC4tt7ZZ6ehHUx25y5BEDUBMyntcisTlrK5WKsXzCLEvYxIngc9CGwNCgY7 Zt9NQ46YXllLqBENPdlrUge9esidTp/heN4HZL5eMUVhowMeUKqWiiB7NUcSTCQO jGMrtOS0kNjnvPXsBDPdAdbcOQldWrbmEVzwaBjzl+YECkBeye0Drz6G3uHFrJt+ p+hnJVufWUOJvhTTVzdRRSUAn91WkeqUhJsEjRwcNibv4fkac89CGZxBoKfPEcaH tZ/bqoWia5AaD6Ei1QulY8B1ixGaUk1D4TfnGvZLazGoRt7gParBLTEHSSaufXLC P4EH8w== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 441m7t9md6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Jan 2025 14:18:02 +0100 (CET) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id C3B5240048; Wed, 8 Jan 2025 14:17:01 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 197542795F5; Wed, 8 Jan 2025 14:16:12 +0100 (CET) Received: from localhost (10.252.31.140) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Wed, 8 Jan 2025 14:16:11 +0100 From: Alain Volmat Date: Wed, 8 Jan 2025 14:16:05 +0100 Subject: [PATCH v2 2/8] media: stm32: csi: add missing pm_runtime_put on error MIME-Version: 1.0 Message-ID: <20250108-csi_dcmipp_mp25_enhancements-v2-2-05808ce50e41@foss.st.com> References: <20250108-csi_dcmipp_mp25_enhancements-v2-0-05808ce50e41@foss.st.com> In-Reply-To: <20250108-csi_dcmipp_mp25_enhancements-v2-0-05808ce50e41@foss.st.com> To: Hugues Fruchet , Mauro Carvalho Chehab , Maxime Coquelin , Alexandre Torgue , Hans Verkuil , Sakari Ailus , Rob Herring , Krzysztof Kozlowski , Conor Dooley CC: , , , , , Alain Volmat X-Mailer: b4 0.14.1 X-Originating-IP: [10.252.31.140] X-ClientProxiedBy: EQNCAS1NODE4.st.com (10.75.129.82) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250108_051811_562387_A19F8786 X-CRM114-Status: GOOD ( 12.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Within the stm32_csi_start function, pm_runtime_put should be called upon error following pm_runtime_get_sync. Rework the function error handling by putting a label in order to have common error handling for all calls requiring pm_runtime_put. Signed-off-by: Alain Volmat --- drivers/media/platform/st/stm32/stm32-csi.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/st/stm32/stm32-csi.c b/drivers/media/platform/st/stm32/stm32-csi.c index 48941aae8c9b..e2f63bb47d33 100644 --- a/drivers/media/platform/st/stm32/stm32-csi.c +++ b/drivers/media/platform/st/stm32/stm32-csi.c @@ -497,21 +497,19 @@ static int stm32_csi_start(struct stm32_csi_dev *csidev, ret = pm_runtime_get_sync(csidev->dev); if (ret < 0) - return ret; + goto error_put; /* Retrieve CSI2PHY clock rate to compute CCFR value */ phy_clk_frate = clk_get_rate(csidev->clks[STM32_CSI_CLK_CSI2PHY].clk); if (!phy_clk_frate) { - pm_runtime_put(csidev->dev); dev_err(csidev->dev, "CSI2PHY clock rate invalid (0)\n"); - return ret; + ret = -EINVAL; + goto error_put; } ret = stm32_csi_setup_lane_merger(csidev); - if (ret) { - pm_runtime_put(csidev->dev); - return ret; - } + if (ret) + goto error_put; /* Enable the CSI */ writel_relaxed(STM32_CSI_CR_CSIEN, csidev->base + STM32_CSI_CR); @@ -567,6 +565,10 @@ static int stm32_csi_start(struct stm32_csi_dev *csidev, writel_relaxed(0, csidev->base + STM32_CSI_PMCR); return ret; + +error_put: + pm_runtime_put(csidev->dev); + return ret; } static void stm32_csi_stop(struct stm32_csi_dev *csidev) From patchwork Wed Jan 8 13:16:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alain Volmat X-Patchwork-Id: 13930914 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 16B31E77199 for ; Wed, 8 Jan 2025 13:33:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References :Message-ID:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=KypdGnyKgLl4nhvMId8FZobhUoEfqEaVUPzgI6v5dkk=; b=1RtyQtcdnUREEp6v+tEREXXx1V b6FxeMe3T7I2r0EgqVapevyCfNIg+8f0qePLee+HTmcYaUlCk3nv9jApPs2kevaYv3h97V+cQ2+d6 14TFixBqx0bW87EGRB+TK3MQdhkU7+G04GSB0Jmjic+YARQXR9kbwyqdn0tKYjD6XHAU1EWmgYTzk 0IxYmf/VLEj2GwNMW9iHGD/c5cNeTa0AdzcygnQXg0/w0ZyLTfrhyP+ng9MOYTB5ZajJO4btX6Odr LdkwzvXeD2s3OCFj5CAa93ixX/I1AhXw+gPKaZz9xl/je/PmOHKIQdTqJC9EVYm1vdYnbM66v1kf0 KTQD0IYw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVWBO-00000008cpW-0RSC; Wed, 08 Jan 2025 13:33:14 +0000 Received: from mx08-00178001.pphosted.com ([91.207.212.93]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVVwp-00000008ZuG-0PhZ for linux-arm-kernel@lists.infradead.org; Wed, 08 Jan 2025 13:18:13 +0000 Received: from pps.filterd (m0369457.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5089S6hV024342; Wed, 8 Jan 2025 14:18:02 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=selector1; bh= KypdGnyKgLl4nhvMId8FZobhUoEfqEaVUPzgI6v5dkk=; b=kRZihFMdMm4/V/5j KLBRxAjDqBfFEVDxaXFsPr/tmRQgkCFThqx3QuYGyO0d1oE3MRA/L1TtUyN+upDS r0CBFTPxgicSNK4qmoKoSRwgZVj+pGZzceEfzECaF2uIO1NeEcbBLUrgMvYSm3lU sdVXbhpwiVPsX1WVqAWIjrMUWO6F7izU5dGugfPt37elLsfe+tObFXjG0wkAzS5z 4mN2R84vIlB5II31tf9NYeJ/SDCvJ+pUixiWAzjHgMH+Wa7jCSO68zCXwgBRvFEC g/WXAy7HG96gc5srZFjPxXixAirhNoL1m8cLaGt0F+DkucJQmSlSOTlzuBVU9/C2 BehfNQ== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 441at8k7tp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Jan 2025 14:18:02 +0100 (CET) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id C79F04004A; Wed, 8 Jan 2025 14:17:07 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 2D52E2795F4; Wed, 8 Jan 2025 14:16:13 +0100 (CET) Received: from localhost (10.252.31.140) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Wed, 8 Jan 2025 14:16:12 +0100 From: Alain Volmat Date: Wed, 8 Jan 2025 14:16:06 +0100 Subject: [PATCH v2 3/8] media: stm32: csi: register subdev only at end of probe MIME-Version: 1.0 Message-ID: <20250108-csi_dcmipp_mp25_enhancements-v2-3-05808ce50e41@foss.st.com> References: <20250108-csi_dcmipp_mp25_enhancements-v2-0-05808ce50e41@foss.st.com> In-Reply-To: <20250108-csi_dcmipp_mp25_enhancements-v2-0-05808ce50e41@foss.st.com> To: Hugues Fruchet , Mauro Carvalho Chehab , Maxime Coquelin , Alexandre Torgue , Hans Verkuil , Sakari Ailus , Rob Herring , Krzysztof Kozlowski , Conor Dooley CC: , , , , , Alain Volmat X-Mailer: b4 0.14.1 X-Originating-IP: [10.252.31.140] X-ClientProxiedBy: EQNCAS1NODE4.st.com (10.75.129.82) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250108_051811_557065_243FE07B X-CRM114-Status: GOOD ( 13.11 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Call v4l2_async_register_subdev only whenever all initialization are completed at the end of the probe function. Remove as well useless err_free_priv label by returning directly upon error. Signed-off-by: Alain Volmat --- drivers/media/platform/st/stm32/stm32-csi.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/st/stm32/stm32-csi.c b/drivers/media/platform/st/stm32/stm32-csi.c index e2f63bb47d33..89fcd7d07904 100644 --- a/drivers/media/platform/st/stm32/stm32-csi.c +++ b/drivers/media/platform/st/stm32/stm32-csi.c @@ -991,11 +991,11 @@ static int stm32_csi_probe(struct platform_device *pdev) ret = stm32_csi_get_resources(csidev, pdev); if (ret) - goto err_free_priv; + return ret; ret = stm32_csi_parse_dt(csidev); if (ret) - goto err_free_priv; + return ret; csidev->sd.owner = THIS_MODULE; csidev->sd.dev = &pdev->dev; @@ -1020,10 +1020,6 @@ static int stm32_csi_probe(struct platform_device *pdev) if (ret < 0) goto err_cleanup; - ret = v4l2_async_register_subdev(&csidev->sd); - if (ret < 0) - goto err_cleanup; - /* Reset device */ rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL); if (IS_ERR(rstc)) { @@ -1050,6 +1046,10 @@ static int stm32_csi_probe(struct platform_device *pdev) pm_runtime_enable(&pdev->dev); + ret = v4l2_async_register_subdev(&csidev->sd); + if (ret < 0) + goto err_cleanup; + dev_info(&pdev->dev, "Probed CSI with %u lanes\n", csidev->num_lanes); @@ -1057,7 +1057,6 @@ static int stm32_csi_probe(struct platform_device *pdev) err_cleanup: v4l2_async_nf_cleanup(&csidev->notifier); -err_free_priv: return ret; } From patchwork Wed Jan 8 13:16:07 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alain Volmat X-Patchwork-Id: 13930916 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8D8F0E77188 for ; Wed, 8 Jan 2025 13:35:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References :Message-ID:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=7zKVl4ErJTsqC1L8EpP30Wrq/2TXXpHRlMyoxXlbIuI=; b=t9iiWzpiJQWbG1hBLl+qMefUiU f/ZncODZ4ghWd946tLJVaT22U5WGn9VAfw78MZA2/aCEjrhwllsvlGwjDUbHWUt3upzJEroVCfQqT torv9K17YpqWjzafHPl3ioRuWiWzB0TGHVn6ca2kCDTQKQztVmw5OvEC13ZaKNYsyZZVUgHr5+ssX vm/5L2ompaP2lfdj7ia38Vo9w+H1NAtC5iLqg3bw0+6+XEMQWrt6m48byuSfaJfrfNcrIZlsxk4hY jEI0Q1pvVhkL+8BFRE+utN5WNSrNX5Tm6b4UKwPDy199TFpT0JLlKCJeft9t0rtb9ow6zB1H+qBJz P9MEB8aw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVWDj-00000008dA0-1SQn; Wed, 08 Jan 2025 13:35:39 +0000 Received: from mx08-00178001.pphosted.com ([91.207.212.93] helo=mx07-00178001.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVVwp-00000008ZuI-0YTJ for linux-arm-kernel@lists.infradead.org; Wed, 08 Jan 2025 13:18:15 +0000 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5089S79s008366; Wed, 8 Jan 2025 14:18:03 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=selector1; bh= 7zKVl4ErJTsqC1L8EpP30Wrq/2TXXpHRlMyoxXlbIuI=; b=J6MpeN4Wx4L8S1vc dbQteZccsNBgU4hreVdOlI0aGn4eook9GTSHAqNkiddJrCD0s/A8kV0HxDrhDZ3S cRUJmX0u/OJLPQ7SXFgNby2VBSV07flu7y4jRXTf4/9mh61ttcbemG4tDYg+WgVZ pC+MSJyHZI4F7RooDjVr5b5YoN/iLvf+xGE2jEaei9wV8L3EjETzfZuFRC5VyRxg I1WRsAaX0VQY+XSarTsD3rzy7KftQKQNr1EHi9paqqFzdJx7eH2bFOILS6YHliuz Zvg7GwhNaoIbxDKYncphIcccA0RPjTsPqgfUBtHiDgkw86n+PevN2p+od0K5rN2F rJVifg== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 441m7t9md8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Jan 2025 14:18:02 +0100 (CET) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 252384004C; Wed, 8 Jan 2025 14:17:08 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 4AB172B0E18; Wed, 8 Jan 2025 14:16:14 +0100 (CET) Received: from localhost (10.252.31.140) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Wed, 8 Jan 2025 14:16:13 +0100 From: Alain Volmat Date: Wed, 8 Jan 2025 14:16:07 +0100 Subject: [PATCH v2 4/8] media: stm32: csi: use ARRAY_SIZE to search D-PHY table MIME-Version: 1.0 Message-ID: <20250108-csi_dcmipp_mp25_enhancements-v2-4-05808ce50e41@foss.st.com> References: <20250108-csi_dcmipp_mp25_enhancements-v2-0-05808ce50e41@foss.st.com> In-Reply-To: <20250108-csi_dcmipp_mp25_enhancements-v2-0-05808ce50e41@foss.st.com> To: Hugues Fruchet , Mauro Carvalho Chehab , Maxime Coquelin , Alexandre Torgue , Hans Verkuil , Sakari Ailus , Rob Herring , Krzysztof Kozlowski , Conor Dooley CC: , , , , , Alain Volmat X-Mailer: b4 0.14.1 X-Originating-IP: [10.252.31.140] X-ClientProxiedBy: EQNCAS1NODE4.st.com (10.75.129.82) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250108_051811_590063_C9645CBB X-CRM114-Status: GOOD ( 16.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Within stm32_csi_start, use ARRAY_SIZE loop in order to search for the right setting. Avoid useless init of lanes_ie / lanes_en. Signed-off-by: Alain Volmat --- drivers/media/platform/st/stm32/stm32-csi.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/media/platform/st/stm32/stm32-csi.c b/drivers/media/platform/st/stm32/stm32-csi.c index 89fcd7d07904..3654f9895dbc 100644 --- a/drivers/media/platform/st/stm32/stm32-csi.c +++ b/drivers/media/platform/st/stm32/stm32-csi.c @@ -325,7 +325,6 @@ static const struct stm32_csi_mbps_phy_reg snps_stm32mp25[] = { { .mbps = 2400, .hsfreqrange = 0x47, .osc_freq_target = 442 }, { .mbps = 2450, .hsfreqrange = 0x48, .osc_freq_target = 451 }, { .mbps = 2500, .hsfreqrange = 0x49, .osc_freq_target = 460 }, - { /* sentinel */ } }; static const struct v4l2_mbus_framefmt fmt_default = { @@ -444,13 +443,13 @@ static void stm32_csi_phy_reg_write(struct stm32_csi_dev *csidev, static int stm32_csi_start(struct stm32_csi_dev *csidev, struct v4l2_subdev_state *state) { - const struct stm32_csi_mbps_phy_reg *phy_regs; + const struct stm32_csi_mbps_phy_reg *phy_regs = NULL; struct v4l2_mbus_framefmt *sink_fmt; const struct stm32_csi_fmts *fmt; unsigned long phy_clk_frate; + u32 lanes_ie, lanes_en; unsigned int mbps; - u32 lanes_ie = 0; - u32 lanes_en = 0; + unsigned int i; s64 link_freq; int ret; u32 ccfr; @@ -474,11 +473,14 @@ static int stm32_csi_start(struct stm32_csi_dev *csidev, mbps = div_s64(link_freq, 500000); dev_dbg(csidev->dev, "Computed Mbps: %u\n", mbps); - for (phy_regs = snps_stm32mp25; phy_regs->mbps != 0; phy_regs++) - if (phy_regs->mbps >= mbps) + for (i = 0; i < ARRAY_SIZE(snps_stm32mp25); i++) { + if (snps_stm32mp25[i].mbps >= mbps) { + phy_regs = &snps_stm32mp25[i]; break; + } + } - if (!phy_regs->mbps) { + if (!phy_regs) { dev_err(csidev->dev, "Unsupported PHY speed (%u Mbps)", mbps); return -ERANGE; } @@ -488,8 +490,8 @@ static int stm32_csi_start(struct stm32_csi_dev *csidev, phy_regs->osc_freq_target); /* Prepare lanes related configuration bits */ - lanes_ie |= STM32_CSI_SR1_DL0_ERRORS; - lanes_en |= STM32_CSI_PCR_DL0EN; + lanes_ie = STM32_CSI_SR1_DL0_ERRORS; + lanes_en = STM32_CSI_PCR_DL0EN; if (csidev->num_lanes == 2) { lanes_ie |= STM32_CSI_SR1_DL1_ERRORS; lanes_en |= STM32_CSI_PCR_DL1EN; From patchwork Wed Jan 8 13:16:08 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alain Volmat X-Patchwork-Id: 13930956 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 82E1EE77199 for ; Wed, 8 Jan 2025 13:45:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References :Message-ID:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=fuFnMO3ijaaacswBw6QbcsmE5nKXXLvyIsQw+1GMwgY=; b=otlTLEyIEnZzl/KgDsT/DcteDv 4ZRLB91apixdLY8DuDDrJ2F+AUtbVObgmdwEy9SKdlNQYXqVlsTb3MtFXwd/a7sI0TMuaFgPIAHz1 fNl5gjBWmBVI4nZM0JdrMYQ/YMNYEECtuVC34t1aDcl2VfAfnF5jjOn8Sw9QtNFeWVBh+J1yZge6y Nn/Eg2YL5njtwEfI/KFWQZDTuhtI/4a+3URHqftRZGVUdP4X2z/J0BqD21eluIbqJg30brDSL1IOC ChYligV7MB5wgpVM6B/UIvDE5AmkZOwhb+BFVVSfka4O2K5q5y7KNhp0wpsWs8YxMa1pCi2xm5DVO LoLf4/3Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVWNF-00000008eh3-3Izn; Wed, 08 Jan 2025 13:45:29 +0000 Received: from mx08-00178001.pphosted.com ([91.207.212.93]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVVzl-00000008auU-1b66 for linux-arm-kernel@lists.infradead.org; Wed, 08 Jan 2025 13:21:14 +0000 Received: from pps.filterd (m0369457.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 508DL3fj027097; Wed, 8 Jan 2025 14:21:03 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=selector1; bh= fuFnMO3ijaaacswBw6QbcsmE5nKXXLvyIsQw+1GMwgY=; b=u9RZxc70cXLvchBK iYjHnAd3gcyecsNcts+g7QfKgG3n9T2Ob2yyg03VgrBBdK7rHRAidZqYzO1tH+m5 X7pO7OrEh0wUwNKW0RZO4g1By5wt3Adey527HOe69Y0u/9QfKKd1VfJMOzP7saCE H+E2iYGyYhUh7G12J4hhyWRkeKlxQ+ULXfOnNmSYavI2ztBN1gC/nkvNGWZIJAkX RdWS3XEN0B12uNNtRa62GLfqGmFG9CDfhA7nZmc5ZSQ1e7RAjJnonFYIS0JX34IA vKZbBeP5N8tA6vfy7RyDx0Q33zYxlhMBWZ8jIiObj83MpxFrB+1pZO8Hze8byZkl 5Wp46w== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 441at8k85j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Jan 2025 14:21:03 +0100 (CET) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 7697D40044; Wed, 8 Jan 2025 14:19:37 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 6975126E530; Wed, 8 Jan 2025 14:16:15 +0100 (CET) Received: from localhost (10.252.31.140) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Wed, 8 Jan 2025 14:16:15 +0100 From: Alain Volmat Date: Wed, 8 Jan 2025 14:16:08 +0100 Subject: [PATCH v2 5/8] media: stm32: csi: simplify enable_streams error handling MIME-Version: 1.0 Message-ID: <20250108-csi_dcmipp_mp25_enhancements-v2-5-05808ce50e41@foss.st.com> References: <20250108-csi_dcmipp_mp25_enhancements-v2-0-05808ce50e41@foss.st.com> In-Reply-To: <20250108-csi_dcmipp_mp25_enhancements-v2-0-05808ce50e41@foss.st.com> To: Hugues Fruchet , Mauro Carvalho Chehab , Maxime Coquelin , Alexandre Torgue , Hans Verkuil , Sakari Ailus , Rob Herring , Krzysztof Kozlowski , Conor Dooley CC: , , , , , Alain Volmat X-Mailer: b4 0.14.1 X-Originating-IP: [10.252.31.140] X-ClientProxiedBy: EQNCAS1NODE4.st.com (10.75.129.82) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250108_052113_693490_D4B4C9A7 X-CRM114-Status: GOOD ( 10.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Put all error handling for VC stop and CSI stop together to avoid duplication of code. Signed-off-by: Alain Volmat --- drivers/media/platform/st/stm32/stm32-csi.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/st/stm32/stm32-csi.c b/drivers/media/platform/st/stm32/stm32-csi.c index 3654f9895dbc..4affbc00b042 100644 --- a/drivers/media/platform/st/stm32/stm32-csi.c +++ b/drivers/media/platform/st/stm32/stm32-csi.c @@ -694,19 +694,21 @@ static int stm32_csi_enable_streams(struct v4l2_subdev *sd, ret = stm32_csi_start_vc(csidev, state, 0); if (ret) { dev_err(csidev->dev, "Failed to start VC0\n"); - stm32_csi_stop(csidev); - return ret; + goto failed_start_vc; } ret = v4l2_subdev_enable_streams(csidev->s_subdev, csidev->s_subdev_pad_nb, BIT_ULL(0)); - if (ret) { - stm32_csi_stop_vc(csidev, 0); - stm32_csi_stop(csidev); - return ret; - } + if (ret) + goto failed_enable_streams; return 0; + +failed_enable_streams: + stm32_csi_stop_vc(csidev, 0); +failed_start_vc: + stm32_csi_stop(csidev); + return ret; } static int stm32_csi_init_state(struct v4l2_subdev *sd, From patchwork Wed Jan 8 13:16:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alain Volmat X-Patchwork-Id: 13930959 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 15B55E77188 for ; Wed, 8 Jan 2025 13:45:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References :Message-ID:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=JbpwNe7H/nYAZqga9/+6DPVfcnSEXkS2J7ZN0f7NL8A=; b=IYRjTJ9sqSw4i4SQJ00lAuAvu3 4YXhSc1f8wAxL37cKvkaB3blclSuumQqVEjNr/RFi7wVvHKnGbdxKkiPmFFjcA5mMyeyrisPBp9D9 /CmHuZBSrnUhxo7uqHAfX55Ku6jf3rH6A0skxa/IKP11n/yWJ6RkyemNTw0ymhms1ZXNZuNFuFucV Kx9JcGnv7vvbAcWK7tT7nWwRjJFH044m2JxaYprHtmJlXPVIO/yYjF2g84pDKo02Xha5xzfhsZ+QC lz0UY2qpQAAqExecouupVwPGKkjB9yy4/7VEkyz3Uqpc8sAkC1UdkRPuT17HyElLxoX6QoTxzIu5F v6QPfYtQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVWNG-00000008ehN-3qh6; Wed, 08 Jan 2025 13:45:30 +0000 Received: from mx07-00178001.pphosted.com ([185.132.182.106]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVW0i-00000008b1l-0bGo for linux-arm-kernel@lists.infradead.org; Wed, 08 Jan 2025 13:22:13 +0000 Received: from pps.filterd (m0369458.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 508DL90P003051; Wed, 8 Jan 2025 14:22:01 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=selector1; bh= JbpwNe7H/nYAZqga9/+6DPVfcnSEXkS2J7ZN0f7NL8A=; b=n1FELsl3p37Pu62t yPHc3xzsr46g5mucwC54OICqHBMsfdl060XfzkSXh8q6r1hNLiw2cfhN90jfqKHh 9D696cZaIkcGzGq52epFQ1lp8iNirakFbQgSmVnPGapLQqDYp4w926KH7bHpUSad exVEvuFrii1bNTtLwHdxyh3pFYJ4MWR831PsREQuxTCWGeYuCkcSPymcg7pvPdS2 13gzTnccLkt42MBjyDQ7EcbdqD905RflJoJOtEr0c1nSI28pkzVekc5ppaY5Oj/U Uc+OG5roB3FI/YVrHb0ocJp/kWH+HnLPwINYq5JTPShGgUHMY8/FmPA7R6qgurdF OIiN5g== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 441kvw1rw9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Jan 2025 14:22:01 +0100 (CET) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id AAEEB4006C; Wed, 8 Jan 2025 14:20:36 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 884D0270597; Wed, 8 Jan 2025 14:16:16 +0100 (CET) Received: from localhost (10.252.31.140) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Wed, 8 Jan 2025 14:16:16 +0100 From: Alain Volmat Date: Wed, 8 Jan 2025 14:16:09 +0100 Subject: [PATCH v2 6/8] media: stm32: csi: remove useless fwnode_graph_get_endpoint call MIME-Version: 1.0 Message-ID: <20250108-csi_dcmipp_mp25_enhancements-v2-6-05808ce50e41@foss.st.com> References: <20250108-csi_dcmipp_mp25_enhancements-v2-0-05808ce50e41@foss.st.com> In-Reply-To: <20250108-csi_dcmipp_mp25_enhancements-v2-0-05808ce50e41@foss.st.com> To: Hugues Fruchet , Mauro Carvalho Chehab , Maxime Coquelin , Alexandre Torgue , Hans Verkuil , Sakari Ailus , Rob Herring , Krzysztof Kozlowski , Conor Dooley CC: , , , , , Alain Volmat X-Mailer: b4 0.14.1 X-Originating-IP: [10.252.31.140] X-ClientProxiedBy: EQNCAS1NODE4.st.com (10.75.129.82) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250108_052212_480883_0869DB17 X-CRM114-Status: GOOD ( 12.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The endpoint is already retrieved at the beginning of the function stm32_csi_parse_dt hence keep the endpoint pointer until the end instead of getting a new one. Signed-off-by: Alain Volmat --- drivers/media/platform/st/stm32/stm32-csi.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/media/platform/st/stm32/stm32-csi.c b/drivers/media/platform/st/stm32/stm32-csi.c index 4affbc00b042..1be12c9dcf55 100644 --- a/drivers/media/platform/st/stm32/stm32-csi.c +++ b/drivers/media/platform/st/stm32/stm32-csi.c @@ -932,38 +932,32 @@ static int stm32_csi_parse_dt(struct stm32_csi_dev *csidev) } ret = v4l2_fwnode_endpoint_parse(ep, &v4l2_ep); - fwnode_handle_put(ep); if (ret) { dev_err(csidev->dev, "Could not parse v4l2 endpoint\n"); - return ret; + goto out; } csidev->num_lanes = v4l2_ep.bus.mipi_csi2.num_data_lanes; if (csidev->num_lanes > STM32_CSI_LANES_MAX) { dev_err(csidev->dev, "Unsupported number of data-lanes: %d\n", csidev->num_lanes); - return -EINVAL; + ret = -EINVAL; + goto out; } memcpy(csidev->lanes, v4l2_ep.bus.mipi_csi2.data_lanes, sizeof(csidev->lanes)); - ep = fwnode_graph_get_next_endpoint(dev_fwnode(csidev->dev), NULL); - if (!ep) { - dev_err(csidev->dev, "Failed to get next endpoint\n"); - return -EINVAL; - } - v4l2_async_subdev_nf_init(&csidev->notifier, &csidev->sd); asd = v4l2_async_nf_add_fwnode_remote(&csidev->notifier, ep, struct v4l2_async_connection); - fwnode_handle_put(ep); if (IS_ERR(asd)) { dev_err(csidev->dev, "Failed to add fwnode remote subdev\n"); - return PTR_ERR(asd); + ret = PTR_ERR(asd); + goto out; } csidev->notifier.ops = &stm32_csi_notifier_ops; @@ -972,9 +966,11 @@ static int stm32_csi_parse_dt(struct stm32_csi_dev *csidev) if (ret) { dev_err(csidev->dev, "Failed to register notifier\n"); v4l2_async_nf_cleanup(&csidev->notifier); - return ret; + goto out; } +out: + fwnode_handle_put(ep); return ret; } From patchwork Wed Jan 8 13:16:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alain Volmat X-Patchwork-Id: 13930958 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 87BCBE77188 for ; Wed, 8 Jan 2025 13:45:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References :Message-ID:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=1OijE7D/bwZ86UgAtBbLF2m/QNftawfwPt9+VBoGOMA=; b=noCdKAbCdmgD82AsCbO5N9eU4n veW+92aq5/SrCXWIPYIxFUI560MHaHfVQ2CBKvVHZ4Y3ImlpFWaay68UR+3nLCdEN84pyHIWd+nXN PkRs2QUqbLdUGvT5S3Kplo6opqKMfVawmAJnJ7+tidi+kl6TfQxOZ5uOGpAAWvgAN2Zj6PVz/4wKR wx/aHfZRDwi0mGa0ZVH/+nhJQR6mZgv3NaR1UYLuRTv4Ka4zGkpBcyt5NuvCHuF+d/4yWwYBHX61k 2MGY0Wg4gx5Bv/4mh8MZhzyGdv4iqEqzLPqSXWM2ixBBHXu3QXOUQF27AMMRX/Q691IOyskODwiRB pZi6JYvw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVWNG-00000008ehD-1P1t; Wed, 08 Jan 2025 13:45:30 +0000 Received: from mx08-00178001.pphosted.com ([91.207.212.93] helo=mx07-00178001.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVW0h-00000008b1j-1zjF for linux-arm-kernel@lists.infradead.org; Wed, 08 Jan 2025 13:22:12 +0000 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 508DL64g031316; Wed, 8 Jan 2025 14:22:02 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=selector1; bh= 1OijE7D/bwZ86UgAtBbLF2m/QNftawfwPt9+VBoGOMA=; b=fOzfeV6PM+6g+WXQ noL5+wer5LSkjZ6XlOg55wd9znIkPf5SSKj1v8OpBxr2mFZ14wU5mnAPj/3sZdyW tv3vPTcssxbPTRheYzKbiypoVypA+ypcPS2uci2apHSTY5sYO9n3GaUHiM0qBpKN 2aXctXyHgqED5DhEspCUaQFrFcCV4xLuQ2YY0KVTwWcQczdZxhEpyZH4AMOjTAsg qKm97xsVgEc954AFLrm/pmlTnix/vfiPyH0jQF8/cXpPPpjR2NKEmLvm0WmQqfJE 1nQmH4Jqj3HQaH66FBj+lD3+acaIWAYtU0HIYyqIl5+5Lacc7omtvCWd8yrnevUJ pbbMpw== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 441pu4rwn8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Jan 2025 14:22:01 +0100 (CET) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 1034240073; Wed, 8 Jan 2025 14:20:41 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id A1B19225DF0; Wed, 8 Jan 2025 14:16:17 +0100 (CET) Received: from localhost (10.252.31.140) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Wed, 8 Jan 2025 14:16:17 +0100 From: Alain Volmat Date: Wed, 8 Jan 2025 14:16:10 +0100 Subject: [PATCH v2 7/8] media: stm32: csi: correct unsigned or useless variable settings MIME-Version: 1.0 Message-ID: <20250108-csi_dcmipp_mp25_enhancements-v2-7-05808ce50e41@foss.st.com> References: <20250108-csi_dcmipp_mp25_enhancements-v2-0-05808ce50e41@foss.st.com> In-Reply-To: <20250108-csi_dcmipp_mp25_enhancements-v2-0-05808ce50e41@foss.st.com> To: Hugues Fruchet , Mauro Carvalho Chehab , Maxime Coquelin , Alexandre Torgue , Hans Verkuil , Sakari Ailus , Rob Herring , Krzysztof Kozlowski , Conor Dooley CC: , , , , , Alain Volmat X-Mailer: b4 0.14.1 X-Originating-IP: [10.252.31.140] X-ClientProxiedBy: EQNCAS1NODE4.st.com (10.75.129.82) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250108_052211_789922_C2C16A52 X-CRM114-Status: GOOD ( 14.44 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Correct several missing unsigned type missing for loop variables and also remove useless initialization of variables. Signed-off-by: Alain Volmat --- drivers/media/platform/st/stm32/stm32-csi.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/media/platform/st/stm32/stm32-csi.c b/drivers/media/platform/st/stm32/stm32-csi.c index 1be12c9dcf55..602b0879f21e 100644 --- a/drivers/media/platform/st/stm32/stm32-csi.c +++ b/drivers/media/platform/st/stm32/stm32-csi.c @@ -357,7 +357,7 @@ static inline struct stm32_csi_dev *to_csidev(struct v4l2_subdev *sd) static int stm32_csi_setup_lane_merger(struct stm32_csi_dev *csidev) { u32 lmcfgr = 0; - int i; + unsigned int i; for (i = 0; i < csidev->num_lanes; i++) { if (!csidev->lanes[i] || csidev->lanes[i] > STM32_CSI_LANES_MAX) { @@ -595,20 +595,20 @@ static int stm32_csi_start_vc(struct stm32_csi_dev *csidev, { struct v4l2_mbus_framefmt *mbus_fmt; const struct stm32_csi_fmts *fmt; - u32 cfgr1 = 0; - int ret = 0; u32 status; + u32 cfgr1; + int ret; mbus_fmt = v4l2_subdev_state_get_format(state, STM32_CSI_PAD_SOURCE); fmt = stm32_csi_code_to_fmt(mbus_fmt->code); /* If the mbus code is JPEG, don't enable filtering */ if (mbus_fmt->code == MEDIA_BUS_FMT_JPEG_1X8) { - cfgr1 |= STM32_CSI_VCXCFGR1_ALLDT; + cfgr1 = STM32_CSI_VCXCFGR1_ALLDT; cfgr1 |= fmt->input_fmt << STM32_CSI_VCXCFGR1_CDTFT_SHIFT; dev_dbg(csidev->dev, "VC%d: enable AllDT mode\n", vc); } else { - cfgr1 |= fmt->datatype << STM32_CSI_VCXCFGR1_DT0_SHIFT; + cfgr1 = fmt->datatype << STM32_CSI_VCXCFGR1_DT0_SHIFT; cfgr1 |= fmt->input_fmt << STM32_CSI_VCXCFGR1_DT0FT_SHIFT; cfgr1 |= STM32_CSI_VCXCFGR1_DT0EN; dev_dbg(csidev->dev, "VC%d: enable DT0(0x%x)/DT0FT(0x%x)\n", @@ -634,8 +634,8 @@ static int stm32_csi_start_vc(struct stm32_csi_dev *csidev, static int stm32_csi_stop_vc(struct stm32_csi_dev *csidev, u32 vc) { - int ret = 0; u32 status; + int ret; /* Stop the Virtual Channel */ writel_relaxed(STM32_CSI_CR_VCXSTOP(vc) | STM32_CSI_CR_CSIEN, @@ -714,7 +714,7 @@ static int stm32_csi_enable_streams(struct v4l2_subdev *sd, static int stm32_csi_init_state(struct v4l2_subdev *sd, struct v4l2_subdev_state *state) { - int i; + unsigned int i; for (i = 0; i < sd->entity.num_pads; i++) *v4l2_subdev_state_get_format(state, i) = fmt_default; @@ -879,7 +879,8 @@ static irqreturn_t stm32_csi_irq_thread(int irq, void *arg) static int stm32_csi_get_resources(struct stm32_csi_dev *csidev, struct platform_device *pdev) { - int irq, ret, i; + unsigned int i; + int irq, ret; csidev->base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); if (IS_ERR(csidev->base)) From patchwork Wed Jan 8 13:16:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alain Volmat X-Patchwork-Id: 13930957 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D99EBE7719A for ; Wed, 8 Jan 2025 13:45:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References :Message-ID:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=mvpHg9TQ6IL1UuT8hLct/OvilUvBkO53Z6F+HaXouII=; b=CCN0lA0+V47YeV1IcgMHlF87Cg dVuY+tHDmSQjNIn2BIaqRbMq26LqBtAaWIs4VuDotNhyL5UK48nrTNYQZ8DIder/ij3WHV3V03iqf 3xPoLS4TeJ6In4L6FW55A0V97kfJHkxGa5qO0pV/D4ZfdR7kRLemN8hw9aDh9r/8tXjKqMnmivZuh M+39H/ypOOKnmgpfQnWnSABI4BlfASkgwb5Sv0BAT3wB9h/4ZC20v5JtayHb+BKn/s47lAWI2qpT+ D+I0MyeN8dG37SZV2qzW2hcIkB0CCzZsY0jcqXP12tVKpuqDV9YYLyuJcySFKRv/YKgT9AcZcmcmC JuxtCGWw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVWNH-00000008ehU-26Ub; Wed, 08 Jan 2025 13:45:31 +0000 Received: from mx07-00178001.pphosted.com ([185.132.182.106]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVW0i-00000008b1m-0b5p for linux-arm-kernel@lists.infradead.org; Wed, 08 Jan 2025 13:22:13 +0000 Received: from pps.filterd (m0369458.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 508DL3ZV002861; Wed, 8 Jan 2025 14:22:02 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=selector1; bh= mvpHg9TQ6IL1UuT8hLct/OvilUvBkO53Z6F+HaXouII=; b=mIuFO2W/T/pz+RBI kRfhDHXuRKgwKBJ4fTDFiKnvamwsyPhFq124XIsmx11kOoW6JcJHuITQ85R3zXwY eym4A06l/6jxEm69xaUB1Jdjk/8SB+Xw+JXBrAQ3YReXd00QPSUzc7l4LiVTfwsM L2UPLAETeg98XwkBeFImbHbG499mIHERgzOvsvAeuvWaVjPVePc6pgtPEpQQco2h tXCojQP4+DQ01edcxKEGjC+jPLYCoU3jLXN/Vcat8JqHpchIX2ufA273VrfMC/aU QYhPcdcC0GfzexHMpI7sMlJi7d+h53UYRaoAq9xx+mgfmhU4VSDnruVWGjcjv/rG QbHbRA== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 441kvw1rwa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Jan 2025 14:22:02 +0100 (CET) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 205F040052; Wed, 8 Jan 2025 14:20:40 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id B8E7A270D63; Wed, 8 Jan 2025 14:16:18 +0100 (CET) Received: from localhost (10.252.31.140) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Wed, 8 Jan 2025 14:16:18 +0100 From: Alain Volmat Date: Wed, 8 Jan 2025 14:16:11 +0100 Subject: [PATCH v2 8/8] media: stm32: dcmipp: add has_csi2 & needs_mclk in match data MIME-Version: 1.0 Message-ID: <20250108-csi_dcmipp_mp25_enhancements-v2-8-05808ce50e41@foss.st.com> References: <20250108-csi_dcmipp_mp25_enhancements-v2-0-05808ce50e41@foss.st.com> In-Reply-To: <20250108-csi_dcmipp_mp25_enhancements-v2-0-05808ce50e41@foss.st.com> To: Hugues Fruchet , Mauro Carvalho Chehab , Maxime Coquelin , Alexandre Torgue , Hans Verkuil , Sakari Ailus , Rob Herring , Krzysztof Kozlowski , Conor Dooley CC: , , , , , Alain Volmat X-Mailer: b4 0.14.1 X-Originating-IP: [10.252.31.140] X-ClientProxiedBy: EQNCAS1NODE4.st.com (10.75.129.82) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250108_052212_479209_3C43AD5E X-CRM114-Status: GOOD ( 17.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Introduce two variable has_csi and has_mclk within the match data of the driver in order to know, depending on the compatible if CSI-2 interface is available and if the mclk clk should be retrieved. Signed-off-by: Alain Volmat --- .../platform/st/stm32/stm32-dcmipp/dcmipp-core.c | 23 ++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c index 5a04018a6a9d..1b7bae3266c8 100644 --- a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c +++ b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c @@ -89,6 +89,8 @@ struct dcmipp_pipeline_config { const struct dcmipp_ent_link *links; size_t num_links; u32 hw_revision; + bool has_csi2; + bool needs_mclk; }; /* -------------------------------------------------------------------------- @@ -164,7 +166,9 @@ static const struct dcmipp_pipeline_config stm32mp25_pipe_cfg = { .num_ents = ARRAY_SIZE(stm32mp25_ent_config), .links = stm32mp25_ent_links, .num_links = ARRAY_SIZE(stm32mp25_ent_links), - .hw_revision = DCMIPP_STM32MP25_VERR + .hw_revision = DCMIPP_STM32MP25_VERR, + .has_csi2 = true, + .needs_mclk = true }; #define LINK_FLAG_TO_STR(f) ((f) == 0 ? "" :\ @@ -296,7 +300,7 @@ static int dcmipp_graph_notify_bound(struct v4l2_async_notifier *notifier, struct v4l2_async_connection *asd) { struct dcmipp_device *dcmipp = notifier_to_dcmipp(notifier); - int ret; + int ret = -EINVAL; int src_pad, i; struct dcmipp_ent_device *sink; struct v4l2_fwnode_endpoint vep = { 0 }; @@ -304,15 +308,9 @@ static int dcmipp_graph_notify_bound(struct v4l2_async_notifier *notifier, enum v4l2_mbus_type supported_types[] = { V4L2_MBUS_PARALLEL, V4L2_MBUS_BT656, V4L2_MBUS_CSI2_DPHY }; - int supported_types_nb = ARRAY_SIZE(supported_types); dev_dbg(dcmipp->dev, "Subdev \"%s\" bound\n", subdev->name); - /* Only MP25 supports CSI input */ - if (!of_device_is_compatible(dcmipp->dev->of_node, - "st,stm32mp25-dcmipp")) - supported_types_nb--; - /* * Link this sub-device to DCMIPP, it could be * a parallel camera sensor or a CSI-2 to parallel bridge @@ -330,7 +328,12 @@ static int dcmipp_graph_notify_bound(struct v4l2_async_notifier *notifier, } /* Check for supported MBUS type */ - for (i = 0; i < supported_types_nb; i++) { + for (i = 0; i < ARRAY_SIZE(supported_types); i++) { + /* Only MP25 supports CSI input */ + if (supported_types[i] == V4L2_MBUS_CSI2_DPHY && + !dcmipp->pipe_cfg->has_csi2) + continue; + vep.bus_type = supported_types[i]; ret = v4l2_fwnode_endpoint_parse(ep, &vep); if (!ret) @@ -529,7 +532,7 @@ static int dcmipp_probe(struct platform_device *pdev) "Unable to get kclk\n"); dcmipp->kclk = kclk; - if (!of_device_is_compatible(pdev->dev.of_node, "st,stm32mp13-dcmipp")) { + if (dcmipp->pipe_cfg->needs_mclk) { mclk = devm_clk_get(&pdev->dev, "mclk"); if (IS_ERR(mclk)) return dev_err_probe(&pdev->dev, PTR_ERR(mclk),