From patchwork Fri Feb 17 06:54:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 654560 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1EFAC636D6 for ; Fri, 17 Feb 2023 06:53:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229482AbjBQGxO (ORCPT ); Fri, 17 Feb 2023 01:53:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229758AbjBQGxN (ORCPT ); Fri, 17 Feb 2023 01:53:13 -0500 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2049.outbound.protection.outlook.com [40.107.7.49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A89B14EB7; Thu, 16 Feb 2023 22:53:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=keh+NmuxdR1TQ+IguE/jzawOVqsCSFgFT1XFagQ1fN3BNdc59OHUY8DFOKqLh40qr0FV0B/1iYKOQgopgEm8lPumI145Dsn/uDZ9wFHe8vgCzYjF53R1q8SocxrMcC7HyZuWt14/ZHfaU+yvvGmsysd6P6L3LFW55seUtyDAyQcTSrsqvOy5OMOpL5q2+4TLE+RzacayeCg1gmwCFhd3K0PZJ12x3MNplfieK2zlNJ8lGxUKyxyzTgnzsniTUCbJY/D9X7PXHxQu/cAf2rBkK8IqNOITucn3+jlCas1J0+jcR0GdKW+cnpA4xNyiM8mVcNo4YUK4fLUmCKZScubq4Q== 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=O2HHqZCmi8hseR+UVb+THPvMsd4VUC+JCmwjkcYGiTc=; b=atS9nlWZ2qdo6tUVsgsjlENMm+kXGbIE/tSMsKsQW3n+/Spf/TEDmlHoNhQMUDiSQO8yTVw71oFy5MZFmVaAKI3FUbBMkh4I3YaSQaVrkSCskWUy8tE/dYMYSrVBqGVTQYcl+XukHsOClQFjoVWsI0KnYFB10LaNr6ajEUWq8nmoW9mkzr9yo6kefU7UgP4kr5WcvteP7W+t53GlXi+ecULQKNnOAshXSMSz7yZete5FrPBxqnYDanNRm+O4GfBXn0xPO380vIiyBf+5dUHyVPmhoQ/5U3JaxHsFRUf4BMeW3f1g6afW5ADEMqnPWZxswNLWKSZNTN0viJwVWD0yTg== 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=O2HHqZCmi8hseR+UVb+THPvMsd4VUC+JCmwjkcYGiTc=; b=bjz8jnm5z+Ga+jdt3sbOabp1cvRsSJnIIJRpQd43c5xcAso6hdBZRkwy/yI2xtwwzQmIfTeM1x/nPC2w9LFhuCcr4UH7030HK7QqHYJU2CyTnGJtxtY4Xsgwc6eShaXVeX4QzrBH8lryBkiTrjJjWrIVY3cSoc252MkBV/oufus= 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 AM7PR04MB6840.eurprd04.prod.outlook.com (2603:10a6:20b:10f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.13; Fri, 17 Feb 2023 06:53:09 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::5725:92ec:f43e:f5fc]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::5725:92ec:f43e:f5fc%9]) with mapi id 15.20.6111.014; Fri, 17 Feb 2023 06:53:09 +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 Cc: marex@denx.de, stefan@agner.ch, airlied@gmail.com, daniel@ffwll.ch, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, krzysztof.kozlowski@linaro.org, LW@karo-electronics.de, alexander.stein@ew.tq-group.com Subject: [PATCH v4 1/6] dt-bindings: lcdif: Add i.MX93 LCDIF support Date: Fri, 17 Feb 2023 14:54:02 +0800 Message-Id: <20230217065407.2259731-2-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230217065407.2259731-1-victor.liu@nxp.com> References: <20230217065407.2259731-1-victor.liu@nxp.com> X-ClientProxiedBy: SI2PR02CA0033.apcprd02.prod.outlook.com (2603:1096:4:195::20) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|AM7PR04MB6840:EE_ X-MS-Office365-Filtering-Correlation-Id: 45dcb056-ff48-4fd4-b530-08db10b3a101 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GBk+fdzdaF0ZcA+2W4eu8oz6zjPyIr7IFvwCWgFlN//wnhljrKe72+OAPUV7JM0RvmoLOWyQqE536GN72tReBhdo8kZfBqIQFg+EB/AGhlEWmxGdZIhpLZrXt8p57odlcePYGecazHY0T3iuTtLH2wB8GSvf3WHovTlCrLxhnQpRftp5rA0heM1qStj2szAmNKqG+NbnqA1HwUiLuV8riTaTDpCwTjutvbkIYWiFuoVeQzwr2eeka5NdY983IPd7jVbg+ztJkGpsN9M0LZH1NW38Qd10LeUPk3Zcp3XvoXTCboDmXOACh6LJmsG7phYwHG7ku6z6+HkYzWCKxc1mM5BJJLb8ukrXrdnxFyNTUO9uL4O+UU0eSIQo/a4qE3KxOp+G789uPyKgynUfctxXnbkl+5/FVDneDOU0TZXH/VGBlzwUFMqFU/M70O8+ftnTga62WE3abK4gXUbMnnJFnv6/d+xmcjJs4mnmS2pxPyS/tkY36ZBmAbOvxa/M2S8ezkHVyRJ6aS+T9KQLOBFGa51d6LlELGjrlIqZkRUNMdPIBm/8OKELeWn78IHqbyORgbmEieJbqKk3+J5Pj+RupG7V00e7gIN0QC0DGDIovbzPwwqfrrVXANoB2mP7+4gSVBhrb7REaMbMiOfkp5nnAtkcpJZOiZG1JQql67IM47PrQRNNCU7Qd1asJ2mobhTKfIgQHp1G+Geqps03/g3sWg== 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:(13230025)(4636009)(39860400002)(136003)(366004)(376002)(346002)(396003)(451199018)(36756003)(66946007)(4326008)(8676002)(2906002)(66476007)(66556008)(7416002)(38350700002)(38100700002)(478600001)(1076003)(6486002)(41300700001)(52116002)(316002)(6506007)(6666004)(5660300002)(86362001)(8936002)(83380400001)(26005)(186003)(2616005)(6512007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +0kPZtk09FUEMD9ftk/Fi+ERJL9zdhUvDpvdEIwaSNCHh8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I0YqnTtSWXaGKq6ch8KV2/NyrWpswEeBc+lUDJlN9ALzT17cH87tBhiRoivKVxkxlhlRCx1oSWU4HQxEGzj17j2YSaRefyeTDIIoI9P4IvCjEYC4PIe9JdJ5dl7yK3uHpAbgUG9OCF+Y5A1H2pOb30ANElCL8HYQyIyolsCObMUrktNGAUra+pjK5UTdtwBGqCWXPqlwSDyx3DaFqBMeXhZl+/0Fhl1BpmJGr2B/8UcZyh91EFzkRUpjrjjQY0UEssvEPL96gB6N4LejpX0yAVxir3SWC9VWTUCfA5/S4s7ApWUgc/uJhTAOTQMHdpDG1b+eoljs2fZXK4im/zKb6PS0LtD8gIw8tN79z4++oKguNkLEe+u2Jr6Ymv3NH19RBjDIbP2Q+im4DehoHXcPU8iaT20NcOWcfJCVq8M0oEKQyuctznccyhLakFzgFnH8VFy7iiuaWCC+l4Hgvr1WcBtJho4lE07 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 45dcb056-ff48-4fd4-b530-08db10b3a101 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Feb 2023 06:53:09.1990 (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: h3WHG/6e1nommGXRYdreFoEwhmxNWGxfW1T4HOIAfXVlQF/NvgH58tUgdTbBtDAEmdjzc+5ywDd6AF7hYBZ0kQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6840 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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 --- 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 Fri Feb 17 06:54:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 654559 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2DB0AC05027 for ; Fri, 17 Feb 2023 06:53:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229784AbjBQGxi (ORCPT ); Fri, 17 Feb 2023 01:53:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229787AbjBQGxf (ORCPT ); Fri, 17 Feb 2023 01:53:35 -0500 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2081.outbound.protection.outlook.com [40.107.7.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BAAC5D3FF; Thu, 16 Feb 2023 22:53:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IQeraaspLZwA6sbVpIPgVP98luFSXCgJAPbhQDpuIQpf4DwFd5YBmyD2tWAlB1fj/FxtKjmGqVzCPMBIIOgZTfUPtJg/94VQEzAqwJhnTSthidpjvvjW/NjtLYmG/ZxLwA1CGXVT0fpXWOLMo0M4Bf7NATRQ9HoklVxNiIsoKAHTeLfHIVpOuz0CeCPeE2a0o2ODok7IfFFFITfTcTJNCO9e/5F2hImLTeBlNpQ0Kq9r1JttNklE19b4E7XEmBF9h1o+uGCt3W5YCd0lG+wo+hbPP1YsDSIKJy/RuTVKxwf20tTGsPSinK8UKn5ZEMhwWVLGjUPGHcxHbWjLYoJAiQ== 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=XcTqDhdohyQQSQqHWgeTGMrWfiWKhF+XMgLvrmk69T8=; b=Fihk2ckbBpwHVEurZ+DRBM3pQ0KQHy9hRrOEGSZOTQxZvq35P1a+T9GMxJrBIsIa46iHYF/fMQa7n1np2xJ/6G9sH5KI5kILHo+r2JWaIzLLqzp9veGkeeg1FHpyfm5PMQ8I15J8jB4pylpa08pFvGY2dq9CKZkW3kqn3CcJ1FIuIwC1Tws5qiIUccw/6xFpaHHZ6jDq6g7ygIv6CDTxu7qjLrXK5HHW97QsxS9Gd5iRilrLK+lz0phMQydjrysR7QAsS0ritsFsVKxI0f8sulBmf5c/Or13SH6gbnvV3fHfguGn1zL/2IgjC3NzktGOcotrw6BvysO5H9gzCg5W+g== 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=XcTqDhdohyQQSQqHWgeTGMrWfiWKhF+XMgLvrmk69T8=; b=sJbooNolrSPoN7aNE/+JlR/qiJ+Yr4b5bsnaMxBujWALES93TPxPD/2QMMsGB7cfxe1/PVdv9Vx+4G2vEckwNXrU82BJc5yD7qGeVDbA/MnatCwUlHJxkw5KELOJoOCjBcO2+sjJNNVOBnJM3zVHwx6jrPCjIRkJj1f+XUSnPR8= 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 AS8PR04MB7541.eurprd04.prod.outlook.com (2603:10a6:20b:29a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.22; Fri, 17 Feb 2023 06:53:20 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::5725:92ec:f43e:f5fc]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::5725:92ec:f43e:f5fc%9]) with mapi id 15.20.6111.014; Fri, 17 Feb 2023 06:53:19 +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 Cc: marex@denx.de, stefan@agner.ch, airlied@gmail.com, daniel@ffwll.ch, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, krzysztof.kozlowski@linaro.org, LW@karo-electronics.de, alexander.stein@ew.tq-group.com Subject: [PATCH v4 3/6] drm: lcdif: Determine bus format and flags in ->atomic_check() Date: Fri, 17 Feb 2023 14:54:04 +0800 Message-Id: <20230217065407.2259731-4-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230217065407.2259731-1-victor.liu@nxp.com> References: <20230217065407.2259731-1-victor.liu@nxp.com> X-ClientProxiedBy: SI2PR02CA0033.apcprd02.prod.outlook.com (2603:1096:4:195::20) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|AS8PR04MB7541:EE_ X-MS-Office365-Filtering-Correlation-Id: 7e7d225b-29f2-4601-d0d8-08db10b3a74d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GCBfSAc8aX7dEM3D8lIKhstwsV0g5K6DhLMz44OHwldmIjq9va5kfg/YmwGm+jOF7ZsMvQo/9DJbnm/tGuJY9eRLir1G25aHhxSgS5NOkxZrJIKjgRDl8VKz9hVqAw0Py4TKjLvNuqBnWfpLlYm7KttBAoHIcad9kFWo8/3Q9aN330XodZxqbTiKxYQuKhbOV8ODJc8fv4ZxdzuWJgLq1tD6f9hRd3yOXxjxp/LhBfc9gPU0NHeN2po1q0zWcpq+pbzKZ1PVGieApD3QDN9cH706S6cZQ799VQc9moqi3GO9/QUwdTl0dMVgrdNdNiJ7ctRiC5q6On8nET07xG8RR3rjid4dzXeXQrQacdnlHG6KwBbEJS77ru7d7ghY9wvnhKlpU0r20pounWEOhGmJ693gMn4G09LxK0hMUsQlFiARwqF/79Ht9JLHFNfj7dCdP//8ZPK1tuYBXfYRa6Y7914oqQVEfRCibap0ob4iXT3TbGC2vlYvLQo9Mi5oSCR7PnyNNQiHTLH67y8RmEoQD0is9NEVLFOp+NjD24xJCDhd9Q/iHTe25+dVfv9Y/2QulEfLAviRpUIbK4RbKgO0oQ7nS8v22Y+0VV8m4fyxPnVGkSvo2vidOWFcBQDd/MsMXn8C6vK5rxPV8aS+Ffh1/hM8gHAdENRUulXbJLz54jMRvz2uH35Rqp9WEZuC7qocoZ7tWYVqZ6lFG3DanbvdQQ== 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:(13230025)(4636009)(136003)(366004)(346002)(396003)(376002)(39860400002)(451199018)(186003)(26005)(6486002)(6666004)(478600001)(52116002)(1076003)(6506007)(4326008)(66556008)(66476007)(66946007)(8676002)(7416002)(5660300002)(8936002)(316002)(2906002)(41300700001)(38350700002)(38100700002)(86362001)(6512007)(83380400001)(36756003)(2616005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: nSmV3REnQ66FS7I6kdtPbUbSwz+eZlCrFERDFVk0f+5NuBgUTIVrjFp8D9gV5hHsCCyZ2KKOagg9ZR6JN9oeo9B3ZaFjJ4VXMOBjVmU650p2TdapCVzaZE/dT7eTUn5S6QL8L8S8P2Qcr6w3uEroMYBZVhebQG6uhS5bqc77Z7lJW4MfTb968/HBuU0b91YAJSesD94qiaNkJ3LqyxT1Ivw40lRgfh6JMiei569BZHd13SKQt+GxUN64YvEWZg772ofNkY+9mF6yDh2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Okf6zElssuaClIkm4OzufxYet0hrQVy7qRCkVjEb7KxuRkiGJJXz1BKmo7iIjq+UhqqIOWE/DXH7L7wrBK1FHSncDmwCnuVIB/mrjmji1/Xd2eI7FRPzmYum2FvLJGlKnthkR7YdqbtOkcvt7su+bWEGsUplLX6ADkUIBaIUf/3VAUJFE2MqPLbHvzdDklEEbC5JMqb9LH17uuHFM3WCqjrjWqp1XVH09UEv9aQfp0aDMDNB/OtMjmGts0Sf X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7e7d225b-29f2-4601-d0d8-08db10b3a74d X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Feb 2023 06:53:19.7017 (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: 8RM1/WYx8Dx+29H5gZsgHQkY6MLb9NKRjUsmIjyP4BwEmWSwg8kBHy1kArWHWE3w5rGkgVe8gOMK/sFzu8vJdA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7541 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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(). Signed-off-by: Liu Ying --- 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 | 134 ++++++++++++++++++++++-------- 1 file changed, 99 insertions(+), 35 deletions(-) diff --git a/drivers/gpu/drm/mxsfb/lcdif_kms.c b/drivers/gpu/drm/mxsfb/lcdif_kms.c index e54200a9fcb9..d46de433cd8e 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,72 @@ 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; + } + + 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,32 +494,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; - } - 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); @@ -520,6 +542,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); @@ -548,12 +612,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 Fri Feb 17 06:54:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 654558 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2FD8C05027 for ; Fri, 17 Feb 2023 06:54:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229794AbjBQGyA (ORCPT ); Fri, 17 Feb 2023 01:54:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229793AbjBQGx6 (ORCPT ); Fri, 17 Feb 2023 01:53:58 -0500 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2081.outbound.protection.outlook.com [40.107.7.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 248B45D3F0; Thu, 16 Feb 2023 22:53:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ho19rkWkZPkbbtmwCTdj+HQ+9eo24185EEJM3CrPACq6IUdRU86bHMmXuNbOnkjR3XKRNr9rt6iY2Sva8aofrI2L2s4P4gpclhBbYi42moTO8VTsXyBHZxaQzN1C+v99dDKQxLsFr0gusb67rpBgRgJFgXrzqaptd3j+cxzGQ42nBAxDZiJnMJ/0czGv1OEGgrB3wKVudy7C4+5s9b0b2keuYgb7H1mXxcziljXbY++Pe+gcHSNLhbiDlq4/Iey76a/ib3S8Fp7szpLRkB0TBJboE8qmPaL0jAExe7P2x1HGaq16zydUPcQcyF+zbWp8a+PrV0slCyzBddZsVqYWHg== 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=45Pt7RvBtxBF0Gwzd3YEF57mgnD0zEJn7sUE89fFrxA=; b=jAfHD9Qxi7woyHGntaX66NLYHe593dcX172bwznEf6k6pt6XsvfX4NvB4FBJqXPZ7XeTXweXJczZkmn4f31mSW493h5NoRrvwOeyIBB1M8dvt2blIO3emXMz+Vq15V6ocOVCX91zxO5gXjeQHuGuysAIihPBN+Z7hbZaDPiVlMbX9tWYXdF5OrgNL3tSwtWYppt1lm4f21YAWOx7PClrp/c8sJRwOB5M+w3phISk9/atIF0gYVK1ot282a3WOAJsEANRK4wlhX/HqC1KwJ1wDu70MNZ9f/NH8Jq9tt7FGaHvX+EabOHeD8qzHCiVU+NTqskJBatMLslrzhgCH+WfiQ== 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=45Pt7RvBtxBF0Gwzd3YEF57mgnD0zEJn7sUE89fFrxA=; b=eh0Y253szI2IKXoLkYwwSvvOkapKl+tUVWLQSGcF/Rz8lsRlay8x9y8SlDLaRPzJlX1RL4QN9Yfvspm0ghRF4kKgwLC8CLHZyFsyteEsNhDSwG2+HxgMRfLI8I/Dpso1GSXMS0jph8ICz03MaRXFvfhXrAKKkO1ftxdMzXn5vmU= 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 AS8PR04MB7541.eurprd04.prod.outlook.com (2603:10a6:20b:29a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.22; Fri, 17 Feb 2023 06:53:24 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::5725:92ec:f43e:f5fc]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::5725:92ec:f43e:f5fc%9]) with mapi id 15.20.6111.014; Fri, 17 Feb 2023 06:53:24 +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 Cc: marex@denx.de, stefan@agner.ch, airlied@gmail.com, daniel@ffwll.ch, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, krzysztof.kozlowski@linaro.org, LW@karo-electronics.de, alexander.stein@ew.tq-group.com Subject: [PATCH v4 4/6] drm: lcdif: Check consistent bus format and flags across first bridges Date: Fri, 17 Feb 2023 14:54:05 +0800 Message-Id: <20230217065407.2259731-5-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230217065407.2259731-1-victor.liu@nxp.com> References: <20230217065407.2259731-1-victor.liu@nxp.com> X-ClientProxiedBy: SI2PR02CA0033.apcprd02.prod.outlook.com (2603:1096:4:195::20) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|AS8PR04MB7541:EE_ X-MS-Office365-Filtering-Correlation-Id: cb01bddc-0962-45fb-f44e-08db10b3aa51 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tEvc0B/wOgk9G6cy0YmaHukcvcUuJth1TxnYSUy+ICIEWV/SMhpIujwZ7FvlzPpXEA5aMjhiafPjaaW/hksvPV6Q9Lx6zSWtY4MZRLo6Y2bJCv+7mbaM/l0pbAOO1eAS8R5UoYdPWRixwV2PR20PdeKSFbrzAehQtXT18Jpnj10jgqGNILV7oxkIVSkveZfeP6LN92ZJOYajwnVxaMZPM9mfhIevZHpCLP36f/C3kV0afYFY+P9O1uMBd4kzFrsiW1m2uyE/7bg40dkY7UGygvHsYqq8FAI8MFFpYMVfKYU6Is5+1/jxjn6JeUUoziXXAu80Php2Whr0X4MyEE17W5OLWFM4b7QfdwQbCZC/nFSTltGNdL/OOACrKx7nupQkNmN/E1efasGyyyqGXjlK2ycc0CHV35NXRjzjNBdHe3Xxhn+4F5bRnEbyEhzLtrpLAx17btJJDwsaD4xv5qV/KZD1KpynYpjt10+2dBN6HtVmSQ1BJ3vC1V0Xcb8nouZ8iAOOlBO2MItGINCQrShl1SFRHRC4VagQlu8onfRjOr0F2sHZmBMn32y587o0U3ofyGoe2a4WyujOtUeqWKfQHz5xU4ANYbBC98Kwbx2u2fc6R4xu7lSvmBEY5ryHE5WCaSb5ujnFy7PMna4q5WORdfcu5xtwXzailPj4GCNHui3UfdPprk3Frf5C+oiHuxAMYmjbpBpo/pWmUA0RyxRFuA== 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:(13230025)(4636009)(136003)(366004)(346002)(396003)(376002)(39860400002)(451199018)(186003)(26005)(6486002)(6666004)(478600001)(52116002)(1076003)(6506007)(4326008)(66556008)(66476007)(66946007)(8676002)(7416002)(5660300002)(8936002)(316002)(2906002)(41300700001)(38350700002)(38100700002)(86362001)(6512007)(83380400001)(36756003)(2616005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KS1p8LpQHTH8iGGDjY6HsZNauD1AtEwPbIeXXIbot2vE9PTllhdWV6BmPQnbuFafh1M42FbuyAZalRhj2+0YEhK7PSiJqBEq24v3CHfG5iRoWx44qrRtSkri85xpBTF7VMf4OKt3SNYoHfZFRhoPeuEZsN/mY7gsZHZLn9loJg4Ld8clfmNgutj2aRBZNVVnJFqPLm85Gauf3EC0+VL226Iw8raUIKMIJNJxlnOgN9jFgQW3vxLQXIC5+L6U40bc36WFsV6P/wDnP3EGc3mt2grd6jzJbkRILvuE+482HpPnHOBkklpugWVH9NPA8i5FEODQyu/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bbgI4jPxxd2Z7e+8jkLRXMVA+uVwKc9vqSO8pI30btyHgUEiNNNlWH92X7pLMEgT/OOBBgYr+ffib5/s6pqSWX1jSDyR3/c3tk4IIqFVT+1+ZrVSB2LEko7Snh2CCY4VB6Lbskz8V1TYZ3WrMzr4HZO2jt7oIxKGaVtk5xSXiFX1vqPFq32mJ8qeLnd6nmYAiWiZGcbu9Aj+tx9aBGuQjqpbEieKD8K X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: cb01bddc-0962-45fb-f44e-08db10b3aa51 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Feb 2023 06:53:24.7790 (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: 1oExaU9NmZNydJDtaIhtSU/k/BMuuk5sv9ZnHYXtnHq1ABipdJQpWg47aolyWu9Nv81Fx9qwdeOdzvGFK9U4Pw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7541 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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. Signed-off-by: Liu Ying --- 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 | 76 ++++++++++++++++++++++--------- 3 files changed, 55 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/drm/mxsfb/lcdif_drv.c b/drivers/gpu/drm/mxsfb/lcdif_drv.c index cc2ceb301b96..b5b9a8e273c6 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 d46de433cd8e..d6009b353a16 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,26 +447,55 @@ 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; + /* 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; + } + + 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; }