From patchwork Mon Aug 21 03:40:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13359028 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6E874EE49A6 for ; Mon, 21 Aug 2023 03:37:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=iemns8Lowv6utEwtei+idM5JtXgKlBL0mamwb4V+siE=; b=olVWmQThydZ4Kz 39xB+UvD+gZtG8O2n3AqmMyBUQvPGgXR2PVpV3QQF4IKfUCNepNi3R5upqqfDP1SaDManPn6md0DE vThAwiGCcDSLqW3yq6BwLyqlVZ2uww3rYmUHZzOdhJcudc/bXYiqiwCpJIlHmXCzsdVUC0BfxJ3n2 dqPS0+PRk+/OFCy+z3M/JoxhLubIrVlI7EhtmUCYnLzBRWTH+8YA6x/eCQC0PVu7H5G3jwX2kglUJ StgC560yiYQ6qeQ4mlwP0L9qKgx1rp4M7QN5SNCw3fjMQZL3SQQzIOpMnbhrx7ZPQSaxty5pwIUWB cJW5U3FaJqdzzMysxQzQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qXvip-00D01S-1o; Mon, 21 Aug 2023 03:36:55 +0000 Received: from mail-dbaeur03on2062e.outbound.protection.outlook.com ([2a01:111:f400:fe1a::62e] helo=EUR03-DBA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qXvim-00Czzm-2X for linux-arm-kernel@lists.infradead.org; Mon, 21 Aug 2023 03:36:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IdhnjfnCXoVYydT9ETAJMpifa3I2PKtLMJKtHed8+CqC9mgZmH/HBEeKN1FXi9V3c+K7TGwsO33hzulsRt/orASGj9mSW17vYkXnBoefxB7xR6m0IO0AwL0DEA93YeSpi8FV3ah1Sx8gw/FgzoLjnKRtQDMtfeMdAACbvJ6bQFveqz7/n/1CtcAZ8fTlnMaw47+4XHxtqEsi7bFIZWNSWojVoze00T6HfBgIFrImfn+Wgpwf8NstKT5aruuQTzQcyP+eob7SX0/PsJFcAbtVw5s+dMcKmdXtmJSeWsow+/+GJyjKxIhefwQHZbw0blp8H0Go3AWWP/ZMoxEe4j9IAg== 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=Yc60TojKkm+EG/yrr5xESHmoBhVpoVUMN1IQ2c9MLKY=; b=E5030RfHOYe1I2AgS/RTqDqsxFD261QswQMUVBTqyDl9IHnTSIRTHBEseg1GJ+reVQPsHMBw0UyRl6cXpanE5XDR7lfPSuWN+ziD9KFn59k5t62CaEDanB0ht2xoZNZ+mMYm2POVKoCeW528mbCv1GtTPexTs0BK9rl/QIcLrMZHg9dRvERIYxgea+9O6jqRJXYY6nFZ712o4ikM3fq7ShL4cp15G/NNwuAkKN8U0MxfhMRT+eFowYZIoWaWx0HSapjGmNJoc/rvh2eQkTZLqEYJgk8eISMntOWCkw2Vz0BATS6+MW6nOoJ9J+k74kcuPxT6jlRjcjAAZ/Dx5mDx6g== 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=Yc60TojKkm+EG/yrr5xESHmoBhVpoVUMN1IQ2c9MLKY=; b=BKFXi+VPLAT1Dj0n3SDWp188xohnhp7T9EEvpPS82DMEqkJjDu+qfk9APxRnoAwplnI/3YxVlWhVFeiQj5N+bfX0uyzEV5/3qgrqljZJvOaar+Vk9RidfXsxprlJ/n/PpdkRmcmxHM1D/o8CYOLc4Csv0f2OmHVY7wkJfJxHahc= 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 PA4PR04MB7758.eurprd04.prod.outlook.com (2603:10a6:102:c4::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.20; Mon, 21 Aug 2023 03:36:49 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::9018:e395:332c:e24b]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::9018:e395:332c:e24b%4]) with mapi id 15.20.6699.022; Mon, 21 Aug 2023 03:36:49 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: andrzej.hajda@intel.com, neil.armstrong@linaro.org, rfoss@kernel.org, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, airlied@gmail.com, daniel@ffwll.ch, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, alexander.stein@ew.tq-group.com, sam@ravnborg.org, jagan@amarulasolutions.com, yannick.fertre@foss.st.com, raphael.gallais-pou@foss.st.com, philippe.cornu@foss.st.com, hjc@rock-chips.com, heiko@sntech.de, zyw@rock-chips.com Subject: [PATCH v3 RESEND 1/9] drm/bridge: synopsys: dw-mipi-dsi: Add dw_mipi_dsi_get_bridge() helper Date: Mon, 21 Aug 2023 11:40:00 +0800 Message-Id: <20230821034008.3876938-2-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230821034008.3876938-1-victor.liu@nxp.com> References: <20230821034008.3876938-1-victor.liu@nxp.com> X-ClientProxiedBy: SI2P153CA0025.APCP153.PROD.OUTLOOK.COM (2603:1096:4:190::12) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|PA4PR04MB7758:EE_ X-MS-Office365-Filtering-Correlation-Id: 321a1688-cc56-4618-a0f8-08dba1f7da4b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hugMRF/1SJ8l3zzqokBk/ePyERPfMPjJu28gYWeiR5fIMVw28Pnln1m5S60HO4UP/3bDA9M0DKyXqBki0tj0zmmWhZPzu2T8/ktKcw7qk4oXJzWB7ElsfX/pe0hMW32kmwqQRAH5CZZI1q9fPhDw7xYVJPQvBfVmDTZYq4sOvdWDC0Yr8jRVNjnKUQF1qXadKIa+RktuLg9DijfKaS/KiDWFQsMEFfd4Q6m3wALlXky3Y4pxJi0aLsA8mxJgQVpkPQl9VN7ONXdgbR3V3HxWfdeq7K5SpMlt+hD1yc3ae6TeRakieCLmZAYrY6q8TtjfZaEU6Zc+LCdmIoKhRzipZV7O/s+JJDV2qEpMqmcQxGkRdNWI6qLJsLiepfybmrCm0J6EjARHKvqo6R4iBTLz7KF7KgBkIMRzzWRLOr3GJQDLMU6I2txod8vzV7bRX+Oivl2p5e4pUkivXuFxcJMxFR59wMWEROoJNoE3mFmLVAMSGONePVac7+jtOQzXuPHR/xgHf4zRI96kjHuMeXRBH/Z0+PdzWofsHUbBbzImfb4x+rxvMZJei442JfHMfYLE2FXL5qhmGuTvvO+0umvWCek2AkrGFgBtozUIHhnFIzufyAPYrR0elu1QL9nZtC+v 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:(13230031)(376002)(39860400002)(136003)(396003)(366004)(346002)(186009)(1800799009)(451199024)(1076003)(2616005)(26005)(6512007)(38350700002)(38100700002)(36756003)(86362001)(316002)(8936002)(8676002)(41300700001)(66476007)(66556008)(66946007)(2906002)(4326008)(478600001)(7416002)(6506007)(6486002)(6666004)(52116002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rORPkrwB5t1oYnqZWVXao1euERUkOSbUdo6V7B3Ri0HyI92xI89rh8RCCcYNEfQBT4OoTVJ2JRA/SCKIaqMeAQyfkFUvOLsh8RDDJT7rmSaafxR39pVIoEmBw5kmldNoiP4okjpBhsYidc3BslGfBEOijg1sSW/Q8aU8ErK+L2mmImIUyuVMrh8rYJugvsPmLKhYj15/Kl/+0je6YKLVnfbqfLLIf8H/P/sOU9TzznL1oYJNnKXJA/T5zuBFmVMDd1n97ih6vWTuznoZPNyha5xcXJ8N2BVsoRWogxt88IZPiTcV9/QiKCxGgQUow0edLNG+0vlNy6Z/n+j7q1op5iLtVS9UkN4H1NuVkNOPf6Z4t/OdxEWpRfI3yAsNr0+wTN+VqhjIdIkBUlVy+BvmBcuH2zmSgf2MBHZXzSX/NlBFNEle36GgAzNGuIv+JmOOaCOC8z8YHH72LujmYd2k5QxEtuoHcQAAnonrN6SK7m6nmFf2jQ93mOmk1n4Whz5CztqNBxdoaXeHV0+K5Rjradgh9tq80MTU0RZpxJGaZVIdoMqHzKcgDN9Bxpini1vJodVcW2SdPX8bZ5x2vhR3hAAKonbCtf37AIf5B7bznkyIIv4VJ2Vkzs/ON7cWUo3WI2KhKu8Ov4GP1s4FCbYPygwlmpza2a8ptwmVaP/a9y29niP2dCehF/d78vQWKI0M6D/hQLCgFsVvP6PGnPD4yuxR7CAbPTr8/Xs7/vGjMFxQTGh3Jlx+Uw7uQKNrfj7IiHV6DNMA/Jm7acj9HbsZFFe9dCUad7lLc4z9cxry8r9l2mmiqWkSJvRy0FWajUYNkeQgPySr3rTbvu1yYBST+7a6a7yGlhVULJxeJpufYjnGfudoAm1ZDn6lsGLAwYzQDWTFQM/O4bwFiSA3AJQ7eJf9AU58Sgf3nYtJ5mDxMFsZbnohUpk3S15b+QyRrTBFWMCft7AliIw45MUpae1DzibNiMPETUK/aytrym+p1YT9WqPQvmTCoBAsPx3lCUbrSQyxIcIZpXdc6VWJis3H0BC3FZD7JNUCsbzkQVD1QoQ1RM/OVqcPF7nqeblgC66XC27f3tdh9a+ZBEx07m54tpbvpwdZExodWfeHOCesAOGmxZyPVaxRtrtW8OrDTh/5qr3dabgmwGO8fd/SP2QrMcZJ4pP3DPDVm29AdB+CO4LkcMoxT7dSIvXR8ZrwzkBIcPY/6HgpI5kdJVZU9MWDP5ipNvklYDqwGjUwkiej9jRMuRQ7Vd66wmWTcw9UgpOIzZbET8RBJijIDmGMPsSVIDd1mVBUAKV1W+ffGiJoWNYOBNN7aoMK/NMvMu7j/o7vAR5kYhPp5A/Xtk7KnWQsan8EIP4RjuY/u5a50FO6/r+5+qL/1HnpTnuJ7DF6y6LHUOBEbbN6Yo1kdA7elis/0FggYdeTb9Ma/qT9LcVQebG209cL+NiFwZ5rjQ6ycpxPDqy/8qcUoo0N5ra55YDWfP/tstQdA9au+5VP3HoX6whro4i+aqIzEFQhz2NVsGPcafuDkTK5xS7IWwlypjZMEizehcpasQZtFEC+2mhvmoPTUI2kpz4lHcJfZaPtzIC/ X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 321a1688-cc56-4618-a0f8-08dba1f7da4b X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2023 03:36:49.6828 (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: 1cRgsS8TrLFqUiUQYy3o3Wsw/T6QoCed/YS7nKPHpIAKmYAJD0BWfFbXKWWL01WO3+9LLfw87AzBYcHyCw52gw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7758 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230820_203652_826626_90F58400 X-CRM114-Status: GOOD ( 10.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add dw_mipi_dsi_get_bridge() helper so that it can be used by vendor drivers which implement vendor specific extensions to Synopsys DW MIPI DSI. Signed-off-by: Liu Ying Reviewed-by: Robert Foss --- v1->v3: * No change. drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 6 ++++++ include/drm/bridge/dw_mipi_dsi.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c index 04d4a1a10698..ba3cd2a3e339 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c @@ -1211,6 +1211,12 @@ void dw_mipi_dsi_set_slave(struct dw_mipi_dsi *dsi, struct dw_mipi_dsi *slave) } EXPORT_SYMBOL_GPL(dw_mipi_dsi_set_slave); +struct drm_bridge *dw_mipi_dsi_get_bridge(struct dw_mipi_dsi *dsi) +{ + return &dsi->bridge; +} +EXPORT_SYMBOL_GPL(dw_mipi_dsi_get_bridge); + /* * Probe/remove API, used from platforms based on the DRM bridge API. */ diff --git a/include/drm/bridge/dw_mipi_dsi.h b/include/drm/bridge/dw_mipi_dsi.h index 5286a53a1875..f54621b17a69 100644 --- a/include/drm/bridge/dw_mipi_dsi.h +++ b/include/drm/bridge/dw_mipi_dsi.h @@ -11,6 +11,7 @@ #include +#include #include struct drm_display_mode; @@ -68,5 +69,6 @@ void dw_mipi_dsi_remove(struct dw_mipi_dsi *dsi); int dw_mipi_dsi_bind(struct dw_mipi_dsi *dsi, struct drm_encoder *encoder); void dw_mipi_dsi_unbind(struct dw_mipi_dsi *dsi); void dw_mipi_dsi_set_slave(struct dw_mipi_dsi *dsi, struct dw_mipi_dsi *slave); +struct drm_bridge *dw_mipi_dsi_get_bridge(struct dw_mipi_dsi *dsi); #endif /* __DW_MIPI_DSI__ */ From patchwork Mon Aug 21 03:40:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13359029 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 56A95EE4996 for ; Mon, 21 Aug 2023 03:37:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=pVKJAIyjLCIiVuIizH3PnVuYFRGnwMvbEFaDztRY61U=; b=iuR7dNIx094WOb uDRmr90uOVE/Fkgd/j+gh+fIwTfq+1QaWbxOt1Y6TU59/pfIlTZfhSJfT9zCirVP1ggp2W0LupOAx 85a2b3qyXLpSXsiwukIQ8zgWZH+WEtY3jVTk6Ne/a6Eoe3ZgUAgVvudiP3KYgZ7P+OViJCW1XSwvB f2cGTERtCsjPOqfoLSQiP5GkmWDGt3Gr9Meh7v/0SoxYNB6eBq9IQD36Cd67LXlhGtVZp0px4J1ZZ BcunG1lhZ5tNu+owowE4h5TFb3WZEkzrbVAswVEjyRyNrOF34Ews61V1q/Gs3uh8Si9KzctqO/KbC n3O79Es1YQGEwklW9HPA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qXvix-00D04L-13; Mon, 21 Aug 2023 03:37:03 +0000 Received: from mail-dbaeur03on20610.outbound.protection.outlook.com ([2a01:111:f400:fe1a::610] helo=EUR03-DBA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qXviu-00D02b-0E for linux-arm-kernel@lists.infradead.org; Mon, 21 Aug 2023 03:37:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cDtwLFMmmliaZEp4Y8vNJjyXrrPNZqJwS8v/Jf4vwMIfZznTOeFCaH/pmAKBReMCLfJT+ZcCcoXEDmYYIt4TE27AydDI7+0PfpjwFCxaMwQgnUo3qw6mqek3BVtb5CDWzuWT/6J5ah8rrVBpAUIfBTA0cVD7oUhBHaWaN4z7enaYi2IteBAU0thmqiHn4tASlEwn3laHfXsf8TGQMpmrSGXJ3wfteiHoXBntiPQwGyl7/GqqaK896DLrP4y8VRcxQd3mrPFUdcefzTBM6IJIWt4mjB/V06x5VzYmqwwQEAHvj1cdlzbBwNqL5FKTqUmT0wcBqavPdtO3rkZu5/ot+A== 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=gTajqDPDTlF5+IDmLkxFKLAOQB1bLTu/KYQ8rt5+wx0=; b=ZJEDI+MiS22urXuY2OX1UdvEZsUUggp27VayQPAn9mqkOLl0caBcHEkxoZRnEXzRUsCOnmVtTtXnu0NgmPqtEa+6pDe2uvucdy35lgAdLpx5UICyIL9NM1o4q7yYNNq9PyiVjz40kqbB3A32hBvqtILnd+fIpwlx3DK7ih/3ecpcvUVABZ0YdeTWOHlzNNSl3bToM8dUUwMQ5grifoThHqvUr9Il4gefgRoJCZKVjFWlwAaExBYOtm/+kJfbrqcbWS7IfR0HXq6gw0i+5iKSVHUMqlCDVn/JgI9nvnLxrL82lsAuQBHdcqcnKvRzIePDWHXf6x3ukBCvLYmRG/2ZFg== 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=gTajqDPDTlF5+IDmLkxFKLAOQB1bLTu/KYQ8rt5+wx0=; b=BiIg7TbSPnBwXmFDYPK1CQId1ZL9P7gu9dQLIT6oQnKto7IPYJqLmSomALpiFUcyLIIppdnomhxe5Vs+22z0OWnKPAvyTpv2cMQyqHN3+g8zI87hFXHgQU47NNRTLSn8KK29bW/k9j3ls4MQl7KCuypcZ56tRjTEHvrZINf+gIA= 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 PA4PR04MB7758.eurprd04.prod.outlook.com (2603:10a6:102:c4::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.20; Mon, 21 Aug 2023 03:36:57 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::9018:e395:332c:e24b]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::9018:e395:332c:e24b%4]) with mapi id 15.20.6699.022; Mon, 21 Aug 2023 03:36:57 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: andrzej.hajda@intel.com, neil.armstrong@linaro.org, rfoss@kernel.org, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, airlied@gmail.com, daniel@ffwll.ch, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, alexander.stein@ew.tq-group.com, sam@ravnborg.org, jagan@amarulasolutions.com, yannick.fertre@foss.st.com, raphael.gallais-pou@foss.st.com, philippe.cornu@foss.st.com, hjc@rock-chips.com, heiko@sntech.de, zyw@rock-chips.com Subject: [PATCH v3 RESEND 2/9] drm/bridge: synopsys: dw-mipi-dsi: Add input bus format negotiation support Date: Mon, 21 Aug 2023 11:40:01 +0800 Message-Id: <20230821034008.3876938-3-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230821034008.3876938-1-victor.liu@nxp.com> References: <20230821034008.3876938-1-victor.liu@nxp.com> X-ClientProxiedBy: SI2P153CA0025.APCP153.PROD.OUTLOOK.COM (2603:1096:4:190::12) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|PA4PR04MB7758:EE_ X-MS-Office365-Filtering-Correlation-Id: 07f31ee3-cb7c-49bd-9b2d-08dba1f7dec8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TEAj60bOZM6bN+LwCkMk+loCtgYJ0Pg3YQDC0HvvxV7N2llI3+Wbjk9ylR9A8fsEjMvBGyfAI6Y9wmi6IVAK44MOxZxHsvz1HUSAC9CGpnV0knFVmQQnYwooL7HMm98QM/lZjEIMaNKZA3zrUGwyA25zBR+NKsuFsIaBCyGXDfCz4e6DqIX5k0oCFl3JHw68cWdPQRHrN77X1OSmtCIIt68ljHdwdxN562Qi5lpsX99eRtbFVFTTr+7b5Mz5yDSImS5Nd7Ff5Wl81Bkr8AE2sr2IqVGYA9LB4IbArZi83wbofRyBFIiS8Ya6+Kt0xiKDqa2MjKfvi742AuFfsqsGXIlJ6EXLKDx3AVUxqYQ9lNMJrPl48hw5E/KrR7SGGptey2ZEYLhME/w7HRursiPf3keb3z/KMhfis3EvXEGNYdmT5vZbtxgpUxH5B+6SuXq4+lkWKtO2ryijLzORp4H+ZehF5JR8DIUBHVCkStTghz8RsHmCwyprZ1rehMkQIPAx1Zgttt5t2X8H54QJxNa+pqgI1MYq9ipo2Wf+8/vThpaWklwDwyj2WFznEIvgZF+FOzzfGoLI6KWFtUMrg3mlemdUb3AjNpVRtFyW4coQr3j62M0L2MgkzqLuOhMKoNvY 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:(13230031)(376002)(39860400002)(136003)(396003)(366004)(346002)(186009)(1800799009)(451199024)(1076003)(2616005)(26005)(6512007)(38350700002)(38100700002)(36756003)(86362001)(316002)(8936002)(8676002)(41300700001)(66476007)(66556008)(66946007)(2906002)(4326008)(478600001)(7416002)(6506007)(6486002)(6666004)(52116002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7qRhkDRIdStvFM8JnyFhh+EZXdu+dSZ+0Rn939Cn+frmAIBDCK9CqDkLUcTcI7thPMwnRFd4c5QnQnTIqgeFTHt4Q7gMut77+0IywjjjVwkVbemUCRR4JYj2AX8hfd/2iqWfW1pcAwOcSs/0tAfvI9knVami+L96vvcWQ30gu0fZYpz+m5IPLnCyqTycLa2macq2zmIybwHaRG2ko8qhztBBsu36Y2V4L4Gbf26x3TMEZ6X1mmjf7hvIihDjE8QOF2m5l8Gb5ZigxPRzmF+dH2nJNXetni25LysMUmvwVRRG5zZPWLr2NZezpQ8NnnydXlUX4nbpOw7fT11v2FfwerDAXdwynTnf7LtGFtJ7S1JCMLVs/apiP2TB7K5yrfpkdGTc3CmYm4fvAyZorlVWUPSL6EGg4yxYVx2UVyoc4PP96DeuJbE9UJYNQYwQW/V7rfxYxUTxHm2PU1lZ/o/TdgV3y9k4D7+K/buzdFui1na4lc36jXk3qje3Y/JrD6LS2NyeSViGETA2KQLwT18lu92XZHfH3RWN1ZopyoTZwJdJrAHl/ZKzMUEVPvAGE8A5TYQn/wYkPXZ0NR88MZQl4m1c+VbJfp4CrpFu74mk6klPxj4SVcCMrtx+Hyl1Rt24zi63soB7MqReJig5B6eWM2BSLeSOUDsLJJtNxqP6IRo6d/UZfKXFwRZ8Mhsg8kg3LSJXNQFKtqlmmd2m3k2fI5DK4DT5I9muZuZp8Yoaj7KY4QxioFy5Y3HMavUF+67i1TiNzcS0XuQ/g3b7yIKtNac012SuzLTkDK49XK19smdxHSAc7Vajo8lD+eehq2itEn6cJI6iZDZcC8htaJMvWVDegezfn10NISsdxcwOhXfKBLQvdoJyzIrzzOrtGZY6Qom33w+i2z+gvAba0qTPAUPL7EyQxbPBn8TfHuUJljSmOu0tjST4gIkD/PNmv87srCRvhky1XWSu2HVk/VfT5Se9Ej/CFyGDAJa3yGPX/+5IYCSQ7Y08e5+CRFiVTJWNJg+yMne1+ZFre7CO2t8zJqOZz4ffO9EQZS3+3t728940nQsiRTij/vASbm13e8uzL83xJV5BcD7OORUZwDmGt7jHeqY3rqZhmfn5ty9gCnBbjbAc+mRIcuQMCTHl2XactmS3gOvaGLPExV+VYiQQMvwn14brWtJoWi/rRn8i83LlbJKUfsnWzRuK8l1WlXeB2OaPUqKMA1rVDZP/TCa6UfzRoTfipb6NzPAXQHuLqWdcC5LqtImVK+hTC+3Y+ydl/r6Eu0fk8oB5SRFteMR8Gw8z+Ik7VaYk36rnaRdZcR3g+2Xh55XVJ4g4JfikojgiVe+r6jn72cS5ELFAC1VKWOY4II+eTU6xg2hBsIevXshm+24a5iDyE52CjvN4afj6i+KK2CrC70es7Bcn3PwGiQN98qE+HbJI8FaKf/2TWD5tOoYL/LJ1jD1ohd5x9D2OpDtnjsMxMi/EZcb8JTWMsGfLTtGV4qOg4fc+Mkh9OIHNHxvEEGvt7XbPFiHIagiOTMQ89mc2RFCx/8AY27NgN+v4ewLNTCfoz+qHMxLWhzHXCw4k2AtJVQCU5nfLwFkD X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 07f31ee3-cb7c-49bd-9b2d-08dba1f7dec8 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2023 03:36:57.1383 (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: 6gTYBWsRrzZzWO5IJkFkXoF1zo9RgXyAzc1gLJkSQHVbDaYSx3YW2DyhrppuJnHL/oC6NY4fSonTna+RG5rFKQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7758 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230820_203700_111239_CB3E05D4 X-CRM114-Status: GOOD ( 13.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Introduce ->get_input_bus_fmts() callback to struct dw_mipi_dsi_plat_data so that vendor drivers can implement specific methods to get input bus formats for Synopsys DW MIPI DSI. While at it, implement a generic callback for ->atomic_get_input_bus_fmts(), where we try to get the input bus formats through pdata->get_input_bus_fmts() first. If it's unavailable, fall back to the only format - MEDIA_BUS_FMT_FIXED, which matches the default behavior if ->atomic_get_input_bus_fmts() is not implemented as ->atomic_get_input_bus_fmts()'s kerneldoc indicates. Signed-off-by: Liu Ying Reviewed-by: Robert Foss --- v1->v3: * No change. drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 30 +++++++++++++++++++ include/drm/bridge/dw_mipi_dsi.h | 11 +++++++ 2 files changed, 41 insertions(+) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c index ba3cd2a3e339..945d46a76995 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -538,6 +539,34 @@ static const struct mipi_dsi_host_ops dw_mipi_dsi_host_ops = { .transfer = dw_mipi_dsi_host_transfer, }; +static u32 * +dw_mipi_dsi_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state, + u32 output_fmt, + unsigned int *num_input_fmts) +{ + struct dw_mipi_dsi *dsi = bridge_to_dsi(bridge); + const struct dw_mipi_dsi_plat_data *pdata = dsi->plat_data; + u32 *input_fmts; + + if (pdata->get_input_bus_fmts) + return pdata->get_input_bus_fmts(pdata->priv_data, + bridge, bridge_state, + crtc_state, conn_state, + output_fmt, num_input_fmts); + + /* Fall back to MEDIA_BUS_FMT_FIXED as the only input format. */ + input_fmts = kmalloc(sizeof(*input_fmts), GFP_KERNEL); + if (!input_fmts) + return NULL; + input_fmts[0] = MEDIA_BUS_FMT_FIXED; + *num_input_fmts = 1; + + return input_fmts; +} + static void dw_mipi_dsi_video_mode_config(struct dw_mipi_dsi *dsi) { u32 val; @@ -1006,6 +1035,7 @@ static int dw_mipi_dsi_bridge_attach(struct drm_bridge *bridge, static const struct drm_bridge_funcs dw_mipi_dsi_bridge_funcs = { .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, + .atomic_get_input_bus_fmts = dw_mipi_dsi_bridge_atomic_get_input_bus_fmts, .atomic_reset = drm_atomic_helper_bridge_reset, .atomic_pre_enable = dw_mipi_dsi_bridge_atomic_pre_enable, .atomic_enable = dw_mipi_dsi_bridge_atomic_enable, diff --git a/include/drm/bridge/dw_mipi_dsi.h b/include/drm/bridge/dw_mipi_dsi.h index f54621b17a69..246650f2814f 100644 --- a/include/drm/bridge/dw_mipi_dsi.h +++ b/include/drm/bridge/dw_mipi_dsi.h @@ -11,7 +11,10 @@ #include +#include #include +#include +#include #include struct drm_display_mode; @@ -56,6 +59,14 @@ struct dw_mipi_dsi_plat_data { unsigned long mode_flags, u32 lanes, u32 format); + u32 *(*get_input_bus_fmts)(void *priv_data, + struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state, + u32 output_fmt, + unsigned int *num_input_fmts); + const struct dw_mipi_dsi_phy_ops *phy_ops; const struct dw_mipi_dsi_host_ops *host_ops; From patchwork Mon Aug 21 03:40: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: 13359047 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 630DFEE4996 for ; Mon, 21 Aug 2023 03:37:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Sx5yl+XIaw+LhZAmq+bmVYfimH/cmcJSWZ+fJbe1mHY=; b=0M98yymV7kTEGl lytuEZyIgm55XHvTPNIohrsntBd5unIDNfFYVARuywspUvdPe/qL6eee7+xtb3/89t2YPph4JGTyc Q3rpgnkGFGMGCH74JiexLKxd+M9e51J7vX2LNZ9nxskctAHwoGnB1xg9cz+qK2qx6SPsTqK8xRPiG Q/54X4O9Cfj7A4IYv6oy+VsQp7LSONYlKnIOcFRE7FrtoeKvQZ/e4yNsnVUYhnvO9kzlkH/8DqAZd dqQbJrXFlPkHaWsmKnxbMPO2lhTQoCGsnvWDsJC13On+pav9qw0Bd98lDBtjoYfn2MJmwrZgbkcjc FezG8rq7O5+gXgxyyxfA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qXvj4-00D07R-2a; Mon, 21 Aug 2023 03:37:10 +0000 Received: from mail-db3eur04on0631.outbound.protection.outlook.com ([2a01:111:f400:fe0c::631] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qXvj1-00D05z-1x for linux-arm-kernel@lists.infradead.org; Mon, 21 Aug 2023 03:37:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GwJbvLfkJnjg5lH1cquNrB63HWRSKg5CaVXDdOjBsWEx+7FSTslqDgjPf71iMvrI6JcD/4Usfr+r6xdTQ8jnWdS0WunzGj69Wy+mXzjFsk17EQn6SvIiOryHdSGEjVx9bgqQ1XjY1AHn3jM1xBklAqv1S7NuEJK4eGErgkchBKLxEMg6xn7CK4Q0UFzn4Y+Z510rqzWeaFqu/7UtVS91XOWfGXuzwjdW5tRiCUangbwWZ4gla+ds5zYRaY+358uE/9ltYrU4JD/FxRYZX6WfiTKMSJLDTW+lRwPCs0FsD5X7Nf4VcEfvIYIInoyE4k2JMBnrb44WKbPr+d8vBbpKxg== 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=G9pohsnP03WT5gNWkT4QfeROXZdvrfaWd96SBV+bF+E=; b=JLDsn7X4kg5GFICvZN06yIu7UWdXnTqm6dwxFw3KfPk2gnddPIknGpcxBj300uAT29msTF5SL2WERlANYD50sHGfp1tI5vYRejlXyF4OL1UZMB0LzPojALEHN4EBKwRXWljHlDsO/0f9SVMgvZ7g8C6kgdcmgYX7ryqfQZk1vRFHmecmrS1vCKRmEwOt1Ttx51Je33Jcfm+wY0RU6/yxR9+Mb5nwRmYQdRDNkaaLYrEGPd7z/Mibuk6TWuKtK577hQuJj2pz4WLfGd2JfPfAzFDhWQc9v8VdvWPxnMucIw/hC9yuoU35NqgmH5UwXme42EGLhs7BLOa42bBxTSyqWg== 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=G9pohsnP03WT5gNWkT4QfeROXZdvrfaWd96SBV+bF+E=; b=HeMq56O5uL4bjig3zVQv77TrUz0Gg32Rzh/K+HQ9O67VwZ+GWekN+S7g+ftExprkyAx2hw/y/OFYnysBiQvq1bb4cTuoHQ26OwEEmQIQhWu80gry1oDT4QSe+m3qJCbG7rraabNcwnmF8OOtf0ixak3ck1nN84VhwGV170XJ/Dc= 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 PA4PR04MB7758.eurprd04.prod.outlook.com (2603:10a6:102:c4::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.20; Mon, 21 Aug 2023 03:37:04 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::9018:e395:332c:e24b]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::9018:e395:332c:e24b%4]) with mapi id 15.20.6699.022; Mon, 21 Aug 2023 03:37:04 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: andrzej.hajda@intel.com, neil.armstrong@linaro.org, rfoss@kernel.org, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, airlied@gmail.com, daniel@ffwll.ch, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, alexander.stein@ew.tq-group.com, sam@ravnborg.org, jagan@amarulasolutions.com, yannick.fertre@foss.st.com, raphael.gallais-pou@foss.st.com, philippe.cornu@foss.st.com, hjc@rock-chips.com, heiko@sntech.de, zyw@rock-chips.com Subject: [PATCH v3 RESEND 3/9] drm/bridge: synopsys: dw-mipi-dsi: Force input bus flags Date: Mon, 21 Aug 2023 11:40:02 +0800 Message-Id: <20230821034008.3876938-4-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230821034008.3876938-1-victor.liu@nxp.com> References: <20230821034008.3876938-1-victor.liu@nxp.com> X-ClientProxiedBy: SI2P153CA0025.APCP153.PROD.OUTLOOK.COM (2603:1096:4:190::12) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|PA4PR04MB7758:EE_ X-MS-Office365-Filtering-Correlation-Id: b51e69dc-9d62-4ed1-a6d5-08dba1f7e339 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /2bXwdLl9+4ZK9KE/uRuA8sdWF7+dFmdULWNzok/AuGSBkIsHrDsUOu6l5P33//XJCHDe6sxV+6yvhVHWT4/mBZAd1JABHWSF2DTvW3Damk3mo0kiHgM3f6bYcR1C1mfjePGConE0dHgw2stoqLCKb3F6/MyNio2RJ7QQ/8Mn6ly7EYwM+ZeyD31HGyf/gTmDEf445Pjn0Xe5yqP//A/5/1FdYR/vf3+r0KOl/zws/+1nVZHqJLTmF0wvhsxYeSaYJqe7ReLIbJHmcbBInH6YeO0xr6f7v5+m9OpZGS+GSqbosEtoQbZs4wcEyyAxCZ9Ccy43RGAv0adk0fSWjcwax9kTxzHnY5ExaCQ2xPxmdi15VDePEwqa2V1lxU+KcqMssD1Z8xYVgUZJ7hR1H64CXUij6/Hhkdpp1C0c6bu3VFOpF0xxRPynAvBeyh1J3gSRlotSeny9Y58E0PZsf05w//dcSy6baRi3LfhqX5FWcAqCSi07ae8o0pLlvhPa8Ij3YruMYTahpIJNGHn37E6cpz1by5PBV6gho86UcVNV7f3zwufy6eyETpCjRWlwqbvBKhycjxjAh4mmwj74ofkqcQALQ5i8m5+ji/Sa8mJ/Xm0uNVmBi+8A6OigYgCQtdd 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:(13230031)(376002)(39860400002)(136003)(396003)(366004)(346002)(186009)(1800799009)(451199024)(1076003)(2616005)(26005)(6512007)(38350700002)(38100700002)(36756003)(86362001)(316002)(8936002)(8676002)(41300700001)(66476007)(66556008)(66946007)(2906002)(4326008)(478600001)(7416002)(6506007)(6486002)(52116002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +tNuj4N76SYNVjrFngoGHwXaOBjFVHWrYKRsK9BtDLqj4NhgyV+CMr/FpXMS22tUgxk8Jrhls8dAdhdnm/VzSqueqeCZV63VuPAN2x2TTrIc7p70hz+UjB9ypppI7LLe68tSvlHTInA7wOR+0UuYK8oNB5fJmXu3YbeD+fdWU6B8V1bk6P4Av4/rxr6fC73IvzayXc0xFPAIMa3hk16wIo5zga4KlrTGHTf7d8N33TeerzWNlPTo8v4xojTq8L3XvJVW0e/ovUL+Wpz8PW8Ot3i37geFnR+ylM0Sb/Sq7zJ9CpOZpx1VHQq7y4jIF6cD6RKUyWq+l2531vPsFtiRvWRVIBQRRMj7mBGcJq8zfro+RGL2hcV+aPPIaXbh8qrr14Y5rvvT5og0NIi7lNLoP1MvPnHFZuwubfyC5HawOyOHPmd3dOHfKJxeXYxFfwzlWKmKDUCgxVDlq6sUhCdxSacXf44LSS7us+wO+gtDJP+fcZ1XZ6EIgUud2x9SSrisTuMEgFdVrEO3R73mcFzOpqmnhfXAz5aR2lothqdm5CmmzhbrczM29L2eSYH5JxHmiREd9GdAYw4vqmZRfcKHQ0ws1eDkAIrJVC4Oy5BfTHN5fQNjDYGXBrtLjp8maJapYSSe6jbm+McxUOx9aXBCseOLmA+vpCzmHYyQtRhji7pnRYAIzmSlsLSGeklwYNYJBLxxjBosDDuoGjBvNSumtAJzuWHtYaXWLpO1RECh/zceoV27er5uZTavvpgIWgarN2njoRxkHZcici+R2OOlHXUOrG6U9qfzqAJD+suC8SodQYi4g6yGPFnUVaK4q2EcnsCPp6XJMw5Sfr91hnYqRa+KyF9SVx3q63k3OJY+07Qo6RT87Esgvw7wDmJ6vkGm4K/UQw0f7laYKjbR/8KEWlnpwvuLwLh92Na5GN+br1dkKjcCXPVNKIrCk3NP73+O/JuJU3L+luEavgYSoyj8sVl97OC7DwByPRrJbenFAP5GiCuselWCKnQiTKwb2wiBOtHZlMBSgaHBrWPk3M67Dq3MszdQKGQi+siT0AbMpVvzzq4/pPcOEItZKbuqvHRHrCfsS+jX0j/ww6+O4bwztWm7IAyxPybiGpcOLHUIbBiNV0G8V6u87FJCQumucztUCzBWcg8mlsxSQgayBx3R/5Qt7P4dl8tgIu5oIvsehIDNqGyiYzr5lshMv+G6bookShQxIX791TkX0kQK952MYbN/UohzTPzC7tJZoS/locm4iU8tbrZCUZqqVDaFfXip4LM+UnvZOTtrta9hZ5yeUtjG7/KDQNXaGvCwBjDzNmohKflRv+jZOYnYLwNOFoAfZvaIHfWQPU29qcChj1dvB+wmeqdzJYrkhI+0GBi7MowjM5yKUmUwyX0/YLvBpWY13itoOHLMRtRdS7LLHOOoLEYX9rAJTc1Apl3VN6KqH3fRYfnwY4zh8whBDFePIMxrbL1gNNiWOqbuRgONnqozxvK9M8t42t0Bi0KreSYuwTiTJl5ZguCUIPOogE5Ucnv6zSd26d93lCdXetPhYBIJbM11Cxf9ph1GCeC5XD2q96EK+IUfdv0oGOnRSu8u5pc0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b51e69dc-9d62-4ed1-a6d5-08dba1f7e339 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2023 03:37:04.6711 (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: HcWkeLMGkKQyhz1QyOYnhMcORIVcY+ydWjRZL0Id27f7Kjbo93Ph8KzrwyXI0lsz0TWndz9etTRJFxg2FJKg7g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7758 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230820_203707_643453_5AA2B880 X-CRM114-Status: GOOD ( 12.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The DATAEN_ACTIVE_LOW bit in DSI_DPI_CFG_POL register is set to zero, so set the DRM_BUS_FLAG_DE_HIGH flag in input_bus_cfg.flags. It appears that the DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE flag also makes sense, so set it in input_bus_cfg.flags too. With this patch, the flags set by drm_atomic_bridge_propagate_bus_flags() are overridden (see comment in that function) in case any downstream bridges propagates invalid flags to this bridge. A real problematic case is to connect a RM67191 MIPI DSI panel whose driver sets DRM_BUS_FLAG_DE_LOW and DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE bus flags. Signed-off-by: Liu Ying Reviewed-by: Robert Foss --- v1->v3: * No change. drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c index 945d46a76995..ed9288a9c444 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -567,6 +568,17 @@ dw_mipi_dsi_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge, return input_fmts; } +static int dw_mipi_dsi_bridge_atomic_check(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state) +{ + bridge_state->input_bus_cfg.flags = + DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE; + + return 0; +} + static void dw_mipi_dsi_video_mode_config(struct dw_mipi_dsi *dsi) { u32 val; @@ -1036,6 +1048,7 @@ static const struct drm_bridge_funcs dw_mipi_dsi_bridge_funcs = { .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, .atomic_get_input_bus_fmts = dw_mipi_dsi_bridge_atomic_get_input_bus_fmts, + .atomic_check = dw_mipi_dsi_bridge_atomic_check, .atomic_reset = drm_atomic_helper_bridge_reset, .atomic_pre_enable = dw_mipi_dsi_bridge_atomic_pre_enable, .atomic_enable = dw_mipi_dsi_bridge_atomic_enable, From patchwork Mon Aug 21 03:40:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13359048 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4F35CEE4996 for ; Mon, 21 Aug 2023 03:37:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zVfvaob1o9WQFkRI1dJv1ZxveBkHoqQL35HG6sZnDBQ=; b=GiXrAmjyfulzE8 nkNuA/95dBRYpIFrAFKcjTcQdDnC7Eqh0x7clPf7ve/Ru/APZmQENGLwCiiCPXlq+sHwdpUj1cs/s 1mszMM6X67HuRJ4R/gwtt5RTfDAuQLV8G7riPT2KGEmxvHVeLY5LAiBENItErVmUzYgY4Y8dlmONB qkhpYydJYmu+WuAfbF3VQh3EvgjzUt7+Et3HsMLhhy4tgZnrlSAYKNHzkyJ3tngXaAwGmkKBriycY +nFxiyU+Vf+7KCjFGaJdtxmd3IqXCwRGloRNM357uijV/vfsFZ32pb0OPgAG4jxjYn2bf+u1YhPiW oeB5eaPWUO4iP/Y7vWkg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qXvjC-00D0Bw-1l; Mon, 21 Aug 2023 03:37:18 +0000 Received: from mail-dbaeur03on20617.outbound.protection.outlook.com ([2a01:111:f400:fe1a::617] helo=EUR03-DBA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qXvj9-00D09a-0h for linux-arm-kernel@lists.infradead.org; Mon, 21 Aug 2023 03:37:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bm66Bj8reuknkHjYg1Judz4YAkSdC2sq4bl+G2IKdhtlji/Uu1pCuz6qiIT6kjGBrsqt8Vr7Sf8XAsN8EjvLvhzAYXgln7ZqVPJ1XiX5nXz9xsytkw8LZNM3UTZ0B/IH1u+MNnbMutjMgGsR8Jg4kilmdq6w2oeWOELittb+GOiFxrsJd8E+5SgUcKFazTGEaR4p6RHg+yugB95P8rt74i/77Oy3/Wn6Lnkein4ErOFZNx30BrgtN3yq737YWl2vTIMxeMnULmpfLcaIiPa2syJ/ORTvHQBp4V0pryBOwMmVLggFBza+bldhDzKM0HNS1tNqIvPEoIJXsDC+Cr8y2Q== 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=WM7ENwdEZtTaAmUcvrIdGqtVTxouZ1RTlDFvwoB1mU8=; b=SOW15eTv/RZIZVmlWCPiUqiOeliMlSL03+Nj3fh3hJ2yl6fWhG33pqZWKBkf3ftVdZAig0yppB3LlEf3uqJFINioxjYoh3iZpaDRD4A9I2OqQfkzqP09NNNQDdPtsoIv/Le16PyVJMMtTuktGrMcvhF6xPAqxVsLK8zTVlNsBtLfk7/fsZlarDma2+CNVmZ45kCiCayKS8bHHzdeAfkfbnPu/b4Q4i14PhtEi9EwRc5S/wwIGaTneDKgnPEFutipikZzk+oFL5jR7zvjxH/SRJhl9xs9lF3vu3mYFJPLdh9ZFjMCM7f4qMymh1OJsyO9O3PH8zNcgetoXByEzWUx+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=WM7ENwdEZtTaAmUcvrIdGqtVTxouZ1RTlDFvwoB1mU8=; b=H3AAMNh0n+h8MEkN7FN/UvVlvYqrQfkIBb+ErtRg0eU1Z1rJUocnIze7poNhz1bg/ljBwmWc/JsrWSVKCwN1pWsGIEuDP0cE3sJFzHqw+UBcLXKEPq64mVpuiWdgrWX6xRAzFJVJ6UZCi9KjtxFSjEhu33SoJN9eH5Se6we6ZSo= 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 PA4PR04MB7758.eurprd04.prod.outlook.com (2603:10a6:102:c4::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.20; Mon, 21 Aug 2023 03:37:12 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::9018:e395:332c:e24b]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::9018:e395:332c:e24b%4]) with mapi id 15.20.6699.022; Mon, 21 Aug 2023 03:37:12 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: andrzej.hajda@intel.com, neil.armstrong@linaro.org, rfoss@kernel.org, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, airlied@gmail.com, daniel@ffwll.ch, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, alexander.stein@ew.tq-group.com, sam@ravnborg.org, jagan@amarulasolutions.com, yannick.fertre@foss.st.com, raphael.gallais-pou@foss.st.com, philippe.cornu@foss.st.com, hjc@rock-chips.com, heiko@sntech.de, zyw@rock-chips.com Subject: [PATCH v3 RESEND 4/9] drm/bridge: synopsys: dw-mipi-dsi: Add mode fixup support Date: Mon, 21 Aug 2023 11:40:03 +0800 Message-Id: <20230821034008.3876938-5-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230821034008.3876938-1-victor.liu@nxp.com> References: <20230821034008.3876938-1-victor.liu@nxp.com> X-ClientProxiedBy: SI2P153CA0025.APCP153.PROD.OUTLOOK.COM (2603:1096:4:190::12) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|PA4PR04MB7758:EE_ X-MS-Office365-Filtering-Correlation-Id: b12a76da-b188-479d-3d23-08dba1f7e7b4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JY7kP2XbWqx7zhKARuqd9vPh6nEtHsa5Bn0JNp9mUa06N2CDMVZt5+ca9fVBJI/PaehghEMmha+Q702Bq56lS44mGlNLUw6rNBnKgb/rZPozACEg9WhI7zrRuvnAPq80gcor4pmI/9Q/9O08rOW0NnVvLwMms0hixlV6O4PvfQU03FPPs7tXZo80G5mZwZ0XI+9g9zryNrUMsJcAAsYPSQYcRnIc5ofd0vUq4ra0R5mvzuyaAniJx6TLiqz9LyzVuthWTLmQTwzHalCWcdzGj2CatnrNLyBoskyPTSMO4esMGgx+0Ji0gSZr/PDCcudfCwj16POr4OhMgFHVl6BUrj11/jp2BlAFlhSYBCWBeCqo8VsRM/CMwG9DEIpxbQaqAoiDLs94i0m96p/xzduqCg9mzqceob/9MqLV2Cnj+YJfWy3GMY5miA4o8m+EkAdUxbZAgXUALrkRUwawxiWH+MjcMcI+hah2mQ35+ELcWXAGm8jaepnMjjcm3Ct1JDpfuvoYycVN0v2tU7TJuZ+hUe87M5tv9l1G8zqTNHRykB36eNNU55CMWNkHgL8eaACEB0jRvt66bt1Nbpymj/zY5sauI6NAZbOys955eQz32DpUJVXCPwCZgNHTOjYgqmIs 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:(13230031)(376002)(39860400002)(136003)(396003)(366004)(346002)(186009)(1800799009)(451199024)(1076003)(2616005)(26005)(6512007)(38350700002)(38100700002)(36756003)(86362001)(83380400001)(316002)(8936002)(8676002)(41300700001)(66476007)(66556008)(66946007)(2906002)(4326008)(478600001)(7416002)(6506007)(6486002)(6666004)(52116002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3qpoe0ekEIzfyDRcTUYvGUOwCoY6xmPwBak4BaYSKwBOKSEwgm9DS5vLcZK5zuhUm7+EaKxwJnwLoMezS2cRhvhUIS2wF29zV9sizAbwHQVRA44NrVq9y4p+PmPy11BsVDm4Z6CCBij3fbI9xwyLvpJyJkS0vJPPENseOXa/qpoMAwiZ2MTIEeChLzDnqw55tWHhvSvXE7aRPlSG9/was8GM6k8RHKYJvo6DdrJTam2qOP4Nuw9tPUvOJYBbV/ag5HMk740PvzCVKrm7kSfZkt0H5EU+MIN5S22Q5Y6S9lShmRou1B4jgk6Y18HKGMrkaqQo5ZM1YuvJugEgGXPOE+T1m6ausG9uGdBnkm9O75pdq5lvCXTcrhWVHPzGwSQjgKJH8/4YqcP4tQQ5GYqeSBtraLyiUM2iwcUdzefo0JxwLwqzP54pakv1d0Z+RQYQDAj9Kik3jkD1qqsck81T1ROBTOVy5/oRfyv43TPc2HUOvMTflonecXdUR1JiW/BMuVYF3BBFiPsB6/vEMBlLdlBTZhwb/Idwkxjjg81GNuurUAcRaiKvRz9NOMjGa5W96tGZlhTmqUiMfFsYAqTN8xXHxBO7eTHglFgQ4wUjSL5JI4r0FINbnrajVecvZZoyJVU1AFtTKgkfi067IJyQlxb6yYsIVmgivA/qWR6MsMBLrqjbiQeBUjh5dTK85GYS3JxqQkjJI3zLEpGpkC2A0vH9uqYlvdI41f6OGeI/L1Ekdo5b3/6Vr4Ml8286RU0BK7XUGaOl8EKWMNgW5qozrEBDW5LgrlC8hzdFf0VH6RlQIl5li0E8rDVO7SvxnEYxypwpZxaikPJbaWvt6ziIJ6JGFshqEJmgy7agjgCSJ/Jp5ToXG61q9qRayEw88T151rD60ADg5MTHQoBEjlD0WWPCbxKMpYsJImWvRUdlVZSCS8253y08hB2h04dVQmEw01xphNcuVYlN3VzSUKq0uRMU+A2cXo4sKvYFpW4T0T/NSC8ozwO2KThh0VSMCI4YaaNWwFsm+OnCpuWjtscK2Cy2bMJPk5VJkmkMVWy/gCHi/ICFZBwUrNlyugoWEUCFKX+L1YXhtmGn8dB2bdiejta9ner3q5g29qpRM6l8dyZ0/KyuWWRP/4vhMFoABm/Ydn85AI839GhX+l1q/cZouh6NWCUb2wK6esmUA3uR1SORPb55ALWgzebEzbQ6H4VLHg3dS60XwR19+uQgRgHXwgihUKgvfUIi8AReFPeVfmB6jwADQaWXmnY2eUkkZ1QS4/lNl5jgAWAOTIv3Nbi7KnIkzE7mm0GU9D2/NFVcDqr5YAAHfbTj6uKJ2J6R9LRG1v47EAPaYg8KRICElTPAIGD9/0Zk09pmH2vOR4JxAmK2TvvIDytbXnPD40THLPRefCCFY7m8h/KqRBdY62gqoNkBsbckQzl7ydr+A6suVCKN25irBfLz3vQLO3LncqPDorEWUC4k4xMejlK4Nf+TrpotAUvHs77IXlhjv1CRGBnCm0viY0MoUkGVVzIYokouPWQIGPd+is3TSXVSNw46oxS/Kc1W+337/Btja76YBn7mIiD1zcZO5aJUM4wTUzg2 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b12a76da-b188-479d-3d23-08dba1f7e7b4 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2023 03:37:12.1784 (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: t3FmkEvupHMYvp5BOithh9O4/jEHGKmR72s7QU0oGsRBhvgnzWKlvTOf4zTF28Odvbnt8MHCgVMsagaleoiwRQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7758 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230820_203715_257672_B4EEB7BF X-CRM114-Status: GOOD ( 13.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Vendor drivers may need to fixup mode due to pixel clock tree limitation, so introduce the ->mode_fixup() callcack to struct dw_mipi_dsi_plat_data and call it at atomic check stage if available. Signed-off-by: Liu Ying Reviewed-by: Robert Foss --- v1->v3: * No change. drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 14 ++++++++++++++ include/drm/bridge/dw_mipi_dsi.h | 3 +++ 2 files changed, 17 insertions(+) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c index ed9288a9c444..b2da803c9de7 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c @@ -573,9 +573,23 @@ static int dw_mipi_dsi_bridge_atomic_check(struct drm_bridge *bridge, struct drm_crtc_state *crtc_state, struct drm_connector_state *conn_state) { + struct dw_mipi_dsi *dsi = bridge_to_dsi(bridge); + const struct dw_mipi_dsi_plat_data *pdata = dsi->plat_data; + bool ret; + bridge_state->input_bus_cfg.flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE; + if (pdata->mode_fixup) { + ret = pdata->mode_fixup(pdata->priv_data, &crtc_state->mode, + &crtc_state->adjusted_mode); + if (!ret) { + DRM_DEBUG_DRIVER("failed to fixup mode " DRM_MODE_FMT "\n", + DRM_MODE_ARG(&crtc_state->mode)); + return -EINVAL; + } + } + return 0; } diff --git a/include/drm/bridge/dw_mipi_dsi.h b/include/drm/bridge/dw_mipi_dsi.h index 246650f2814f..65d5e68065e3 100644 --- a/include/drm/bridge/dw_mipi_dsi.h +++ b/include/drm/bridge/dw_mipi_dsi.h @@ -59,6 +59,9 @@ struct dw_mipi_dsi_plat_data { unsigned long mode_flags, u32 lanes, u32 format); + bool (*mode_fixup)(void *priv_data, const struct drm_display_mode *mode, + struct drm_display_mode *adjusted_mode); + u32 *(*get_input_bus_fmts)(void *priv_data, struct drm_bridge *bridge, struct drm_bridge_state *bridge_state, From patchwork Mon Aug 21 03:40: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: 13359049 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EC654EE49A6 for ; Mon, 21 Aug 2023 03:37:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LNM6TsBShQH21ATDKEKJcchliek46HsWIUCFLaiWBbo=; b=JHb0T4fglWBUFV 3QqVLdyEKoPj2ILoRdImNQrmPPC9RMc9u6GoXXDCjh4eJhqAjnEJ3JBJPmlYaUKOGM4GpvxtqJLco llK4ZQHbpIikmMy5oKsQPAQ/fQaPhw+tRVf1q0k1WYWyuN+wBF/5hLzUYoX1arQ+q/v2aebFQCVAq wG7agCSpFAWaVynGxGEWe/Ugz2JobNj5JBurC3hPKLzyoRkUeROHPmbrdQxTosw0404F2CZxrOlFf a3KtiV/rYuzyrw6AMeDgVbChY8mUHxcDBwr4Exuz1q3K00vVeS/C20pFXKCwhyD7jtx8XHohVykxl UYR7a6UCs6w9kRiLPxPg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qXvjJ-00D0F0-13; Mon, 21 Aug 2023 03:37:25 +0000 Received: from mail-dbaeur03on20608.outbound.protection.outlook.com ([2a01:111:f400:fe1a::608] helo=EUR03-DBA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qXvjG-00D0Da-2a for linux-arm-kernel@lists.infradead.org; Mon, 21 Aug 2023 03:37:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cxaMEfPZ7WsBvZ3NBdMV+OviLRcxcIsChRXcBKlEIZBg83asAz2D7K0pCAPNoJPvnqez30H4PhKBktizXVYeDKALbI8WEqDQFxyaFUVAlcD1O4gH0MzdXT37LTwoOYMthMcypDPJI40w0yBGYGV6M6aXGWvapce5ytno0ArYWgUT+5qyYal2xTxDr5nYpis+1OHYe0g43mcUotJaf35g7aBX7D88AU7tT8n/xYjrNHcQAJZpZDGazyGTHwkSWhdDSR5/xvzSDQiUX3DZANa8kqnxYUNxMJsxNlqngDsHmAYGRTGq0IWyWIaie3AXh8wrN1lk03P+KGsagahDcSHWZA== 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=Hu/bTnsUSt9Y+yJOcDeiW8RmhLkGrUQKX8g5t4vnYjc=; b=bLvbI7MSB9mF9hLgOd4EONfR5jS0dM5xNXhdsjGlMa1XPfBgkO3d7Gp/VnSNZLe78GLeAve5Qxnot4okl9Uvy8P5e7JJQae3ylUDb9oVWzUxwRx8GbfTGfFC7EGBc6Z1hig6/yqfM0G7nbKYWwKcKPAYcvegxBgp5ockCpMgPUGAu/w33L269J2WKv6+LE2BgNj0nQ23nJHNL5v86WHkFCdYv33xianeIDfe2A4IO0y+9QDZxS/+zTJ+k7dLhLS91FoexqdKjChorhwv1hripzMg7Pn6aSFJ/N8vtjbWMb1B/+Z0VqUZGhz2RXmHeJ3ed5KnqR/dckq9lXes+ypb4g== 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=Hu/bTnsUSt9Y+yJOcDeiW8RmhLkGrUQKX8g5t4vnYjc=; b=Ifx+om3Rdpsv9m+/WtjaPQCrNq7JAZcYEQapIrtRlEkIwFpgyFBRO0Pt0LfhyI5r9TTuRtkt9o0RFKveqHFThiLar20yD4a3l4mjKGoET7kDcd+QKvy9kHXA7dSJE708iHdkRdudd7isWxpUHjONkKpDnHRUUEhl40PdESB9J7I= 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 PA4PR04MB7758.eurprd04.prod.outlook.com (2603:10a6:102:c4::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.20; Mon, 21 Aug 2023 03:37:19 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::9018:e395:332c:e24b]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::9018:e395:332c:e24b%4]) with mapi id 15.20.6699.022; Mon, 21 Aug 2023 03:37:19 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: andrzej.hajda@intel.com, neil.armstrong@linaro.org, rfoss@kernel.org, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, airlied@gmail.com, daniel@ffwll.ch, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, alexander.stein@ew.tq-group.com, sam@ravnborg.org, jagan@amarulasolutions.com, yannick.fertre@foss.st.com, raphael.gallais-pou@foss.st.com, philippe.cornu@foss.st.com, hjc@rock-chips.com, heiko@sntech.de, zyw@rock-chips.com Subject: [PATCH v3 RESEND 5/9] drm/bridge: synopsys: dw-mipi-dsi: Use pixel clock rate to calculate lbcc Date: Mon, 21 Aug 2023 11:40:04 +0800 Message-Id: <20230821034008.3876938-6-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230821034008.3876938-1-victor.liu@nxp.com> References: <20230821034008.3876938-1-victor.liu@nxp.com> X-ClientProxiedBy: SI2P153CA0025.APCP153.PROD.OUTLOOK.COM (2603:1096:4:190::12) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|PA4PR04MB7758:EE_ X-MS-Office365-Filtering-Correlation-Id: 428b9b25-ff19-4948-97db-08dba1f7ec33 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0VmOAg3eF2xiA1uMsC2eLmplwrz3gseWo+fEn2OPiveXNmXl0jeDGJ2p4jQBASakFURE9x9sMpS8Ss4nf9ym/sSmTlbty+iGn8/7kd4GhSp/V42VMAL8sqQU3W7xwkwBvo3IxYQQNbHQdY5BfHMazJnJWSrZlmet3iRiVwa61CxiZvMAnePgIosy6sUBPpwdnOFxjRX9UGhc5ReertLo9PNyKvC+CcKzozGrXSYLaOL+R5bwPO3XJOOpQIHr89S41ifsp8VDrp1NM87+Mr0UulyAToDkb26Ds8v/daY3rikRCbpZzkrxurL8WSVqtNeLyL3Rqov1F4V+N6/I0TjyULFXUzGvxdSSN441J4qL+Eel4rG+88/UeQnoOmDsfF7wC7AYkWE/iVZJ4YZ4BBXHuO6PRk8IjduG8ZR+NVQjgZ5fJdiuTq4eXojKheOyQvNhC4m+XUTmVn2TBN5eBWF5iO9ESrFNf5XNtA/zgIiPShjwOi6/8V+O3Y7YlMVwyVHD0xStJlSvJIzBUrCoTfyHzxFQrTxBlbnxM0mka42uWG5IzQZJC9W7hJ910GUalcnHtXmVohqtq3LJtgAMcrXH0WyH3iWaHLMsigocP5s4K5M= 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:(13230031)(376002)(39860400002)(136003)(396003)(366004)(346002)(186009)(1800799009)(451199024)(1076003)(2616005)(26005)(6512007)(38350700002)(38100700002)(36756003)(86362001)(83380400001)(316002)(8936002)(8676002)(41300700001)(66476007)(66556008)(66946007)(2906002)(4326008)(478600001)(7416002)(6506007)(6486002)(6666004)(52116002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5Ulmu0H02kUC9wRzbE0zp/VPpucS82o8vtV6DFvSXr9CYiPHB/7/ttNmIJv3slYnDiee8rN+gt9MnydYbf8uZWDa7JI/nUTDUI8WxGfhQfgbL4FzdFA34UrU9NqrFyQFtZkxNr6QxX5sdR+y1v7Wdl8088dozL/o00oxCgQuC/n66Fiu/DQGXNx7gcTK0eWGyBFShf6ZztmlOJXTBZENkS5Q1+MCC6o8fErhFZ8gR9qnMN/5SrVRiCcwneAQSOE+TaL9ifR/PD5nJR6jFm1OAYAIY/R3jgwLxm8XpcDATGBESVTdhdKhm3mM5n0jXA42pa8lqU8wZ7WTQQjM/SuLrYFIcc7JAambDTFhM6orwP2dUfOaFWSzRtML6BF9y9oFcrOT5myEdSIhBu01ObCCg7G+FykI5/uXZ+Iq5juKORBjcSFqX5/awKNMJ0LANt/wwyw6KikQWQmC9aV26fNkxz1HeqsXXDGEopRTAkC6NZYCNwYx11cIVr8DyU0MGlhWyr0lUo0Xa5OSlReWw+t64v65i/T5oWz/s96Gi9SJturQRXfjxZ+vDmr1BLwMx1XouGZrkpO86BQv8zo/HGAo4IFTePrtEx11Owr/w8KNW41yrREsT67uQoShx0F7+uxKrHDkWI0/a6EnSXmg+ZGzRyoJgJHvQ7FVberyEZvXd7e9+hAdkXBQ96o1o7F//JIAjBig2TFwhJWK8jJpjsJ6NLHh50oB+jhZgkF4PrGmwuZbjmS/u442E/YVBCMVZXDMIukssj8BFL34AHLQv+89hc5HnwLY0BuPI3SA4RJsxB8F+J5FUEV7b4Q8EUQ6uKxeVLCQDwQKkJQfVuFU84SFMdxzOstohwngMcPeETq3vJV4OQ+FyNmxwVM2WtgA4KygG5gjf249kYzEgCu+MIuAIreqK3nyTQXrZCaXLiS5VzympiE2ZhbNThm2CUdP8kYVv5WQ25avR4q5U66+tHuo+NoSVZy599hZVgNLOd/009t1J3MOOoEJZ7ZvXcSkVUdct+0/I/dqjTXpQGCUOQV7HvUPGqx7dnM4RnUpBWKjloG8G0L14aOsCrkM8aB/1U8tIGjp9Q4arBffD7N3ihv8naKepm7Pu7QdkuwYT8r16ExRAsXr5N3uX4h+OcC1Pwrc0P9AnVPkNac1HtmVSvNkiorMEztCLv8dLiD23xUvdw6mj40ke2tJhtCxlhRwceNUeEfRWvpXXzZ2WAI/rcIDsAuXOOIp77TstweSa3qvSymRTW6N7x92FRq0e2yQX0LQrw2dzCI8bZWRnNB6fEAZHcTYNzzI/pFTyZWLEz+HQuEKoG4WA9TQFkQczEicWrLErlxYMBO4HSZoUXX33dj02F08shxunPzF8xVYD5JonnllshW6IlfBcjtiRvHYX+0XZPgtOjCa6pgtC4Ji79iMhXJEiRdzQD5KjxMkLoVSY8jegmrsD7iVKiIsCPiRVOdwKTlE0YnL4OvSmgIIrK2o7J6+WWqfcpu+pQEY/n7N0JWg+5hKlmv9itJt4SJUEZcmc5G3aYit6l1IlaQ2K4huiwHGa15DbGTx03gBCvlSD1JxbiPHdjg+rWqvap/CXLJN X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 428b9b25-ff19-4948-97db-08dba1f7ec33 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2023 03:37:19.7272 (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: Hr0NeE8D4joKbFbdQy0qr1//K1j6sEQVeJAmfnDLy2gDUMeXEPFH2Zj9FSfLoilMnOuROHfOHLoC5zJ4/+7nxA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7758 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230820_203722_842652_82DCE954 X-CRM114-Status: GOOD ( 13.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org To get better accuration, use pixel clock rate to calculate lbcc instead of lane_mbps since the pixel clock rate is in KHz while lane_mbps is in MHz. Without this, distorted image can be seen on a HDMI monitor connected with i.MX93 11x11 EVK through ADV7535 DSI to HDMI bridge in 1920x1080p@60 video mode. Signed-off-by: Liu Ying Reviewed-by: Neil Armstrong --- v2->v3: * Add Neil's R-b tag from v1. v1->v2: * No change. drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c index b2da803c9de7..18e7d64b0216 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -764,8 +765,15 @@ static u32 dw_mipi_dsi_get_hcomponent_lbcc(struct dw_mipi_dsi *dsi, u32 hcomponent) { u32 frac, lbcc; + int bpp; - lbcc = hcomponent * dsi->lane_mbps * MSEC_PER_SEC / 8; + bpp = mipi_dsi_pixel_format_to_bpp(dsi->format); + if (bpp < 0) { + dev_err(dsi->dev, "failed to get bpp\n"); + return 0; + } + + lbcc = div_u64((u64)hcomponent * mode->clock * bpp, dsi->lanes * 8); frac = lbcc % mode->clock; lbcc = lbcc / mode->clock; From patchwork Mon Aug 21 03:40: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: 13359050 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6CC28EE4996 for ; Mon, 21 Aug 2023 03:37:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=oSD79ZDrITY8dCN3RWEvsEINPSKudyMif3PCsj/SKg0=; b=4x5MHr8CVY7Nv2 73YHDKCxlOaV70MAR5No2BaULgO+CTWC76aI+kgcIO+loC9L+shm9EYH4mNjIWDHJ85S58mpwRuOn VZpMOAAYMq7rqN65/8qbxWtStlvKS3Mhal8eYSRtoDvWXTZ1RuMGuCY9c4CiPQhgUQO8WLquI4TLE 8qmtDxhcQ0M4scVXMmqmMDK4g1G1Gwcs2qJy1Rq+us2swYZn43dK1sYfc5/PIHmT+jR3f7nbXD5O1 69oeZG0zNxG8kP86MvkEMV60QWMQcSb7xsBIzqWKakT4sbmedED5sljJ6YIIUA59B91TxkeYKIld/ 2lmC8g5+truQQwEpP/rw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qXvjQ-00D0KO-2Y; Mon, 21 Aug 2023 03:37:32 +0000 Received: from mail-dbaeur03on20602.outbound.protection.outlook.com ([2a01:111:f400:fe1a::602] helo=EUR03-DBA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qXvjO-00D0Hg-0M for linux-arm-kernel@lists.infradead.org; Mon, 21 Aug 2023 03:37:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jg1XhwC4o+eWCuR3XKQFTvN3Yv5ym5YwWwCbh7x8zs/1o77A8JMv6Nthazgq2qt0SW35ILOV6eK8NfiNcpV4uATr/+SWZRH5zDR+EeuQcoydcCNeMFVDenmPNeaz36jh3C5VRCCx2HfzKa6SO+bNm2e+JdvbJOsjypqtG+eoczsy3an2TMEs8VnQERhcR1uc8Zk5/IvlMCwGawaUM58bdw0XaeqhvGlFxi8qrPIYsJ7J4iO8uRs5rMDq1ILvt/SMdKoFlc51dIbIZ70h1obolH4gXgqYIE31XNvsS011moO0N90gsBgVbSI0Uc0AR7U34ZBHog+2w0kg1ZmX8hBShA== 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=MT32ykjmXob2U8ilTeXW2ZG+9MRcznifpijOIBI7G+Q=; b=kAWdxTSIstEAMrtM8wShgxBivFlL30EeGdUq7cJdcm80RH/Xjfetq+jkAkghSYGc1PKw5gPGnAfi0avzRV+V9mQXq0xVmDTBQTVJmXqnFHqmuGfggc8Qsdj8p+Ziwjyz9PL00tvUq7URlyZhW3Mcz/LgktMxnBAy3qHX21IIFn9whZMrNudbZExAVj0l0kFUnGLImw0bVSMk1nmiM5jkLTJ5DfmE2fp8xLEzZWObQ1marEMaCv9hRCaZaI3JuooJ1ghf+iVB1pjvbZL9MzwpwFgk0LVeIvaKJfaE8VZH/yHTOMFT6muRfwsYb1EQm3TMyKNxYiIjKm5+JsqN8BCppg== 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=MT32ykjmXob2U8ilTeXW2ZG+9MRcznifpijOIBI7G+Q=; b=JQkMpXnQDyBi5XUiwFbxoYMFFfD1EzirKU85PMoEox+drBIJmRqHb2A/qX/36rIF78UfcGgk/FZzynxPd5FJWRaXyzBPgJCWWGEc6v2IYj2WXysgg11IgHLkdSg4ASGefTVc0fOESfFS03MER21wiFyDaCBUe19nf9GqiKPxD/k= 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 PA4PR04MB7758.eurprd04.prod.outlook.com (2603:10a6:102:c4::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.20; Mon, 21 Aug 2023 03:37:27 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::9018:e395:332c:e24b]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::9018:e395:332c:e24b%4]) with mapi id 15.20.6699.022; Mon, 21 Aug 2023 03:37:27 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: andrzej.hajda@intel.com, neil.armstrong@linaro.org, rfoss@kernel.org, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, airlied@gmail.com, daniel@ffwll.ch, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, alexander.stein@ew.tq-group.com, sam@ravnborg.org, jagan@amarulasolutions.com, yannick.fertre@foss.st.com, raphael.gallais-pou@foss.st.com, philippe.cornu@foss.st.com, hjc@rock-chips.com, heiko@sntech.de, zyw@rock-chips.com Subject: [PATCH v3 RESEND 6/9] drm/bridge: synopsys: dw-mipi-dsi: Set minimum lane byte clock cycles for HSA and HBP Date: Mon, 21 Aug 2023 11:40:05 +0800 Message-Id: <20230821034008.3876938-7-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230821034008.3876938-1-victor.liu@nxp.com> References: <20230821034008.3876938-1-victor.liu@nxp.com> X-ClientProxiedBy: SI2P153CA0025.APCP153.PROD.OUTLOOK.COM (2603:1096:4:190::12) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|PA4PR04MB7758:EE_ X-MS-Office365-Filtering-Correlation-Id: e9dc83ac-1fb7-4b08-cbd3-08dba1f7f0ab X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aQuSJqnJ/Hn3x1JkqnVvDwFUiSr4cLyGKatVbL7ZBYVrHjN31EVdQIqpsAFzKnKHkCYxXT44lslMfTKPpjMe2kpXFTWp3DJr8+tAhRTeKWg3X9V4hBcjmqW3oT11W/9yPdw39rF3uP2xDlyk/j55BIEH1z83zdoRbJaPMf/HBAkBtkThCEURXAlDfDKpDOzcDVdhuGGkhnbWawzs8YTr31mtAoO5DHQ45GgKhbFA4JFwPZkGNpOSgxy3L/bqMagMDdxunGD9ouYpvDatcUswVQvA6k9nja5c/guvgNVUHPZYajycVkWZQLHoZbS3eNZlE37Rp7il+VWrkx79rhWlxTi5esSQxrf7wdaPIJOgc3Lj0RxE5LYOjTTz6WHtU38W04B6E58R9q2FZ5agZOIGFyRMhMIhNFidsuBbEaw8n58fdmVkGjCdOt1v8mhUvuebSkZlfaEXtg1nHjcRvRruVSTF8jYAYw3vqYATT3w8YOMZEUpLxYDS9QdFAR/BB8EFxycuvfBjJvSIVSwlXgs5pEyMjWJsgXYq/GGYqapUy+sdV3MhBnBxXwYe3lViS7gliy0KxeQCJsTOXoWxNbfcXXrOFwd1hWjZlc+MM69xFpwBpL0gPYfE65EzkEN3Bg18 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:(13230031)(376002)(39860400002)(136003)(396003)(366004)(346002)(186009)(1800799009)(451199024)(1076003)(2616005)(26005)(6512007)(38350700002)(38100700002)(36756003)(86362001)(83380400001)(316002)(8936002)(8676002)(41300700001)(66476007)(66556008)(66946007)(2906002)(4326008)(478600001)(7416002)(6506007)(6486002)(6666004)(52116002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YbY9VrsfI8IAEkygQUNLhL6FSPk+XtVqwEro4S5Ws8aVNWbbnaW5g1veaTx/oiRaaS8KhrdQlgQef6bqwNQZROYCc6fTakNnu5IqdIgRhW4SCrAmJH82epKtdVyP/3KShYg/WJwxC1U2isHrwDVAEIZ/kIqs1Unc7uYQwQE8560LZDPpc9tYchXMsLqYGNP7+fRi9xDp7pOLQhyGArsdya2lWQ/LjRxvlqwuiB4Dnihwyn0kn6JC1kTGcckAnc66UVK2ZEOLSDQPJFEjS61gBudAOmMfHyjl1zFEd1HixgbEv7FSVwwybneMOe/g2Vb0TfSiQsmNZh6YYk8HHh6quCCbk8/c/LcNYn2dv6ITNl3KuT5DlKWRUjPpfmDRAE23S0uY4utIDUwS/AlkCtoqXZrNXO/w29G4s2ccx+2P1xn/clxKJ0vGDrTtX2rvAy+fxDvyDYJnOGMkMIUHFF5vi9SXSbw60LqUFRu2UBcUIzoiM3LqMfMONmg04Ml57mfvri0OHgcxw3td46SEIPNLzwLpzFH63nwKortBB9GdW6zsbsdfzCWYH0LyVD5iMAWfyHeUvq5rxAUHlbMligX9FteX2ofkxRyI9pnhe1W2kzHIEa6HinOvj2nk3YFJ1SaQ2jdzBY3Kiu8n5xLOEWNkY7jkWw5ZzPtq3rHnB7QijqTI2VK4Ulqln6W4cjMAvviswHJXhrwuSc3ScI6WbyLyf0MakY2a4SsvNJI1GbsPXNm1kK7KNlo3AGS190QRtwWtzgW77IcV34YZgymi4oh8t9uEGyXDa8khumd0g3IC4bXvkq9N+LYxd1SW65nqZHynUXTCuXvkWavKLTzr2dukdy9LD1/I/x3+Gz1ztrbtK4RNSejoRNVC2VtY/sva0yMn9M1+pCURvUVfIHuMgod8ATpxb/s8Ggc273jZ/MWyhtl9OIWWAfP5eVjJM7sjzYW6/crrO9V+z/36ZGQMydpOVoW3mHOgb+gpWyhLvQupAH5LJP+csf+uowG8Oc40O8MqiLVntxxXnj6ukyPnyr1mkyRC7JFGjE47P52uVVbNCVFi0r2Fna3ttvzTk6wt9nnEA04jpOr1GLrxl2ZjGDaXFabwMKHvbS9mODCfiSUKb64n/BvAAKuHVQ5cau4RPnqyAZXHANBt3swqSdWqBSyZmVsJrvpDQx1a4vSLvv3KOAbGzECqWxXVCx58rwD3w+uZxTAbBj0n/w84SbsT2qH/fJffDDMXhFvIenu1tqUHPOreFIowgZmvAcRtmAlLR3l0KsHvAQaJMJb2iPiHlhriqd/D9AGo96IsLBCT5Cm5XjI/YTkQzQ+uHbRSu7Ag6ifcWpkJydyP8Q0fr7HUP/mgIrvKtRcBrgm1/ziFTRbe/CyxwCl3dMgOgy0QqBA8WUN4UFLstMa/VP9KtkRNvr9vPQ3vy3JJ/5vbj7qJuW30s9sKsdnt9gNNtY+tnHHGl5p/oi3vKY9z4m7uUH5P20RzY+11OZswcoQOnOtzfhR4X+prerVpGX2ChygF8nS1lFWhxRgcXxhYBcLI4khpmN9BlSp3/yhw/I/Nua3BRNCwLZhw9TV9wswcf3j4ll/Ozjm0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e9dc83ac-1fb7-4b08-cbd3-08dba1f7f0ab X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2023 03:37:27.2478 (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: fABbwaGZzHd+s34v0uniyn9mGuCMaI04cEGmtFMGFjUj0KnN/80J766fTZmM79YGbFSGsAaJ0nVhsTDdIbJp+g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7758 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230820_203730_151594_24E3ACDA X-CRM114-Status: GOOD ( 14.94 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org According to Synopsys support channel, each region of HSA, HBP and HFP must have minimum number of 10 bytes where constant 4 bytes are for HSS or HSE and 6 bytes are for blanking packet(header + CRC). Hence, the below table comes in. +------------+----------+-------+ | data lanes | min lbcc | bytes | +------------+----------+-------+ | 1 | 10 | 1*10 | +------------+----------+-------+ | 2 | 5 | 2*5 | +------------+----------+-------+ | 3 | 4 | 3*4 | +------------+----------+-------+ | 4 | 3 | 4*3 | +------------+----------+-------+ Implement the minimum lbcc numbers to make sure that the values programmed into DSI_VID_HSA_TIME and DSI_VID_HBP_TIME registers meet the minimum number requirement. For DSI_VID_HLINE_TIME register, it seems that the value programmed should be based on mode->htotal as-is, instead of sum up HSA, HBP, HFP and HDISPLAY. This helps the case where Raydium RM67191 DSI panel is connected, since it's video timing for hsync length is only 2 pixels and without this patch the programmed value for DSI_VID_HSA_TIME is only 2 with 4 data lanes. Signed-off-by: Liu Ying Reviewed-by: Neil Armstrong --- v2->v3: * Add Neil's R-b tag from v1. v1->v2: * No change. drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c index 18e7d64b0216..c10ca32dff0b 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c @@ -759,12 +759,19 @@ static void dw_mipi_dsi_command_mode_config(struct dw_mipi_dsi *dsi) dsi_write(dsi, DSI_MODE_CFG, ENABLE_CMD_MODE); } +static const u32 minimum_lbccs[] = {10, 5, 4, 3}; + +static inline u32 dw_mipi_dsi_get_minimum_lbcc(struct dw_mipi_dsi *dsi) +{ + return minimum_lbccs[dsi->lanes - 1]; +} + /* Get lane byte clock cycles. */ static u32 dw_mipi_dsi_get_hcomponent_lbcc(struct dw_mipi_dsi *dsi, const struct drm_display_mode *mode, u32 hcomponent) { - u32 frac, lbcc; + u32 frac, lbcc, minimum_lbcc; int bpp; bpp = mipi_dsi_pixel_format_to_bpp(dsi->format); @@ -780,6 +787,11 @@ static u32 dw_mipi_dsi_get_hcomponent_lbcc(struct dw_mipi_dsi *dsi, if (frac) lbcc++; + minimum_lbcc = dw_mipi_dsi_get_minimum_lbcc(dsi); + + if (lbcc < minimum_lbcc) + lbcc = minimum_lbcc; + return lbcc; } From patchwork Mon Aug 21 03:40:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13359051 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6832EEE4996 for ; Mon, 21 Aug 2023 03:38:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=e1L43k5G+KvtryS4CPdSzM//VjMKDEL6/43JgmN7QBA=; b=QhAOA3Gf73icMP Tyn6s/aaW7vKoKFmlRcB99pxH/NqDb2eTZyTRyp5n6K59sNCzs421XhZJH+YvtiXw0XqIP6djWyrN uUsSpYG47HTNEcDJqPTBRl+APaG6oogMHHy4mqkBnVGEQjbLkmiS6IJSVKkXFaGcwCdt6OsUWXKoM vlKVFavmlh4Es3ji7GWQmWLmEZg8mklLae72BJpfRPQlrb4PQUVKrr9oteqF0PCXf4ydQGcfp/vPr qoup1goU4i9xlClNklAuch+5A4CndtVWoCjRY2CSVHWi9LdnoETmzxLlpkfvqOI4VWpQZn7OJTWQO 3UE/n76qggmOxaGKmlUA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qXvjY-00D0OR-2J; Mon, 21 Aug 2023 03:37:40 +0000 Received: from mail-dbaeur03on20608.outbound.protection.outlook.com ([2a01:111:f400:fe1a::608] helo=EUR03-DBA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qXvjW-00D0Mn-1F for linux-arm-kernel@lists.infradead.org; Mon, 21 Aug 2023 03:37:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VG8JnuJPlyHwYj+ZEdPs3agOoJPfJE7si/jKEnpaJoZUszITAtPDPQT8cEhtVMn0gp/NHloMDfbK3b3cPUE7iNU4H5al4qQZ0p+N48g0K8HCeZrqCeHP16IqczDaur7Lf75Q45HKqPLQOju1mOm6VVM1Q9JaRojO/JggdXxQthOZz4o0Q0mIeWbI2Nd7vbZPLI+xoea+h1hqFyqSXbyRlhC6Ph7HuzJyD3jST3XC1gNlu7e81Bmkd1Jn9uewrdHV3UwKjkg82GiONh5y3u62mnbvhOXxu5qIpGL2WbtGQ/UCjv9PWtX3xSEtGTEgVT5z4ApMRNYQYCVrZBiyyJVrBw== 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=CVXnfxj/ckYeqKH52I7gfYVIIQEx/vEUtr+1t+l7dxw=; b=ZpZE6WTP/twTgI48yJ0nvMxiu/JPLqAfcwT0b5yRzS5KOOleMbvyVIdSKqZuyjAumvJsaJVhgMljiWdgc4HBVNI5+gIHvjfa/3ZO+eqb2VOV5y++v2Eb7ZWruRoObefLWAV7RnKBXJrX7we5d4igqt5/sQGVovc+SplABFgfUxVOecGtEe9b2tAqkK2l+1EqqA6Yqh/RC8lQevgj+/3JKMi9q3BW+SlQKs0XTC8v8NwouCRI31miVJ4pGtGfyZz89nRfHQpK+OHhGf9yPrAaMCLU4WkKFeDA+f8qhsQ1myNxe3K4IzIq5TMTW31gA0VZb9VLJadLbCELY0AAv1UiGw== 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=CVXnfxj/ckYeqKH52I7gfYVIIQEx/vEUtr+1t+l7dxw=; b=mXZ72c81Yjtoem0t9J2ZC/dasMZFOpvfYQnEh+zVSnaNEehs3m70oP3VFtVJY/JCbefGz8Eq5bHDzgjJlu6mQ+vQeNLTo9AAW47bD2SvBClsVgMTcvtfN7CyYbMbREW6dm7c+foTr4GrPTmJjnnk/KnifHGNzQUrGjZwOjUJSV4= 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 PA4PR04MB7758.eurprd04.prod.outlook.com (2603:10a6:102:c4::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.20; Mon, 21 Aug 2023 03:37:35 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::9018:e395:332c:e24b]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::9018:e395:332c:e24b%4]) with mapi id 15.20.6699.022; Mon, 21 Aug 2023 03:37:35 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: andrzej.hajda@intel.com, neil.armstrong@linaro.org, rfoss@kernel.org, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, airlied@gmail.com, daniel@ffwll.ch, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, alexander.stein@ew.tq-group.com, sam@ravnborg.org, jagan@amarulasolutions.com, yannick.fertre@foss.st.com, raphael.gallais-pou@foss.st.com, philippe.cornu@foss.st.com, hjc@rock-chips.com, heiko@sntech.de, zyw@rock-chips.com Subject: [PATCH v3 RESEND 7/9] drm/bridge: synopsys: dw-mipi-dsi: Disable HSTX and LPRX timeout check Date: Mon, 21 Aug 2023 11:40:06 +0800 Message-Id: <20230821034008.3876938-8-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230821034008.3876938-1-victor.liu@nxp.com> References: <20230821034008.3876938-1-victor.liu@nxp.com> X-ClientProxiedBy: SI2P153CA0025.APCP153.PROD.OUTLOOK.COM (2603:1096:4:190::12) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|PA4PR04MB7758:EE_ X-MS-Office365-Filtering-Correlation-Id: ec70e357-7271-4be4-4a86-08dba1f7f551 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZOpZch66GbntDRl5fg8MC+pacEnc3x7mHUfromG9LxxzukbDoe2Z6MAEzPqRTpNzu39B6GHVEPxb2zEdoU4Ygc4kSFVS8OZW1SakAQMWhkXR8Ylr+t/fwveNyPfISdwpzpRW5S2e06BHJM62e3j/gNUpEZKNzsZBt+Mx0yLDk20dAVUQKKv12oZoGxdkUeby/RVvgI+maj/d5b0Q4iD1irei4RPOoAA2zdO7jrXJXb3zNU7U9kgGp3ywHX7Tg2PmMQpwEcWqwkxKSlKgP5W6n6i1lrqTsh3QmOYnDU7mGS4nslOilEYjovHeBKvtnVedAbBniLW02CEk4RT60FFwKBB6VEFWPpvk1ROlNKEomKPkInWAkwPQW7jM11E2Z9Uvc1V9yuqPGEgwo51QFaFFrCOYC3CV1yy7PZf4j7IpauEPtWgTbDdyYeQVrFDhsKKudJIPUaEsXBc7rM32N3DX0aJHpmTdpQlQSV4DtHfITs5VyIh68els2dfZmdGafOawFd4ZaADR2e1YPJr3+axkCkG1iTpPbAmL85EPLKMSl3i1ShEZODPJJ8Z3AXseD6D+edU6gHkF62Jes7nX33I/8wSTS8DHAIWB70teGCCD2pH6DLvOeUBIeTi7UbPENWpo 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:(13230031)(376002)(39860400002)(136003)(396003)(366004)(346002)(186009)(1800799009)(451199024)(1076003)(2616005)(26005)(6512007)(38350700002)(38100700002)(36756003)(86362001)(83380400001)(316002)(8936002)(8676002)(41300700001)(66476007)(66556008)(66946007)(2906002)(4326008)(478600001)(7416002)(6506007)(6486002)(6666004)(52116002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VWAkEEvRAjpdf9cBwXmSsRI0wem80RmRbQAeQ9gftKCBMo5wOqr18zOxDj/sUNG0D0YvvwRZ5oVMUjN/Rjjbt6NqGgeU4luUZ0krmh5D/VdE+L1OAIiAktoHLFNn+inGwkBVXEIr+21hWI8Y8ZGAFGOoxJFU0enIyPmTvKgP68ghTbw6Lzh98X1hOmnnEvLCfFqb7FdoUg6+eUkkAU7I9hmQAkW00l/DofHuees8DbWlO4vbUBaUiVkaSEInoS4KyGlmRFAFCGNJhTPcEejW+pKJDMaoKTIJbW5DpVTOmEPm4/ja3VGiyw6lDs/B1/E+zwB/zHXjzwZtzaAOrG4Dkk9XmaTmYe6j3/Ba0raOVTewZHM4ZlfqoflvJjM8EgY70sQZz8jgj+JIdlBtR2bjMVEXRKwiCzknVGsEuIlIxvyVo0r90RIDjewXYyDQN2tJNK8GueO/UWicD/JxYc3uGllbPhfpN2l70eH1o0IiZsNw1A02r3igoVBi5H8158460YB68KpFrCs9vicFp94vwLg1oIIgu4ajJWp1KJLx1hBNdo7sCJ1j0Is6O2KAE5gBLF7I/09VUDLnXyrjhvb+/8JaW9ZAUo0FIFmk/uaQxZGDgCv4wMNO8FBwRl8hCpEk9OuG/ySw8XrDwnpVVk7NN+JNto/W6HBJTohaLSiX/2dFh1AJH8NZ7ZWd3zURTYUsu+wQk1rFCjn1gPsbdDHKYDneWuUeDOHlh2Ae+u5d+9ICOGL8TIkK/9pm9UGutSyiEy6mJS+665KUmMrXpimjY+cSvjTXEGoMo7w3EI6+H0b6Mb+T+TKOH+G+Q9orZcNayHMKCllZOsubd/gZz6ne5cHI1Ky2yXMWAnGllL+KQxKmTUofXSwsK80iN8VKtE78fEQj9w1JwX85RiHxmQon+8sFJ0kj4gK/4HGs8+Hh7rtspEDv9wVG9do1VhgVrz6s/5hTNRiLD+9Nt1riR18mXfa35wSNGw5BS/ZJssOtf6juxkgBgqB6v4houuFaMxFHWK8lT7wdHx30CVaNNBZ4Rtm0QgJWcSR2IIYic9zTw8CgC4EoA4PDxoxbV3OPqRsJLJZPJNGSwmFbImePq0gN33pHbO4Q7LX9GWvJZ7AgiAsLOyWMmXU1fMoa7brHh0xuf/1skwA/fzrF4e4/R91Pp14pvfy1dhv446SdJoNkvJepa2YUvS5xvyccDuMZbfEH7Qx9b3oiSVlt9ymDAz2f8pTxxjtYCVQSruredmrPXBz1j8J9IX3VM+gbUGXh7DRtP73RQukIKEbKOKj9rcVByUc3NHqxp+Bu/Z3LwO/cgYfeGlJah3e6YAhVFLQfIM07iQWibeXI6sVlGy0uOdXdQCS8YjUB1BBIgPm9csimznvG8uWtH0Ir59SryrUxCTW9QihRaNihWZGdmTAJr1d/aT+Xb7ijhy9+JG6KR4OCOSIkgxztnvOk7QARNndVDTYYNe5sNXvjTibWR/XQ+tPZZ1NLW2xm2Zgmh8qVvw+FVKXC4Qb2OqnzSml4ZYL+CgUGakj/D4aIM8xG93zrfrjDcJBor7YYn87U+LFwwUi8n5z3dLuqpRRpSaVhTR7DXvLi X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ec70e357-7271-4be4-4a86-08dba1f7f551 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2023 03:37:35.0339 (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: Sz2FzhdBe4Ta/bpREumAFJTfl/AyGU/EEIWsG/MFiehx/HZC9mUCa8kkdTbLPFKmuQtnx/N2boVneVpT2dZV5w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7758 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230820_203738_425544_F55B6DD4 X-CRM114-Status: GOOD ( 14.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org According to Synopsys DW MIPI DSI host databook, HSTX and LPRX timeout contention detections are measured in TO_CLK_DIVISION cycles. However, the current driver programs magic values to TO_CLK_DIVISION, HSTX_TO_CNT and LPRX_TO_CNT register fields, which makes timeout error event wrongly happen for some video modes, at least for the typical 1920x1080p@60 video mode read from a HDMI monitor driven by ADV7535 DSI to HDMI bridge. While at it, the current driver doesn't enable interrupt to handle or complain about the error status, so true error just happens silently except for display distortions by visual check. Disable the timeout check by setting those timeout register fields to zero for now until someone comes along with better computations for the timeout values. Although the databook doesn't mention what happens when they are set to zero, it turns out the false error doesn't happen for the 1920x1080p@60 video mode at least. Signed-off-by: Liu Ying Reviewed-by: Neil Armstrong --- v2->v3: * Add Neil's R-b tag from v1. v1->v2: * No change. drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c index c10ca32dff0b..9af97895c243 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c @@ -686,7 +686,7 @@ static void dw_mipi_dsi_init(struct dw_mipi_dsi *dsi) * timeout clock division should be computed with the * high speed transmission counter timeout and byte lane... */ - dsi_write(dsi, DSI_CLKMGR_CFG, TO_CLK_DIVISION(10) | + dsi_write(dsi, DSI_CLKMGR_CFG, TO_CLK_DIVISION(0) | TX_ESC_CLK_DIVISION(esc_clk_division)); } @@ -749,7 +749,7 @@ static void dw_mipi_dsi_command_mode_config(struct dw_mipi_dsi *dsi) * compute high speed transmission counter timeout according * to the timeout clock division (TO_CLK_DIVISION) and byte lane... */ - dsi_write(dsi, DSI_TO_CNT_CFG, HSTX_TO_CNT(1000) | LPRX_TO_CNT(1000)); + dsi_write(dsi, DSI_TO_CNT_CFG, HSTX_TO_CNT(0) | LPRX_TO_CNT(0)); /* * TODO dw drv improvements * the Bus-Turn-Around Timeout Counter should be computed From patchwork Mon Aug 21 03:40:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13359052 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 78D8BEE4996 for ; Mon, 21 Aug 2023 03:38:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jFspaEZmRmKQbcAQzuaerccT1FO4/6G5qD5wKEr+OFs=; b=C5iDiCRdI2U+0B bG2ErlY1Qj8OIgzgRF1/JKIXoDn/BqYeGMv8Q6UbaJ2KRVDVB22ttIc3E6kYhfKh59Oz9Pja0tl56 q1drw/BBGSyqptvaucCH7WaSdery+5YlFL6MeDwVV1bwZ8ql897DmdIGTX0nlRgmw0GcL1zlZ9Umg swpqhy7t1E2nMe91yvEKfuVpS3CfyeOvEYrvCI6x49kwOU9l4ddPJsUSB7crkYzweoCdR1e7LLV+w frhWgcTHg+KociiV0UJB7SH0VI2j5x6O5i9AoS1qIwxFtiwW0+0AMgEvsVomBTHodpK8Dt23Opo4J NUeEKxuu3qwjCZ8PQvNg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qXvjg-00D0So-1k; Mon, 21 Aug 2023 03:37:48 +0000 Received: from mail-db3eur04on0631.outbound.protection.outlook.com ([2a01:111:f400:fe0c::631] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qXvjd-00D0QW-0F for linux-arm-kernel@lists.infradead.org; Mon, 21 Aug 2023 03:37:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QdksJzKeCQ+sx2kS/2V2q0UgOisgghdxTJFpIpMQEq4Adj7WtT3TV7BoRzV9GN7o0OvcjlGVLetzeymOaNpaEb/WusTDtuO0Fe+HCe3wJmsUuSGaTyyEkgXVS/EITKXhCinrcm390CV9ppnRaQKo1gIA1+QhmK6qHlATwxh5n9pfGhknsq5i8RBgcEDWg022DrJLwxstfKf2dB8LBrGPneMaCvAjX3tVMqo9Szq/wOn9XavNDuoiw+P3cD0RIagkdPQ/9QgEt/EQvRDguuW3yYZYCArZVvjJ+LtEY3XtMcVF1wWlif8B4y+BVVOIV18WmnyU0cVjNGgnrpf6+r/FjQ== 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=QaSy5Q0CXsysYWOiOideIJmkgVMU5fTcbKDsyETU8EA=; b=Bp61OPv1E59YXBinTpJWpcDQ8pZ06TTqPHSp+70CBmLwnFGOOBMV58EwwtTpj0e1l9YzwQhZQqr32BuyESr9PQXK4yyR1MERpMy2H6T6+kdygAAq8kF4u2IAzNsTJNzLMQgTIH4fyv40pK0c3TggMjln0050quPzb/rdcvcPuNcPONp0dJGvDfteavWPit8X0xUZgeOD3MpoM5bovDW43RXLQZ81j72ui3EOGeubaOrImuvFvo8LMqdEW0mOOpcuJyEsCiZetkVRZxsNgrOKZMXBCD1fOhpJszv6D9Fo3MlZ3NdNFH6rkeVx9Jl/WBnpyO65OpPf+WxmRWZxrwuLBw== 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=QaSy5Q0CXsysYWOiOideIJmkgVMU5fTcbKDsyETU8EA=; b=lnyL61r0OG2JRw2T6W245y+1ZtgTTkfqbyNyJgz3CRkjDV7yqhMwoshthPZQs5u9smQeeODD23/ubX4qfBOqChmVf5Czy5hSaa3ip+xnpZCnziuJTK9pSIU/BRVoR8kMZwnt1m6kpwegY7KNmsRgNsdempaw1YPlNZ9TQ9190Ws= 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 PA4PR04MB7758.eurprd04.prod.outlook.com (2603:10a6:102:c4::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.20; Mon, 21 Aug 2023 03:37:42 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::9018:e395:332c:e24b]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::9018:e395:332c:e24b%4]) with mapi id 15.20.6699.022; Mon, 21 Aug 2023 03:37:42 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: andrzej.hajda@intel.com, neil.armstrong@linaro.org, rfoss@kernel.org, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, airlied@gmail.com, daniel@ffwll.ch, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, alexander.stein@ew.tq-group.com, sam@ravnborg.org, jagan@amarulasolutions.com, yannick.fertre@foss.st.com, raphael.gallais-pou@foss.st.com, philippe.cornu@foss.st.com, hjc@rock-chips.com, heiko@sntech.de, zyw@rock-chips.com, Rob Herring Subject: [PATCH v3 RESEND 8/9] dt-bindings: display: bridge: Document Freescale i.MX93 MIPI DSI Date: Mon, 21 Aug 2023 11:40:07 +0800 Message-Id: <20230821034008.3876938-9-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230821034008.3876938-1-victor.liu@nxp.com> References: <20230821034008.3876938-1-victor.liu@nxp.com> X-ClientProxiedBy: SI2P153CA0025.APCP153.PROD.OUTLOOK.COM (2603:1096:4:190::12) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|PA4PR04MB7758:EE_ X-MS-Office365-Filtering-Correlation-Id: 1e912c4a-66d5-4884-520f-08dba1f7fa00 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mLa1p0JUlk7LU4/ZQ2d9vSdssuPL6HSe8ahGEw/3d1XEX9KjhO/E/oPzCyxVHY9VEurHjDIqT9Tr/hB9RlDK/2r+UvD8XpiKc6/Hqui9S0kc+dhK9TaSPYMHpt861jy4Af0EqWEXvi5I0bEAgpsPKsZrOFYZkwXDpuqqeclFGExSIl9pKTPwFY4lr/gKlItWDcNqT9GGN30Ae0ogYV1yvcU8ovubBoCtprxBt35M6nq0kaiSoBa9b5kMmD0O+kmtFtL5j2YvKJfPmKGmD8kgKScGGGvM7ewj4isxysjvZpLKzeE4JEwS94PtbLqypj8LClmWnevvD1bAwlftynrgmmL9lgdmAyZm0LFk0IZi09/ncnwTrYzkQoOQ+ZI79isz6SWux3ksgrZn9Xzl9jl6amNW7H8kgqBJJVAwHGel2i8jX7SOmBVFqm48ZPVExsXB629hLuVLyvrtnhsf2wHAvKq+namCZaSYCayhf+Ev4I9BJD6DYSboJ5xCpEiEzxHbDMnkALSNy2R7BHf6NSkrvwYfYTEb/iO7P5Iwxp3+rJBHMLAgF6GfCX2LAUoCzzCzdvVwUOJuLNnoZBkNqAEPsXgPlhoJTnWh8wKBZsMeiWwhqOqnwtmgohK+erR8p8pTg7iP6OPFgKjd1lDdVBoa8Q== 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:(13230031)(376002)(39860400002)(136003)(396003)(366004)(346002)(186009)(1800799009)(451199024)(1076003)(2616005)(26005)(6512007)(38350700002)(38100700002)(36756003)(86362001)(83380400001)(316002)(8936002)(8676002)(41300700001)(66476007)(66556008)(66946007)(2906002)(4326008)(478600001)(7416002)(6506007)(6486002)(6666004)(52116002)(966005)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: oXWOCZOlm2yjz0G7a+O44/ESCA09E25tFQSMH9cjK7fAqfNChBohYpvlD3GzEyeOgAuCihFkCK8tnkD55iHRJI+I1lZdMoWMMYwvtSRh6W+rOHbavp/IlDzpkq9Ekse4FFF/qVgABDzja9GJqYy5oRa2yR4buyC3B8z/TBev3LBdRVuZUAvWrr7/N9RxmLhLgl/9gYz2oaj9UUxZC6y92Z0Mg1D/N85gG8ZkGasPNj6Ol5imZ6l+pI0wBY3/dUv6bq3igLuO8tYRbxlUTkRZsOzl4I8lQ1IG0UCAs3OlE8eY74Bfmp/V+0+pawopStyqEqBOuwL20eab1xdRKZg2tjdEajrtV1IgTdddO9COeZXCahjrMRPT/uFQZQtar+MHsqmYy541qcT9UYO3eQG/UF5YbDSRRl3tA4Hh8lqGj0xIlUejRs2A6KxPKNo88s4Cq9W/xJ5tOk2VMyICWQCgBf5itnSItDL/lSuPrXhb77F9zA03+5zzydTjXQndbj8VCQPPHWUsvjNNShJAI/QEFj6kXz3KQ+hqEwByI1AXXKQCnjJ44FWmZ0FXphrzeJR3Robj3daarMu6JKwYrku87o/rJgRBSjr6P64lZMJx+wkGJIVlgziBFcsd7/9LLZGPuFGIGLefxv3Qqp2kPW9p21E9haoCwHc7zTbk06J5P1NIOTs24UlxuhYa1hv0cmxTIF5cs90Vv7tQF50LUCkQS8nQUKhogVJO5Of59a/Z/uD1aas3s1S36jnlKKVYkpYBfOd2EG6F8mlPjzJ9KviEUlhaVXzl/bSi/qDtFXKbm1xPhN3qATIY8uAEETmu0UYVXDeHIdFuTMf9Sq4oXXnTLC/lGdpY3sz3erMJhTtjbWfEkp0pUfsuI8+6gFzM7kF8XMuZ6x19ESwrJ8GT1bW1PgxYz20TdMmYpQoXTGyruWnuKdY7HQYcXwAL1vym9YtLp87wdA0OWAzxU2dwj5F8mTRzD0ui8NytayRfK4/aV2mCoReXbAhXsz9sdmPWCjJI4LthhZoxcpa6vejkAYc5LMm5/qEXQI/Rd2kHkODTkFZZhGailGKg7Eh4XKPiKeU3/6SW0X/aTjr2rpyPK6gmOKsgpdAB1GNLKj5dqrHKJZYsEnysFPvL/zvsWJPpjBKRaVl1bRH77TPWMeGessnhI1MQQpG4X4h+HrTdqC55L0Pr1dejHLkFS9ogQ9ZSi7RhYIyA9JUrE3pbPSgO/GuGdW2IiPuWxWFJGxR+UV5uBactW/pQwwsjNLzp2z56yS/tBuDbyBXEbynNiOWTh6swBpzwSS34i+CTzXTJ+0EuaCZ4lUispj/TOVMRiGrsBWkYtp5lKP+SnmmFJO3T8ckXqaUWijIwBVQ1KuQwUCI3b+speJtdnAucADcr0TN5w2Ub9dsMjfaKCjMYnoEuLHaCDDOhidLyX6dmImPALNdp2mtqiy+f7D17o7Nbu9tHVbaqAbc4Rjba5UlvJHkxbGBMabSq22ij5Sd8GgBBXmpJ2To3w9ALOncWnH2FETB8qniJGRwW4ZiREHb5hOEWoqvPv38AjZBVr5pdPJl85Nqjk62WSGaaCXFVYjCAz22DIND7 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1e912c4a-66d5-4884-520f-08dba1f7fa00 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2023 03:37:42.8059 (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: bv9ezjLVLRrLd0cBRx8R5n/cGa5peuKWxQ4d3eyery+jPRYFe9THmH8m5GewstqKhg/AJY4p8ZpW/vcnbP5n/w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7758 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230820_203745_122005_7782AEFC X-CRM114-Status: GOOD ( 12.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Freescale i.MX93 SoC embeds a Synopsys Designware MIPI DSI host controller and a Synopsys Designware MIPI DPHY. Some configurations and extensions to them are controlled by i.MX93 media blk-ctrl. Signed-off-by: Liu Ying Reviewed-by: Rob Herring --- v2->v3: * No change. v1->v2: * Add Rob's R-b tag. .../display/bridge/fsl,imx93-mipi-dsi.yaml | 115 ++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/bridge/fsl,imx93-mipi-dsi.yaml diff --git a/Documentation/devicetree/bindings/display/bridge/fsl,imx93-mipi-dsi.yaml b/Documentation/devicetree/bindings/display/bridge/fsl,imx93-mipi-dsi.yaml new file mode 100644 index 000000000000..d6e51d0cf546 --- /dev/null +++ b/Documentation/devicetree/bindings/display/bridge/fsl,imx93-mipi-dsi.yaml @@ -0,0 +1,115 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/bridge/fsl,imx93-mipi-dsi.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Freescale i.MX93 specific extensions to Synopsys Designware MIPI DSI + +maintainers: + - Liu Ying + +description: | + There is a Synopsys Designware MIPI DSI Host Controller and a Synopsys + Designware MIPI DPHY embedded in Freescale i.MX93 SoC. Some configurations + and extensions to them are controlled by i.MX93 media blk-ctrl. + +allOf: + - $ref: snps,dw-mipi-dsi.yaml# + +properties: + compatible: + const: fsl,imx93-mipi-dsi + + clocks: + items: + - description: apb clock + - description: pixel clock + - description: PHY configuration clock + - description: PHY reference clock + + clock-names: + items: + - const: pclk + - const: pix + - const: phy_cfg + - const: phy_ref + + interrupts: + maxItems: 1 + + fsl,media-blk-ctrl: + $ref: /schemas/types.yaml#/definitions/phandle + description: + i.MX93 media blk-ctrl, as a syscon, controls pixel component bit map + configurations from LCDIF display controller to the MIPI DSI host + controller and MIPI DPHY PLL related configurations through PLL SoC + interface. + + power-domains: + maxItems: 1 + +required: + - compatible + - interrupts + - fsl,media-blk-ctrl + - power-domains + +unevaluatedProperties: false + +examples: + - | + #include + #include + #include + #include + + dsi@4ae10000 { + compatible = "fsl,imx93-mipi-dsi"; + reg = <0x4ae10000 0x10000>; + interrupts = ; + clocks = <&clk IMX93_CLK_MIPI_DSI_GATE>, + <&clk IMX93_CLK_MEDIA_DISP_PIX>, + <&clk IMX93_CLK_MIPI_PHY_CFG>, + <&clk IMX93_CLK_24M>; + clock-names = "pclk", "pix", "phy_cfg", "phy_ref"; + fsl,media-blk-ctrl = <&media_blk_ctrl>; + power-domains = <&media_blk_ctrl IMX93_MEDIABLK_PD_MIPI_DSI>; + #address-cells = <1>; + #size-cells = <0>; + + panel@0 { + compatible = "raydium,rm67191"; + reg = <0>; + reset-gpios = <&adp5585gpio 6 GPIO_ACTIVE_LOW>; + dsi-lanes = <4>; + video-mode = <2>; + + port { + panel_in: endpoint { + remote-endpoint = <&dsi_out>; + }; + }; + }; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + + dsi_to_lcdif: endpoint { + remote-endpoint = <&lcdif_to_dsi>; + }; + }; + + port@1 { + reg = <1>; + + dsi_out: endpoint { + remote-endpoint = <&panel_in>; + }; + }; + }; + }; From patchwork Mon Aug 21 03:40:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13359053 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 958F3EE49A6 for ; Mon, 21 Aug 2023 03:38:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=R6T3dxVGVeKOD04gZ/q7Vrthm/jT1YAVtPihmMt8WlQ=; b=a504FxHd847Vdo rJx+GH9+YwaD0p/+EpNtE/gMpOCRGNhjzzy58lA0Vo/0XV9YTnFMaTfSTGd3oCobZG0wwoiRisHKU 9Wy1Cnul4yN1LjTPyV7Q4mmrFNl+KU43IsfPOCroog15Pasa9K1G2GcpDdaksmdYN9usqT0MhbTlr K4my2yNJ1IYLeX+OgE7a0ZhpK5hemH/IIePxUi/TopL5i2W4aaLNol5d1/ucA7WYH7vNntYvlyKjT kKvnfVjCRZIWTIEFM2pjt5qAGKW5Q90r1t6jodxXTQL4m7coWjZoZnmq8wojSbR3YPOkY0pUcMaRG J+mr5hCFoS7OtcIpAHEA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qXvjr-00D0Z8-0P; Mon, 21 Aug 2023 03:37:59 +0000 Received: from mail-dbaeur03on2062d.outbound.protection.outlook.com ([2a01:111:f400:fe1a::62d] helo=EUR03-DBA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qXvjm-00D0VV-0F for linux-arm-kernel@lists.infradead.org; Mon, 21 Aug 2023 03:37:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RkXNbKf35CUaGHYfc8PtDyisrPCPWQH8GLU4q1Nt5EOicWb7Fs67gqnZjZOoQmc2LEy7/Njhv3mMIDdlBDtXArzKr/VTVik3XbeGhRc/FoUvY4IwKbj4G7w12/C//FZdfpp4G0idTc9IjRbvzkbaEPh+16EgAQxqSz2lqotNfZuZMC9Azw9WLv5ebVCL6gG/Kraflt6TcXEBaRjN42WmsDf/fnnnp1TBN5x6Cz/gTT1IlfywG1zgwdrLfxx25TqjJ25HIMC80p2MMHv0luuXB3DCmvLBBh059keT8NA5MQHN/XNlhioI6K5kHxDonB9xhXzIE2y1U3doLRrXr7oABQ== 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=1q9U4p8M3eCr1pPQLE1PqxC7716K2kLcf/CpA5FfdLs=; b=d2ugQAc7dVJpMf9KmgdszXeZg/GyD0JlWf7VlPnlPg+LbUhpg/nJ7p6jjNDB4MQN3kOF1jJh2Nndvf2uQROhzfYC+TnaPp/NxopggIKz3ZXRIkVBd+o/VriNO3lMdMmQKBOOOaY65gXz74Kbf6q84e0NEUv9fpF6tZzKHb+gpBqPnLciN03BZmrY5dGreZaU6fkxks8CMNZ8S6rEThEzoon209isC+/r0ai2AAZYX/uEYud1AuxZ4M9eWIHBlmGOLW5nixuR7/kkFt5j1RIakIegkpv9cvXzpwRIXAj5tHiSwaoyCMBLq7bU9t3GkygUkWjO4stPZrfydp7GCOXj6Q== 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=1q9U4p8M3eCr1pPQLE1PqxC7716K2kLcf/CpA5FfdLs=; b=kXlh/dV1MMB5gY+FupDM4yiD4ciJOKlWYdEoGO/JsK99vSZB3TSykGPsAWWz+dK+PI0wzILCCGD0OdIpjkq7Oo8tOtVw/QpNyApW/6X1odKXasuLM41B1oB3c5zyAcJmDJ71MS18xGl0Q3N7Zr7mFQuQw0dqIbeQ1eidNJmjX98= 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 PA4PR04MB7758.eurprd04.prod.outlook.com (2603:10a6:102:c4::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.20; Mon, 21 Aug 2023 03:37:50 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::9018:e395:332c:e24b]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::9018:e395:332c:e24b%4]) with mapi id 15.20.6699.022; Mon, 21 Aug 2023 03:37:50 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: andrzej.hajda@intel.com, neil.armstrong@linaro.org, rfoss@kernel.org, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, airlied@gmail.com, daniel@ffwll.ch, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, alexander.stein@ew.tq-group.com, sam@ravnborg.org, jagan@amarulasolutions.com, yannick.fertre@foss.st.com, raphael.gallais-pou@foss.st.com, philippe.cornu@foss.st.com, hjc@rock-chips.com, heiko@sntech.de, zyw@rock-chips.com Subject: [PATCH v3 RESEND 9/9] drm/bridge: imx: Add i.MX93 MIPI DSI support Date: Mon, 21 Aug 2023 11:40:08 +0800 Message-Id: <20230821034008.3876938-10-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230821034008.3876938-1-victor.liu@nxp.com> References: <20230821034008.3876938-1-victor.liu@nxp.com> X-ClientProxiedBy: SI2P153CA0025.APCP153.PROD.OUTLOOK.COM (2603:1096:4:190::12) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|PA4PR04MB7758:EE_ X-MS-Office365-Filtering-Correlation-Id: 21c7b487-98e2-495c-9add-08dba1f7fe6c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IvH2UkgpHLelRx2yexEdf73ixf6ysixmwjJpTrKTtEDiuywpLOwpfgp/RyDLF/Yfrt83MzgvjSJEKomHeNBUhsGD3ZWw+/7rj0Enisx8GkW0w9qXFznA5zm4J3o8z/24DnIlBuSdhZo7bzTDbOJ4rX0uLNDXL3wx3NPD4+MEmYhp3hsZ5DhdBnhjC7Pq6HAN6HMcrBOYpv81BLCwKyadw7J/VJiug2cmAfgSn409yXg0xzRuAj1lbeJTmMVIg7Bl2X1cPdpm/gTCL0iGYpM0AscmaB3QjV3wJrNqvFkaP4mCAg13BVOCudwp75qJA0qu6a9oqvzx/KvoxXNzteSDbCZaGvkfsKBXphv0WaB0cGm1FI0AJ7BEWEcZF7+lWnq0LqdXfBJ2r3jevN6BMdAsUg/VhF+QOhEFR065tWWafWGHBYWT3/v4T7mVzj6jyuF3EkLfNWQypqoDPDbW8hbto4RHeLF5BZAlVqrhx7JSZNJ5NrzlQRYmKTl/LhmiT3H34BEB2Ztd1ox+4mIb1Wqk+ow4aBNuiTVMdJF65/uSMaWeUT5FF6RSGPx5U5N7oMdp3nvEV7S6aevcZnCylg5HO4faUJiRDBTNvLftaYyC0Cu3Vf2X0E0/dSMDXX1isAbL 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:(13230031)(376002)(39860400002)(136003)(396003)(366004)(346002)(186009)(1800799009)(451199024)(1076003)(2616005)(26005)(6512007)(38350700002)(38100700002)(36756003)(86362001)(83380400001)(316002)(8936002)(8676002)(41300700001)(66476007)(66556008)(66946007)(2906002)(30864003)(4326008)(478600001)(7416002)(6506007)(6486002)(6666004)(52116002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hwcTevKG84e+ofabVrT8ov+2RP6kaKKjLwKOTkj89s7kG9NgwZnAEKLhSAupJwtSrrfQ74+O2UDmJ8GSAetHfip8BaFaOcPsTiwRQx/ptFbuTKydH6ZPnF/TAxoRo5PKBB38DpfhWKXp9Cei512YXQA9x/O/3BFTzWcs6vx4d3F4gTER8Mk1YVjoauRjqV2Qj+jpPndJ8/pHKz3IDyBPNess+qHR/qXfpML2wrUt6R72MvN9rDz0rq/xDncqBiVOoOahqInI0nO4nQ4jR6hZPdMBtR3pr5W6T/s8XJ6PswUBkcYgkStEUGxlMGrZzI12RnuoSN60lsEgFr+1hB+3F0ruk9UIttXykdVr9uxpSY8cS57x76dguNW7GCuUJAzuCrJGUL50ITvT3ZaxjEDcn5rzKkSImYjxDl3hN+V5GcHK1gM57HyZtxJy7SKHVyPczMrhcWrBiGHUwv5cAUc+facsR6t5fkc5t/c5b7icVqals20oIH5lS9AfgYiZzq/fKeX5UgaIW63FOpD+ALGv4nlEakY1GNgvfr9ADY/4I8JSDHkMVMwQjVnJo27rAEknaH3cqTOYPFg6jnZ/epbg6f5rXjgY8EA9sIGhiovj6DlC/Ng5lvVhzZBahWNAJSPeUdcEG2trDefYvin72oqI0RE5DmXK+fT1TqpdTXCONGPQvIO1SvbtfV6kNkM+bfuizc+iDE8NoeDNkVdeH/sU4nLc+Pe7M5iSfZFVn/XLR5RMD1q8nfJEs36d1Tk+cLNP3ioDvdkRFn5TNuuNp3lmhojafLySOUz92mDTgJlcubqXhqeFRYJxc4C+6pKNu/qeAD4jKDhFnv/ponJDlLEDDWCxO5BfV6agYOzqjC4rQMhjp/mg3Ki3v2W2vfWF0HrexznVAlahGQn75Q8TU71FR17iaeCIK5QkxkXbrxQw4Em8vu2N81ZWBxX9N3pVPVpnPH4Msg7BDMjXkQ6yzsMZEOLBr/Kvy8vF2+kknHIdZ9NGggyxUoos0aRfk+AJqyF+9l5lcBFzUzPH8g/u/5oKOyQbpBTG6Ors36HxUATuAkkYj90oqtEKw587mJW/xyCNBF7J28FKyHWrm9Iqc2h/+RJAy2KIphp/SBwKj0Mi4HvnRHc37bi1J8PuWOxp6qTAICZka8L+JiBAvFizF+Ro4+RfyzX6T9G8Odf8Fovnae5WMfiHj6URRnTcf/1sWwraZGjrMrfKBXDAkatPD5O3bXg+Fh5Ou/CBrEOdfXc/9B9l/pSVWq64aPKib1KzuSKgkYWaeeDNj4oeHWsd6LSWz8Mn5iBOTKrODbY6xBbtRJ3bfzcT7wPGknNNPOUX4q7YSwUzyi9Z+8owfraWtf/OvX+7GdFBQIe61dc8Ru0OEgP43TeQiIhQpMyluB30KSFQ1pG/ytkvhQ/2odFb1TuXkxTT0BVeisIXITHay8+btuIWGKFLT11XmtyRmgMI7ejTvw21mUGTys3FPwfOtg7a97zAgwyIVyBJ84gkJQmoFCqMqqLYtvL1CrYc/39Ch146cHvETtbCNUOrtD2gUqsOyh0I5b3qtHhykSeMyNpviOzhG7W/0ZbaTdGUTCYtoJBG X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 21c7b487-98e2-495c-9add-08dba1f7fe6c X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2023 03:37:50.4093 (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: N2FPIqKnC5vVbOOvgy5xLfbIEjuZZG6d7WpGzcJXGJkwe9L464hpmirNEEcJ0oh3OVSHJUMsRt8XDfOwMqkEZg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7758 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230820_203754_278072_8D853E52 X-CRM114-Status: GOOD ( 16.64 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Freescale i.MX93 SoC embeds a Synopsys Designware MIPI DSI host controller and a Synopsys Designware MIPI DPHY. Some configurations and extensions to them are controlled by i.MX93 media blk-ctrl. Add a DRM bridge for i.MX93 MIPI DSI by using existing DW MIPI DSI bridge helpers and implementing i.MX93 MIPI DSI specific extensions. Signed-off-by: Liu Ying Reviewed-by: Robert Foss --- v2->v3: * Select GENERIC_PHY to fix Kconfig warning for GENERIC_PHY_MIPI_DPHY dependency. v1->v2: * Use dev_err_probe() to replace DRM_DEV_ERROR(). (Sam and Alexander) * Use dev_*() to replace DRM_*(). (Sam) * Fix build for arm architecture. (Reported-by: kernel test robot ) * Improve error messages for imx93_dsi_phy_init(). drivers/gpu/drm/bridge/imx/Kconfig | 11 + drivers/gpu/drm/bridge/imx/Makefile | 1 + drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c | 917 ++++++++++++++++++++ 3 files changed, 929 insertions(+) create mode 100644 drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c diff --git a/drivers/gpu/drm/bridge/imx/Kconfig b/drivers/gpu/drm/bridge/imx/Kconfig index 9fae28db6aa7..5a4f3d58501e 100644 --- a/drivers/gpu/drm/bridge/imx/Kconfig +++ b/drivers/gpu/drm/bridge/imx/Kconfig @@ -49,4 +49,15 @@ config DRM_IMX8QXP_PIXEL_LINK_TO_DPI Choose this to enable pixel link to display pixel interface(PXL2DPI) found in Freescale i.MX8qxp processor. +config DRM_IMX93_MIPI_DSI + tristate "Freescale i.MX93 specific extensions for Synopsys DW MIPI DSI" + depends on OF + depends on COMMON_CLK + select DRM_DW_MIPI_DSI + select GENERIC_PHY + select GENERIC_PHY_MIPI_DPHY + help + Choose this to enable MIPI DSI controller found in Freescale i.MX93 + processor. + endif # ARCH_MXC || COMPILE_TEST diff --git a/drivers/gpu/drm/bridge/imx/Makefile b/drivers/gpu/drm/bridge/imx/Makefile index 8e2ebf3399a1..2b0c2e44aa1b 100644 --- a/drivers/gpu/drm/bridge/imx/Makefile +++ b/drivers/gpu/drm/bridge/imx/Makefile @@ -4,3 +4,4 @@ obj-$(CONFIG_DRM_IMX8QXP_LDB) += imx8qxp-ldb.o obj-$(CONFIG_DRM_IMX8QXP_PIXEL_COMBINER) += imx8qxp-pixel-combiner.o obj-$(CONFIG_DRM_IMX8QXP_PIXEL_LINK) += imx8qxp-pixel-link.o obj-$(CONFIG_DRM_IMX8QXP_PIXEL_LINK_TO_DPI) += imx8qxp-pxl2dpi.o +obj-$(CONFIG_DRM_IMX93_MIPI_DSI) += imx93-mipi-dsi.o diff --git a/drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c b/drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c new file mode 100644 index 000000000000..3ff30ce80c5b --- /dev/null +++ b/drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c @@ -0,0 +1,917 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/* + * Copyright 2022,2023 NXP + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +/* DPHY PLL configuration registers */ +#define DSI_REG 0x4c +#define CFGCLKFREQRANGE_MASK GENMASK(5, 0) +#define CFGCLKFREQRANGE(x) FIELD_PREP(CFGCLKFREQRANGE_MASK, (x)) +#define CLKSEL_MASK GENMASK(7, 6) +#define CLKSEL_STOP FIELD_PREP(CLKSEL_MASK, 0) +#define CLKSEL_GEN FIELD_PREP(CLKSEL_MASK, 1) +#define CLKSEL_EXT FIELD_PREP(CLKSEL_MASK, 2) +#define HSFREQRANGE_MASK GENMASK(14, 8) +#define HSFREQRANGE(x) FIELD_PREP(HSFREQRANGE_MASK, (x)) +#define UPDATE_PLL BIT(17) +#define SHADOW_CLR BIT(18) +#define CLK_EXT BIT(19) + +#define DSI_WRITE_REG0 0x50 +#define M_MASK GENMASK(9, 0) +#define M(x) FIELD_PREP(M_MASK, ((x) - 2)) +#define N_MASK GENMASK(13, 10) +#define N(x) FIELD_PREP(N_MASK, ((x) - 1)) +#define VCO_CTRL_MASK GENMASK(19, 14) +#define VCO_CTRL(x) FIELD_PREP(VCO_CTRL_MASK, (x)) +#define PROP_CTRL_MASK GENMASK(25, 20) +#define PROP_CTRL(x) FIELD_PREP(PROP_CTRL_MASK, (x)) +#define INT_CTRL_MASK GENMASK(31, 26) +#define INT_CTRL(x) FIELD_PREP(INT_CTRL_MASK, (x)) + +#define DSI_WRITE_REG1 0x54 +#define GMP_CTRL_MASK GENMASK(1, 0) +#define GMP_CTRL(x) FIELD_PREP(GMP_CTRL_MASK, (x)) +#define CPBIAS_CTRL_MASK GENMASK(8, 2) +#define CPBIAS_CTRL(x) FIELD_PREP(CPBIAS_CTRL_MASK, (x)) +#define PLL_SHADOW_CTRL BIT(9) + +/* display mux control register */ +#define DISPLAY_MUX 0x60 +#define MIPI_DSI_RGB666_MAP_CFG GENMASK(7, 6) +#define RGB666_CONFIG1 FIELD_PREP(MIPI_DSI_RGB666_MAP_CFG, 0) +#define RGB666_CONFIG2 FIELD_PREP(MIPI_DSI_RGB666_MAP_CFG, 1) +#define MIPI_DSI_RGB565_MAP_CFG GENMASK(5, 4) +#define RGB565_CONFIG1 FIELD_PREP(MIPI_DSI_RGB565_MAP_CFG, 0) +#define RGB565_CONFIG2 FIELD_PREP(MIPI_DSI_RGB565_MAP_CFG, 1) +#define RGB565_CONFIG3 FIELD_PREP(MIPI_DSI_RGB565_MAP_CFG, 2) +#define LCDIF_CROSS_LINE_PATTERN GENMASK(3, 0) +#define RGB888_TO_RGB888 FIELD_PREP(LCDIF_CROSS_LINE_PATTERN, 0) +#define RGB888_TO_RGB666 FIELD_PREP(LCDIF_CROSS_LINE_PATTERN, 6) +#define RGB565_TO_RGB565 FIELD_PREP(LCDIF_CROSS_LINE_PATTERN, 7) + +#define MHZ(x) ((x) * 1000000UL) + +#define REF_CLK_RATE_MAX MHZ(64) +#define REF_CLK_RATE_MIN MHZ(2) +#define FOUT_MAX MHZ(1250) +#define FOUT_MIN MHZ(40) +#define FVCO_DIV_FACTOR MHZ(80) + +#define MBPS(x) ((x) * 1000000UL) + +#define DATA_RATE_MAX_SPEED MBPS(2500) +#define DATA_RATE_MIN_SPEED MBPS(80) + +#define M_MAX 625UL +#define M_MIN 64UL + +#define N_MAX 16U +#define N_MIN 1U + +struct imx93_dsi { + struct device *dev; + struct regmap *regmap; + struct clk *clk_pixel; + struct clk *clk_ref; + struct clk *clk_cfg; + struct dw_mipi_dsi *dmd; + struct dw_mipi_dsi_plat_data pdata; + union phy_configure_opts phy_cfg; + unsigned long ref_clk_rate; + u32 format; +}; + +struct dphy_pll_cfg { + u32 m; /* PLL Feedback Multiplication Ratio */ + u32 n; /* PLL Input Frequency Division Ratio */ +}; + +struct dphy_pll_vco_prop { + unsigned long max_fout; + u8 vco_cntl; + u8 prop_cntl; +}; + +struct dphy_pll_hsfreqrange { + unsigned long max_mbps; + u8 hsfreqrange; +}; + +/* DPHY Databook Table 3-13 Charge-pump Programmability */ +static const struct dphy_pll_vco_prop vco_prop_map[] = { + { 55, 0x3f, 0x0d }, + { 82, 0x37, 0x0d }, + { 110, 0x2f, 0x0d }, + { 165, 0x27, 0x0d }, + { 220, 0x1f, 0x0d }, + { 330, 0x17, 0x0d }, + { 440, 0x0f, 0x0d }, + { 660, 0x07, 0x0d }, + { 1149, 0x03, 0x0d }, + { 1152, 0x01, 0x0d }, + { 1250, 0x01, 0x0e }, +}; + +/* DPHY Databook Table 5-7 Frequency Ranges and Defaults */ +static const struct dphy_pll_hsfreqrange hsfreqrange_map[] = { + { 89, 0x00 }, + { 99, 0x10 }, + { 109, 0x20 }, + { 119, 0x30 }, + { 129, 0x01 }, + { 139, 0x11 }, + { 149, 0x21 }, + { 159, 0x31 }, + { 169, 0x02 }, + { 179, 0x12 }, + { 189, 0x22 }, + { 204, 0x32 }, + { 219, 0x03 }, + { 234, 0x13 }, + { 249, 0x23 }, + { 274, 0x33 }, + { 299, 0x04 }, + { 324, 0x14 }, + { 349, 0x25 }, + { 399, 0x35 }, + { 449, 0x05 }, + { 499, 0x16 }, + { 549, 0x26 }, + { 599, 0x37 }, + { 649, 0x07 }, + { 699, 0x18 }, + { 749, 0x28 }, + { 799, 0x39 }, + { 849, 0x09 }, + { 899, 0x19 }, + { 949, 0x29 }, + { 999, 0x3a }, + { 1049, 0x0a }, + { 1099, 0x1a }, + { 1149, 0x2a }, + { 1199, 0x3b }, + { 1249, 0x0b }, + { 1299, 0x1b }, + { 1349, 0x2b }, + { 1399, 0x3c }, + { 1449, 0x0c }, + { 1499, 0x1c }, + { 1549, 0x2c }, + { 1599, 0x3d }, + { 1649, 0x0d }, + { 1699, 0x1d }, + { 1749, 0x2e }, + { 1799, 0x3e }, + { 1849, 0x0e }, + { 1899, 0x1e }, + { 1949, 0x2f }, + { 1999, 0x3f }, + { 2049, 0x0f }, + { 2099, 0x40 }, + { 2149, 0x41 }, + { 2199, 0x42 }, + { 2249, 0x43 }, + { 2299, 0x44 }, + { 2349, 0x45 }, + { 2399, 0x46 }, + { 2449, 0x47 }, + { 2499, 0x48 }, + { 2500, 0x49 }, +}; + +static void dphy_pll_write(struct imx93_dsi *dsi, unsigned int reg, u32 value) +{ + int ret; + + ret = regmap_write(dsi->regmap, reg, value); + if (ret < 0) + dev_err(dsi->dev, "failed to write 0x%08x to pll reg 0x%x: %d\n", + value, reg, ret); +} + +static inline unsigned long data_rate_to_fout(unsigned long data_rate) +{ + /* Fout is half of data rate */ + return data_rate / 2; +} + +static int +dphy_pll_get_configure_from_opts(struct imx93_dsi *dsi, + struct phy_configure_opts_mipi_dphy *dphy_opts, + struct dphy_pll_cfg *cfg) +{ + struct device *dev = dsi->dev; + unsigned long fin = dsi->ref_clk_rate; + unsigned long fout; + unsigned long best_fout = 0; + unsigned int fvco_div; + unsigned int min_n, max_n, n, best_n; + unsigned long m, best_m; + unsigned long min_delta = ULONG_MAX; + unsigned long delta; + u64 tmp; + + if (dphy_opts->hs_clk_rate < DATA_RATE_MIN_SPEED || + dphy_opts->hs_clk_rate > DATA_RATE_MAX_SPEED) { + dev_dbg(dev, "invalid data rate per lane: %lu\n", + dphy_opts->hs_clk_rate); + return -EINVAL; + } + + fout = data_rate_to_fout(dphy_opts->hs_clk_rate); + + /* DPHY Databook 3.3.6.1 Output Frequency */ + /* Fout = Fvco / Fvco_div = (Fin * M) / (Fvco_div * N) */ + /* Fvco_div could be 1/2/4/8 according to Fout range. */ + fvco_div = 8UL / min(DIV_ROUND_UP(fout, FVCO_DIV_FACTOR), 8UL); + + /* limitation: 2MHz <= Fin / N <= 8MHz */ + min_n = DIV_ROUND_UP_ULL((u64)fin, MHZ(8)); + max_n = DIV_ROUND_DOWN_ULL((u64)fin, MHZ(2)); + + /* clamp possible N(s) */ + min_n = clamp(min_n, N_MIN, N_MAX); + max_n = clamp(max_n, N_MIN, N_MAX); + + dev_dbg(dev, "Fout = %lu, Fvco_div = %u, n_range = [%u, %u]\n", + fout, fvco_div, min_n, max_n); + + for (n = min_n; n <= max_n; n++) { + /* M = (Fout * N * Fvco_div) / Fin */ + m = DIV_ROUND_CLOSEST(fout * n * fvco_div, fin); + + /* check M range */ + if (m < M_MIN || m > M_MAX) + continue; + + /* calculate temporary Fout */ + tmp = m * fin; + do_div(tmp, n * fvco_div); + if (tmp < FOUT_MIN || tmp > FOUT_MAX) + continue; + + delta = abs(fout - tmp); + if (delta < min_delta) { + best_n = n; + best_m = m; + min_delta = delta; + best_fout = tmp; + } + } + + if (best_fout) { + cfg->m = best_m; + cfg->n = best_n; + dev_dbg(dev, "best Fout = %lu, m = %u, n = %u\n", + best_fout, cfg->m, cfg->n); + } else { + dev_dbg(dev, "failed to find best Fout\n"); + return -EINVAL; + } + + return 0; +} + +static void dphy_pll_clear_shadow(struct imx93_dsi *dsi) +{ + /* Reference DPHY Databook Figure 3-3 Initialization Timing Diagram. */ + /* Select clock generation first. */ + dphy_pll_write(dsi, DSI_REG, CLKSEL_GEN); + + /* Clear shadow after clock selection is done a while. */ + fsleep(1); + dphy_pll_write(dsi, DSI_REG, CLKSEL_GEN | SHADOW_CLR); + + /* A minimum pulse of 5ns on shadow_clear signal. */ + fsleep(1); + dphy_pll_write(dsi, DSI_REG, CLKSEL_GEN); +} + +static unsigned long dphy_pll_get_cfgclkrange(struct imx93_dsi *dsi) +{ + /* + * DPHY Databook Table 4-4 System Control Signals mentions an equation + * for cfgclkfreqrange[5:0]. + */ + return (clk_get_rate(dsi->clk_cfg) / MHZ(1) - 17) * 4; +} + +static u8 +dphy_pll_get_hsfreqrange(struct phy_configure_opts_mipi_dphy *dphy_opts) +{ + unsigned long mbps = dphy_opts->hs_clk_rate / MHZ(1); + int i; + + for (i = 0; i < ARRAY_SIZE(hsfreqrange_map); i++) + if (mbps <= hsfreqrange_map[i].max_mbps) + return hsfreqrange_map[i].hsfreqrange; + + return 0; +} + +static u8 dphy_pll_get_vco(struct phy_configure_opts_mipi_dphy *dphy_opts) +{ + unsigned long fout = data_rate_to_fout(dphy_opts->hs_clk_rate) / MHZ(1); + int i; + + for (i = 0; i < ARRAY_SIZE(vco_prop_map); i++) + if (fout <= vco_prop_map[i].max_fout) + return vco_prop_map[i].vco_cntl; + + return 0; +} + +static u8 dphy_pll_get_prop(struct phy_configure_opts_mipi_dphy *dphy_opts) +{ + unsigned long fout = data_rate_to_fout(dphy_opts->hs_clk_rate) / MHZ(1); + int i; + + for (i = 0; i < ARRAY_SIZE(vco_prop_map); i++) + if (fout <= vco_prop_map[i].max_fout) + return vco_prop_map[i].prop_cntl; + + return 0; +} + +static int dphy_pll_update(struct imx93_dsi *dsi) +{ + int ret; + + ret = regmap_update_bits(dsi->regmap, DSI_REG, UPDATE_PLL, UPDATE_PLL); + if (ret < 0) { + dev_err(dsi->dev, "failed to set UPDATE_PLL: %d\n", ret); + return ret; + } + + /* + * The updatepll signal should be asserted for a minimum of four clkin + * cycles, according to DPHY Databook Figure 3-3 Initialization Timing + * Diagram. + */ + fsleep(10); + + ret = regmap_update_bits(dsi->regmap, DSI_REG, UPDATE_PLL, 0); + if (ret < 0) { + dev_err(dsi->dev, "failed to clear UPDATE_PLL: %d\n", ret); + return ret; + } + + return 0; +} + +static int dphy_pll_configure(struct imx93_dsi *dsi, union phy_configure_opts *opts) +{ + struct dphy_pll_cfg cfg = { 0 }; + u32 val; + int ret; + + ret = dphy_pll_get_configure_from_opts(dsi, &opts->mipi_dphy, &cfg); + if (ret) { + dev_err(dsi->dev, "failed to get phy pll cfg %d\n", ret); + return ret; + } + + dphy_pll_clear_shadow(dsi); + + /* DSI_REG */ + val = CLKSEL_GEN | + CFGCLKFREQRANGE(dphy_pll_get_cfgclkrange(dsi)) | + HSFREQRANGE(dphy_pll_get_hsfreqrange(&opts->mipi_dphy)); + dphy_pll_write(dsi, DSI_REG, val); + + /* DSI_WRITE_REG0 */ + val = M(cfg.m) | N(cfg.n) | INT_CTRL(0) | + VCO_CTRL(dphy_pll_get_vco(&opts->mipi_dphy)) | + PROP_CTRL(dphy_pll_get_prop(&opts->mipi_dphy)); + dphy_pll_write(dsi, DSI_WRITE_REG0, val); + + /* DSI_WRITE_REG1 */ + dphy_pll_write(dsi, DSI_WRITE_REG1, GMP_CTRL(1) | CPBIAS_CTRL(0x10)); + + ret = clk_prepare_enable(dsi->clk_ref); + if (ret < 0) { + dev_err(dsi->dev, "failed to enable ref clock: %d\n", ret); + return ret; + } + + /* + * At least 10 refclk cycles are required before updatePLL assertion, + * according to DPHY Databook Figure 3-3 Initialization Timing Diagram. + */ + fsleep(10); + + ret = dphy_pll_update(dsi); + if (ret < 0) { + clk_disable_unprepare(dsi->clk_ref); + return ret; + } + + return 0; +} + +static void dphy_pll_clear_reg(struct imx93_dsi *dsi) +{ + dphy_pll_write(dsi, DSI_REG, 0); + dphy_pll_write(dsi, DSI_WRITE_REG0, 0); + dphy_pll_write(dsi, DSI_WRITE_REG1, 0); +} + +static int dphy_pll_init(struct imx93_dsi *dsi) +{ + int ret; + + ret = clk_prepare_enable(dsi->clk_cfg); + if (ret < 0) { + dev_err(dsi->dev, "failed to enable config clock: %d\n", ret); + return ret; + } + + dphy_pll_clear_reg(dsi); + + return 0; +} + +static void dphy_pll_uninit(struct imx93_dsi *dsi) +{ + dphy_pll_clear_reg(dsi); + clk_disable_unprepare(dsi->clk_cfg); +} + +static void dphy_pll_power_off(struct imx93_dsi *dsi) +{ + dphy_pll_clear_reg(dsi); + clk_disable_unprepare(dsi->clk_ref); +} + +static int imx93_dsi_get_phy_configure_opts(struct imx93_dsi *dsi, + const struct drm_display_mode *mode, + union phy_configure_opts *phy_cfg, + u32 lanes, u32 format) +{ + struct device *dev = dsi->dev; + int bpp; + int ret; + + bpp = mipi_dsi_pixel_format_to_bpp(format); + if (bpp < 0) { + dev_dbg(dev, "failed to get bpp for pixel format %d\n", format); + return -EINVAL; + } + + ret = phy_mipi_dphy_get_default_config(mode->clock * MSEC_PER_SEC, bpp, + lanes, &phy_cfg->mipi_dphy); + if (ret < 0) { + dev_dbg(dev, "failed to get default phy cfg %d\n", ret); + return ret; + } + + return 0; +} + +static enum drm_mode_status +imx93_dsi_validate_mode(struct imx93_dsi *dsi, const struct drm_display_mode *mode) +{ + struct drm_bridge *bridge = dw_mipi_dsi_get_bridge(dsi->dmd); + + /* Get the last bridge */ + while (drm_bridge_get_next_bridge(bridge)) + bridge = drm_bridge_get_next_bridge(bridge); + + if ((bridge->ops & DRM_BRIDGE_OP_DETECT) && + (bridge->ops & DRM_BRIDGE_OP_EDID)) { + unsigned long pixel_clock_rate = mode->clock * 1000; + unsigned long rounded_rate; + + /* Allow +/-0.5% pixel clock rate deviation */ + rounded_rate = clk_round_rate(dsi->clk_pixel, pixel_clock_rate); + if (rounded_rate < pixel_clock_rate * 995 / 1000 || + rounded_rate > pixel_clock_rate * 1005 / 1000) { + dev_dbg(dsi->dev, "failed to round clock for mode " DRM_MODE_FMT "\n", + DRM_MODE_ARG(mode)); + return MODE_NOCLOCK; + } + } + + return MODE_OK; +} + +static enum drm_mode_status +imx93_dsi_validate_phy(struct imx93_dsi *dsi, const struct drm_display_mode *mode, + unsigned long mode_flags, u32 lanes, u32 format) +{ + union phy_configure_opts phy_cfg; + struct dphy_pll_cfg cfg = { 0 }; + struct device *dev = dsi->dev; + int ret; + + ret = imx93_dsi_get_phy_configure_opts(dsi, mode, &phy_cfg, lanes, + format); + if (ret < 0) { + dev_dbg(dev, "failed to get phy cfg opts %d\n", ret); + return MODE_ERROR; + } + + ret = dphy_pll_get_configure_from_opts(dsi, &phy_cfg.mipi_dphy, &cfg); + if (ret < 0) { + dev_dbg(dev, "failed to get phy pll cfg %d\n", ret); + return MODE_NOCLOCK; + } + + return MODE_OK; +} + +static enum drm_mode_status +imx93_dsi_mode_valid(void *priv_data, const struct drm_display_mode *mode, + unsigned long mode_flags, u32 lanes, u32 format) +{ + struct imx93_dsi *dsi = priv_data; + struct device *dev = dsi->dev; + enum drm_mode_status ret; + + ret = imx93_dsi_validate_mode(dsi, mode); + if (ret != MODE_OK) { + dev_dbg(dev, "failed to validate mode " DRM_MODE_FMT "\n", + DRM_MODE_ARG(mode)); + return ret; + } + + ret = imx93_dsi_validate_phy(dsi, mode, mode_flags, lanes, format); + if (ret != MODE_OK) { + dev_dbg(dev, "failed to validate phy for mode " DRM_MODE_FMT "\n", + DRM_MODE_ARG(mode)); + return ret; + } + + return MODE_OK; +} + +static bool imx93_dsi_mode_fixup(void *priv_data, + const struct drm_display_mode *mode, + struct drm_display_mode *adjusted_mode) +{ + struct imx93_dsi *dsi = priv_data; + unsigned long pixel_clock_rate; + unsigned long rounded_rate; + + pixel_clock_rate = mode->clock * 1000; + rounded_rate = clk_round_rate(dsi->clk_pixel, pixel_clock_rate); + + memcpy(adjusted_mode, mode, sizeof(*mode)); + adjusted_mode->clock = rounded_rate / 1000; + + dev_dbg(dsi->dev, "adj clock %d for mode " DRM_MODE_FMT "\n", + adjusted_mode->clock, DRM_MODE_ARG(mode)); + + return true; +} + +static u32 *imx93_dsi_get_input_bus_fmts(void *priv_data, + struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state, + u32 output_fmt, + unsigned int *num_input_fmts) +{ + u32 *input_fmts, input_fmt; + + *num_input_fmts = 0; + + switch (output_fmt) { + case MEDIA_BUS_FMT_RGB888_1X24: + case MEDIA_BUS_FMT_RGB666_1X18: + case MEDIA_BUS_FMT_FIXED: + input_fmt = MEDIA_BUS_FMT_RGB888_1X24; + break; + case MEDIA_BUS_FMT_RGB565_1X16: + input_fmt = output_fmt; + break; + default: + return NULL; + } + + input_fmts = kmalloc(sizeof(*input_fmts), GFP_KERNEL); + if (!input_fmts) + return NULL; + input_fmts[0] = input_fmt; + *num_input_fmts = 1; + + return input_fmts; +} + +static int imx93_dsi_phy_init(void *priv_data) +{ + struct imx93_dsi *dsi = priv_data; + unsigned int fmt = 0; + int ret; + + switch (dsi->format) { + case MIPI_DSI_FMT_RGB888: + fmt = RGB888_TO_RGB888; + break; + case MIPI_DSI_FMT_RGB666: + fmt = RGB888_TO_RGB666; + regmap_update_bits(dsi->regmap, DISPLAY_MUX, + MIPI_DSI_RGB666_MAP_CFG, RGB666_CONFIG2); + break; + case MIPI_DSI_FMT_RGB666_PACKED: + fmt = RGB888_TO_RGB666; + regmap_update_bits(dsi->regmap, DISPLAY_MUX, + MIPI_DSI_RGB666_MAP_CFG, RGB666_CONFIG1); + break; + case MIPI_DSI_FMT_RGB565: + fmt = RGB565_TO_RGB565; + regmap_update_bits(dsi->regmap, DISPLAY_MUX, + MIPI_DSI_RGB565_MAP_CFG, RGB565_CONFIG1); + break; + } + + regmap_update_bits(dsi->regmap, DISPLAY_MUX, LCDIF_CROSS_LINE_PATTERN, fmt); + + ret = dphy_pll_init(dsi); + if (ret < 0) { + dev_err(dsi->dev, "failed to init phy pll: %d\n", ret); + return ret; + } + + ret = dphy_pll_configure(dsi, &dsi->phy_cfg); + if (ret < 0) { + dev_err(dsi->dev, "failed to configure phy pll: %d\n", ret); + dphy_pll_uninit(dsi); + return ret; + } + + return 0; +} + +static void imx93_dsi_phy_power_off(void *priv_data) +{ + struct imx93_dsi *dsi = priv_data; + + dphy_pll_power_off(dsi); + dphy_pll_uninit(dsi); +} + +static int +imx93_dsi_get_lane_mbps(void *priv_data, const struct drm_display_mode *mode, + unsigned long mode_flags, u32 lanes, u32 format, + unsigned int *lane_mbps) +{ + struct imx93_dsi *dsi = priv_data; + union phy_configure_opts phy_cfg; + struct device *dev = dsi->dev; + int ret; + + ret = imx93_dsi_get_phy_configure_opts(dsi, mode, &phy_cfg, lanes, + format); + if (ret < 0) { + dev_dbg(dev, "failed to get phy cfg opts %d\n", ret); + return ret; + } + + *lane_mbps = DIV_ROUND_UP(phy_cfg.mipi_dphy.hs_clk_rate, USEC_PER_SEC); + + memcpy(&dsi->phy_cfg, &phy_cfg, sizeof(phy_cfg)); + + dev_dbg(dev, "get lane_mbps %u for mode " DRM_MODE_FMT "\n", + *lane_mbps, DRM_MODE_ARG(mode)); + + return 0; +} + +/* High-Speed Transition Times */ +struct hstt { + unsigned int maxfreq; + struct dw_mipi_dsi_dphy_timing timing; +}; + +#define HSTT(_maxfreq, _c_lp2hs, _c_hs2lp, _d_lp2hs, _d_hs2lp) \ +{ \ + .maxfreq = (_maxfreq), \ + .timing = { \ + .clk_lp2hs = (_c_lp2hs), \ + .clk_hs2lp = (_c_hs2lp), \ + .data_lp2hs = (_d_lp2hs), \ + .data_hs2lp = (_d_hs2lp), \ + } \ +} + +/* DPHY Databook Table A-4 High-Speed Transition Times */ +static const struct hstt hstt_table[] = { + HSTT(80, 21, 17, 15, 10), + HSTT(90, 23, 17, 16, 10), + HSTT(100, 22, 17, 16, 10), + HSTT(110, 25, 18, 17, 11), + HSTT(120, 26, 20, 18, 11), + HSTT(130, 27, 19, 19, 11), + HSTT(140, 27, 19, 19, 11), + HSTT(150, 28, 20, 20, 12), + HSTT(160, 30, 21, 22, 13), + HSTT(170, 30, 21, 23, 13), + HSTT(180, 31, 21, 23, 13), + HSTT(190, 32, 22, 24, 13), + HSTT(205, 35, 22, 25, 13), + HSTT(220, 37, 26, 27, 15), + HSTT(235, 38, 28, 27, 16), + HSTT(250, 41, 29, 30, 17), + HSTT(275, 43, 29, 32, 18), + HSTT(300, 45, 32, 35, 19), + HSTT(325, 48, 33, 36, 18), + HSTT(350, 51, 35, 40, 20), + HSTT(400, 59, 37, 44, 21), + HSTT(450, 65, 40, 49, 23), + HSTT(500, 71, 41, 54, 24), + HSTT(550, 77, 44, 57, 26), + HSTT(600, 82, 46, 64, 27), + HSTT(650, 87, 48, 67, 28), + HSTT(700, 94, 52, 71, 29), + HSTT(750, 99, 52, 75, 31), + HSTT(800, 105, 55, 82, 32), + HSTT(850, 110, 58, 85, 32), + HSTT(900, 115, 58, 88, 35), + HSTT(950, 120, 62, 93, 36), + HSTT(1000, 128, 63, 99, 38), + HSTT(1050, 132, 65, 102, 38), + HSTT(1100, 138, 67, 106, 39), + HSTT(1150, 146, 69, 112, 42), + HSTT(1200, 151, 71, 117, 43), + HSTT(1250, 153, 74, 120, 45), + HSTT(1300, 160, 73, 124, 46), + HSTT(1350, 165, 76, 130, 47), + HSTT(1400, 172, 78, 134, 49), + HSTT(1450, 177, 80, 138, 49), + HSTT(1500, 183, 81, 143, 52), + HSTT(1550, 191, 84, 147, 52), + HSTT(1600, 194, 85, 152, 52), + HSTT(1650, 201, 86, 155, 53), + HSTT(1700, 208, 88, 161, 53), + HSTT(1750, 212, 89, 165, 53), + HSTT(1800, 220, 90, 171, 54), + HSTT(1850, 223, 92, 175, 54), + HSTT(1900, 231, 91, 180, 55), + HSTT(1950, 236, 95, 185, 56), + HSTT(2000, 243, 97, 190, 56), + HSTT(2050, 248, 99, 194, 58), + HSTT(2100, 252, 100, 199, 59), + HSTT(2150, 259, 102, 204, 61), + HSTT(2200, 266, 105, 210, 62), + HSTT(2250, 269, 109, 213, 63), + HSTT(2300, 272, 109, 217, 65), + HSTT(2350, 281, 112, 225, 66), + HSTT(2400, 283, 115, 226, 66), + HSTT(2450, 282, 115, 226, 67), + HSTT(2500, 281, 118, 227, 67), +}; + +static int imx93_dsi_phy_get_timing(void *priv_data, unsigned int lane_mbps, + struct dw_mipi_dsi_dphy_timing *timing) +{ + struct imx93_dsi *dsi = priv_data; + struct device *dev = dsi->dev; + int i; + + for (i = 0; i < ARRAY_SIZE(hstt_table); i++) + if (lane_mbps <= hstt_table[i].maxfreq) + break; + + if (i == ARRAY_SIZE(hstt_table)) { + dev_err(dev, "failed to get phy timing for lane_mbps %u\n", + lane_mbps); + return -EINVAL; + } + + *timing = hstt_table[i].timing; + + dev_dbg(dev, "get phy timing for %u <= %u (lane_mbps)\n", + lane_mbps, hstt_table[i].maxfreq); + + return 0; +} + +static const struct dw_mipi_dsi_phy_ops imx93_dsi_phy_ops = { + .init = imx93_dsi_phy_init, + .power_off = imx93_dsi_phy_power_off, + .get_lane_mbps = imx93_dsi_get_lane_mbps, + .get_timing = imx93_dsi_phy_get_timing, +}; + +static int imx93_dsi_host_attach(void *priv_data, struct mipi_dsi_device *device) +{ + struct imx93_dsi *dsi = priv_data; + + dsi->format = device->format; + + return 0; +} + +static const struct dw_mipi_dsi_host_ops imx93_dsi_host_ops = { + .attach = imx93_dsi_host_attach, +}; + +static int imx93_dsi_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct device_node *np = dev->of_node; + struct imx93_dsi *dsi; + int ret; + + dsi = devm_kzalloc(dev, sizeof(*dsi), GFP_KERNEL); + if (!dsi) + return -ENOMEM; + + dsi->regmap = syscon_regmap_lookup_by_phandle(np, "fsl,media-blk-ctrl"); + if (IS_ERR(dsi->regmap)) { + ret = PTR_ERR(dsi->regmap); + dev_err(dev, "failed to get block ctrl regmap: %d\n", ret); + return ret; + } + + dsi->clk_pixel = devm_clk_get(dev, "pix"); + if (IS_ERR(dsi->clk_pixel)) + return dev_err_probe(dev, PTR_ERR(dsi->clk_pixel), + "failed to get pixel clock\n"); + + dsi->clk_cfg = devm_clk_get(dev, "phy_cfg"); + if (IS_ERR(dsi->clk_cfg)) + return dev_err_probe(dev, PTR_ERR(dsi->clk_cfg), + "failed to get phy cfg clock\n"); + + dsi->clk_ref = devm_clk_get(dev, "phy_ref"); + if (IS_ERR(dsi->clk_ref)) + return dev_err_probe(dev, PTR_ERR(dsi->clk_ref), + "failed to get phy ref clock\n"); + + dsi->ref_clk_rate = clk_get_rate(dsi->clk_ref); + if (dsi->ref_clk_rate < REF_CLK_RATE_MIN || + dsi->ref_clk_rate > REF_CLK_RATE_MAX) { + dev_err(dev, "invalid phy ref clock rate %lu\n", + dsi->ref_clk_rate); + return -EINVAL; + } + dev_dbg(dev, "phy ref clock rate: %lu\n", dsi->ref_clk_rate); + + dsi->dev = dev; + dsi->pdata.max_data_lanes = 4; + dsi->pdata.mode_valid = imx93_dsi_mode_valid; + dsi->pdata.mode_fixup = imx93_dsi_mode_fixup; + dsi->pdata.get_input_bus_fmts = imx93_dsi_get_input_bus_fmts; + dsi->pdata.phy_ops = &imx93_dsi_phy_ops; + dsi->pdata.host_ops = &imx93_dsi_host_ops; + dsi->pdata.priv_data = dsi; + platform_set_drvdata(pdev, dsi); + + dsi->dmd = dw_mipi_dsi_probe(pdev, &dsi->pdata); + if (IS_ERR(dsi->dmd)) + return dev_err_probe(dev, PTR_ERR(dsi->dmd), + "failed to probe dw_mipi_dsi\n"); + + return 0; +} + +static void imx93_dsi_remove(struct platform_device *pdev) +{ + struct imx93_dsi *dsi = platform_get_drvdata(pdev); + + dw_mipi_dsi_remove(dsi->dmd); +} + +static const struct of_device_id imx93_dsi_dt_ids[] = { + { .compatible = "fsl,imx93-mipi-dsi", }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, imx93_dsi_dt_ids); + +static struct platform_driver imx93_dsi_driver = { + .probe = imx93_dsi_probe, + .remove_new = imx93_dsi_remove, + .driver = { + .of_match_table = imx93_dsi_dt_ids, + .name = "imx93_mipi_dsi", + }, +}; +module_platform_driver(imx93_dsi_driver); + +MODULE_DESCRIPTION("Freescale i.MX93 MIPI DSI driver"); +MODULE_AUTHOR("Liu Ying "); +MODULE_LICENSE("GPL");