From patchwork Wed May 10 09:24:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13236678 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 A3F7DC7EE22 for ; Wed, 10 May 2023 09:20:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A14C210E216; Wed, 10 May 2023 09:20:46 +0000 (UTC) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2067.outbound.protection.outlook.com [40.107.21.67]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8E78310E468 for ; Wed, 10 May 2023 09:20:43 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UeQxhYqGBj2EHHZIeSk84Q48UgcPuFAUfrwwGHMV41RY35wEL8P1AspJPlvU/XTiCQOqdrtIiLVIFJ+JuAUkOUCs8tHAjzg/iO7/0HFOfhhq4dqLUOifir7TVd+gDE1FOHGHHnnjb831IHeFeGr898DyKnLlQ/UZ2s1KaFqPPfWK/Hu7RYNFJ5wfodJxmoA2KnXU30UJIg3LY7T5ql4OTNG/37VmjCPk5JklY0FOeEfkm2MQV751MesSbgKkWyOEWUAECSgFDFhYWTxiGO1hhoc8x2FDHWkFi+Um6BkBX5aQlRVNaKm/JrADbcqRBNGxsWMZAPi2kTrNnjxzruBxSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=Kt/Wt6vQ8c5rpEREnbw7iKAlZC+1U2Uqz+cvj/tCRC0=; b=CbvKWtF+HbzQ2rRU1E70k3VVkRUHlU0zLKLq/n4h89hQhUM/bT6H13qUBs59O19/RFPKUymNqGXbQUHAulAsO+xwBCbyNOUcW9b4vj8EETIyf1uYDRXXipzmzmiX3APS31xiXWLPmWsqFmMzPhPTF+Zb6Zmuk1t5fT/OEl+biDT3Cy3Cuxw5yX5+OKrF6ZcB6ypQI9Hd3c6U7y3adHuv/ZrpRiYYwARdkoGEVDAFlGDHUS+EQPquN6U1SJyiDmo7ldx9yLr9UeS5Z8O7vsdWT8rCn2w0bsfZeWn+3D17RnzolMJS/YPo5mJc9PSYhkwEuqXwOJKFlK0f6naBK529Lw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Kt/Wt6vQ8c5rpEREnbw7iKAlZC+1U2Uqz+cvj/tCRC0=; b=SJBugp0u4yVriEi6/qc129kkWMvJ+78TolmbZeQI18qSBTCLXUZeuXJQP/sCM84IeTeQzBPogWD4r/h8A6VPeg+w0kDB0xe8wDBZsAzcBWWuXoyQa9WnbX9YkHd/Kz9SaxBM+eJpa8cVOT6qYLS+GK4xAfnCW4ZRg85LpJ10DGI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by PA4PR04MB7711.eurprd04.prod.outlook.com (2603:10a6:102:e1::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.20; Wed, 10 May 2023 09:20:41 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::60e3:2297:61f1:4d1d]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::60e3:2297:61f1:4d1d%4]) with mapi id 15.20.6363.033; Wed, 10 May 2023 09:20:40 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v6 1/6] dt-bindings: lcdif: Add i.MX93 LCDIF support Date: Wed, 10 May 2023 17:24:45 +0800 Message-Id: <20230510092450.4024730-2-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230510092450.4024730-1-victor.liu@nxp.com> References: <20230510092450.4024730-1-victor.liu@nxp.com> X-ClientProxiedBy: SI2PR01CA0027.apcprd01.prod.exchangelabs.com (2603:1096:4:192::7) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|PA4PR04MB7711:EE_ X-MS-Office365-Filtering-Correlation-Id: 3c0ea614-51a6-45b3-0cc8-08db5137d2e5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8pvUECXvbT7QxkUc550LUZG/yHjSfne1GcNrAUUekHPYul1ufNXYjTgn82qlre/bUPl1F2WmyfPOIKPMO+ajtHywP8LY0FOm2iOpeR04IqHn1CpOTFwu++KQO+SQGpDevXHf7m3EGnPtJ6eDAw+oPR/EJUaQO6Jl805nIwkE8Eo3tfIOj9nDIxQRI7DXTo41/+Yuc2/qMQC83NkNiyz0WZD92phBMmFNZt7TtPMn/24u/50JLiKuZAf541n+DsOHmexEBxN41WsNtIpZKbcA4+8uZIjpAy4abJcK+vxxb9Bz1mqKItcPKgwv0TT4GqRToMuWY24bg58oAvNIkNlwbWbZlBwDBepbWUthyO7HsIksfzdspz1ouUbYetgXWCGg+OqpUE2fUjElhkjUPWwGsgXc8hXdt1X5ynyYf1AUNOHF4VbYnDmnjiCS3Fq98at2NKutIdOVNJxjdSqhN6kb/l7v17WmtBMbUaqbX2GpvpZ/r14izDkvicIp9t+XLaBxatYT4/GzHS4zPdEtEC19unlzFBO3BfguRP3iccNm3C8USMaDBSNBFxm14MyKQnPBK+gldVzyXQ/3qDX/TXdYpOGbs5VdScxd+QZrBL66/cqp7XKYkAPJ6ZS1KsH8iryq X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR04MB7046.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(136003)(346002)(366004)(376002)(396003)(39860400002)(451199021)(4326008)(316002)(83380400001)(52116002)(36756003)(5660300002)(2906002)(41300700001)(66476007)(66556008)(86362001)(66946007)(6486002)(1076003)(26005)(6512007)(6506007)(38100700002)(38350700002)(2616005)(8936002)(8676002)(186003)(7416002)(478600001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UiazrwXxnMupZXsTjAWHJbgepKycdwHS9vIYpyXfrd7rZYZ2kE5WJCqRFeInQeVHQIw3B+3Kf/WONop9n46/4inSgBZ+czaTGZLWFGOsdfXXumz3iiDdHXg+HbCkcrvb5/Ap0d2QaSrsrHhm2Xxs+OaOV0FIe3yzSTjkPBT2yGDow7BZGbUO7u0x/ALuFycVO/HHiaF02k4cz4C9pNXz9hHEukPtZsl7RV5gLsCJw8FgNWDHBrIHLbuFjD4KIGXa+r1/FEbHVEXHBOFsoXpsUmSU8SbsACYV/cqIJnk0wvluVzC9Vz+dpftDvY8ncmoIb9FqSuCHUymOkfZsPw+sBO6gg5D6ew6EkftFHTkxNhiz4aCKyRToos2Sy+B3G/G0LPhr8yKPWsv/tQsLnarYw7BSGu5DGdqQ7O8b+oK2FsUyXxDR6RGX5TTBV5gZXyuq+znOjK56IsfXvdjdPw5gcT65s/jgTTGwqCEf19vHSC56VvlmLrCYHdOdSmdQd4mt8JxB2xbRz7VrJPfBulIY1PNI1XLv+pN8Mzbt1a2SnF2sLf3/5Iljg6tElLdcw7vf/+oFBhcDQmrjtGOgbTEdv4WfeZYhAykLpEos6syCdqh91CqY2VQfCM/YMC27qRnNAO2FDXlmljRwkvjypnqQYUH/X4O5csydldBdnX6WH8ibbqj+dazLcpwP3910PKuvSCpBuced2oNWctQbe2Usprn03vbiEN6fnkFU1Vr7O3DugeJJWYwLqTugsbwYx4OtWfQcBNpAIduEGIy3JLRj+RFJFzdSzBUUbDxslJBey2pEqzGnkwhqQbaZGSHAX1mvtdctLeaYkUXPzd5DNqJrrnDR4QI8NX9mKl2+Q7h6wJ+yLsTSpqhC2seXUhpxU+gH8PSPkOcd7K3bUYQnTtyCEAxVS5B9FhFD0dAn/G6LlW/mSElodsKOS8SsYDQui67U8XyetckrgLj2eDE57eY6L6DkNNBEmY7Si4D7cVVoeMyICRrWkjlnuCTVV2iQXU2h7iivPliNaKGwMTjD/JlPUi9gbpsC7UdWkSFfu3RLLVKt2KIKrImeaEQyQKmOrlq+buohMN/cUCcoMl5O7Trm7e8ujvFNQv9H/WJmEZymULmM0IdwMNEKe3nY0EEsGRwQY6eISE+H6VO2M9+tpuQmusv2ufBWxXkBug7IcQJhznx3IoRy2o3lNz5zoZLVqlcvYk/+0Ipd6PS2eJlXFRl9HUrJDetpWlzVvDqnCEmLeXLfbl0pTE4m55kuBx0Psf8aGTd+BRO0VTaHcQV9l/tN66i2cbPHEN2R97HHDGeNJrCrfgITGYEnaNbwTKFgB7g6G+XwZKeLHTaJ6PRopxJTCTaimpRChW+TVhAivDXLpYmviaSgYH+J+SDpaaOImcaESCGIHG1z4bh8Clslui79jMynDADAfbHrWDnLoJ99cz9vKQ0uQcreM1wTl0WMmJcYkQ5l58+CL/4iTLkIhe+vYnqgM2gSBSjBS/dtDbAuLLYD8oDEYZF6R8nYh89dP4wVfiiLCw3bhIPfkCAyYPFurX75SBUu0zzFFvid3I0o9/lgdfkU+nweCdN+kOUw6aB9 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3c0ea614-51a6-45b3-0cc8-08db5137d2e5 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2023 09:20:40.9070 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: uIfyeZyBkkyyNCyXzCfR2GFfOYju8bxBmOx7w4Moma/ynN8vBrHv4q87hKLW4laCURZidvjWjWBEzwjaMyRZKw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7711 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marex@denx.de, conor+dt@kernel.org, alexander.stein@ew.tq-group.com, shawnguo@kernel.org, s.hauer@pengutronix.de, krzysztof.kozlowski@linaro.org, robh+dt@kernel.org, linux-imx@nxp.com, krzysztof.kozlowski+dt@linaro.org, kernel@pengutronix.de, LW@karo-electronics.de Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" There is one LCDIF embedded in i.MX93 SoC to connect with MIPI DSI controller through LCDIF cross line pattern(controlled by mediamix blk-ctrl) or connect with LVDS display bridge(LDB) directly or connect with a parallel display through parallel display format(also controlled by mediamix blk-ctrl). i.MX93 LCDIF IP is essentially the same to i.MX8MP LCDIF IP. Add device tree binding for i.MX93 LCDIF. Acked-by: Krzysztof Kozlowski Reviewed-by: Marek Vasut Reviewed-by: Alexander Stein Signed-off-by: Liu Ying --- v5->v6: * No change. v4->v5: * No change. v3->v4: * Add Alexander's R-b tag. v2->v3: * No change. v1->v2: * Add Krzysztof's A-b and Marek's R-b tags. Documentation/devicetree/bindings/display/fsl,lcdif.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/display/fsl,lcdif.yaml b/Documentation/devicetree/bindings/display/fsl,lcdif.yaml index 75b4efd70ba8..fc11ab5fc465 100644 --- a/Documentation/devicetree/bindings/display/fsl,lcdif.yaml +++ b/Documentation/devicetree/bindings/display/fsl,lcdif.yaml @@ -21,6 +21,7 @@ properties: - fsl,imx28-lcdif - fsl,imx6sx-lcdif - fsl,imx8mp-lcdif + - fsl,imx93-lcdif - items: - enum: - fsl,imx6sl-lcdif @@ -88,7 +89,9 @@ allOf: properties: compatible: contains: - const: fsl,imx8mp-lcdif + enum: + - fsl,imx8mp-lcdif + - fsl,imx93-lcdif then: properties: clocks: @@ -107,6 +110,7 @@ allOf: enum: - fsl,imx6sx-lcdif - fsl,imx8mp-lcdif + - fsl,imx93-lcdif then: properties: clocks: @@ -123,6 +127,7 @@ allOf: - fsl,imx8mm-lcdif - fsl,imx8mn-lcdif - fsl,imx8mp-lcdif + - fsl,imx93-lcdif then: required: - power-domains From patchwork Wed May 10 09:24:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13236679 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 3B4A2C7EE22 for ; Wed, 10 May 2023 09:20:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 469F010E468; Wed, 10 May 2023 09:20:52 +0000 (UTC) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2083.outbound.protection.outlook.com [40.107.21.83]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8C4A810E468 for ; Wed, 10 May 2023 09:20:50 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HSYzjcYw/Sb5GNkEGSsgRfZNTyt/p0hphWN4QF0sLlqif37Z8O0vtKovib1Xx595hOyRBE0z4W9bNWrqmFoHEaWQdmwaVInv5PlN4AVXJPj9HFx3M2ibOskfTE41rWoKKNxhn3lfKmXA/g1S+UBYRzhv2Fv+SYdAa05INNfFZYqZQrZZzf5UBoDFjINYXtjGsSoAcqF4+Ih1VW6+6svGd3SaUYdM+u8yKxMH305hC+6vaGXd0ajhgdGwkilEJZoPAjwAYSmK6+NR2T4JIfJIGAqB19YI5O7Xcj97iEnjMpEqs0ADhsAkIAivAlm8h56QdCFeB7PtvlJjvMKJ0ecqKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=FAlqnbTDPRhNNoQbdUlsUMRoO8LAmssJ0asyGwxTkVQ=; b=dHUzyCWI/jsPdlcvBs1V4kLiC/muNUUQqNNFDikhSRbnC1wX6HvcQVQVqxLfoF1XdRczNUzOzST6jzLc/wy/wBkOid28ggFMugfVk+QCy/UIOx8RF7L5UTOMT/QEB0jL0ueJBaDWqXLYqGny/rf8cAUS+nPVi4k2U1XwDCvMBC2lPqOqPyeiCa/mOkNfc5jyRNJdo22QI9FlIsH2ehrHFPiexd7onJRXSxj2Qk1kG55TKY5fYjACkkXRM/VkkGXGwkj17qXomuFCc8n4y5qiXAbqWOaHse6HmkUSOpU1oVR4Pcc3QYxDOuQBvuBBP2otIaEfTNEowNyWZ97SI1unKg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FAlqnbTDPRhNNoQbdUlsUMRoO8LAmssJ0asyGwxTkVQ=; b=UX8Dm6BNRqVwwu3VLVs0Rvqps60roowKMvmH74jkUc4eQ357rZClCb0TgAYMjG8kooWSTz1sxxTQ98R5OJCZcTIzvu10UHE+fHD1gze5teYtEmLtZwVkSrEY+BiKwyN6YsXMKipFSKv2BUW7Q+Xv0otJ5Nyn2ewTPqYHcYJwkYk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by PA4PR04MB7711.eurprd04.prod.outlook.com (2603:10a6:102:e1::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.20; Wed, 10 May 2023 09:20:47 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::60e3:2297:61f1:4d1d]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::60e3:2297:61f1:4d1d%4]) with mapi id 15.20.6363.033; Wed, 10 May 2023 09:20:46 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v6 2/6] drm: lcdif: Drop unnecessary NULL pointer check on lcdif->bridge Date: Wed, 10 May 2023 17:24:46 +0800 Message-Id: <20230510092450.4024730-3-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230510092450.4024730-1-victor.liu@nxp.com> References: <20230510092450.4024730-1-victor.liu@nxp.com> X-ClientProxiedBy: SI2PR01CA0027.apcprd01.prod.exchangelabs.com (2603:1096:4:192::7) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|PA4PR04MB7711:EE_ X-MS-Office365-Filtering-Correlation-Id: a8d3ccf7-990f-46fa-1003-08db5137d619 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5PTWz8jmorFtLlaHELgxiXpwyCVV8WRC7Eccfnqdo4YtHqiakl0M30tVCpuJvx2bHOtHm616NdTs0C0cZECgi5KqgFrGALIiC7ajq/rAzsDqjvZqQPkkSjEtgsUAcB2dtA0GtyxmYoEUSuBFg0kUEw4j5LYQRsGF3ANHyb7SVxNDbjoG9l81KKbEOtEamh5nc42NTM3CTRkZ7i+gGc1MDByBoGlmOD9NYIsEwO4mdUpysB/B4cMTWZsR54d5Ci2PJjozhsdvgxiGb6z0MaAW44mVjQC6UWTHYdUBF9dz1nUdUCiKlYbvOEhaAbSbH5S0NIO5tagfhOjU4jabwdqLJcHafDu2MDKvvTwJo8bcXoXfUQ8me+6XCvwDZZyXcO/48iJWWPXb644LpjjyR/v0CvYviOstQuAnKTkz3LC4JEENnaUtKpYdotlSBY0hTEswerDGWzrOcrKcQ/Ph/wu5pjnlG4XX0xfzcZZblmnKfXcuIhpS3K+6FPZHKSxBHF8zZrnuHMewsXW6yzc396SlDDuNupJK06u14TQIR880HKEgPvnNkHpc67lCysWinT9IdIKSNZnJ4fJ1K0YPClqRXqU7u9S1Z8eip8Q08GV2ySWCvfxS8/yLtEPHhy7PAUVb X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR04MB7046.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(136003)(346002)(366004)(376002)(396003)(39860400002)(451199021)(4326008)(316002)(83380400001)(52116002)(36756003)(5660300002)(2906002)(41300700001)(66476007)(66556008)(86362001)(66946007)(6486002)(1076003)(26005)(6512007)(6506007)(38100700002)(38350700002)(2616005)(8936002)(8676002)(186003)(7416002)(478600001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dzmwoUudQTvg1o53QY8Cfta09ynpMUUwWuWsKU5+KVc6H9VP2VqdB7vLA+NIqRG4/CDXwQIBwfj/H6jCEUBMMhCtQ5s3byPf/1R0uIPu2dhOCm6b1X8jKFlsdE+di1QtRJfPG9hwn/78GaFziv622fwDQV1SVk63b93cH4EawsqfXWIQmsZMRUuf315CTyzHvCENUtdzY+yNxT1xq8BgK9CvLOe2vW8ogWgn93kweGHqwFyueVIrzsGWUr32yzfK8PZFH7A2tw6+6bSYrjIYVx+RIXeDwVVfDWnL1olcou2Nrfax8TiIRGGpEzk5qAbBq5qVzNmlFz1cZBUuNtPQBv6xgkcHoOwzWjrvmDN3VGK4+XKyswm37uMKAFKSkqGCE1morIuyTqm8SsJA/disvb2dOPdXL7z/iFnNH30PatWCnBVD/Hr1VXBYNFcV02IavKL005OR/Ci6rKejxgKgTWntv5DUK6tY/RtGyboWtSr4XEQYfc8DFkv2Nz9Tg6AutHO77tdyzWJvEqVuZzaiHvfvvW4nMidsc4bBPRP7xzTm8UDzH+mJ9usLfMQOwqgZLu/0Hvy33ZDtw5jWqBLJKibCslvILgDjahs6WU6oNeBPR+kJx1mmmBU2E4SS7z0EPKawfxEGendNQHR4+pwrDLf26o7gpuC2SLJICg0TZM1V0tXJxYStYPOt5Lo8S+wvJVh8ZuKMyWgeO7i+fIW/wuS1F+zSo17m8hU7UBYAYIT0wXscLt+J+urzd9wHrbjj5AmPG3cfho7DjkIFcSQCMJUcE8woI3pZ8pxRmi7iXCr5oeVozcFsYY8XeM+W5+gkA3MOoLKL6qNZhM6aitF/K6y5r6ZAZkbXn7MhThjdEqyo/MkyEJJ/KEvOCv3hb7ew9qRjMbL/Sl3r3OixKbrp9Pj2VkDd5a2N7AVfIAPf+5OIHHpvTjFeBTalXdtARxRjszu8QmWUE+dJgsYTj79MjFkZiVvJdbg2v87nCjQVuOS5WP3VaUe3NMVhMuTz8y5ezwJECZe6tVL+ZMrEGCR/wZtG1iMd6cz5o3/1sbdbB+8D312MdpiiZhaP/q93LbxU3emS511ib6AaR+GqQOD/Q6Uu85QsUYBirkIrVk5STrWtArek6vhi54EeDzdgSgTWZg9frXirBHQZTtNy0qL8KNIxaNFCultfAgSRVkZOGQE3LqNevWunzYKTiS0q4mH3Df1ScueL8y2/4ZgYsvUSnNKZiORc2i9jTyCK2DYGjxTAgzze7LFkIFKgDmMlWa7/ZbgSiDBOiSnCqhj2jcEV5Q4TwEpGlWjhJ7JDQd0tZYwdH5UKeldWReTfYc2ilLgiUCIsUATmW22oXk9sL5zItpCFmysLJ2GI10iwMOgW9KuH3j1fuhzUlfo7TzXc5RJng/XyqawVxtmZFg3c7pPw55CoGgPdfv4IwVzSi4dN5lazOHxg8Aq2RoeH7WooR9WOVDbxhKL08uUFyGoi5mdHvaEMzaXLaYPRpDKWAlapR/h678xuUnPwvbfyFrihGyVjV73ZZ4wkclDQrOOOEkC1PMrOVTXHdE7QpVUBHqFg4fAIsIrKXqY7skOiMdvFH4q+ X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a8d3ccf7-990f-46fa-1003-08db5137d619 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2023 09:20:46.1832 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: w27IvvXoSkNE/Yd8k/1WldgOYqktVO5XxPr0U+bzemOR9aA92Kc+eoLVbktzUxW9hxQjuA8Dp9x6OKuss5LMoQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7711 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marex@denx.de, conor+dt@kernel.org, alexander.stein@ew.tq-group.com, shawnguo@kernel.org, s.hauer@pengutronix.de, krzysztof.kozlowski@linaro.org, robh+dt@kernel.org, linux-imx@nxp.com, krzysztof.kozlowski+dt@linaro.org, kernel@pengutronix.de, LW@karo-electronics.de Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" A valid bridge is already found in lcdif_attach_bridge() and set to lcdif->bridge, so lcdif->bridge cannot be a NULL pointer. Drop the unnecessary NULL pointer check in KMS stage. Tested-by: Alexander Stein Reviewed-by: Alexander Stein Signed-off-by: Liu Ying Reviewed-by: Marek Vasut --- v5->v6: * Keep default MEDIA_BUS_FMT_RGB888_1X24 bus format in case bridge_state->input_bus_cfg.format is zero. (Marek) v4->v5: * Add Alexander's T-b tag. v3->v4: * Add Alexander's R-b tag. v2->v3: * No change. v1->v2: * Split from patch 2/2 in v1. (Marek, Alexander) drivers/gpu/drm/mxsfb/lcdif_kms.c | 36 +++++++++++++------------------ 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/mxsfb/lcdif_kms.c b/drivers/gpu/drm/mxsfb/lcdif_kms.c index 262bc43b1079..ba00a155d9b6 100644 --- a/drivers/gpu/drm/mxsfb/lcdif_kms.c +++ b/drivers/gpu/drm/mxsfb/lcdif_kms.c @@ -394,7 +394,7 @@ static void lcdif_crtc_mode_set_nofb(struct lcdif_drm_private *lcdif, struct drm_display_mode *m = &lcdif->crtc.state->adjusted_mode; u32 bus_flags = 0; - if (lcdif->bridge && lcdif->bridge->timings) + if (lcdif->bridge->timings) bus_flags = lcdif->bridge->timings->input_bus_flags; else if (bridge_state) bus_flags = bridge_state->input_bus_cfg.flags; @@ -463,30 +463,24 @@ static void lcdif_crtc_atomic_enable(struct drm_crtc *crtc, struct drm_display_mode *m = &lcdif->crtc.state->adjusted_mode; struct drm_bridge_state *bridge_state = NULL; struct drm_device *drm = lcdif->drm; - u32 bus_format = 0; + u32 bus_format; dma_addr_t paddr; - /* If there is a bridge attached to the LCDIF, use its bus format */ - if (lcdif->bridge) { - bridge_state = - drm_atomic_get_new_bridge_state(state, - lcdif->bridge); - if (!bridge_state) - bus_format = MEDIA_BUS_FMT_FIXED; - else - bus_format = bridge_state->input_bus_cfg.format; - - if (bus_format == MEDIA_BUS_FMT_FIXED) { - dev_warn_once(drm->dev, - "Bridge does not provide bus format, assuming MEDIA_BUS_FMT_RGB888_1X24.\n" - "Please fix bridge driver by handling atomic_get_input_bus_fmts.\n"); - bus_format = MEDIA_BUS_FMT_RGB888_1X24; - } - } + bridge_state = drm_atomic_get_new_bridge_state(state, lcdif->bridge); + if (!bridge_state) + bus_format = MEDIA_BUS_FMT_FIXED; + else + bus_format = bridge_state->input_bus_cfg.format; - /* If all else fails, default to RGB888_1X24 */ - if (!bus_format) + if (bus_format == MEDIA_BUS_FMT_FIXED) { + dev_warn_once(drm->dev, + "Bridge does not provide bus format, assuming MEDIA_BUS_FMT_RGB888_1X24.\n" + "Please fix bridge driver by handling atomic_get_input_bus_fmts.\n"); bus_format = MEDIA_BUS_FMT_RGB888_1X24; + } else if (!bus_format) { + /* If all else fails, default to RGB888_1X24 */ + bus_format = MEDIA_BUS_FMT_RGB888_1X24; + } clk_set_rate(lcdif->clk, m->crtc_clock * 1000); From patchwork Wed May 10 09:24:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13236680 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 03E99C7EE22 for ; Wed, 10 May 2023 09:20:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5E91510E46B; Wed, 10 May 2023 09:20:56 +0000 (UTC) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2081.outbound.protection.outlook.com [40.107.21.81]) by gabe.freedesktop.org (Postfix) with ESMTPS id B83FC10E46B for ; Wed, 10 May 2023 09:20:54 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OjJZB99Vt7n+0IteqvpCHSimNYGihm9CTcElvqz1wlHss+pnxizHsaNDkMel5Vrd7CYZ8LULqP1ptJ3PKPqOpnV6UlUuzRQ6hS7ikfBf/DBfs4+yKwEYRDfNQrjKkTrDa3RWaOzORh8/XHRvn8jlH4WjeLQOCXHI0c08BIoCXNs9uvK+gD1U1kM5cBNM2rxKlJ4FzaYrTJ8ijchBa7ZU/4RQporUe1BUEoZ7lAxC1jOuawkpX/ZSVRLe+X0hcbUumum1aXcvzHsITR5I6gWu6yOmuo2enxSfzImkrt4RXBkD2c740C34dZ36XKo2kQlvQXH+1w/+Y0I5PZjqYd4L6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=8nc0cV36qpOug9d0/gysCL8DoRLyFFfwr6JT3sNylq4=; b=JFHKDE0JoDm41hwdYCwGXcXlN9o1amRsNgECq97ptuFz34blNnNmA91AxX2FaX70M6fPq0/fxkJOGH+EoQyHyGWTs8hzIgC/WyavYvYvx+jc8ioRChLpf9lzjlxDHU7mx7PBBrp244j6poxgdwPyzGXgtzeDezPFrsODZIFcD2qS2yOhvFSb9w4SIJNK+7GleZuYq2wPtRvDKsNhD4odz/gw0ZfMSOO8X+7qrGN83pUiH+ASfZgqO40PyA7YWmtQsoyZRs+evFTIrVIn1OEM/WOPo0W21c+RyiPIxkTEkqDfhm3hvo2Glzv9MSUdjknbWuBVw1rqLooYE4rO9GCdlg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8nc0cV36qpOug9d0/gysCL8DoRLyFFfwr6JT3sNylq4=; b=VbQ8enALcO4AWTYsaWfq2dxYSsnOmDhrufAtio+QzqsZO9ro9dzKiqTn28H+A4BLI7vqifnBnBYxeflWzf3TJTlzQysY+OwkPAirUQWipQhwnckeQ2sw9X1uZfrRXhVKZHM/Y63jLO8q4A5ecXja88zsO9y+s8mkC6rEhGMt1CY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by PA4PR04MB7711.eurprd04.prod.outlook.com (2603:10a6:102:e1::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.20; Wed, 10 May 2023 09:20:51 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::60e3:2297:61f1:4d1d]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::60e3:2297:61f1:4d1d%4]) with mapi id 15.20.6363.033; Wed, 10 May 2023 09:20:51 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v6 3/6] drm: lcdif: Determine bus format and flags in ->atomic_check() Date: Wed, 10 May 2023 17:24:47 +0800 Message-Id: <20230510092450.4024730-4-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230510092450.4024730-1-victor.liu@nxp.com> References: <20230510092450.4024730-1-victor.liu@nxp.com> X-ClientProxiedBy: SI2PR01CA0027.apcprd01.prod.exchangelabs.com (2603:1096:4:192::7) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|PA4PR04MB7711:EE_ X-MS-Office365-Filtering-Correlation-Id: ae1a6b99-fb08-424e-c5b8-08db5137d93e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oDCG5UMJWrp+VFByHTwhgyzMtq/9iS9kfLjwdC/bl4mdK35KDTv7Q6CPkSoWS0FtYsaJ7rgs6yeXJwyajFRuu/QWktD0fWOqXjA1UBemI5wM43uaVbO0lzyP8LqW/u75vKgLwB9j5T1jVWFRBsQAfJr412R4dbR55g8cMx9zdWPrQGhUTYTfdngYC0+zeEx8WdEc88airfvEQyuGFRNLeoIcANRubz8UBnllu4FY6wbsqFkwAOzof0zUWAetyysP3LSGxyLNEmCWMBHgrG2PSnAA7ExIqWLHzhx2H7uAeOjnD8nVlkE1B8kI57v5XAU7RtTxuS2XHnA4zJ+QdSYpjjfD794QI31Kce5iHvoZaTIjNWkqnHy8gTrLfFkZyyB4YLBnsTKCan5yEzSJaFD4lYR/kaDzptkvVy1VRD4MEFhbhcEq8kmjm71ozmaB+WKIMPIHG5s9r5x91DX3juAIK0yoWLqmhbFt0YxBcdPP46r5985I/o91sw3VQZYh6DTxVZAb7LlLG07KaRyA3mK/30bJ2FCS24Of0SB+LVzvEJvXHS2OykpuhfRNlET09d6zEPQlSFW3PGER9uI9aBNin9lVMjLj0P4YhNQvbgv58h2tr1mgP8qIn85txvaMgTJH X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR04MB7046.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(136003)(346002)(366004)(376002)(396003)(39860400002)(451199021)(4326008)(316002)(83380400001)(52116002)(36756003)(5660300002)(2906002)(41300700001)(66476007)(66556008)(86362001)(66946007)(6486002)(6666004)(1076003)(26005)(6512007)(6506007)(38100700002)(38350700002)(2616005)(8936002)(8676002)(186003)(7416002)(478600001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xUPFy0Wl8fNRN3DQzptxw4WA9mqbmrDktGpFP2OaPBcz0oYH44psXEaEQT1nBEGA9OO/KZ4rJ7kvhD7JKKQrj36EixZx+5jVvBzSqoXywyhmKQWKXcZRgeyNDQXB8UMs/qtsxlawy+p1zLq2OODGrHbccOMOBbfUNT3Uyb5NlK51Nn7eOARWQNvSyQNNtitbQPSNboV/w0cnlJ4DNd5jkotZ5EVCFz2pdd6MQ7ZjlR2uRgzN9Ali5aCbOi4mCLPexhbbYHf4sVooEarmOgGNWM146WphZwEZ7MbZFS2As2VmiI9xFUjHjPzLy46fWd8uTFcJJGwV1W/BT2hv1Tb+KPZ4t8pbClzQRurZDxRElBq4pyU6VCVAfeqtb5b4p/C0NhDxWxyM1Ys6VbUIepBhU5ZuMB8Mxd5FiK+wA3U3npXn4K5lmIjKUKZQCDSqPRQiMbEPCGOGGRz2tF+eCGYb20pJWtfPa+VaWlFtG9unqRyqjD12pKAaEGh/LO4SmfmV24UNwupFgEtuwUi2zI5fLNWG95StfkdtsFeLKKv8VGzYLDNWPTqtQEnHzmSl0Ui4HBZtArUfLjynekwpkQ5bBD1nd0HIGg7NIbuARdvTHWYNlAic5TB9u+I9IZKxrRVYrPK2Y6FFvX2855j23XG+xwmtrB7dalHStR7/fj942rHUNWV3Phr3phTAldEJa93ckrfE/y8zEq1NxWdr0jr6ulZk3TS2xbkZW1jGjr+/2CXtPUvvrF4Z/SisNNzUjzHQNTxfYX9QpluqTsFKjBzjUIhI+ydqrfU4sW7acSxAiQy4CT6YUjJm4aKMK5FugGL60HVjYuFswcX5d8jSqqwDG7auxvkZoj28FnpSECNjx9xm0Dx/gsFpabsuZmYqaPx7DvjZSw4VyIDcfCOQrNVRhpR3+M1qUSqkNlIzidXDkczI9T+wCiJi3yYzCYhj1NgzRTKZKSaZO45Y5t3bkPAqIy5KdV/sia+yDkpTwrh1Ybd9gLVpVmXObIkiRbEa/ubdUiwPL1S6utZtaYJIRfp4BW/z95o8hMwylBuu/WVgwd+rmAvFkEEVc+lBjOn5JKV0clDUHj/IahIlIB8vXi7EUIiGSHh2toum6/VZW5g/W30R24vgNxwmdmbsLwmPhCqKl8t3YC+8W+tcUS4g1ILQvivh3BUwZMbsmRPPWz32zoMIulRHbQ3tKciAQGVMtVcH0JKXcUb8+VRFAmX+o8qT+OpS4ieNXHl0F61sJijrzAB5zTYBIgUXLeFhrmlvyPKDcyKENokDLT7glh8lyYJXufZu6+9Uk+nRnXY0d9N1DjTqFnnSkyn9nOMUc96VBwMO1cBrkng2s1fBJ6Ydwg8xqZouJiGWG8cy7mgCsleCzwiNVx3MXxN79GpnIvgj+stC+9wpA6m6ICNFvIbOl6h/k/Xn/OgJ+dj91EGpbXOqrGLwmCkR2vPLMu0v1PGoMSTqJ0/n8HF+8HteUAr1aoVuWegtZ/4Mjh0VDBYWh2cffLFEaVVoLspArg2u/LFQeS1KuiZerv+pfHfQzgrtPRhUgVLyp8i/fhC2VBmcg1G5XOUkpR2saUyyTpCL4dxLqZCg X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ae1a6b99-fb08-424e-c5b8-08db5137d93e X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2023 09:20:51.5619 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: DlxGYN5GQHqfz9dB9kmqhrLQLNOxiMMBs6K51mhlKttkG7Pfhrg3QvNdEZlm45dNW4fCBeCmy2Hk4IDLw/n6HQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7711 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marex@denx.de, conor+dt@kernel.org, alexander.stein@ew.tq-group.com, shawnguo@kernel.org, s.hauer@pengutronix.de, krzysztof.kozlowski@linaro.org, robh+dt@kernel.org, linux-imx@nxp.com, krzysztof.kozlowski+dt@linaro.org, kernel@pengutronix.de, LW@karo-electronics.de Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Instead of determining LCDIF output bus format and bus flags in ->atomic_enable(), do that in ->atomic_check(). This is a preparation for the upcoming patch to check consistent bus format and bus flags across all first downstream bridges in ->atomic_check(). New lcdif_crtc_state structure is introduced to cache bus format and bus flags states in ->atomic_check() so that they can be read in ->atomic_enable(). Tested-by: Alexander Stein Reviewed-by: Alexander Stein Reviewed-by: Marek Vasut Signed-off-by: Liu Ying --- v5->v6: * Add Marek's R-b tag. * A slight change brought from the update in patch 2/6 to keep default MEDIA_BUS_FMT_RGB888_1X24 bus format. v4->v5: * Add Alexander's R-b and T-b tags. v3->v4: * Use 'new_{c,p}state' instead of 'new_{crtc,plane}_state'. (Alexander) * Simplify lcdif_crtc_reset() by calling lcdif_crtc_atomic_destroy_state(). (Alexander) * Add '!crtc->state' check in lcdif_crtc_atomic_duplicate_state(). (Alexander) v2->v3: * No change. v1->v2: * Split from patch 2/2 in v1. (Marek, Alexander) * Add comment on the 'base' member of lcdif_crtc_state structure to note it should always be the first member. (Lothar) drivers/gpu/drm/mxsfb/lcdif_kms.c | 140 ++++++++++++++++++++++-------- 1 file changed, 102 insertions(+), 38 deletions(-) diff --git a/drivers/gpu/drm/mxsfb/lcdif_kms.c b/drivers/gpu/drm/mxsfb/lcdif_kms.c index ba00a155d9b6..fab2253e4786 100644 --- a/drivers/gpu/drm/mxsfb/lcdif_kms.c +++ b/drivers/gpu/drm/mxsfb/lcdif_kms.c @@ -30,6 +30,18 @@ #include "lcdif_drv.h" #include "lcdif_regs.h" +struct lcdif_crtc_state { + struct drm_crtc_state base; /* always be the first member */ + u32 bus_format; + u32 bus_flags; +}; + +static inline struct lcdif_crtc_state * +to_lcdif_crtc_state(struct drm_crtc_state *s) +{ + return container_of(s, struct lcdif_crtc_state, base); +} + /* ----------------------------------------------------------------------------- * CRTC */ @@ -385,48 +397,75 @@ static void lcdif_reset_block(struct lcdif_drm_private *lcdif) readl(lcdif->base + LCDC_V8_CTRL); } -static void lcdif_crtc_mode_set_nofb(struct lcdif_drm_private *lcdif, - struct drm_plane_state *plane_state, - struct drm_bridge_state *bridge_state, - const u32 bus_format) +static void lcdif_crtc_mode_set_nofb(struct drm_crtc_state *crtc_state, + struct drm_plane_state *plane_state) { - struct drm_device *drm = lcdif->crtc.dev; - struct drm_display_mode *m = &lcdif->crtc.state->adjusted_mode; - u32 bus_flags = 0; - - if (lcdif->bridge->timings) - bus_flags = lcdif->bridge->timings->input_bus_flags; - else if (bridge_state) - bus_flags = bridge_state->input_bus_cfg.flags; + struct lcdif_crtc_state *lcdif_crtc_state = to_lcdif_crtc_state(crtc_state); + struct drm_device *drm = crtc_state->crtc->dev; + struct lcdif_drm_private *lcdif = to_lcdif_drm_private(drm); + struct drm_display_mode *m = &crtc_state->adjusted_mode; DRM_DEV_DEBUG_DRIVER(drm->dev, "Pixel clock: %dkHz (actual: %dkHz)\n", m->crtc_clock, (int)(clk_get_rate(lcdif->clk) / 1000)); DRM_DEV_DEBUG_DRIVER(drm->dev, "Bridge bus_flags: 0x%08X\n", - bus_flags); + lcdif_crtc_state->bus_flags); DRM_DEV_DEBUG_DRIVER(drm->dev, "Mode flags: 0x%08X\n", m->flags); /* Mandatory eLCDIF reset as per the Reference Manual */ lcdif_reset_block(lcdif); - lcdif_set_formats(lcdif, plane_state, bus_format); + lcdif_set_formats(lcdif, plane_state, lcdif_crtc_state->bus_format); - lcdif_set_mode(lcdif, bus_flags); + lcdif_set_mode(lcdif, lcdif_crtc_state->bus_flags); } static int lcdif_crtc_atomic_check(struct drm_crtc *crtc, struct drm_atomic_state *state) { + struct drm_device *drm = crtc->dev; + struct lcdif_drm_private *lcdif = to_lcdif_drm_private(drm); struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc); + struct lcdif_crtc_state *lcdif_crtc_state = to_lcdif_crtc_state(crtc_state); bool has_primary = crtc_state->plane_mask & drm_plane_mask(crtc->primary); + struct drm_bridge_state *bridge_state; + struct drm_bridge *bridge = lcdif->bridge; + int ret; /* The primary plane has to be enabled when the CRTC is active. */ if (crtc_state->active && !has_primary) return -EINVAL; - return drm_atomic_add_affected_planes(state, crtc); + ret = drm_atomic_add_affected_planes(state, crtc); + if (ret) + return ret; + + bridge_state = drm_atomic_get_new_bridge_state(state, bridge); + if (!bridge_state) + lcdif_crtc_state->bus_format = MEDIA_BUS_FMT_FIXED; + else + lcdif_crtc_state->bus_format = bridge_state->input_bus_cfg.format; + + if (lcdif_crtc_state->bus_format == MEDIA_BUS_FMT_FIXED) { + dev_warn_once(drm->dev, + "Bridge does not provide bus format, assuming MEDIA_BUS_FMT_RGB888_1X24.\n" + "Please fix bridge driver by handling atomic_get_input_bus_fmts.\n"); + lcdif_crtc_state->bus_format = MEDIA_BUS_FMT_RGB888_1X24; + } else if (!lcdif_crtc_state->bus_format) { + /* If all else fails, default to RGB888_1X24 */ + lcdif_crtc_state->bus_format = MEDIA_BUS_FMT_RGB888_1X24; + } + + if (bridge->timings) + lcdif_crtc_state->bus_flags = bridge->timings->input_bus_flags; + else if (bridge_state) + lcdif_crtc_state->bus_flags = bridge_state->input_bus_cfg.flags; + else + lcdif_crtc_state->bus_flags = 0; + + return 0; } static void lcdif_crtc_atomic_flush(struct drm_crtc *crtc, @@ -458,35 +497,18 @@ static void lcdif_crtc_atomic_enable(struct drm_crtc *crtc, struct drm_atomic_state *state) { struct lcdif_drm_private *lcdif = to_lcdif_drm_private(crtc->dev); + struct drm_crtc_state *new_cstate = drm_atomic_get_new_crtc_state(state, crtc); struct drm_plane_state *new_pstate = drm_atomic_get_new_plane_state(state, crtc->primary); struct drm_display_mode *m = &lcdif->crtc.state->adjusted_mode; - struct drm_bridge_state *bridge_state = NULL; struct drm_device *drm = lcdif->drm; - u32 bus_format; dma_addr_t paddr; - bridge_state = drm_atomic_get_new_bridge_state(state, lcdif->bridge); - if (!bridge_state) - bus_format = MEDIA_BUS_FMT_FIXED; - else - bus_format = bridge_state->input_bus_cfg.format; - - if (bus_format == MEDIA_BUS_FMT_FIXED) { - dev_warn_once(drm->dev, - "Bridge does not provide bus format, assuming MEDIA_BUS_FMT_RGB888_1X24.\n" - "Please fix bridge driver by handling atomic_get_input_bus_fmts.\n"); - bus_format = MEDIA_BUS_FMT_RGB888_1X24; - } else if (!bus_format) { - /* If all else fails, default to RGB888_1X24 */ - bus_format = MEDIA_BUS_FMT_RGB888_1X24; - } - clk_set_rate(lcdif->clk, m->crtc_clock * 1000); pm_runtime_get_sync(drm->dev); - lcdif_crtc_mode_set_nofb(lcdif, new_pstate, bridge_state, bus_format); + lcdif_crtc_mode_set_nofb(new_cstate, new_pstate); /* Write cur_buf as well to avoid an initial corrupt frame */ paddr = drm_fb_dma_get_gem_addr(new_pstate->fb, new_pstate, 0); @@ -523,6 +545,48 @@ static void lcdif_crtc_atomic_disable(struct drm_crtc *crtc, pm_runtime_put_sync(drm->dev); } +static void lcdif_crtc_atomic_destroy_state(struct drm_crtc *crtc, + struct drm_crtc_state *state) +{ + __drm_atomic_helper_crtc_destroy_state(state); + kfree(to_lcdif_crtc_state(state)); +} + +static void lcdif_crtc_reset(struct drm_crtc *crtc) +{ + struct lcdif_crtc_state *state; + + if (crtc->state) + lcdif_crtc_atomic_destroy_state(crtc, crtc->state); + + crtc->state = NULL; + + state = kzalloc(sizeof(*state), GFP_KERNEL); + if (state) + __drm_atomic_helper_crtc_reset(crtc, &state->base); +} + +static struct drm_crtc_state * +lcdif_crtc_atomic_duplicate_state(struct drm_crtc *crtc) +{ + struct lcdif_crtc_state *old = to_lcdif_crtc_state(crtc->state); + struct lcdif_crtc_state *new; + + if (WARN_ON(!crtc->state)) + return NULL; + + new = kzalloc(sizeof(*new), GFP_KERNEL); + if (!new) + return NULL; + + __drm_atomic_helper_crtc_duplicate_state(crtc, &new->base); + + new->bus_format = old->bus_format; + new->bus_flags = old->bus_flags; + + return &new->base; +} + static int lcdif_crtc_enable_vblank(struct drm_crtc *crtc) { struct lcdif_drm_private *lcdif = to_lcdif_drm_private(crtc->dev); @@ -551,12 +615,12 @@ static const struct drm_crtc_helper_funcs lcdif_crtc_helper_funcs = { }; static const struct drm_crtc_funcs lcdif_crtc_funcs = { - .reset = drm_atomic_helper_crtc_reset, + .reset = lcdif_crtc_reset, .destroy = drm_crtc_cleanup, .set_config = drm_atomic_helper_set_config, .page_flip = drm_atomic_helper_page_flip, - .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state, - .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, + .atomic_duplicate_state = lcdif_crtc_atomic_duplicate_state, + .atomic_destroy_state = lcdif_crtc_atomic_destroy_state, .enable_vblank = lcdif_crtc_enable_vblank, .disable_vblank = lcdif_crtc_disable_vblank, }; From patchwork Wed May 10 09:24:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13236681 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 17BE3C7EE22 for ; Wed, 10 May 2023 09:21:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6ADBE10E46E; Wed, 10 May 2023 09:21:03 +0000 (UTC) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2070.outbound.protection.outlook.com [40.107.8.70]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0638E10E46E for ; Wed, 10 May 2023 09:21:00 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HfwlASVG4rMVmX2qy8dLXdRSiQ/Qs6pJVeGwOg5XfqEsOK07u7Zik6Yb5T0OSSWBBS3XuwVi1gXOzR8UnNZLC8M4e3rkF6Sa/wvxsyqNvdanoN8Bf5/HA/o8shha3FwWTO8T5mEx3+ISwD6NYeVwUUS1yINTgYSp9ciR66rYSG3nSV+KwvmXhgTAFtPD279VZpiyJssHB6Gp91Jtd//iYS8ZLzs9HbH3sR+yxLLTPMr6ACCJKZ6t2WEdaw/XEZyQVFfuUKhrYLvY6cMNJ8gWO/imuk2+/y2bwD+YtBQ93Y3CXtxHd3hzkUPx3ihqbSUNLXQpB24/stwEiAsCnW6/xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=4tdz8bCm6649ewUxnSzx9oakx3CTF4tl82AyCa2nlH4=; b=iccVhCP3QAUvDZxLZ0QLfzE1OM6pioMGJAgINICcWWAWmafDLfb6wBqDBuBHTtrGUnxxrieEAlsEoM4g7GtBBSl0rLrN0XfIYbzOQXwaqFCDNP3HP+taOd8U300QsX/84HMV5IxdEurLvB0kZsUTbsDKMzMsaj9yltLRDk51ML8W0uYgoNk4x39ZuOoP8jSSFEEH8PWkiGB3iTyURs99HEQs3TAhRZN/l5eBH/HN3/nco755ZcAWTvo1nzljZHfdjRNPrbJVwzZmKpRgQkAFaWYO7SZFFH+kD3sHAsUIJy8ih3nsnduFp60Y9W5D0JLDd2aMqxa7Wzf4IPj4GtVmLQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4tdz8bCm6649ewUxnSzx9oakx3CTF4tl82AyCa2nlH4=; b=QBb9Sz7vq0X4Sz1adiN2eXyXjH/NFqJlTtBmGSGodJgmT21rN5ZPkVRJyl5cVjYvfs8sOmd7T0ivRboEDq0ygm0qFGWYw7V9sTLvJFwhm64eN1KRD2xpC5RI+s03KH/hOCA7Ib5IpDNMcJP3W0SqwbDpZoRupWE1umm5XSt/24s= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by AM9PR04MB8161.eurprd04.prod.outlook.com (2603:10a6:20b:3e9::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.18; Wed, 10 May 2023 09:20:57 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::60e3:2297:61f1:4d1d]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::60e3:2297:61f1:4d1d%4]) with mapi id 15.20.6363.033; Wed, 10 May 2023 09:20:57 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v6 4/6] drm: lcdif: Check consistent bus format and flags across first bridges Date: Wed, 10 May 2023 17:24:48 +0800 Message-Id: <20230510092450.4024730-5-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230510092450.4024730-1-victor.liu@nxp.com> References: <20230510092450.4024730-1-victor.liu@nxp.com> X-ClientProxiedBy: SI2PR01CA0027.apcprd01.prod.exchangelabs.com (2603:1096:4:192::7) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|AM9PR04MB8161:EE_ X-MS-Office365-Filtering-Correlation-Id: 71cfaa8b-20ae-4b08-8d86-08db5137dc77 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: A6wccTu5FdjNThWEf2uwXZHoADVYWKixS2aaEOR2i3laQVFF8D1GXVMJhgy6KLY0BoUAYN35Wfpxeumsitvfm93tETCtLG5tVozBZhSJaFvTTHMW6J4i46yI1JZ983ipY2cMXzFCaAkFXTLyBNSAO9QsBdeTg66IQf9I33u/5HeItSAasyKtkE9LgG3OB2/b3m9b4pPmOFFDix026E/YkZnsOUl4l2CB5vP3bydVJdMWIKCYyztpkrGrOHwuYceTN70SQEXVdU8vHjPSSPZCHpjJbeBV8I9lErKaQD9014mOEmV+N29GfyTIz3dJVFbkh8YsOEd9VyZiVr9Ry36628pZ+Cbgi4ryUugZDPb9DSjrS3EmlH2+ot2teP/2PGzrI7GhdJadvrFuJNLPvEf45645empH/BHQm9tWXv8a+ay0vsrzVxMWTD7C0jx6gr8Cs/uUSkv180W3DLSNd7DEwNiQdHdUeP7m1SvxJy8y52uCD8ChGB+t1Di7F1ZR2ETnCQ2ZPH0ewFjjeuEzQemTkcoZZ4GTUDtFsqColWn+uypN1QtqhGxqTpDHk9vv39pGUoRJzN3Kc4M8lu5qDGKKYMhtYq+oFbbsd/mO3DKOhbP6L0hvHoIr0zz+h65N9F9T X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR04MB7046.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(376002)(366004)(136003)(396003)(346002)(451199021)(66946007)(66476007)(66556008)(83380400001)(2616005)(38100700002)(38350700002)(86362001)(6666004)(52116002)(6486002)(1076003)(186003)(36756003)(26005)(6512007)(478600001)(6506007)(2906002)(316002)(4326008)(8936002)(8676002)(7416002)(41300700001)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: G/3fQaU/SNU1x2nUqb9boH1g7D08Zudhdgiz5BrLnbRSMpT6hP0lVXGq+Q0pvVm/LWQ0aNRV5quEdMtFXycdKk6sH9H0pbn3/HWP0zk+0BNw9gvAuXe36XoOsHrHoDufufSw22Yat2qgBMTMJnYGufFJ88RISQ9eMuVyYJxOpWwIsRhlo1CA5tAQtCDI7LAdgNN6WDaLT3WqQ/Oh3VT3Q441OYdaMgtoPksKhLIEPMuLg8ujKvBkpAhXTjmQj/K4/4NDTpaPY9fMaaNWGxb23vHuqkcMW+kjcVuOF+k6+vwYfKrw+lTGp1giCln7dv/1oWE/HRS+XaJHyaui1LeP53BtSoieb3eTJebXSWJTx6/xiHtyajNZWhcHIrsZCXmhL1PHN9ikI0YkaL6xl6xcnyI/rkLoKVZGEi2jShPc4A2RkexIlK1N8xoOp+4LDSnEYsbY1kwXOwNfK66S45lrStRyiB78IuZbR4GyFp5KiLAfT9rcDzO9HZYStfnrmssjQ+tToma20wBuc+A6cAFPTriiTjOKPbu4RTuiGpRtopFENKEPCu8VgChaGqkEnX96cu5mX0kwQIV6r3E6m7NVlfBNcV9rDpaadbWleDzgUdDJF7uRKpxQKQlRqCd+3XQBuG5RvJ+LUXuGHzdsyz19QMyIi9dKTvhH+5iJAp0SKiHzPdISU0/psZO11D3vgMjVeZFlFXb60sPX5QHQJm1yuoKOHsE8RhTlWswWtZaSi5T3nGT+K8VQ8ZT03h4XWjGjlWVBin8dE1DpdSJti2PnosJnBKifQq+hEHBVIp3dQuwfqXp8mf2enk3JVbbIN0yvu5yrRLXeDO/MGgVghqlvqlwmAOQScxHu9OsPEYp3S4CSbv2t6gad6dmyjj1Guhqk6gqixjfNwW3uVUNL/9FGdtrLP4G9w9zwKAArnTZ9o4y2NqVHqTN2yHXXWrLZ70ZNp7g2NVkwJqx4h1q+we3hE45DR1PijaOCV32eZ+4S+RMccBInTlMSS6WwPldc8wgrZrwFPAL80Zr8E5w/gFWQRcXunvVcApWEyD4yUKqLYFydzposTJzbeRZOOq9o5BIMv2CujDr4qAW1V03OeF4qb7mbzj9sXeTNYxe53zqhmv+BYioPibNGsENuZhefozELzqoQHFo6A4o+eGy2agS4Zpbz6RgyPHwBFeeRT+pVQWvuV9/Hr1+2AKgi5l+WZKNJyRlpX+cwt9c9FEIVrlqyySjlHJ09sr/bNvuGKmXcZiW/Hl2NIBpS0//lv7zdvbqsxZG4V33LNauwojqOjpf/+ARNj8A26B1RTyVUhKUHFSuXfthQARZo3RZxFWpZSuNomJy8NRHWMRlkYr1hU9JpSN3ZivjvTKY+so3leN91KQSH4IYJFFfdZn3im8PJkFHsfYLQ42f3uJ7CDIlCO/U3TfDbOCbmlb8Sn/mEse4AeiXaXVZqPkNvMUTZ45Sl9R84fZ3BF1AO5WgjUCuijqFGSYqA6l5S4SUqKUtJss+6rf+9R1mPo38nhVR7ZzxdlKkDAclnPHXOeUxiLQtUmkAgRnT5ti0SCeQ2XiPighSw8PLw78YYXU0l5b3vPmB9F/5/ X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 71cfaa8b-20ae-4b08-8d86-08db5137dc77 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2023 09:20:56.9839 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: A8o1PKs7TVZECRuR+NrM1CveP1ZlELMSJdzhTSJgJZTtbhyJNtceS7p7FdEXU9cPIKyB3imCU/ii661RmvpcpQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8161 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marex@denx.de, conor+dt@kernel.org, alexander.stein@ew.tq-group.com, shawnguo@kernel.org, s.hauer@pengutronix.de, krzysztof.kozlowski@linaro.org, robh+dt@kernel.org, linux-imx@nxp.com, krzysztof.kozlowski+dt@linaro.org, kernel@pengutronix.de, LW@karo-electronics.de Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The single LCDIF embedded in i.MX93 SoC may drive multiple displays simultaneously. Check bus format and flags across first bridges in ->atomic_check() to ensure they are consistent. This is a preparation for adding i.MX93 LCDIF support. Acked-by: Alexander Stein Tested-by: Alexander Stein Reviewed-by: Marek Vasut Signed-off-by: Liu Ying --- v5->v6: * Add Marek's R-b. * A slight change brought from the update in patch 2/6 to keep default MEDIA_BUS_FMT_RGB888_1X24 bus format. v4->v5: * Add Alexander's A-b and T-b tags. v3->v4: * No change. v2->v3: * No change. v1->v2: * Split from patch 2/2 in v1. (Marek, Alexander) * Drop a comment about bridge input bus format from lcdif_crtc_atomic_check(). drivers/gpu/drm/mxsfb/lcdif_drv.c | 2 - drivers/gpu/drm/mxsfb/lcdif_drv.h | 1 - drivers/gpu/drm/mxsfb/lcdif_kms.c | 82 ++++++++++++++++++++++--------- 3 files changed, 58 insertions(+), 27 deletions(-) diff --git a/drivers/gpu/drm/mxsfb/lcdif_drv.c b/drivers/gpu/drm/mxsfb/lcdif_drv.c index 6fb5b469ee5a..e816f87828fb 100644 --- a/drivers/gpu/drm/mxsfb/lcdif_drv.c +++ b/drivers/gpu/drm/mxsfb/lcdif_drv.c @@ -52,8 +52,6 @@ static int lcdif_attach_bridge(struct lcdif_drm_private *lcdif) if (ret) return dev_err_probe(drm->dev, ret, "Failed to attach bridge\n"); - lcdif->bridge = bridge; - return 0; } diff --git a/drivers/gpu/drm/mxsfb/lcdif_drv.h b/drivers/gpu/drm/mxsfb/lcdif_drv.h index 6cdba6e20c02..aa6d099a1897 100644 --- a/drivers/gpu/drm/mxsfb/lcdif_drv.h +++ b/drivers/gpu/drm/mxsfb/lcdif_drv.h @@ -31,7 +31,6 @@ struct lcdif_drm_private { } planes; struct drm_crtc crtc; struct drm_encoder encoder; - struct drm_bridge *bridge; }; static inline struct lcdif_drm_private * diff --git a/drivers/gpu/drm/mxsfb/lcdif_kms.c b/drivers/gpu/drm/mxsfb/lcdif_kms.c index fab2253e4786..e13382beb53e 100644 --- a/drivers/gpu/drm/mxsfb/lcdif_kms.c +++ b/drivers/gpu/drm/mxsfb/lcdif_kms.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -424,15 +425,19 @@ static int lcdif_crtc_atomic_check(struct drm_crtc *crtc, struct drm_atomic_state *state) { struct drm_device *drm = crtc->dev; - struct lcdif_drm_private *lcdif = to_lcdif_drm_private(drm); struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc); struct lcdif_crtc_state *lcdif_crtc_state = to_lcdif_crtc_state(crtc_state); bool has_primary = crtc_state->plane_mask & drm_plane_mask(crtc->primary); + struct drm_connector_state *connector_state; + struct drm_connector *connector; + struct drm_encoder *encoder; struct drm_bridge_state *bridge_state; - struct drm_bridge *bridge = lcdif->bridge; - int ret; + struct drm_bridge *bridge; + u32 bus_format, bus_flags; + bool format_set = false, flags_set = false; + int ret, i; /* The primary plane has to be enabled when the CRTC is active. */ if (crtc_state->active && !has_primary) @@ -442,29 +447,58 @@ static int lcdif_crtc_atomic_check(struct drm_crtc *crtc, if (ret) return ret; - bridge_state = drm_atomic_get_new_bridge_state(state, bridge); - if (!bridge_state) - lcdif_crtc_state->bus_format = MEDIA_BUS_FMT_FIXED; - else - lcdif_crtc_state->bus_format = bridge_state->input_bus_cfg.format; - - if (lcdif_crtc_state->bus_format == MEDIA_BUS_FMT_FIXED) { - dev_warn_once(drm->dev, - "Bridge does not provide bus format, assuming MEDIA_BUS_FMT_RGB888_1X24.\n" - "Please fix bridge driver by handling atomic_get_input_bus_fmts.\n"); - lcdif_crtc_state->bus_format = MEDIA_BUS_FMT_RGB888_1X24; - } else if (!lcdif_crtc_state->bus_format) { - /* If all else fails, default to RGB888_1X24 */ - lcdif_crtc_state->bus_format = MEDIA_BUS_FMT_RGB888_1X24; + /* Try to find consistent bus format and flags across first bridges. */ + for_each_new_connector_in_state(state, connector, connector_state, i) { + if (!connector_state->crtc) + continue; + + encoder = connector_state->best_encoder; + + bridge = drm_bridge_chain_get_first_bridge(encoder); + if (!bridge) + continue; + + bridge_state = drm_atomic_get_new_bridge_state(state, bridge); + if (!bridge_state) + bus_format = MEDIA_BUS_FMT_FIXED; + else + bus_format = bridge_state->input_bus_cfg.format; + + if (bus_format == MEDIA_BUS_FMT_FIXED) { + dev_warn(drm->dev, + "[ENCODER:%d:%s]'s bridge does not provide bus format, assuming MEDIA_BUS_FMT_RGB888_1X24.\n" + "Please fix bridge driver by handling atomic_get_input_bus_fmts.\n", + encoder->base.id, encoder->name); + bus_format = MEDIA_BUS_FMT_RGB888_1X24; + } else if (!bus_format) { + /* If all else fails, default to RGB888_1X24 */ + bus_format = MEDIA_BUS_FMT_RGB888_1X24; + } + + if (!format_set) { + lcdif_crtc_state->bus_format = bus_format; + format_set = true; + } else if (lcdif_crtc_state->bus_format != bus_format) { + DRM_DEV_DEBUG_DRIVER(drm->dev, "inconsistent bus format\n"); + return -EINVAL; + } + + if (bridge->timings) + bus_flags = bridge->timings->input_bus_flags; + else if (bridge_state) + bus_flags = bridge_state->input_bus_cfg.flags; + else + bus_flags = 0; + + if (!flags_set) { + lcdif_crtc_state->bus_flags = bus_flags; + flags_set = true; + } else if (lcdif_crtc_state->bus_flags != bus_flags) { + DRM_DEV_DEBUG_DRIVER(drm->dev, "inconsistent bus flags\n"); + return -EINVAL; + } } - if (bridge->timings) - lcdif_crtc_state->bus_flags = bridge->timings->input_bus_flags; - else if (bridge_state) - lcdif_crtc_state->bus_flags = bridge_state->input_bus_cfg.flags; - else - lcdif_crtc_state->bus_flags = 0; - return 0; } From patchwork Wed May 10 09:24:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13236682 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 75D49C7EE22 for ; Wed, 10 May 2023 09:21:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B50BF10E46F; Wed, 10 May 2023 09:21:08 +0000 (UTC) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2059.outbound.protection.outlook.com [40.107.8.59]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4334110E46F for ; Wed, 10 May 2023 09:21:05 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jgrTOzlDl4MasWXrsKJqY3vdC/zBIo3aA6kynBHM7mx0CRMzFuZ57hGiwvUJHw/EMY96wmUjSRG71eAaYE7aq4Und9r2vMCntXN9Ydd0xz2u/9o0qVECj1uQecgYaNalEDTPCnJOHHAbYNyQ5ucCRr/+imDro9jqkJJBW0Lb6e1NbCb8xeoGwMxuM++jZVVrWFW/FHz6jACaU2wp65QyqiBi8l4Eb5Sfk7EkIPJhB7u3d9aowqFsVg+o6EC5skt27qGfWtzY3uMN6BmxVh31OfEPPijXKTxRV1dvJNjp7kN0CDp2RbnNIktToRUYKgKJUGNWSfGD478NyXBDCYjuAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=jNHD8g2U4xOqngqkCoSvDlg1+SRNCmEVGTfMxaJUeOQ=; b=YA0yBx9bsaBfP2+aqN1lIhLqg/HCh+xE/aK7Ku+I/013cjcjERMmi8ePMXqjHDDzL2uw0DOA4CzdbbTMaWucSohuXf2Ot1UL7K8Gso3E8DytIUE+KW+AH/ZTPqBJ3yAYjbTCH5RypY6c6xErcAQ3ulKz1klFJQP05Q8LcS+3pLrjtImdjFmNsKHS05ziZVgUCR1xWfsBOTJv4vGk7dZZXosvWiM4WafEE0GmF5SrdMJK4a2e+HBsCXDjUV1RQzt2rtvi1VW6FwjCbbcv8ZDhwrbHLHlPAWBUHZVozJQFGFXuaD8b1XhB0uT87DVOCENFLgn2Avl6/3b6Jd9EaSDAsg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jNHD8g2U4xOqngqkCoSvDlg1+SRNCmEVGTfMxaJUeOQ=; b=WIEMN1Hvg2eyhtnMX2QGDCQ/KBCiADzRFwHnSTHNJGxxluIUBDVeZqOmE1pLhPxmPaGg3soAQHZk6qEdkDYr/o9NSU9989bsUUFzZtG3O9/KTSfBjllQqYUe21qddp5fp1AKOBAJOB0Lln7UqzPKlUZx8O5iWQd/om0EcZ1DEyM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by AM9PR04MB8161.eurprd04.prod.outlook.com (2603:10a6:20b:3e9::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.18; Wed, 10 May 2023 09:21:02 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::60e3:2297:61f1:4d1d]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::60e3:2297:61f1:4d1d%4]) with mapi id 15.20.6363.033; Wed, 10 May 2023 09:21:02 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v6 5/6] drm: lcdif: Add multiple encoders and first bridges support Date: Wed, 10 May 2023 17:24:49 +0800 Message-Id: <20230510092450.4024730-6-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230510092450.4024730-1-victor.liu@nxp.com> References: <20230510092450.4024730-1-victor.liu@nxp.com> X-ClientProxiedBy: SI2PR01CA0027.apcprd01.prod.exchangelabs.com (2603:1096:4:192::7) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|AM9PR04MB8161:EE_ X-MS-Office365-Filtering-Correlation-Id: ca58f142-217e-4744-b771-08db5137dfb2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XQ/cymh3J3vBi3MrpyEtPwVbvwq0in8SzATNfvP53uQTDOmxp/Bch9Pn/RElm8KCQZoeEVsZp6ozP/9rx7YU/ihlCrUTLDtZZtWnRU0VXqYVP3mXi3WxmAujlIA0Wod0104qIVufj+e+TpV94dnofjldfqQ7jSycW/nsTr7Jsr/ZIupkA/xPRU+uY5A7ar3jiyq56DdFLXSenn9HCHraYwWkCTtZrsTS2uUPin5YCvgrqkswJLNuJYInQqyNpXc29Fj329MwWN34ZJf5OXcHyjn1aD+zBpRjG9aAPdGDd6F+pOlVoctpWTtScpdcSViLIj17wTcADGT1BvZUlh7YUujsGTP4uNURO6Al96mee2wPHyOFT3QaCP/BZhhBam1ZC1HiCA54w0bzp5rsG9t55AGZg16nTPnqBmF9+qqSlSF0hLlpflrLGDpk9UsRMOHLk02AtSxdifrRWdrVwt9w6uGcEy7UOpgWNkCNAqOC0CGPmLs9OvOJsXG+QMCl7jspWaDW6XrQz5KWVH3v9F8FpqUKnklSXFe8z/QYrPyaDcioXMjSd70cfrNMcWfmL0F6MFjNJDTpFSnZOb22ciFTIL726Z6wJJl6R/wFGi+tZMePuApRby8E6eJv3r03/joK X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR04MB7046.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(376002)(366004)(136003)(396003)(346002)(451199021)(66946007)(66476007)(66556008)(83380400001)(2616005)(38100700002)(38350700002)(86362001)(6666004)(52116002)(6486002)(1076003)(186003)(36756003)(26005)(6512007)(478600001)(6506007)(2906002)(316002)(4326008)(8936002)(8676002)(7416002)(41300700001)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YLMQxDaxKjSlQjVN8UQqsmmCw4wjzEGTC8u+t0B4v2Ea2n2GfMSlIYXKV7xFpXGtN+ahMkwFlq9S85lSCrQwTgqBi/xTKFUIylxK4hhbutGAHWR302afrJRBIC8+M/U4IDEWCnFRk3W8dvmQLYXmBsiYjNBT+O7ZbUpkCbl5tfLNDJAoB0kWPRaY2PIKHKHELadHbSeFSskcZyFzaC79DWnPnu+WgeK2gglKj8ISeU2zQavqCHgNHJGyh3oamzGQrBt14/W6RO80pug38RzcyscUi9nwr1j08m7r9gIfo1TOzL0drEHVgiJ0Dpx97YR4424C3vCdDO+ozU64R/TZhtW7TQNGq3SDJ2ZOdhTvfZMMbLAYnEie3tpuikZ3lTSvjNvdwyHgW+x5ZtIY2ioUn3n+Mw2/VWZ3PRPHXRADXc1rKQeNgPgnuM0vQwxqWC3YUnWZeZgE7QQGO/1EbbtV6tEK5x3n0xrXzc0f1lPuoAQN9LeS2RxontJb7+OO/sJUr2Sf6gFeBY2Gxfv4AGfMtoSvMP1Qg9GD7sPQchIob9qoeHOltdNH/bJ4RdxaiImGMDsqlV+62HhNC/eNPecRpnuvF7ahKgNRJFWNxkBk/FviGSr5WA3tEGHoXcPby1fFDzMmYXLkKH/Ao8zBhrz83uLrh1hbyuzoqQRfvRyrmEMwtTy3fnrqvejx6X+c1qZATKXEEIaP11GTNc+4cBTgd7/VYMKiSXiL1JCXQWgz8BLP1hvoWVGwFdrcpiMYCfLTg2leZHSORd5kO3b2aEiN6lVvDvNgEF0dIOig+SniCT7nO8tPyOqOCJaLH3nSHR9qnUCwkEq85Ptlrj29kL/CS7JcShqcJb1Gno8cXKpdKpBpJjfCx9uBhFMuP/sKqKjmyvuY3jU9e0Fa3bacjq63a+GWoHdjZX1ItycC6FkSGK7BeyZHuouzhtziHLLQpeuwlh36+FssNZwvQjGj1Ou22NAY1dcfLM/kSecBMIDTxT9k5i+sFztXel5e8xW6GbII7ubnaF9BIo3szbhie/eaDyV9Tr96oW4tOpfwpFLiUHBe63tcJNWuKnYlmjlfzAPdzSzOGyg2vwo9HfYpry5cY9FKY/C5+2x6zLqrWpA6HxQSB8XcojGtwvnGMUPlFCVBXviZ9RzGw1e8Dgdjvh/E5tEuL+Ycx7kBGyOtQsNgrxHOcFgwF+z9Ibr2lJ4VbCzPFGzB/W0eryjdOjX7CXAgxdlimi3Ow5MhefDIAr8Vp9hCfp+9EWypfSmEdx6Q5ciNTP5Q37rPSAKo5L6YQfa/uCyEIrNh2unMmMvIzV32cHYrFA8HaNmvvpay7GHuvQDhQjgj4TOF41tOcqrTtMifValLftFOqRPUn49aYYDX1vEZqyMNMFxhGuSS/gz8OtlYaqnXYRsn7On5TZ9MR63C6JUIcVKLJJN4WkioPye0S2Xkl8Q9dqgboLyLcO7RHKsIe4MtY7YQ6Q6lgsEPic3xpFqdnwyuN8bRRD/lbJJrm6re0AtedibPOFp7RMLy4sljf7wHMA5H2Jmi86NGjSQU933qBYSRcH7hSTqD6Y0+dMBcpZQCnkYtSuFdF5JLqLvH X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ca58f142-217e-4744-b771-08db5137dfb2 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2023 09:21:02.3103 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: XnfdQ1ioq1k0DzHQ8THjB7QDsidylcKqBYMJUcWXnSmo+Z88fjMqW15++3AhXjzV+LyvPnFKetxilZpUR6/OAA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8161 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marex@denx.de, conor+dt@kernel.org, alexander.stein@ew.tq-group.com, shawnguo@kernel.org, s.hauer@pengutronix.de, krzysztof.kozlowski@linaro.org, robh+dt@kernel.org, linux-imx@nxp.com, krzysztof.kozlowski+dt@linaro.org, kernel@pengutronix.de, LW@karo-electronics.de Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The single LCDIF embedded in i.MX93 SoC may drive multiple displays simultaneously. Look at LCDIF output port's remote port parents to find all enabled first bridges. Add an encoder for each found bridge and attach the bridge to the encoder. This is a preparation for adding i.MX93 LCDIF support. Tested-by: Alexander Stein Acked-by: Alexander Stein Signed-off-by: Liu Ying Reviewed-by: Marek Vasut --- v5->v6: * Drop MAX_DISPLAYS macro. (Marek) * Drop the encoder member in struct lcdif_drm_private. * Drop endpoint id check. * Allocate encoders by calling devm_kzalloc(). v4->v5: * Rebase upon v6.4-rc1 and resolve a trivial conflict. * Add Alexander's A-b and T-b tags. v3->v4: * Improve warning message when ignoring invalid LCDIF OF endpoint ids. (Alexander) v2->v3: * No change. v1->v2: * Split from patch 2/2 in v1. (Marek, Alexander) * Drop '!remote ||' from lcdif_attach_bridge(). (Lothar) * Drop unneeded 'bridges' member from lcdif_drm_private structure. drivers/gpu/drm/mxsfb/lcdif_drv.c | 70 +++++++++++++++++++++++++++---- drivers/gpu/drm/mxsfb/lcdif_drv.h | 2 - drivers/gpu/drm/mxsfb/lcdif_kms.c | 21 ++-------- 3 files changed, 65 insertions(+), 28 deletions(-) diff --git a/drivers/gpu/drm/mxsfb/lcdif_drv.c b/drivers/gpu/drm/mxsfb/lcdif_drv.c index e816f87828fb..dc85498b81cd 100644 --- a/drivers/gpu/drm/mxsfb/lcdif_drv.c +++ b/drivers/gpu/drm/mxsfb/lcdif_drv.c @@ -9,13 +9,16 @@ #include #include #include +#include #include +#include #include #include #include #include #include +#include #include #include #include @@ -38,19 +41,70 @@ static const struct drm_mode_config_helper_funcs lcdif_mode_config_helpers = { .atomic_commit_tail = drm_atomic_helper_commit_tail_rpm, }; +static const struct drm_encoder_funcs lcdif_encoder_funcs = { + .destroy = drm_encoder_cleanup, +}; + static int lcdif_attach_bridge(struct lcdif_drm_private *lcdif) { - struct drm_device *drm = lcdif->drm; + struct device *dev = lcdif->drm->dev; + struct device_node *ep; struct drm_bridge *bridge; int ret; - bridge = devm_drm_of_get_bridge(drm->dev, drm->dev->of_node, 0, 0); - if (IS_ERR(bridge)) - return PTR_ERR(bridge); - - ret = drm_bridge_attach(&lcdif->encoder, bridge, NULL, 0); - if (ret) - return dev_err_probe(drm->dev, ret, "Failed to attach bridge\n"); + for_each_endpoint_of_node(dev->of_node, ep) { + struct device_node *remote; + struct of_endpoint of_ep; + struct drm_encoder *encoder; + + remote = of_graph_get_remote_port_parent(ep); + if (!of_device_is_available(remote)) { + of_node_put(remote); + continue; + } + of_node_put(remote); + + ret = of_graph_parse_endpoint(ep, &of_ep); + if (ret < 0) { + dev_err(dev, "Failed to parse endpoint %pOF\n", ep); + of_node_put(ep); + return ret; + } + + bridge = devm_drm_of_get_bridge(dev, dev->of_node, 0, of_ep.id); + if (IS_ERR(bridge)) { + of_node_put(ep); + return dev_err_probe(dev, PTR_ERR(bridge), + "Failed to get bridge for endpoint%u\n", + of_ep.id); + } + + encoder = devm_kzalloc(dev, sizeof(*encoder), GFP_KERNEL); + if (!encoder) { + dev_err(dev, "Failed to allocate encoder for endpoint%u\n", + of_ep.id); + of_node_put(ep); + return -ENOMEM; + } + + encoder->possible_crtcs = drm_crtc_mask(&lcdif->crtc); + ret = drm_encoder_init(lcdif->drm, encoder, &lcdif_encoder_funcs, + DRM_MODE_ENCODER_NONE, NULL); + if (ret) { + dev_err(dev, "Failed to initialize encoder for endpoint%u: %d\n", + of_ep.id, ret); + of_node_put(ep); + return ret; + } + + ret = drm_bridge_attach(encoder, bridge, NULL, 0); + if (ret) { + of_node_put(ep); + return dev_err_probe(dev, ret, + "Failed to attach bridge for endpoint%u\n", + of_ep.id); + } + } return 0; } diff --git a/drivers/gpu/drm/mxsfb/lcdif_drv.h b/drivers/gpu/drm/mxsfb/lcdif_drv.h index aa6d099a1897..61483a4e058d 100644 --- a/drivers/gpu/drm/mxsfb/lcdif_drv.h +++ b/drivers/gpu/drm/mxsfb/lcdif_drv.h @@ -11,7 +11,6 @@ #include #include #include -#include #include struct clk; @@ -30,7 +29,6 @@ struct lcdif_drm_private { /* i.MXRT does support overlay planes, add them here. */ } planes; struct drm_crtc crtc; - struct drm_encoder encoder; }; static inline struct lcdif_drm_private * diff --git a/drivers/gpu/drm/mxsfb/lcdif_kms.c b/drivers/gpu/drm/mxsfb/lcdif_kms.c index e13382beb53e..2541d2de4e45 100644 --- a/drivers/gpu/drm/mxsfb/lcdif_kms.c +++ b/drivers/gpu/drm/mxsfb/lcdif_kms.c @@ -659,14 +659,6 @@ static const struct drm_crtc_funcs lcdif_crtc_funcs = { .disable_vblank = lcdif_crtc_disable_vblank, }; -/* ----------------------------------------------------------------------------- - * Encoder - */ - -static const struct drm_encoder_funcs lcdif_encoder_funcs = { - .destroy = drm_encoder_cleanup, -}; - /* ----------------------------------------------------------------------------- * Planes */ @@ -759,7 +751,6 @@ int lcdif_kms_init(struct lcdif_drm_private *lcdif) BIT(DRM_COLOR_YCBCR_BT2020); const u32 supported_ranges = BIT(DRM_COLOR_YCBCR_LIMITED_RANGE) | BIT(DRM_COLOR_YCBCR_FULL_RANGE); - struct drm_encoder *encoder = &lcdif->encoder; struct drm_crtc *crtc = &lcdif->crtc; int ret; @@ -783,13 +774,7 @@ int lcdif_kms_init(struct lcdif_drm_private *lcdif) return ret; drm_crtc_helper_add(crtc, &lcdif_crtc_helper_funcs); - ret = drm_crtc_init_with_planes(lcdif->drm, crtc, - &lcdif->planes.primary, NULL, - &lcdif_crtc_funcs, NULL); - if (ret) - return ret; - - encoder->possible_crtcs = drm_crtc_mask(crtc); - return drm_encoder_init(lcdif->drm, encoder, &lcdif_encoder_funcs, - DRM_MODE_ENCODER_NONE, NULL); + return drm_crtc_init_with_planes(lcdif->drm, crtc, + &lcdif->planes.primary, NULL, + &lcdif_crtc_funcs, NULL); } From patchwork Wed May 10 09:24:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13236683 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 B6B73C77B7D for ; Wed, 10 May 2023 09:21:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C7DCE10E473; Wed, 10 May 2023 09:21:14 +0000 (UTC) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2064.outbound.protection.outlook.com [40.107.20.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2E1F010E473 for ; Wed, 10 May 2023 09:21:13 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Pf7efIkCfQeiIB33VzR53n8GcN7kfDvVYHuyDOVrwoXC4s2epnnBEfHrePgiDrAFEL3+LDif/IDgIEFaMnEvw+L2fffTJJ+DHgO88Pl1WJ6WeLa0SYkcT1WsKwuut4tUUIGq1zO7BX9vhh7BOukjNyOsDcTuqGlqi/igdgBvy+lMBrv0AQZo3aIXX+UpXSXywbLuuamXv1BhPrT6cxXdah2ce/H0RXwtywWEJk+xWQOHexLLg9b7Vm4SHR2+a7u5VgV9CChl9tktoujkjxMJJPeVeSc8QNPPbHlXioct9050s4Ien7XqwFDCAbJEPjc8O58osZ8W5XWtWTN5mVB75Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=/+8OTKynV/Lw2CW+oOPo/MREJ3R42EIFCrnmzBOnXnk=; b=fCGlsCINA0EXfNrfZJUOLPoHts73Ohb+0Y3SlPTkRChcNH0dYYBWSXUXQwS7TdPZZ6XZYiGHzhDQq3xMKfdMopNyy6UxMPREt9GfUoX8NNhaMQnaFVKON8/wfmpN4fYAh/dFVK01mgrTwUreNe6GMcKvkzh1JFM3wU3xCgG+oWv3pIetcfq+qsTKc4soD8ltQ9YLwx3ScK8ZlIIC3cenkb+KQXE3HeGUsfqhe6bgZFQW7dD3Qcf3Zzok0UIHrFr13pjK4ZyO3q8NzWBFepoH3oP2OgH3IbLO1ur/x75aH4vHcsi5aNOMcAyavQ/yxEBwSOOn1WLYbAU2lfRYgKqPQw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/+8OTKynV/Lw2CW+oOPo/MREJ3R42EIFCrnmzBOnXnk=; b=PQda/cddOFYo6167yRLl5EupM5mHrcibhkN8JHqXnIK4ZB84w+hOAguX1zYhQS+fH6tlfzj12by9cxYSrg2BKF1GYOX73CQ2/ksJOU9VDRBC7me1IGEXynFuF3isGwaojnhowS9M7uvjvfawUNazdU3xZVuwwLIYx47n/+mIQWc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by VI1PR04MB7005.eurprd04.prod.outlook.com (2603:10a6:803:136::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.33; Wed, 10 May 2023 09:21:08 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::60e3:2297:61f1:4d1d]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::60e3:2297:61f1:4d1d%4]) with mapi id 15.20.6363.033; Wed, 10 May 2023 09:21:07 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v6 6/6] drm: lcdif: Add i.MX93 LCDIF compatible string Date: Wed, 10 May 2023 17:24:50 +0800 Message-Id: <20230510092450.4024730-7-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230510092450.4024730-1-victor.liu@nxp.com> References: <20230510092450.4024730-1-victor.liu@nxp.com> X-ClientProxiedBy: SI2PR01CA0027.apcprd01.prod.exchangelabs.com (2603:1096:4:192::7) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|VI1PR04MB7005:EE_ X-MS-Office365-Filtering-Correlation-Id: 1d45a33e-b014-4102-93eb-08db5137e2df X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mpu3P8v+ma8ZJn1atC4WFjwoDVY4a/F2YOKrLGUG65Y2pNSIw0dwvsmocB+RsX11A5lvy4HDZzrdMF48WiwPSrHYvXE/4VnEKJsIWX1vbKtsgjwrAhg/hN/Gv1QQEeUyWnKuMZfM8uqKRRd8Vxw9qeQeYc89U/UDKm4t88q9hrrcOfBy8ZYwRY00vTMZftB/kuMVJ2FUBJpVB0XVmUhwniyKNPuzmVJNlSi+hNW/99qcTGuB9EUeIuWf2bs395AqgZoN02C6CNQ41x3/GFFl33R/ZkOaVUwQ8Q2yY7AXVq4QAoVvl/WjjKaxYRmNhZlDApAqv2+MnErMhc2njBZRPwmhyx5ZyZpR7FF4iQk6un4jgbGUzhWekHnWIYOO+kSm8CEeJ1XKR/SX5kDVJ0owwSAZuCgevqrdok1+EG037nAaZ9HrPpVP0gckZ4YaXxdHjdQ+XOf93rdeyl308nEsFobHPoWzM090zhVrLtzSg3hKr4KnU7xnvKP6A0Dne0MOeSH2NvzrttcgJU79YbmfE1L3dwOjMV5kzneaVdcgEaBK11A5qlMJfhr4TFDZm3o4jNZKqNakRnPMk005a8WWB+PUWmI8Ws9Fiw58hWEYngRm6vp9JPEqUA2VO1bnoZzO X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR04MB7046.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(396003)(39860400002)(346002)(366004)(376002)(136003)(451199021)(86362001)(316002)(52116002)(6486002)(66556008)(6666004)(66946007)(66476007)(41300700001)(4326008)(5660300002)(8936002)(8676002)(7416002)(478600001)(186003)(6512007)(1076003)(38100700002)(6506007)(38350700002)(26005)(2906002)(2616005)(83380400001)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: gc48jROz1qddYmjRHbupozctCbUoU1kEKkcuSxG7zG7bVQJXGPNY0dE//Z4k78nD6S3HOlLkwM67jahCC5es2FVQfKAR95Wk7GXOR73P/myYpZDbYXgB2tCvvbaJeb0XXeddxl4ES28dgjf1JyfR5mkpG+Zp8YDCcoLBxEsm+yBLu8mkuUjMktivZRxTJqybz6cOqmAH6Q84ZaowKdCyVVNUIm7IR2Aa05VkLtWLjcicPE1QsgCN8PfIX6WbXys1JS5KrWJTc1o5ag+N+uJskX/SJHdPAIEAE1Sn3ORkfiGXr4Lsym4nlewoPkEVWWHabukvuvBkY8qY/I4KyEKVpqLbZ9LbVNJls7HrTj80LioiTPy6liIsveQSvlgFEZ5Pu1jjG0Diacv52LZzdIofj203+a6m67Ju59xGH5pbLAnEGgnj126jCxyw9jv1oNOxYrfGrgSF1YK1ifPSMnrRwRZXTpuWJ0EV7/2pvxPjsGxxDU9TSATRmCvRHqim7oQYxq8ZPyag5T7COEKcZK8zFekul3FIuXl3A7svG5khdscclUDNrOJp0qNeD9+DEnh2zVrO6ANM1kPVdA3wppILHp+tfJGGicdWGPHzMz6hjTz8A6X4XnQ7ABGDI++YrtyZP96LLVx64OxANPHRV7TCrAba7fOEzXnT9GSPZUvSSYDOl183SDiOeiPAhXfxvsyTH6bP/seAS6PmIvaOywVVKcNNoZkddr7vt5Y06zIIJNNcv350m86HYG+vg7w2lEAgIKz1r/Rov5kwCah41GiP0fouLEA7Glc7JHfOhX9TolfKSjRdzJRoK6c3DhYm407bRh2NLXht/apsQJ/3uv9WBB8svObqT7Ty6m9+UnE8yimHe1zL52uFtl3LEiWSCIDIC0P4LYLlXxhffDl/iGvbnKqEOJuSsYTxGOKRf+sbiC2szVVLlgJC03Eo0sYmooUntpz8sr/MIFKzYlO7dvxlvaNO/SY/Fn9NgK/euFTmm2hw71sArjmnyqYcrxrzmaAd6hzA5fPU3KvSUitW2USbBdhVAYFRaR1wtj+C1uWFoe9CALaUhVWMZYgH9pBZ1d00c/fZVp8hX3D47qPoq5kRWnGAgQHCC9Oht13T+szj0xyJJqMWl4zTxnRu7H7HrD8DWmwkPgEyDYN1wFcZ8CTzCKN7oqXpM2JJyLftpDjIWZdty1OGlYNCB8A7znnyiei/53o1tvb2ZaIYdQUjRooRCekRC+d2B+S6qGTTw0WUxDgy9zCi7GuvSNHVwJOh5qvzy+Jma7DjzKtLlCTpM9y51YtxCjGAORDOMGtpgmr4ZiCCPCg+4niAIfSStgvdzFS/gqQeDLN76lG292kqDoFAYQ2SCv63i+fdtpyimA0egTVofk/uHqamw/T41k20wKsT1sKpMw1gRIFyR53vtFNGWy+vvl6//Xbuow0kD12gNYYbrmA5seToyt4L/48ZrM1QCREipp89PDtvr1vDVuQkLeOs3UUsnWg17gtxCNRAiqCQ2oPK7OQpxnMqr1tA56dRIlXfaywjEfVOX0JoZf6JZpcfdMh7WmjQ1z7wV2oFN4+z+YzTLqhvBKFJbE8TgTQh X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1d45a33e-b014-4102-93eb-08db5137e2df X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2023 09:21:07.7466 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: c1s4FXarLc/1muTcXKOLF3CYYb5iSxum8I59eruWGEovsIW0sxf5ncVbNizEkvOeWL67TOWpK7Dwn5dVRwThEQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7005 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marex@denx.de, conor+dt@kernel.org, alexander.stein@ew.tq-group.com, shawnguo@kernel.org, s.hauer@pengutronix.de, krzysztof.kozlowski@linaro.org, robh+dt@kernel.org, linux-imx@nxp.com, krzysztof.kozlowski+dt@linaro.org, kernel@pengutronix.de, LW@karo-electronics.de Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" With all previous preparations done to make it possible for the single LCDIF embedded in i.MX93 SoC to drive multiple displays simultaneously, add i.MX93 LCDIF compatible string as the last step of adding i.MX93 LCDIF support. Tested-by: Alexander Stein Reviewed-by: Alexander Stein Reviewed-by: Marek Vasut Signed-off-by: Liu Ying --- v5->v6: * Add Marek's R-b tag. v4->v5: * Add Alexander's T-b tag. v3->v4: * Add Alexander's R-b tag. v2->v3: * Fix a trivial typo in commit message. v1->v2: * Split from patch 2/2 in v1. (Marek, Alexander) drivers/gpu/drm/mxsfb/lcdif_drv.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/mxsfb/lcdif_drv.c b/drivers/gpu/drm/mxsfb/lcdif_drv.c index dc85498b81cd..c9d8cbb21407 100644 --- a/drivers/gpu/drm/mxsfb/lcdif_drv.c +++ b/drivers/gpu/drm/mxsfb/lcdif_drv.c @@ -251,6 +251,7 @@ static const struct drm_driver lcdif_driver = { static const struct of_device_id lcdif_dt_ids[] = { { .compatible = "fsl,imx8mp-lcdif" }, + { .compatible = "fsl,imx93-lcdif" }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, lcdif_dt_ids);