From patchwork Thu Jul 20 07:09:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13319884 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 20D2BEB64DC for ; Thu, 20 Jul 2023 07:10:23 +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:In-Reply-To:References: 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=EZwxz6FdTzxZnf0YM07TUEI18BR1QOV0Ud1JKn997ik=; b=GZX/kCt6cIQ2bF cN8C2aWbXTrxL4zORevzRvPvrIsBTFBT5EE17/oTI+6hvXGL2DAjzSaggDpnxumyFRpOJdXTUM43n vfTELmfirOy6cZmaRm/JlVY/xk8PYQwC9Xpp+T43ckBKC44ACuMV/michc/pqbuzX7DhfwG/pvMSQ B/5RMYEQxhxM3jXwQrOv/eGfOzLdrgj89o3bDsIMLdS0Nqc43pNxVB6p/g6WJQsLtLgRkdMmoJeiy 9g0puBGx6WcvFcwnkvL2u//Q0pTitPu6Q5pIW25y3fTtg44oonA1xZD/dqT3cqoMGmzMsg1/90i7/ f2I8ekFjmct64dktGHeg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qMNnY-00A4DL-2I; Thu, 20 Jul 2023 07:10:04 +0000 Received: from mail-vi1eur04on0626.outbound.protection.outlook.com ([2a01:111:f400:fe0e::626] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qMNnR-00A48P-0N for linux-arm-kernel@lists.infradead.org; Thu, 20 Jul 2023 07:09:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Un8STEzpv7JxITnM54a5vIvcNe+NVRn8zsYzhb/e9sH0TZhLyW31wSHsdRCeFk58KUxx0LCg1afCNhD9jVBhtPYPhb+Q+z03xigamDSO9oeJrNW1i9iFZqQMhJnXKcetgNpK+31I40+Ox6GNj3oGsjA2zILvbanilX0CU9H/J0/A2CrG8t4+Jvg9Q1+NhI5O6Qc/ixGoxkNnPOfKV+6vjpfdP13MEP/Ro9NihahHhF8iRY9GVyxqEMyqbm6hirvElImqW8WKd6jZb8cGJFmtK+yA9khXgvnOj+aOb1iDTx5rM+MvI2ZnDSjo/vXEE4gYMnjhCQ+a//pXCFjU7I8iug== 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=R9q4GKRXA++y43AmVaL36Uoy7t2H7ScDYcW3i/rdTq8=; b=JmQtcY1HccAO6v/z17UKx/14CJLy0hq6gARVJcxQJsd828x25FiZb6EIZ8yStD0PupBospIY4F0lmNRkf2qkYqmtEOssz0uMlKbI2hhJ+7lrmz2P49RCzFhsHVHw3fsQx5TNyFygtkYHwQ+O73U/JI8ZrvV+bDIDAleIqPmsB/bn9oRMGJdoYlF2bXZH9EtM+1atysBPPcpjLy6YPDyOThWpeqNzz3HxPt3gpCfgFdF51RMWxocXfEOydlvC3FjJyBLqPXoNKB40/x1iXOH2b1NV/jzbRa7Tp758wGe5gY6cg3M/LzGgQwJXCjszBH/gRTWJeH8YufmGxO31TwXSmg== 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=R9q4GKRXA++y43AmVaL36Uoy7t2H7ScDYcW3i/rdTq8=; b=iTWyiX2llWH6Yw7RqgUBHSFVgsbyQir+R7BOJPTFv3IoY+XbwUfTl0eInTD1avr29LnuTfaP8mrsttVRoReSi13oQ7Tdts/vizWWeuWA2by3CDJsMvhYyKL5u8gMlm3MrZhN97CGzNRSBcfnX/a2XY5xk7RL17PSSExZHNSc8Rw= Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by AM9PR04MB8307.eurprd04.prod.outlook.com (2603:10a6:20b:3e6::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Thu, 20 Jul 2023 07:09:54 +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.6609.022; Thu, 20 Jul 2023 07:09:54 +0000 From: Ying Liu 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" , dl-linux-imx , "alexander.stein@ew.tq-group.com" , "sam@ravnborg.org" , "jagan@amarulasolutions.com" Subject: [PATCH v2 1/9] drm/bridge: synopsys: dw-mipi-dsi: Add dw_mipi_dsi_get_bridge() helper Thread-Topic: [PATCH v2 1/9] drm/bridge: synopsys: dw-mipi-dsi: Add dw_mipi_dsi_get_bridge() helper Thread-Index: Adm62S8M2gb4MN2eQEG+NSKpq9vOfA== Date: Thu, 20 Jul 2023 07:09:54 +0000 Message-ID: <20230720071430.259892-2-victor.liu@nxp.com> References: <20230720071430.259892-1-victor.liu@nxp.com> In-Reply-To: <20230720071430.259892-1-victor.liu@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SI2PR01CA0039.apcprd01.prod.exchangelabs.com (2603:1096:4:193::16) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) x-mailer: git-send-email 2.37.1 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: AM7PR04MB7046:EE_|AM9PR04MB8307:EE_ x-ms-office365-filtering-correlation-id: 15184736-c12d-4b57-35c7-08db88f05199 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: z1I7xY1xTkIvq2HgUDfxeuIxvRAskDEWv0djrH9I4Umz8/rgLSY2Cvkh41G5lSyOTYF+lTCJ0RFnLDhASDWyHDSE9r+QmkxVkcATI5M4Y0ShwyF7UY+rWJHaJYbmJ2vj6Ol+Qv7MhuMp2WScLGUiGqoOWGqzK3anck9lWmRS7A2extyGGXsmdhENWH1GVc78bLuFGroWPJLgZ+zx068qSVabPCXrV3Vxh6aHMVSqsFAA0o7nscH2IBwdTHx41bUvlp39aCpdTBGoyVH2LR153AyZeXBSivrThyExCPM9/4nUcR/AYdaizDLXRpKoBv/zJXeg04enG75TE2qMZmcpPopf3s5AhDAYIGU2CgYpXMr1OT2jD9LfioD+Do/bFTBfkQ7/sAiAw95frKNd5DSV9tTkQrih5Q1Zud/FIBixEu31vhmJhS9fo/NiomjLZZo+iG+mXOuXXSrYYWz/oXdm9qWqCuz3os+e54vmUGa+BOwzwkKI8LkRneeV3Y8c8W+3bhUmMAe0SjaF8t+UB7TxxCIM/WKp9ArFqjsu/13/UIov3v4nkSUlK11aR4Gjwx12RYS28PkwINES/A3tNcTV4kUDl3dNC8I5+jsgvGImQ5JDeOZwQDtT70UoqkOg2nkh x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM7PR04MB7046.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(346002)(136003)(396003)(376002)(366004)(451199021)(86362001)(478600001)(1076003)(38100700002)(186003)(41300700001)(26005)(71200400001)(110136005)(54906003)(8936002)(8676002)(7416002)(316002)(2906002)(122000001)(4326008)(36756003)(6512007)(66556008)(64756008)(66946007)(6486002)(66476007)(66446008)(6506007)(2616005)(52116002)(38350700002)(5660300002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?bTC29ulO2U7pe8naLby4aAS?= =?iso-8859-1?q?+42t0iQwYRGqsoAyRCte5mKdOwinOk5hoWksUPeTdiLhaJRpuou0DRGB2a+b?= =?iso-8859-1?q?0rp3HxZVgoTuCNZaOZMRX8vcmkUoHb82SWunrLvE98NDFvCtOSiSa38MA3Vu?= =?iso-8859-1?q?Qjg53T0227BC20Oqxv4ixLi04gMBVX3vA7SdH+KkJyaWSU8V0rwYg3dMYEDV?= =?iso-8859-1?q?1fVwDSfwhPl+61FLMH76loFF5EpGvwaN1wvsrHBLizHAGqNoVuHd47BZd5KN?= =?iso-8859-1?q?4dH15/md5z1J/88vOLyHcAN4KXxTfR+PWYJwwrI5teKssnWj2RhbW/PitpMV?= =?iso-8859-1?q?rniARymbzdb29XbiE3PumbxtsFaaD7ZmBu1RFSscCOh5xCsOBC5bfjQRvwaG?= =?iso-8859-1?q?70Fqn24OvqlEm1CbsStVTKcO/7r7eTbr/m8xGS77WRyqkttz5x04rovFfcgB?= =?iso-8859-1?q?xCo7STeFHEYd9pu6jfSFo4FqymlIbsr/f7eIckqmh6fkzB2lFd7sSEFZLQ51?= =?iso-8859-1?q?98MYT7iWJLv1NdRjEJ3ZVBPDLfl4RwtCjrT6LKIxyiG8VraciFAs4I/WRMNs?= =?iso-8859-1?q?3un5XCBdHXLFtZ3nEv38OlAE3BV1I41n3kS8/24vk+SSCz0DnOp2CNBCSG9a?= =?iso-8859-1?q?xkDrLewxtrHJEhbxFEAoRsiUZToQoj2vE/LezZVcywTWWZku+CHGpiiHt9QG?= =?iso-8859-1?q?d76I5LmRUFjG97suigcfVTK2oX12av/jOn1rtXEZn+CPExz1g9iW2pt2jF+t?= =?iso-8859-1?q?GGLf7YjqXmoLCqirjVmR1XVE4M9+Jpay0vihV/6HknHbADbepeUsD0d233Sy?= =?iso-8859-1?q?pwJp8PhXFMRerYdrHv43vT/TjhZue/cSRleh7E6H1ltZOC/tRLHv9dR3xee0?= =?iso-8859-1?q?5AkXs/+rSYrERTrBQKoPnVanc9KI5f/hQDe293CMEUNmMXq2g4bAz22Q8jvi?= =?iso-8859-1?q?NKDpJo6xJniaRi3FDk75Lxd5AkLUeKasjY4vATH1TnumU365MaEvbPwpjFe5?= =?iso-8859-1?q?42xQvQI4WHxClH4znH3OEspbTBQPi3BDkyLmaUVuRSGLqx35vcSQ7l9D1IR6?= =?iso-8859-1?q?n+P2JXluqSJhVWf8PO4A8Jnes4DFM6j6dh/N21Oe6qwW8FCLv19+u2vdSn/D?= =?iso-8859-1?q?n/25Rf9COSC/BhwnSW4eBC+V9SXh+QstakGKhQgmZ1Esc0OsyPuSY0eBcWJL?= =?iso-8859-1?q?28TSavGDmX23KVUwUuXG6eJb7YYG76jQL3FVba2yg++Pd6K+1CgKZ5eA9CDW?= =?iso-8859-1?q?dJ8+HbQ+zWkkkYbQHRE9ziBqL9oTCOESytbYPnb/zRFQR6UPzGKP09I2oC/2?= =?iso-8859-1?q?EN2OZbZwfcgNR3SB0Xh3VQ1g6w/KzNsTFVZd5N5RTDBlw4Cu3CcGYm1WUHIV?= =?iso-8859-1?q?jtEDAjNtzwenchPgRDXf/O5ew0DYxGmsIE8obdZt8BYhzdm2Henr86/WHht/?= =?iso-8859-1?q?6hgZ5pE7kWK3tHbSrphr2FGS7f3ICRAY7+xVR/GM9kALAzJVQdB6lkzin/Op?= =?iso-8859-1?q?ybIoc93IcpAxnllKZ6qDQgXqIqndDcjWzf850Y+HI6zop99U3cHjMsk+hFhk?= =?iso-8859-1?q?kVkeKpMdQuSVnXwfr0B3TSnH95mcfw3IiEPDGsWzcVce01EnEWMqJnKAbQOM?= =?iso-8859-1?q?pKaUxYCchI0h2q/ej?= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 15184736-c12d-4b57-35c7-08db88f05199 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jul 2023 07:09:54.5117 (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: 9kka767aDne/c9yyIqhsTjMwt7K3yUFApSWU6RR02zRacBSelxYq42Q5oTkeNkYB6VNU7825qNiZpeRnqG7pHw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8307 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230720_000957_156413_A8B8EFC6 X-CRM114-Status: GOOD ( 10.42 ) 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 --- v1->v2: * 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 b2efecf7d160..57eae0fdd970 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c @@ -1207,6 +1207,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 Thu Jul 20 07:10: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: 13319885 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 D300CEB64DD for ; Thu, 20 Jul 2023 07:10:29 +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:In-Reply-To:References: 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=n0Y01bKxQf7nywGHOtW9Gw+hm6uPHGbuR4XEz5DyerY=; b=YLnp6uY12asHfb 1fQ56l8SgMXnlV3YMKeL3t5i0gvmkNaNg0n7A9E2ga39djvFSP521ixYo6blAkA3WhK4Ww7nV8KO+ sCrIFDYbmq6mzYtoVv6FDZnqG6/S/Ag6tMcpEk+xvgaFdQq79JpaqXznbTD+oL+4aAzwRpFCRtkPP T3J1YIurc8picX30GqX2XLf/NyrX0fII276ZXhIwISPNfKowPaok2vIFTPAihv6TQvxr+0+mTxIKP SidfPRUnmO8d2I7p+mZ7T3PIIft1cLJh5GgPChft/cH4tGQr0t1txH97Bk4t39afsKl/Jkgku5QPL OiuOl8K+z7TLQZmoyXDg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qMNnf-00A4Fw-1I; Thu, 20 Jul 2023 07:10:11 +0000 Received: from mail-am6eur05on20610.outbound.protection.outlook.com ([2a01:111:f400:7e1b::610] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qMNnc-00A4Dn-0L for linux-arm-kernel@lists.infradead.org; Thu, 20 Jul 2023 07:10:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fNsWqJwxWee8xnskP6wVIhjsF66ck4dOMLRagBRiyign4lnfniSSWOfpmpFsK5KjVcRue+cXC/d1exIKYRRJwsqnSMCaVCDa8m4Ha+IMUtaf8a2IOb/luVEL2m6/763N9gVaZzV7B5OWcUJvz4AOI1Anm1XjqtZgXn+o0NRabhue6rYA8+uusv+HjV0aVLpYYGB5bZdRLqnxZEbMaCl0EcZV2yxe16MqqCDgZZs6mrirzxtdfsjQWXfI8qKdIvHKoEmEPAL/UwoKdDf8oh3gG0Ldk31W9uVDpFXwPSL1F7q/x7VPRgYYrK3Vsjyh9JXtrB/J9cREsNDwvlujyt1xrw== 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=4O0fgjP1+XKJcTTF0Uohkbnc2npkwLKZrcddxbnMKSU=; b=UwreG5/oFNhQojIWRvi56x1+cRqG+ylVeLB8GXlhjwq4FVSKjVjPrJbnoX+/oHNvPmEdXRPYkVcB2sD5SOogZHyLas62g+h/8CHV4lx0XGwfq5gWRHRsFUJsdIjUvveR/JCXllry22aJRejuUS61ylMXJfpgQ9DOskvUH4X6EfBzzm47WqEJ4z2HnB+Z9MgwmYm/rQH9O2COwVBWgXA2u+hWhuKT5L+fnu5TIhFfcLtUlKCW7RAgFHFfUsK+E1lQtMO0txBKHxRx1FtljugExsKsPvTKg3tnxjZpHxhZII3Soy4ClwhtRZP2+ijtMO1TBEeBUL8n5QfpXWBS3tdS7w== 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=4O0fgjP1+XKJcTTF0Uohkbnc2npkwLKZrcddxbnMKSU=; b=l+QHuwzWdIRPH7VdWGLK/ADyubl2SYYWLGaIdnooIOqv1Un9+/knREKb4XuRTG7g4eoS/AuuE68sy0tLJPJXyMwtZ5GAPF5RTWMCnFmwZo4WJi12JsdXob5wHVKAJY5AfhAGnE0jhDzE03W7C25L2CUCAjF6gW7DYckSMONnRbE= Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by PR3PR04MB7243.eurprd04.prod.outlook.com (2603:10a6:102:8c::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.25; Thu, 20 Jul 2023 07:10:00 +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.6609.022; Thu, 20 Jul 2023 07:10:00 +0000 From: Ying Liu 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" , dl-linux-imx , "alexander.stein@ew.tq-group.com" , "sam@ravnborg.org" , "jagan@amarulasolutions.com" Subject: [PATCH v2 2/9] drm/bridge: synopsys: dw-mipi-dsi: Add input bus format negotiation support Thread-Topic: [PATCH v2 2/9] drm/bridge: synopsys: dw-mipi-dsi: Add input bus format negotiation support Thread-Index: Adm62TK6XpKEKypROket2EgKxcczbA== Date: Thu, 20 Jul 2023 07:10:00 +0000 Message-ID: <20230720071430.259892-3-victor.liu@nxp.com> References: <20230720071430.259892-1-victor.liu@nxp.com> In-Reply-To: <20230720071430.259892-1-victor.liu@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SI2PR01CA0039.apcprd01.prod.exchangelabs.com (2603:1096:4:193::16) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) x-mailer: git-send-email 2.37.1 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: AM7PR04MB7046:EE_|PR3PR04MB7243:EE_ x-ms-office365-filtering-correlation-id: 5cc9c64a-1982-4f21-4236-08db88f0553d x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: dpFrMVXkh1c7AeWdiBq1kcuSA2ZOhfIbYPWO1gEuM1Z/JcdCjpCf34QFkxUm3i4zUWguh2JMQl61IVvoMIQ662eT45RrxhAUzVevRTa3B46Y+fL4trSzkIv8BVXOn7W5eHhywWH6Jfwu/g0w3ZuR3wqh1F8URKArF3CwPsk80QTe5V4Efod1ayVg1uXGZl5buMGSUBQHKbyYLtG//lXwP9E2jQAuto0ZPzffFZ8kXagj3RaRb3gj/cT7tdZMAvlRpwgFdMcQpHMjb/kcO9ufkNkIMuVsQo7lQQ1p6jM0vtsxEM1U2Z8CIE16lDgXFfEglGQXamrvsD34Xe/vF7lE8dBXzZUaaOIVGjmNmZic32A8YEd26Dy83KWPJEErFqNVBaU868YLQ0RI3qjoHaaJm1sLJrEpVn5UwwmUuuIoA9P4JZH5BDFRoF1xC+D+Bg6W1N8olsmw6A7kHaLpXfqCnT4x5l+Rk33OiCKIsha88m8FsnZ3Q9+mlbfSLTUHlq3GoM3X7YXIznz3baDROCgwITM5P4jZe4Ro6/ZRqZuL1SUkYXv/Ku+2DqvkEzJ6MDtOGh/vleRd1oNt1QGl7Z3bY/BI/AWv8FvTiwlOsXZRGqvm1hEfThkXne+x+ulH4I9i x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM7PR04MB7046.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(136003)(376002)(39860400002)(366004)(346002)(396003)(451199021)(41300700001)(6506007)(1076003)(186003)(26005)(478600001)(4326008)(66446008)(66476007)(66946007)(66556008)(64756008)(71200400001)(316002)(8676002)(8936002)(7416002)(110136005)(5660300002)(6512007)(6486002)(52116002)(54906003)(2616005)(2906002)(38350700002)(38100700002)(122000001)(36756003)(86362001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?P+08aTGrXDowKeq1wOcus7T?= =?iso-8859-1?q?shnUVUE4zKG5u7Pzt2XmuKXxSt3sSnpXeAkhpgFJ/qhKfDUb2JygLrwqeIGA?= =?iso-8859-1?q?oNf2h3idSV9zRzDvJo2EVYI6zfaffv0c1m9idHxQwmsV01jDVCFN7MwwaJd6?= =?iso-8859-1?q?2XdexOjYV+lM8CtV/7oVLOuHAExcfpWZdpShln13PfmtLCnrIJBUus0Zr5eT?= =?iso-8859-1?q?OWysgjPrBfL5M96DKxIrUJ6VUC93EjHvkq9OCyH+1ogTAOo1+OctqqdOucd0?= =?iso-8859-1?q?Z+2KpuUDWOtlarD0j1th1eCyrmzQJucNJjGfGoCm3iiTwQhhj6Fh5PdqCJpz?= =?iso-8859-1?q?T2t2IC9QS6ZRR10onhxUPFwcEGPb1eSDMAYNc12W+tzMgOH4uqTXiB5xIAsL?= =?iso-8859-1?q?RwyeEg0mVdWOMvAMHmILydzirqMEs5JgQeOLD1lfLGi1LsutENqtTaJOWUdG?= =?iso-8859-1?q?G9sLcyUvJiwYuGoaKkJnXeKna78HYvwC/Sx/h8JGl1f60hnKlDIRGD6GCeCy?= =?iso-8859-1?q?/YtB4w2yWZmV4hpPaupghBJ9zL0nFjOfoJWaMJCJhaHqhPtxhsSVHno5ltYH?= =?iso-8859-1?q?ELz0jPoLyAvbmqlj4IYiJTueen4K+Buc6sQ1tdVvZ4EtKP8H/SrY97HF1OOF?= =?iso-8859-1?q?cuqsEkiI9+PnOMkIGdU0cpsbjrI+A+g8xomFuQSfltPEQJoyVLBoQ/BUkaRe?= =?iso-8859-1?q?tfJupkIytgdYclb5TUD51DPrzdiwy+/8rsRBOVdR5vzrxnZWtzEZod3AtwcG?= =?iso-8859-1?q?LvT+drsTlQh2gNwVUyi2OH7gNz259dw4EOkSQODeXcLzIQnu0iT5ILuY/36I?= =?iso-8859-1?q?s8KNp/NrvfhWmY0bIJTATserdNbc+S7PdqTl1lAHlTkrGD+iblAv0htSarIw?= =?iso-8859-1?q?Dc7cNPf6/BQnvjh0F2wDXPmcW0xSu/AL6FTCtV1gxMVeNyuDWvVH7L0kThXc?= =?iso-8859-1?q?n3DhmEOAmk71SF+1Nr7AMMg4RXWCcDpFQmWIpHeAM3I2WUiDCxSEsEM44J/9?= =?iso-8859-1?q?VjgTPzvPskQdbPRZDxMzj9mnHlBqY9KSY7gbCAq1nt0x2T2z0jf3/KseSZ63?= =?iso-8859-1?q?NVZoK2bK2O9WOHlmNyPO4JOUFoJwofVJ+LG8M/w7QOcgmsFP3IqWQhpkZ0Fs?= =?iso-8859-1?q?oMthflzhtHvSJGwWs/KZ9yHsLYuyq6yDgv//FbtkEbfT4RmQc/6Iwmy84Xbj?= =?iso-8859-1?q?BxIkYssY/pvcHzljeWrYEmzrMyv6ySzBTwySiwYv2mcb8/ilBCHHInK0V3DS?= =?iso-8859-1?q?d5+Cd441vZPJ1mFacLlne/rn0ktsuUof5dJV1w7vzaA70mX2xALFFWpFVJ8F?= =?iso-8859-1?q?X8lZSPXZye6FOgKuI1jeBULHUnvPoETIz95tAkIFfXJGm212uzsO3dE6ux5/?= =?iso-8859-1?q?PuO9j1sljjUvd9ejCByjoa7C1eJXPcVPizjjYu0ZMB316pzY9TEp1kmpe9hI?= =?iso-8859-1?q?gllWVVTd+13I9bjUTdYt1BVXgICO7VLaiPg36nPXjIg5uognBYETAK8RFmWo?= =?iso-8859-1?q?AG6MxHHB3hYyvgCy0WlAW3doa6P+J22DK2Yhhjh1qUAXPSwVOCgtVr6iqJNP?= =?iso-8859-1?q?/DWN8wFBaOvFwaaOHShrPvXPqUL9VLH8j1uOUTwzbxUTEPsVQVZW2uQN0Frc?= =?iso-8859-1?q?JnZMk3mMPduBffJD/?= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5cc9c64a-1982-4f21-4236-08db88f0553d X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jul 2023 07:10:00.6324 (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: 6wfHRU9e/JdiH/hO7Hxh6YP2a6U0JvnVtc0mxvQ0jl5cffBJvCKAnprnhSFtyPR3MAnqfnP27tGv31Dc7Mz4bA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7243 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230720_001008_146802_70597489 X-CRM114-Status: GOOD ( 14.33 ) 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 --- v1->v2: * 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 57eae0fdd970..8580b8a97fb1 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 @@ -536,6 +537,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; @@ -1003,6 +1032,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_enable = dw_mipi_dsi_bridge_atomic_enable, .atomic_post_disable = dw_mipi_dsi_bridge_post_atomic_disable, 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 Thu Jul 20 07:10: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: 13319933 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 8A0B2EB64DD for ; Thu, 20 Jul 2023 07:26:20 +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:In-Reply-To:References: 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=q8lPXJCl4lNa7GXv2SCmRwZZMrqtRVm5JG7c2bYIkZM=; b=kqfUNqM5aX2981 WD8xV+jwGCt1xN0+CbbHrRK/Zmpbsk7YFVTx5ZoFfSZ/LdnfdBN+Lt/vtIX7Qj0Arx6rFpOKMP6uz 62iH0ZMM/JN6+s9IWPHeBGwSGM5fI1oXFCvgpgfqpsNRUGXLpZBVM7bL703UOMjTiwqs2yEQbY+Fe z4RiVEpdhYsB0APVWOJCL9YjnNdGdtZwVVoNlVqoXPImy3kVj7WviPU1gu+X62YqaGLnij++ZAkvT 7i3qO2RuM5VIp+DEOGzYbr3eXzF1WAS6O+kf7SoqqAEExOe6jSCCWr2OvALZQblJnNIEgOl9eH9nR DrtbJH7DTRoZfZrn+j4g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qMO30-00A7MW-0G; Thu, 20 Jul 2023 07:26:02 +0000 Received: from mail-db3eur04on0628.outbound.protection.outlook.com ([2a01:111:f400:fe0c::628] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qMO2x-00A7LT-15 for linux-arm-kernel@lists.infradead.org; Thu, 20 Jul 2023 07:26:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bo1d3ynAPtQ02ZEwHe7iiZ+wjvIcUi48AlhylN0aO4oOpFh2BEkVN8u6kCTAVxjTrbXuCaWRS/FMaiXp6BfR2A2W0EHWtY7qCHdFU3snvpb1lVbMAJVKdbey+sukA5vdyKkq8/m1XN5hjOiqztyvn0qOCi9q+9HV1pHR9yABa52EnV6/UlpTcIuie4DCyoTvezbeuy8rS4D2Aiv9QwkDBAKxX9oaCaZFgLTXhPqKw6IL9q5t8SCOkDC2zeyWwZ4awYQl4Kx/USUeKCPwWq71LwY0duWp45mPoWcaxb9lANXkwsSY+lc6h7LORfRDwofP7eBbw/AEM2AGNENTv/4RLw== 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=6BTL19AEog0wfHvJBaYbx4+o0nMsy/EIbPzhBO7+D58=; b=JtAuQhos2JWANKYBmC97I9eHMQz/qr9hO5ZppAaUuyr+V8wjVlhABFa8n1EmGAkEVdCLdeq+YHR2j/I9uw4KDnnPKCX1UA+HuPpExptWdRIOjHfJF/ENTFGjb1Ng0JJgvIiG7y0FxxJYzDJfQM/DsZeUna8FJcMAFBODnMcGlnYBv5LfT3nSztGhz5TwkjJ4ZjfTc+tIZnqXJvu/1uZMeHXna8WRE9bKMZNqALeI4BE1h4lvp2Ybt3nlf5yO8Qr2+O7uIu/zSBFL8o8fZrfF/ASMTgro+rKb5a2z9Paa/7FZ/6PfxQ/uGOIM/VoVjJwHEAn8sGd7D+NoWAV6DGGbBA== 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=6BTL19AEog0wfHvJBaYbx4+o0nMsy/EIbPzhBO7+D58=; b=iGaMjaL7qcWDklOBHXvGBfUERJpIBITJHFWCI7vKsH1wR8nwamZwL6qfngnS/wvW25oQYQn5nXfWagWf+L6aR9ddx8wxOXjAg7FVs4FxzKzZdvqbbpzRuPW6ZsNSzhnV3h/iVZcbTa7v+hUIGAfkVy/92HiNyIA0bxl18gOI+00= Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by AM9PR04MB8415.eurprd04.prod.outlook.com (2603:10a6:20b:3b5::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Thu, 20 Jul 2023 07:10:06 +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.6609.022; Thu, 20 Jul 2023 07:10:06 +0000 From: Ying Liu 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" , dl-linux-imx , "alexander.stein@ew.tq-group.com" , "sam@ravnborg.org" , "jagan@amarulasolutions.com" Subject: [PATCH v2 3/9] drm/bridge: synopsys: dw-mipi-dsi: Force input bus flags Thread-Topic: [PATCH v2 3/9] drm/bridge: synopsys: dw-mipi-dsi: Force input bus flags Thread-Index: Adm62TZXrb2BNeOVFECO4yk1+av6XQ== Date: Thu, 20 Jul 2023 07:10:06 +0000 Message-ID: <20230720071430.259892-4-victor.liu@nxp.com> References: <20230720071430.259892-1-victor.liu@nxp.com> In-Reply-To: <20230720071430.259892-1-victor.liu@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SI2PR01CA0039.apcprd01.prod.exchangelabs.com (2603:1096:4:193::16) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) x-mailer: git-send-email 2.37.1 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: AM7PR04MB7046:EE_|AM9PR04MB8415:EE_ x-ms-office365-filtering-correlation-id: 38b87bdf-7560-45bd-0121-08db88f058d3 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: NU8uMLmZsB09bW1pL6ggEe+w516rajxzxPFu9DV8IklCoedasObbZBVjfaVaFDqSxyQcBqNpfC3tUXz5yT5fGmcW2cnZcjGLpKoL66AT8sjuk9exldIo9H97n5B0Wr91b0exQYsUizT/upvYX/7HKXMokmMqzmkA4uRckkdFABFYw95abFLLck2y8v6YH7XPxMlhdIamdcV+JcxvkUu5xB4wJGCYrKsTyTAgZxH0HzspspUfS/QRuxXtRVyCFdZWQzLRQL9DLiYNWaVWz1C3ZupXRXpwvLwqefw78E8fsZj3gl2zBZ2BzVMpZ8CxYxM0CqLllb33N9vnoXDarpjGcqrUt6eptqyHeug2Vm1q/xrLN5REHqQd2i099ysUq8E5V91H6bO8frml1j+WHsb6e+qY3gO/8GCmmOe+JkcD/c5z33l62JG4eQ3M83VinyEUUcw5mMfsOys1eQRFahyJ+NQlT35Xh1I9qfIB0XvPY/kHfEgVZ8cHr8QgEXthhGwqQLNNg3JAVsHe+0gUef0W3Nz9SE8R/kAm0fu4lpIboF9utahTNPrghw7m2FNgsynvS3FV/zc7nq7xz5C/ZSPvNgsNRJ9kdKtN4AILd22Ql258ktXIWtFgsXU4jHpgISLs x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM7PR04MB7046.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(136003)(376002)(39860400002)(346002)(396003)(451199021)(6506007)(478600001)(1076003)(26005)(6486002)(52116002)(2906002)(6512007)(71200400001)(4326008)(5660300002)(66556008)(316002)(66946007)(66476007)(66446008)(54906003)(110136005)(64756008)(38350700002)(36756003)(38100700002)(7416002)(8936002)(8676002)(86362001)(186003)(2616005)(41300700001)(122000001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?zIHFoBxf8NMFAXTa5Z1RM9p?= =?iso-8859-1?q?BGdHvLPb0yeF2O4p3ST/Pi9Xc+L2ORWRuhpNpILRfDlFzuvhUEbBRSjdTGYI?= =?iso-8859-1?q?5HvyQp3w1hckEUfiVIvhcvLcix1ozzMnXKnDHT/r81qv+gvnjKrHA8fpyBFh?= =?iso-8859-1?q?2yxbelo7JlPMNV2vcKkwT/IjyZbgtCxUjVbXtv3t8Jj+cjFI7neHNO+YaZpy?= =?iso-8859-1?q?vrNDRmim5VQOEqBwAP43hwDLwHVMsuIkhnh1z1Q9y7dEP7JxNb3hTWiGTmTi?= =?iso-8859-1?q?I08NhMzL6UOiS6nmN9YNgn3JStEfjLeq6SKEnx5pj0Dd1jC5C0ryTlFhEi3v?= =?iso-8859-1?q?Vy5hjoAJ+dvW2foEsZyZoL8FD6SiUmgtWoN2vQzx0B+JsNxwWhK4uQGxaeeB?= =?iso-8859-1?q?YpTwYGtIHbRJ4W6kvjIzqyrmmgMAx2izMkvHtvYlefZekGNx3C/8bev1CfID?= =?iso-8859-1?q?9NIfx1ODijXGg292gQBKddaUgyRonReKhPwwej5p032nCWFVVJWD1T3guFLI?= =?iso-8859-1?q?wQzGTMHtcEdUI0zmEBvCG3i7ToxRatALmUszRl50l4BiXw4Cgf6EHkeZ3kDC?= =?iso-8859-1?q?6wgzQ9MJiOKHDxdeg2wSr5GQX/N9vvs5QpEhN/u+SheGgXQdDQk+AV4gL91y?= =?iso-8859-1?q?1REE7g20WO+RHL7bdfF/uydqDjn5UtlrdpWA6IY5acAXDL5OGippJTI23h9r?= =?iso-8859-1?q?lvBsHUmp+3nL0gOUnzNgcH6wXOpon2N1HR9viWZEKqiai7XyORcvrtdcGjn7?= =?iso-8859-1?q?nGnvAfEMC5WNI4mIK2+IGUSc0DuPNX+MuCPYs3HAE56uLanWBqLFegJBnsQF?= =?iso-8859-1?q?1yyt6b5T4x1YXuSrjUlok/udBHt6MUOca8TEy7YXcgt8iQij/4rlE8Vbbkuw?= =?iso-8859-1?q?ek9EcUgsaKLnvG6Zyna3+oiiK8cuJx1Dv45k0PKRAYQ7jxvxBQ0hYbkjvgTP?= =?iso-8859-1?q?RtBQaO53w6JkEEBSdwI28eQOxqytscaC0KaFpuYeYiq+t1l57SOVDzTgrHM6?= =?iso-8859-1?q?nG97a04z7vaBAkejNzFGNR9AwDy5H5AdAZCQ3WH5zld/jB0A8kuOoqj+Dq5x?= =?iso-8859-1?q?W9bGYnlE1K9ZB9OIR/1O1ohEyPtU7nSWiOORaM3UwawT1FrLNDkO6rUK0iQD?= =?iso-8859-1?q?UDMerQK3BraOY9mHgvReaLECjUtgskLpyIUHVgOQXp4Qnv2CeR30QzapjCXi?= =?iso-8859-1?q?BPLf6y/98RBE390Masc4PElLrlVZPp4bNjiKKc37btaUB+moQ/rNpcgE1/t8?= =?iso-8859-1?q?TKrNdImk20vbcs++4WZmU52rZIpkahwNITNQ44KyBumo/urCesoAYcbvfT9w?= =?iso-8859-1?q?kZdthyan62Ue6UTsa6vMfaEG8/coRYaSzMh1Id6Ez4FYlrvagWm+rEBwCWs4?= =?iso-8859-1?q?R/GzqUzokMse1h0b+TEyuyPa9K9ruK8S8f/rj25cZ2Hgoy/IpLt04Q3miI1E?= =?iso-8859-1?q?5SZqjvkYmIO3itAwee8qrcuJjL/2cuUNCZ2MaadcLSI3gzGCR23Pmgj6y6PW?= =?iso-8859-1?q?gMCYBwQ2EzVxS2j9K10nyHvMceP66DDJzEYkWORpB2PWlimE/Zr8XyG/9XhR?= =?iso-8859-1?q?XY7z4FGyX5kOL6A42Y02Uley9399QI+8UZ1Y4rcMraF7cn36mSWOdcEBjaSf?= =?iso-8859-1?q?AnxhA9uN458qgmQT7?= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 38b87bdf-7560-45bd-0121-08db88f058d3 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jul 2023 07:10:06.6794 (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: uaFbzr3wEexWGxkY1BKL9COdyLd9Uo5TUYHJovibrOApMaDek8AqKpG/hocgohmSU3EfLysonS92BD/VSmUfOQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8415 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230720_002559_378662_2C950890 X-CRM114-Status: GOOD ( 12.90 ) 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 --- v1->v2: * 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 8580b8a97fb1..8cd89a63b5f2 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 @@ -565,6 +566,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; @@ -1033,6 +1045,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_enable = dw_mipi_dsi_bridge_atomic_enable, .atomic_post_disable = dw_mipi_dsi_bridge_post_atomic_disable, From patchwork Thu Jul 20 07:10:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13319934 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 D3E40EB64DA for ; Thu, 20 Jul 2023 07:26: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:In-Reply-To:References: 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=wC61RWggNS9wUD7hABIBSSlcsnBdBPhwYdRYqfnhdJk=; b=nxPoYqyrrFyJF+ OPC6HEAOjShVBJZzEwifXRZt4PYg16P2WjjTMVDeow0KUHgsE7F3H34eu2u7YFiBFaZCcmXbAVc17 hw5Hu2PM2obMWBPIcpyUHT3g0XaOMb78nVEhgf2wmJ8isj15TQX95KC6H9VFzpsa3F85II+S1Ln4D sIitb9MGmJNpD7hspAYrnkB+OjMxlLOcL7cH2txk7qZ/6XvOO1c9XC71fHQX3nrEE/qJ5FaRvQBIW W5yauR6Vjn2C4WdGKfkKeBp7IL8HwXCa7h7xgcPSKlvRWN0nDpR7cJ/guGCVP3HypTivLsduZhuUb WXLS4VOGZzRdXJYCUt4Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qMO36-00A7Nv-2L; Thu, 20 Jul 2023 07:26:08 +0000 Received: from mail-db3eur04on0628.outbound.protection.outlook.com ([2a01:111:f400:fe0c::628] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qMO2z-00A7LT-04 for linux-arm-kernel@lists.infradead.org; Thu, 20 Jul 2023 07:26:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TXUrd4ejqhis5UckhtWzwGlhritMHQs8j4ffvw0zBKTSgWz0oXeU02Ur7ZEhu8zJhevriQffJZg/ar3lj1mxsJSbWSzPPJSEwKyD9lK742O1DfSxifHXpGFxOFInUZW1iSaWFI5cPR/QrtZCfklliSC85wzvJgy3R4FrA9MDYH0pToWGRFI8w0LF2vVkLni71N3FeW2NtUTIMBg/DvKZMitwpsn7YCWvyS4ZEDAFZ9HWL6LSs4GYz3KxvDE3DOSYXlek9tThFiq8u5Gxr4QS59Mp/OWZuV+x2rqI6RAQeLAc9R59pQLCto3OHT3iJD5dF2A+h85gqJMgdZvve5R4Lw== 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=VgdLuqLE8xkkaSAA8nXeHcktITpl/jG1NAKvXK04ASA=; b=MrVLVqgZxNIqYZG2uH98uQerPcii7mrUj+A82MOvdoVvSZs8tPzqJVAiTP2EA9kilaUJajIxtEkfGnLFRCa8gtnGNHGR7YO/F2//nfzZjHHf3kf/QpnmPvRMXTBxf2qsBh3+xvd29avY49p1BlQnkxN8X41CxL4vWJuW4Mpb5frIdhI4CjPYKu/j0QzwKdNaaO+PHaI4DQd592X2RKabfXfkKljeeBdYwC9X/hlUk6SplpeE7a5F46vHUwTp8s9mdbrezxDHWw7o6OVqIfbltzlKHjEfEPN7PyUO30FIA75v8+aXrPNs9tAQxEyCkWAyPjzES13okWdzoGOYKYFrMw== 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=VgdLuqLE8xkkaSAA8nXeHcktITpl/jG1NAKvXK04ASA=; b=QDXfT9q4sbJ5CoGM2IylizhfnZ4MsMB50r7j2QtPCdTZS70YY3dHofuyHZ66qDnk+4Onap5LOGoz3/9rsv0gFonzgx+olkUr+uXpDp1G7fiKIP2vkNeELL/4t0h/+AbLAUjMYyUUub258XBmLPPiSI4/rM36bcowid9kt8juizo= Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by AM9PR04MB8415.eurprd04.prod.outlook.com (2603:10a6:20b:3b5::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Thu, 20 Jul 2023 07:10:13 +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.6609.022; Thu, 20 Jul 2023 07:10:13 +0000 From: Ying Liu 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" , dl-linux-imx , "alexander.stein@ew.tq-group.com" , "sam@ravnborg.org" , "jagan@amarulasolutions.com" Subject: [PATCH v2 4/9] drm/bridge: synopsys: dw-mipi-dsi: Add mode fixup support Thread-Topic: [PATCH v2 4/9] drm/bridge: synopsys: dw-mipi-dsi: Add mode fixup support Thread-Index: Adm62To2Cn6X9/VuRkilIYeiuTcrbg== Date: Thu, 20 Jul 2023 07:10:13 +0000 Message-ID: <20230720071430.259892-5-victor.liu@nxp.com> References: <20230720071430.259892-1-victor.liu@nxp.com> In-Reply-To: <20230720071430.259892-1-victor.liu@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SI2PR01CA0039.apcprd01.prod.exchangelabs.com (2603:1096:4:193::16) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) x-mailer: git-send-email 2.37.1 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: AM7PR04MB7046:EE_|AM9PR04MB8415:EE_ x-ms-office365-filtering-correlation-id: ad9bd8a4-cf9f-49a9-cc0b-08db88f05cb9 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 3h3GxtG3W8DgLyfu2JKJKPt0E8qtKzo+cGPoxhENR5srIOBPChQemFm/BsiO5JUiYHpfcr1TulPeAo0tpT1swqdqLY4UFBdynzIbDPR5imanDkQuiHnnpQ2NEUlCpFRTiWUkEVTkg9YA15vnhrUDW0ehyPRiPVQo6ipA5tWhHlIYVeLetehXByDHO5UOnv7fiSB90fxywYJhQSmcZtKDJBtLCsfDqSD086sIdC+83yeTF4jMMZWRPY9CezFQl3NTBK2jym6/ExXcC1QLUYXXnCIlfc14nVLV9CZ1pyjX3qLSEMcYq19UIgBCEO7j74d2L53iyL0JKjW05Y50uwcD/Ljui06/Lz025ybp8riYX9h/SWxrDyFG6BB+7v1cuUA9N3svXn56fXsX23Wd7U7Rnr3g7xg+KuMpLF+dx8+S7Qb8+GpuoYMnUwVC8xi7eEGgCxNV5trr6V/sXC4Lwpu3j6sfbqHbC4sZnu3SvbkKAudbxQ4WfyjQ+Q9NJMalo1WkNEoORYZ1n7Grd4AhGNHYbjRxuejaC+x7+ezyNrB7MXLqEwwdxYLsjrhTXafNUiTvoxlJMuj+bWV171fwYSzd/GkXMq/x0HiKs1mi/kils9EOxOuGp5axP/mwfsolFc6f x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM7PR04MB7046.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(136003)(376002)(39860400002)(346002)(396003)(451199021)(6506007)(478600001)(1076003)(26005)(6486002)(52116002)(2906002)(6512007)(71200400001)(4326008)(5660300002)(66556008)(316002)(66946007)(66476007)(83380400001)(66446008)(54906003)(110136005)(64756008)(38350700002)(36756003)(38100700002)(7416002)(8936002)(8676002)(86362001)(186003)(2616005)(41300700001)(122000001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?fUnnwH19Vl9o+ETWOiFQHqr?= =?iso-8859-1?q?Fx9mSPQUopd/yG7fE9dJkf18y4iumn1A3DAXSLJuQ8zZ2mOI6Kapwf08OUQ+?= =?iso-8859-1?q?OY2chOHEwEMkK/7pejMGGV+KgMXcGCrNmunzNSGuvC2AR7FaIorIaQMpnLaT?= =?iso-8859-1?q?ht3WeIcPe/xoS9mHPtXRy9p8Pwea+yBi3tv/YYUjoXqR8dpztUqUWyQ2oy/I?= =?iso-8859-1?q?Ga8XiB8uqNZ+UOV0LwWff3UGndDegUJ/6K1CyWEt8FAgmepM5glGJPFPZTqn?= =?iso-8859-1?q?9zPEkCaG9t1SfPqHxPRAU7gn3IN6JW8dsX8bZi//1BkBA5OXaUbyEYBF3dEm?= =?iso-8859-1?q?vWWWImtyICdp9i7UkeqOXFrkJUTYeON3LAyNZYgYCHtPt+ecvvH5tnyr6NAh?= =?iso-8859-1?q?xw76HTv91astkglHQw8bNAoAvmDHPSfrTVbGBKSXvQIXd7vMHx8LQRBWb1Ig?= =?iso-8859-1?q?SoqRALhXw6DpyCGRviSYIZ5dpTXqb5qvpd0NKOn3cflQ0Ei3zyp2LMlXlQvz?= =?iso-8859-1?q?u6QjVXLsdXeWar0TsRQqou4yMWVGO78i9iIaK/Banvw1MbyOBUUUh1CvPARm?= =?iso-8859-1?q?NdN2ST5bdb7tmRlYxiACiqQB2n/IKggaNwHMuUyThsypUjrmUgeAgulj9NwM?= =?iso-8859-1?q?LCx8eJmtOy/9Rkt175wMkm/tkIi3BxfUXIS2hF2XlK0bJw38ykwtQPdj/dXv?= =?iso-8859-1?q?52q9JObSJrdksuHpq71nCHhDBK9pcUUI4GmNNscR4w2PfxX+JPqgdVfwqVR+?= =?iso-8859-1?q?ixM94gJF37ClFezf8XRURa/6rBAyTrUadDbNuE44YQWmTUUkzVwWU/D5qqR+?= =?iso-8859-1?q?bDV7k+PHq6Kcx/4xtiBirFUPYsrXIIJiMWF035O7XUwZz4W8asXfG+7Agy2g?= =?iso-8859-1?q?ymE5e/c7mt3O9wSslHrQOkFoqpFseNm8baHvYtOjpv2/M/AGwRQPa7AnN/6m?= =?iso-8859-1?q?R2TUjXZdG1TU/I6XY8ifiMQYz1Cz7lobQqYDRnZcN75i3PxaESHR7FI/vSjP?= =?iso-8859-1?q?sRgzbmo302lF5PDJKZ68SPaRqIY0rjClbJMJ2JDcrttUh7vFzI34phyvOsrB?= =?iso-8859-1?q?F2iLwsQRqbOUHV31wPGW09u/eNzG90jU3SF5op4Djs8DiYSq5gquSXsGb2FJ?= =?iso-8859-1?q?VcZMPh0lQQjxdl5pNuKblcsMIY+MzYsI7a5i9WEKIMmCI113AR8Ve9ZxwJr9?= =?iso-8859-1?q?h3IEHuAmYA2xMMC0/t/yfNGYD9fN32TH8z+7TJpGtLr1bJOvsziw003oE2Wf?= =?iso-8859-1?q?moNLris1NKC7NTxU0lOOhP3V6YuE/9o28u7Ue0K0vUXbr02LBh3aqLbYBf+X?= =?iso-8859-1?q?L1q8gjdo2IdjmzXPgJf3utaVzP0772qm1w3OstEn2qUw6MgRyP39H1r3szxg?= =?iso-8859-1?q?rxwg3SO6ZwOV6k+Ueu3bGE5INxHSzqjyOopK9NTY4SoWmxub3X/aFTgdGmMf?= =?iso-8859-1?q?nvstahtLLlV3G1FrZ83z4NVQfHnV5t0UyCJjJ8pJe4jeezAxt/c8AZSqmgDo?= =?iso-8859-1?q?LFQ5N8hU2ennRo12Y9QlUZafhIgAiR5Ge5X0lvWnKAq5604snxgECMOEE3nO?= =?iso-8859-1?q?ay3Cxu0YkI/kZ0PkVUUhgeFCd/pmv3+DMxmXqKNFrSQBF6mJaNQdOFWk6Dil?= =?iso-8859-1?q?dLkqWom5IeVPlZj2O?= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ad9bd8a4-cf9f-49a9-cc0b-08db88f05cb9 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jul 2023 07:10:13.2006 (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: MA2n+jmJqevDcuzSqVzyevZDjt3CmV/BNHKC4onKtYxsGtLpwjbzxU+zo520BCWjdfdgH9ZbN+hEAvJBCyrXRw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8415 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230720_002601_058697_387A7C7F X-CRM114-Status: GOOD ( 12.96 ) 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 --- v1->v2: * 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 8cd89a63b5f2..c754d55f71d1 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c @@ -571,9 +571,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 Thu Jul 20 07:10:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13319886 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 681D5C001DE for ; Thu, 20 Jul 2023 07:10:44 +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:In-Reply-To:References: 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=8Tpw+3JPaJJugURAlLMjfnt/WlQWm/oSSJHaLlbGs5Q=; b=GskvAFm0vA/F9k kwSlT50wdgRtWiyLei8iRfAba9r8U5iYrkGbskSSaAOxIKSAj897RN0Rt6VyEuaF8MisKf7K9Mu7B Fd1O2NNGvq+D3hqul6oIL/iGoMNlbiRIl+tlqyO7Cyahydd/bGmY3xJHKNGuGM6gapIU7+RMTZ0GP h2A5vpkO2Lc6uqeFhVlT9drT5Y/kn+A63ig831lT2aD/sjV5OPoNBvM65WI+Jp9c0QODb1gEeNHZi WCq24c7dssC3D6rFRpng+svt00JxHDbICvw3qf063oKdbQ1nJUs9F5CgP6MYzfyOnoiCLMyHuIouj Ur4cLzIo7mUuJKXCcieQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qMNnu-00A4OR-2r; Thu, 20 Jul 2023 07:10:26 +0000 Received: from mail-db5eur01on0631.outbound.protection.outlook.com ([2a01:111:f400:fe02::631] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qMNns-00A4L6-03 for linux-arm-kernel@lists.infradead.org; Thu, 20 Jul 2023 07:10:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iebD1sNFUvHM9FzvDiYtru0o+DNKMjVxovMXzr/OZVn9mmk0XZYu5R7q26CetNwIJGOBbtw5EnqlVk6/K42IDlQBVBKj0rPEfXXqBL2s6oZOzgo8EyDJFZucBLGzuI4qc+ZC4z4Fi3bMNuk1p+CwZ9DpbnwHwAkGkbzPeihFosbe05gE5tf72+YcdjS7av0opu+oVqUQROHHey7ZnyZgSBV6MrgRfzN4u+rLHQyO2PqJBtHPkouBlZwfo4U4CK9YEk/hhq/Jrid+CaRrRalUaqHxrBEma73bWy2BaLX/0WG5qnKGfBUViOsuPlYzz4PzDA0nynNGK4zDz3j5EtY+0w== 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=QcM4UwOad8aiPGN1wd4BrcxlMjn1XZT0hNlv74Fm71U=; b=W2T0BZ+vVunXRzf1yEJ60gYPy5JFLRkwaAtUlHJnJYwMx77ULtDj9FgOeHd2FR4h3HVhSqQL/XYR6fmZxoU2e5KtYndPhUWwaQSNNuCDD7Hn+DNopOHdQqixdj0Ce+yFy+5xMfHnsZkzwejws8khi4MXrzOJ56wDdUrNBFerqHZA2DaGmcgJUyRdoZQ01i7ZtScp4gnHXJrabUTybzlBBJNEioNo2XX+1BBTMhmPPV+erMZIe7mUn08G3bdZxrbqzV+i5jlIno/dFFYJXZ1N7PZuyObTFFm5/1ktUnhjLTqaHXDfY73crG3to138tszLorEDyUD7wwFqUxpkZFkvfw== 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=QcM4UwOad8aiPGN1wd4BrcxlMjn1XZT0hNlv74Fm71U=; b=p63uVE1ONxlpX2cNAKmATkJxkyFiArmHHr4db7MBOhHwr5+31wnIw3L17XKkZ6tIT9/grP7Gc4dBt6f8/qnzmNiWCbk9gHynj4NkiUuV9W8XMD4OLe/uQ4yAV/qY6OMc3xhmGw0Dtsqy3Ra9BB+vnNVkWqecteB2nvHIDJvYYMQ= Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by AM9PR04MB8415.eurprd04.prod.outlook.com (2603:10a6:20b:3b5::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Thu, 20 Jul 2023 07:10: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.6609.022; Thu, 20 Jul 2023 07:10:19 +0000 From: Ying Liu 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" , dl-linux-imx , "alexander.stein@ew.tq-group.com" , "sam@ravnborg.org" , "jagan@amarulasolutions.com" Subject: [PATCH v2 5/9] drm/bridge: synopsys: dw-mipi-dsi: Use pixel clock rate to calculate lbcc Thread-Topic: [PATCH v2 5/9] drm/bridge: synopsys: dw-mipi-dsi: Use pixel clock rate to calculate lbcc Thread-Index: Adm62T4XsRXruAuytUCRfthfHJ0PDA== Date: Thu, 20 Jul 2023 07:10:19 +0000 Message-ID: <20230720071430.259892-6-victor.liu@nxp.com> References: <20230720071430.259892-1-victor.liu@nxp.com> In-Reply-To: <20230720071430.259892-1-victor.liu@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SI2PR01CA0039.apcprd01.prod.exchangelabs.com (2603:1096:4:193::16) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) x-mailer: git-send-email 2.37.1 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: AM7PR04MB7046:EE_|AM9PR04MB8415:EE_ x-ms-office365-filtering-correlation-id: 5f39451c-bd98-470c-49b1-08db88f06092 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 927SuwfviYwscyZCa5dO7tqXKFvioMorJOXtth6I0zsODsAVtNszmHr0I7EffDf1uz9vUvrs+eM3jjWkcWM1hxtq9E3t0jNeSpSPuvD1dCCMXNqJSApd6kRaF+8vmZVpvoyokQ4XGDC0g+Jh573NC9YBU49Co4wepeUm21843J055OzfI1pvzOsd/wFDVnkF9T+HYToWlHNNHh0S+T+C/k7jvnGJ4FEs+/ScJ78kqxxGkT3KlLVblePQS4kNeMkqjZHaQut964Tc+w7EiMYmb2PlA/0HJiyiKAGzeoA6g1h25P9jQYbIe6ccd58eYXPNot27RK29hYq91Hqu/QZeZUvVDt9a/l/uQ1QJcGcKtqbqS/27Lm/0IoGbhGLejxRkZUa9i6HRfNPSCkj/E2o7eZE9NhWmt4U84YP1YLapI1CMl/veWsX6eurMFp80TcjXb4M+5xyHbLAz6+19Z1DPoTm7lqmBULjOM45FS3uIXNaKawb4LpZmQRHlJKAOS8eULhd5sGDDKAlnOb8HwCkl80M/BLVvsaqdWkBUViuSuaqkkDi9jSs+QoVfp2tFbus/Lb9HSRH7v5KHuSC0JXP6XEDFom+LCJ7wLw9IHeGUcrg= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM7PR04MB7046.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(136003)(376002)(39860400002)(346002)(396003)(451199021)(6506007)(478600001)(1076003)(26005)(6486002)(52116002)(2906002)(6512007)(71200400001)(4326008)(5660300002)(66556008)(316002)(66946007)(66476007)(83380400001)(66446008)(54906003)(110136005)(64756008)(38350700002)(36756003)(38100700002)(7416002)(8936002)(8676002)(86362001)(186003)(2616005)(41300700001)(122000001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?pFIuyYGjs++tFrtAbBWKG2B?= =?iso-8859-1?q?VQ9ZJ4tW0TOo+Dw92NSGdm/cBJFNLYSM29+v3qops7gFmWy7DyrIyCdSL/pJ?= =?iso-8859-1?q?k6St2buNdUFMzF7ddi0qGjnQKkwGhRyDtTbrr0MP1RsBqwrkskatOeiYty/F?= =?iso-8859-1?q?HdeXTc62ZXk/T3ydYN9BN3dM7FdZPiMQR+mxD+zmMJqo9fuv75471brwkBTg?= =?iso-8859-1?q?AGEG8bgtT9zack9dDWMw8g4wT1/plBq81nMTUJNuSB35XHt8tLArtN8cFjIx?= =?iso-8859-1?q?2P5RLrqnIcP6ukyY/zx8WmUrryTWHjq5MuRFRAsq8DUUw0VecKW21cZdNGuE?= =?iso-8859-1?q?S/lohap/Ej27vdSk+9TDjxklTzNPQJ0xhoniAClo+tCTyKmo4uJvu145dJ9L?= =?iso-8859-1?q?S0Ewq/qXdL2FWhNqJROv7GQFIwdpsRb1m3I+sVfK64ydMfF6LxeviH5yJscc?= =?iso-8859-1?q?iWZMkCTB9TniuToXO3ZI9oiIlrP1Q2vaZ+jLOLmc+JcPgPhl8Pa7LEZJNK1+?= =?iso-8859-1?q?GyrcdA9ceZwm+M5dNwYyklHyDrXPYlCrYtN0xebwFj5Boy6/F6Xod6EHrWK5?= =?iso-8859-1?q?IWrtLyowe3BheP2w6NrvfkO90vzmcPUxRMmH/H7J1EPmgN6jYv75Dts/mq+G?= =?iso-8859-1?q?pv8LvLXztQBnTo/PRdvjK3a1mN1Q8voyS8Hgy21LEtywAE98S9GedpJ7INYq?= =?iso-8859-1?q?dK6lDQEr5vFnhDf/0kE6tVSCIreAgAT1Ig3ZTBf3ZXc+ER4lwTmSwLLZJCkW?= =?iso-8859-1?q?x/7lVHpVZg1Q3wbD2pKYw5pEXrYvmOfZT+KqEqNg8bxhETaNovz0z+REVaSL?= =?iso-8859-1?q?UI0qU8wSaf/f2q8RWlQ7ZjFzeBwIlmejtSm40LwQHvrTS27hfM0ixZcmQ9aR?= =?iso-8859-1?q?0Sz4mIy5H5b++eb58B2Ie/PFQW6JoQGpu2VqaiX+r5BluZk9xcxBTNden3M5?= =?iso-8859-1?q?js7Som7yheYFmnELINnKO3c5/SZuERb8tMtQMBlsAeTYLuI43UBF7QILI6FK?= =?iso-8859-1?q?1b8rnGXRRF8GKsCPR7b56up8o8/ddelizeGG73iGp8kV+DAGYsMycqydyoHb?= =?iso-8859-1?q?7EF8ibe185jOc0+rzO3sjCahRcSHio7SUkZopQXq+13OIjJDPZsCXphgXASs?= =?iso-8859-1?q?oknL6fUsxDTIN9tnXqynbS/9haNMMsgIKCIgjiL3hmaxxZljod9Cal2155bz?= =?iso-8859-1?q?dBKzEj1pFzIkfEne4MzNc2fQJFUfk8q2gxqpNIxBP48xnV7Qkx7iEVD3D+dx?= =?iso-8859-1?q?a6MDgfbZQ+JEI2OVUpSjYiRz66fF7aGdbn8zb8yNjVaLzmhDjFgLmmZJj5GZ?= =?iso-8859-1?q?QxfHEyf596T3rN7kD+NxdwPKVplyEaUzTanYzGie1DRDkXsLOcnGdW1PuZ3H?= =?iso-8859-1?q?Rs8OUJlI//nCvOW79F+JXuKektKqG67jLUI0AwyR03V0VT/yWNomwFbmlk7v?= =?iso-8859-1?q?Q4kJUN5vddfDOUjqqhuJdT3uvfPln3UM9eRcIC8gxoJNNLy/zguWVUmggwKJ?= =?iso-8859-1?q?IEY9nyUc927WFz76oujuUeZ5+kQIfnp93CGMJA5BRipnYpXc1hKEKdaDE9wR?= =?iso-8859-1?q?hvtm24DWU+85sw2Wh7tXud+IE4OPlodxyqgon1oBRf0DFX2tlon3kxYmko7i?= =?iso-8859-1?q?xLktmPyKtqbgRpNiG?= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5f39451c-bd98-470c-49b1-08db88f06092 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jul 2023 07:10:19.6718 (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: /aiazLIxuDq3z9yQZVss5F3pct/K9HTwicUSVVnoXI3zyBSmlLKlwHyxOMshlPBBY2yglbFwGBmL1C2ANlF3hg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8415 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230720_001024_061658_4227DE04 X-CRM114-Status: GOOD ( 13.13 ) 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 --- 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 c754d55f71d1..332388fd86da 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 @@ -762,8 +763,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 Thu Jul 20 07:10:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13319932 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 2EB23EB64DA for ; Thu, 20 Jul 2023 07:25:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: 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=Y7h/7M+phC7pcdFpyanfHXN+I83F8G9oxR6kNcj0aX0=; b=m8CLn343PexsrG 6PSZIpt1dpPEEzGSSLaaoS4dK5+DMtV6cW8NmYmw+6RzMSmaQqz6LRjNQTkkWPaXLlF/XQSoAgyv6 G3umHUSKe6eQ9RxNwNIoItnCxfsLSqGM8IQqoIxqtZu2x9nayl9BvSGUTXKrWzpehyZaJK2Klpckj 3A1sGLOm3Jd/2cectHOCTLl9zpTNiBewAxOV/D7IxgDzAk+qZusbFDDhy2PfzdgKZzNVIK04YTNkR Z0V3ppnU2EOPcc137psHRbZN1odfCUUx7F9kp6eMj2juKFePgoYDoWWyngbHijLfTiCCMjO9r1qpi Fn5FzKE75MXGDI884VqQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qMO2b-00A7In-0p; Thu, 20 Jul 2023 07:25:37 +0000 Received: from mail-db3eur04on061c.outbound.protection.outlook.com ([2a01:111:f400:fe0c::61c] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qMO2Y-00A7I9-09 for linux-arm-kernel@lists.infradead.org; Thu, 20 Jul 2023 07:25:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HjW1Gnn6/bQSemsX5gitmzAQWSwAtRAVqNFbPVLMDJHFt28se56bPYwl5+yYlc6O+cX9RbYMTIavGuU8+nwA1bj/CcGAw+luMviDm6QzZyOphpL4UXqALCwan31un0xESWrlISbvIm4LMtyIOUg++gN+lGXPVuJQCpsGmit0/bLule27xPP8BFXitJvzR5SYnoHh6GjSDmTh8WglkAPV9hsjkF1IHTJePqQdY/Wr430lsWSPRzShOCZgWj562BTY1IBIruR0tf45rBVcNSG1TKM80hpQQA82evBL4b4UhSM4HxHrVDY3bvgH7DN1iSTzKYvKehpoGCLlFcYD9Drk2Q== 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=rhSkJQntSWcBdOAGaZsa21wewZ+p1zIS6OBZzYYOB0A=; b=bUUAemaBCdaxkzhYm56TdUWeeGzDvbMjfgMKwfVv6ZKTF6WkBGTAmlOXjAwM0W7du3AGaJECHNbBuzVHPFnGqHrJE7m7pas09313dkHxNhpkTPH/4veiJy8ZQeHo3WVAFHgT4VLkV2zD9qA4pgA+XNxXrlHfELvwPk3++CdfkFf+jD7SwMqZbvfk0yCIDESAafTabFhpCRGQU4/7t7VDmMgboIpmr0n/+PH3Fiw/CSW9kF3lkoM3qU7VhQ5ZPf0ZSMc2sO/Mm/pfqE0r2dt+0lPMnktZRSdSEpkHGObFTAeoqXFvQoBKVy4+sk5Fnh1+gLZrmApLsQnjfrF+J9kCvg== 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=rhSkJQntSWcBdOAGaZsa21wewZ+p1zIS6OBZzYYOB0A=; b=cQFz6qxh7B5iAUnVqqnDB45tEjRV5R0NbAQyyruQmH6C2b5z07KlyQOOUMD77g1mOPI3ZImvcA5otRYsqjCQl6fZw7nnIn0/g2AHnp6i6AsFUmDnlQOMHOpR4jXF74iue/oKTZi5nEFH/X221eZFLXNdaE1iO3D5OZjG+Qf6IGc= Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by AM9PR04MB8415.eurprd04.prod.outlook.com (2603:10a6:20b:3b5::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Thu, 20 Jul 2023 07:10:26 +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.6609.022; Thu, 20 Jul 2023 07:10:26 +0000 From: Ying Liu 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" , dl-linux-imx , "alexander.stein@ew.tq-group.com" , "sam@ravnborg.org" , "jagan@amarulasolutions.com" Subject: [PATCH v2 6/9] drm/bridge: synopsys: dw-mipi-dsi: Set minimum lane byte clock cycles for HSA and HBP Thread-Topic: [PATCH v2 6/9] drm/bridge: synopsys: dw-mipi-dsi: Set minimum lane byte clock cycles for HSA and HBP Thread-Index: Adm62UHicPoHs/xOAUWcntvTIy5cWw== Date: Thu, 20 Jul 2023 07:10:26 +0000 Message-ID: <20230720071430.259892-7-victor.liu@nxp.com> References: <20230720071430.259892-1-victor.liu@nxp.com> In-Reply-To: <20230720071430.259892-1-victor.liu@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SI2PR01CA0039.apcprd01.prod.exchangelabs.com (2603:1096:4:193::16) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) x-mailer: git-send-email 2.37.1 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: AM7PR04MB7046:EE_|AM9PR04MB8415:EE_ x-ms-office365-filtering-correlation-id: a446ecaa-7d24-4f1e-6510-08db88f06468 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 6+y8DSfmjnOhEJAMvH5/CQCYPIexSA12mz/Q5OzrMGWBixFboH9426KMcDcbW8ZxQRDH2dgwJvObp4ap2XOXsgR22gF9S4BW6gJrkN5gHpTQsaHe+8w58iZ4bs6XSGRzS5CnPBn2WPvL6yzXq7GAfOueM/QsNOVKbyj6fT/2NmsKyX2JK9BnqfMWr5BcPzzgqKF+W2h9TRkF7rRzQaHlzSKcDUlBiFKcJrYuPxRWA2qYpXCZti5M+qciq/Jn/cVyHpPW5ktcT+n3jClfymMYxboLNybcqhRAnuOb8bA198Eh6ljPNqsQKmBQkBPcQE06SoTHBQHwsdaKZoaCNLHpj3QwWVCYGGaCFOcbQvIfDhAL7nC+wNJ6c/Dd0nanjim6vTQE179es622pPZNTK2F/ww9Bx6Z5g91SorwIptKgkaECVZYqmH/LtC8axICXMJz9wgBTRC7R+sugbfSxDbMYoICV4l6U4MvcKEdBf5b+rj9oFE3AAejkzR1gw6fpILS7GaPN3Hx22TJDEri7jSyAYgby/WDmJ4QXf9IC4v2HC6WTVZOvodof2o+TxdZmiD6l96pPuiaM5sSBQrt80KEvVWB+0UDMWMrppETvFfSAmXoU2leY/058N2vYlz5QplM x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM7PR04MB7046.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(136003)(376002)(39860400002)(346002)(396003)(451199021)(6506007)(478600001)(1076003)(26005)(6486002)(52116002)(2906002)(6512007)(71200400001)(4326008)(5660300002)(66556008)(316002)(66946007)(66476007)(83380400001)(66446008)(54906003)(110136005)(64756008)(38350700002)(36756003)(38100700002)(7416002)(8936002)(8676002)(86362001)(186003)(2616005)(41300700001)(122000001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?bI2uAWd/1sX9fPuhsQhyiOO?= =?iso-8859-1?q?ZEBo3BtkX8kO8xWoyRWM9x9X795E48Hv9MhbTo6PMir0NPJCLJdbZwfK9lH6?= =?iso-8859-1?q?X+E2BI/AoLNgfRgyxjEDo9vfv7OjUaLvMUIy/TrtINiH3K/P2p9oNKcoCPda?= =?iso-8859-1?q?XFgRhdRXcAqfvTCgvFqHHS2hbas0agXQ08bTvxKBvL/SYbM8DINIF/V1jvVu?= =?iso-8859-1?q?3Iy6bJgqwyBXO/6kxZnl72iGu9+sRHL4JOmwVRzr7DI27fgTMYWI9mHX3RX0?= =?iso-8859-1?q?vjfi6D9wRN38TOUjo47d+8XGxSJjITth+SNy0Lrj43sRt1Hdi7wsLY+yTY5z?= =?iso-8859-1?q?IBw1r7iJiZtGOcrzGJFJRwKxGgI6jl2gqnnojapC9ZlYpLLNZbXF6V7Epdjn?= =?iso-8859-1?q?imPcXQnwPZkk/K3oRnrh0nVSuj1Xq4TvM9A8CFy/2mHWERknQY3P2YT31mYm?= =?iso-8859-1?q?MQtz0wpKSl+ykcPQmeXh/kHO7OWd5ogDxTGvB13hKVbWVRwPH3ivnKLvDXjq?= =?iso-8859-1?q?G8N+6LC2sGy/wT1WVwNwjJFd2rSvbFjP9Ds6jHhmXuh6USEMtiRoDZ0czAgO?= =?iso-8859-1?q?BmGSXPuFvDvK0ymaxRaYG8IY2BVk0+fJGtLOtSB5K0sGNV63xO/4TK/M0c4e?= =?iso-8859-1?q?iq9WONH7XC/9nYCR91WMSGPFAF0OK06gwPdvQQsoA8YJagXhwdqBBS3hUgo5?= =?iso-8859-1?q?BLwl1U4L4+F5hjm2uDj6Kr5iQHFzqRKbiW6AoG8JLRBOwu6J0CePtc8YMB02?= =?iso-8859-1?q?7g7c692xeONXawc6PChY1s9UtvetUYJ5ZiLha9QiZn963Jg2h1sWtDxDnDTA?= =?iso-8859-1?q?9Slkr5pKA5j5K5/ygst9tesMzeBnYbU/TPsl6slBxJnfJRublGMafb6QcPR+?= =?iso-8859-1?q?jJkL3FL6bWiKezEvvDEo+6T/QPHElcf3IeO4oFsRbKBhkEM2pCnaesll145L?= =?iso-8859-1?q?xd8/oQ8E5uvNe6SjO9i3xu/LsB4MzciU1GhEn1HipBDEqvJJjMr2gIrOWRR8?= =?iso-8859-1?q?5TLnHZFLc1AFiTW61tVK4hTVKcQT2W81fLNp5W45guCHjN4pyW0e9Pe25Z0b?= =?iso-8859-1?q?567PRY7q2/KttGSIl0SWKgz9X4kPMIn7ZTgbilaEIw+zvhOSakbTp9fbZLUb?= =?iso-8859-1?q?kTS2et9l9i8HzwT0OCxsuyolNCdvIFVFAQX3I50LxbjAU7uuz/swwztHuX8M?= =?iso-8859-1?q?zdmeFByiB2w3d6K2PPhg6JCBMOZfw3OL8ki2RmdWTCsWUTf0TUUKXJN/kxvp?= =?iso-8859-1?q?FbsiXAKytJUFoxtDeelaE14iq3Gf2Ti6brfhC7ZJNQx1fKXNHMNRdFJ1YtLK?= =?iso-8859-1?q?7e44Yrk3M7tPYT4I1WFhFgLyEPJdlaNdMucy6PgUbKstGwN53l+iDNKOnXPo?= =?iso-8859-1?q?DKUIWxbHp7JiIGQ1dsRrIHhsyA1O9guvzlKZef0E8qlCFgpHkR/81+ScbDd+?= =?iso-8859-1?q?zFjqgsxRDEC6Vo6f2Q0B3xXGJEJG3n0eTWTt9JY/WU1E2hSkxw+hyGlC8cWg?= =?iso-8859-1?q?z7eQ/1xVwpkL8Xx6GSgFLKRrx1RBz+roeuIZ7XiyyRMLVUlL7hVW301JojU1?= =?iso-8859-1?q?9wP95xlbpZ/GmltXZP5l99xHjGenvD0XwKC00ZwWmhdCGAewIRMdM7cnnmMo?= =?iso-8859-1?q?f9q0390jarWTldJDi?= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a446ecaa-7d24-4f1e-6510-08db88f06468 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jul 2023 07:10:26.0564 (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: IA6gQbTrrmGXPKqPVyPpkJTeJmduevHkMcTpiSI2Q+tJO7yIexM7MaNTtSNRf9LEaNH9znO1Vgq6DGvX+DAQaA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8415 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230720_002534_111947_5A8CE2BD X-CRM114-Status: GOOD ( 15.40 ) 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 --- 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 332388fd86da..536306ccea5a 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c @@ -757,12 +757,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); @@ -778,6 +785,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 Thu Jul 20 07:10:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13319887 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 502C2EB64DD for ; Thu, 20 Jul 2023 07:11:01 +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:In-Reply-To:References: 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=pGSVrtxTi6whpy32tKFcTWW9Uicy653fEuLZiyHVuS4=; b=M1NYpq1/PUvmrM zsDYwr3MmQQ35gkjw3rf9A8i38uOVPvX2nhwJDJ3tvvUWK9skj50RNg4pV/ooBAV19M+JCWSyeIXV V4MlGpCm0MGC5XLsfn+qcWqIAtYTgpuLmfHUuzIa6JNfmGIs2fkpyq9mXq/GSTWZQPBwaJGw7kHP2 WNfZxYTFiKyyjmURFXg1RlB59Q70/to2MUIbr1x7CIRf7agzF9kF9hU39b/B5p23b1y8dJbQjYQU6 1Ty1tAT9ts98mzMxgAXl8BImSJO9knfJcSofPSy1WhzE05JsqQ/j74+dc55yR3uQdo2RU4DuMF5zl HNYQD4Bfy9y61CxG5WQQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qMNo9-00A4av-0x; Thu, 20 Jul 2023 07:10:41 +0000 Received: from mail-he1eur04on0602.outbound.protection.outlook.com ([2a01:111:f400:fe0d::602] helo=EUR04-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qMNo5-00A4Vi-2u for linux-arm-kernel@lists.infradead.org; Thu, 20 Jul 2023 07:10:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IbCJ9kWD2576lAbJvOqOc96c7JpFbErWnoQg1deS8kRDIi6Ios6M8b3lmOy1NmsZXLRxqrYbH6zBlBvcI9nP8YsiTlan957NQMDdyOyhaI81d5qhSOt8FDPTHm7IYqsbLSCuwHArGNzG27scNkZ+y+hJq88QlL/bBr8eTOqLA7vSyWpzXbEfx6Duu/eHp7+Xn3JEEr1vFn4zYlQMhkGeqaBwgBpuEa/zyIA9kRJRcixnnc6wVztW64RTQxPz6PE7uA6/iqbWtSoEjBHKyNVUgAhm8QN1jrTIl4DnbJZ6cBfTOjIwRAhkLJNfxTNQZr/nf796gqu5nYf6kWdEt7Shlw== 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=Ro5EOp6mEkZd6S0WaGYqv9gtqvuAyxqa35OiIznoIJM=; b=aRyBzTpAqz60XTbrMF6FH2g01fRPjL5bwbZ7U7Rr2yrJvJjC4YEDH+N5pxgr8n64Uf6BNxEvSrDVGKw8/GwN5pyGMox4ptZfZxzlbIzCqQGfDO+a0RPOCb6oESxTXlUuGzTGS1cz+qd6FbK5K2LA/A+hWlkc8G7rrjKlmqCNCe6NDg2ghTeSRG8lwqmqfHhCVQeS2AgiUSEkviXpyDJe7Z3NjlbT8EVCw8XpjsbVfVrCpCRP+22e3zMylOPqLEmwdbNPYzFwIxNo/E2cjj5mKuCXku7DwT2MZyv/cJ69bVXxQWsyB8NJPZmaUasRw6qlEzjryUdUFnm+XmJ95DSi0g== 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=Ro5EOp6mEkZd6S0WaGYqv9gtqvuAyxqa35OiIznoIJM=; b=gP5Pv9/8giUgjPKf9juczSRwGAZ9QONFVE7ZUSydo0yCkNKoZITS04244VquGNNS1k5AXjV6WI4RClLEUGG69yZUDLTm2pZOiaj/bKRTvdnfYD9TwvFYLj/7HjmhDS1c3TTwuyCCHHDv8rtI/SmyOukdFo4HgJjO04Z7w7OEyA8= Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by AM9PR04MB8415.eurprd04.prod.outlook.com (2603:10a6:20b:3b5::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Thu, 20 Jul 2023 07:10:32 +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.6609.022; Thu, 20 Jul 2023 07:10:32 +0000 From: Ying Liu 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" , dl-linux-imx , "alexander.stein@ew.tq-group.com" , "sam@ravnborg.org" , "jagan@amarulasolutions.com" Subject: [PATCH v2 7/9] drm/bridge: synopsys: dw-mipi-dsi: Disable HSTX and LPRX timeout check Thread-Topic: [PATCH v2 7/9] drm/bridge: synopsys: dw-mipi-dsi: Disable HSTX and LPRX timeout check Thread-Index: Adm62UWNCyqQxjzgdUmjJHPwqEPmsA== Date: Thu, 20 Jul 2023 07:10:32 +0000 Message-ID: <20230720071430.259892-8-victor.liu@nxp.com> References: <20230720071430.259892-1-victor.liu@nxp.com> In-Reply-To: <20230720071430.259892-1-victor.liu@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SI2PR01CA0039.apcprd01.prod.exchangelabs.com (2603:1096:4:193::16) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) x-mailer: git-send-email 2.37.1 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: AM7PR04MB7046:EE_|AM9PR04MB8415:EE_ x-ms-office365-filtering-correlation-id: 69888b05-0bd7-4453-d394-08db88f0680e x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: LKldNpDWd3hmOB/Bpr6a/6F+3FGySCfQn0aNbYMoMxq7aYZ+Rht1uBeeIySt+V2g6bK4KY7nvLgBwcPbgnA5f9PsECC4un7UtJAS7k/v8xep9ERrzTBpd1OiGeicnFolVXyUY0EPdOIwN7r5OISl6Hs3OTqTbgHw64yzdf9cEGU8DlFrMg91u6E4/XdkNcXNezZJ4HbbDxeA1bMXgRBBWjReMAP2KPB6eq3IwpES3bRjOiW+dGS6C31IoEU8KVDzzBhK1H4aiZLJnlPLjuGWXe53KZ3twYzSS6l62ZyI33n0kojVGjPBNzh60uU3a1l17XYFCsDRsJkAAuNCJmTS4aS1kSV6Yw8mXJB2yradc5fLPKfMHgzSr3h/jgP5J7+X8dFpNrA+cC1mpD0j8h4NrJGU8GyI9R4hOuF4Xu/9+3p/8hckFxiRCxCb8M/p1u5TNKpEerJAmcpIRvKCUbMsFdhS+0pHv2nN+Z6G1BMyPsZLHbazmOsmwPN1hulffMe9a/TYZenm3BvTijtTae23+DPeMtOsdOlnD7rPPZy7Tq6XP0ECzbqI+xq0y3sIALxDzz0XweBB4rMwshXZzMXP95JX4+/Svur4nK8dB6CZ+oQMrYW3z/SzoJkgcaZrFvPI x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM7PR04MB7046.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(136003)(376002)(39860400002)(346002)(396003)(451199021)(6506007)(478600001)(1076003)(26005)(6486002)(52116002)(2906002)(6512007)(71200400001)(4326008)(5660300002)(66556008)(316002)(66946007)(66476007)(83380400001)(66446008)(54906003)(110136005)(64756008)(38350700002)(36756003)(38100700002)(7416002)(8936002)(8676002)(86362001)(186003)(2616005)(41300700001)(122000001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?R+gKqyyMBFptvoZofgvNiPp?= =?iso-8859-1?q?3Z0pBsgkrmLlzPqaRLdxtn7K7j8zGT9EolawKCCxcgf0O1DYFpT7ivr++f0f?= =?iso-8859-1?q?N5LKSiDQa+rykZz6zxMrZIQhN4mNefL/XlgF1m2ThxOnrKqPj/FuxsQc23Fm?= =?iso-8859-1?q?n3wpAfISldqhulFiusNuk/iKCnCHd8YdmU5fX94wdhSPa/9XEpYDpAS6+F5m?= =?iso-8859-1?q?oJ0eFNdLYngLkWHaGwtCN0CpmdJ4proZH96BBEtz0NkUgW0574veT8hiWYLX?= =?iso-8859-1?q?fxI0PQDoFFxz+o7Yr2t3oA8JnxAliaj6hv8E10Vdf0pCxOg/YEtUf6GleUU4?= =?iso-8859-1?q?zW5sM17pSQv4aGSgS58GnRzzJxdKEjYyUMRL5uy7ptRNHysSjr4ZKWlMjvGV?= =?iso-8859-1?q?0Wg2MrL9aiZR3ydczp6SI9QSd04F+d+Okj1SrTfF5j+VRN3W9ZT5GoUoEzYb?= =?iso-8859-1?q?omN64SEhtV+8a6fRHMV1+qOgC7qtZoqzjglOZ9CtPIsXC/FcWLorRJfkLeRY?= =?iso-8859-1?q?r9rmBY2Z/LvrIVNGZSnd0E/5QzAaqObKLlYLWaCHHbsY1ofI6ucBN0krlgmy?= =?iso-8859-1?q?2rm9mrQstQGi+yQwjOGCTz5dkhNoOOImsDamipxOHqATxWFBHNT4xH9Nr98d?= =?iso-8859-1?q?8nO8Hz5PR+EE+vwYFcP5uk2GeWskoYGuK8z404AvFPtDxvFK2GF68c9N5ErR?= =?iso-8859-1?q?HInk9+9ph+bepvTt024mhpGsegu5KfZ6G9XriMEk9R0lkKtRY8LwaKMdbeRO?= =?iso-8859-1?q?dbrORGZuE9zzYV8GrSxaQlpzlXKqUhLE2KTXlPm1JlY0H33IRdJe+SI5kWd1?= =?iso-8859-1?q?pqhT4jfuA7R2aqn4kKG7aSKbjM7ZPpayu4s7UR5dmfdy1W+54Z2TE2atDzJO?= =?iso-8859-1?q?Z1lpw4IXRYgF9ZhSwZN2WiL51VI9X/NIbxkZTVcHQYAf7BZwng1eks4X37Z4?= =?iso-8859-1?q?1K+D8hnBDqlh7i74/NWXQO3mqxwvLZCPHih4f6z4wNbyZvoxKkc+O5ChiT7g?= =?iso-8859-1?q?Nvs8+wr+SrEqHL0WqzuvQwuFXbOhpWJ7WfhwkbDjwe6+pF7qYAcR7+3u6nOB?= =?iso-8859-1?q?Pbi4GVHXMRAq05iHPOUzWP+5p2NZjCvEndAnroy95S6+5Bwo2TeRLFdGRT1a?= =?iso-8859-1?q?qJ/wwBk5LWA0PlxMENN1ugrKNmbxPPF8Un1DGQoMsvOuSa3au5dGLdH0SC8b?= =?iso-8859-1?q?S1tzv0XE6bsRthmTck4EPu+7C5/+DXDY4x6T41wifse11o9VlZdrp0LeEvNZ?= =?iso-8859-1?q?gJ+uQn7JZWT0vlWpGOgc6SfzKooT8Fkn1vtNS9KrSux2aPldAj2fw4a3NHuW?= =?iso-8859-1?q?9VqOxRK+nSkHSK8NhufT+iL8V9jwdZG9p9jg8/F26Jf2XQGdEEJUFhp+AewD?= =?iso-8859-1?q?JlflX5ZUgGnx57R5GwsIU6EpWRxFG+i+mxL3pA5eV1WpXXf+J6wfTgT0YFlU?= =?iso-8859-1?q?eMg81Su9p/ahC7Ckg4YCepArYA1KOrpz2NfeRgZbTN+MM82LYMFlccvszliY?= =?iso-8859-1?q?tkvqATog/0UWehcvoi2Wpmtkgtd2/zHMpKX2jxAHHsY1ibtJkFy0pMB4vOHD?= =?iso-8859-1?q?4tFKn+Y5fOSDBlr2nXXiQGpjAQlTqC4uyGleO3ViZunhNZU4h3Nn7ER0nEd3?= =?iso-8859-1?q?0S/bcuj37+G/8ghLz?= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 69888b05-0bd7-4453-d394-08db88f0680e X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jul 2023 07:10:32.1952 (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: XUixrAXBC+LPWrgLCvV6MFuqbsLdl3WfEDdnZ2lRWIAs6kJbodURnp6wiF1XEWL2sLKanjt2MSd/Uu8z1lsppg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8415 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230720_001037_948251_778B484A X-CRM114-Status: GOOD ( 14.21 ) 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 --- 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 536306ccea5a..0fcadf99e783 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c @@ -684,7 +684,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)); } @@ -747,7 +747,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 Thu Jul 20 07:10:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13319888 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 83FA0EB64DA for ; Thu, 20 Jul 2023 07:11:14 +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:In-Reply-To:References: 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=/fSK/Jy44JsxdAZTYV1l6x863kWFJBa6zsD0hmlsLWc=; b=GBC2T9TLAH6avH 1yMrYNzbIUwhH82YsVl39Lo/ZmsewU098sM8HQqtmeuEGAS3jTf0FKOXWXqwfVQsT4k8uu7vfDy/i F30Xlh5gp7UaeCDAHKpKaEqNv0KoCxzidJRKZjnjvo1nd50lM98j03DWP7cQByxf0+Qpx2r017/IK HSh8Kzo2IEiRTLE0Hx77dLWINDQNX7Z45XmErmDVq+m+8HPGIx8onap5ZVwGiZV705+7pm0tgpOFi I7z6EGY2OBQhSlCFhUOPLAy8IaPMX7mzMpmoLSXWB3I95b4ixPIG3m33xwuLF4I1ei2Fjdcq2QbjW 8vPxOGVbFuJLUNChKTew==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qMNoK-00A4ld-0M; Thu, 20 Jul 2023 07:10:52 +0000 Received: from mail-db5eur01on0603.outbound.protection.outlook.com ([2a01:111:f400:fe02::603] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qMNoD-00A4co-0m for linux-arm-kernel@lists.infradead.org; Thu, 20 Jul 2023 07:10:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ggpUP2JEGMQHR2Z0cu/y/23vps/JwqImy5R3jh+2/amH3lCGyjWlW28s6ftOmu5pn74JoH/+bSWjwLXiud0h9GODfa72cmNNljPULtGWjfPfoR2dx7e9gPFPLzOLHKoU54veVv1OU5vDyTRSVxIF/RBNuTwO9k4c/YiY7PkbQuiXvRkO8Etleg3fgRx8cY8QRUP6YoCcVZtRcZzxh+q6xVueA4x1d5Jrl+u7ZzX+7VUxJOkD5TDe/iD3nmJui2nV91CEgVxndzRL4kWuS/LamtS/hv2i3+VwBG6l079+LXRfMRzapBP5QixOCcTMApcjd4OiHF15ib9xArrqlgg5GA== 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=ht35sNILRuy3JDoTfo8lLosxxMyf2f6Qkc+PxgdkdHs=; b=f4plSjK56AG78fN0D+sulI57wToOLt8dteM6eLjr6m/mKrC9dPGyIqP+1mqjwuPQQTGi8BizzvkXpKn1YO0aonCKhmUsjKp399dZhFvt0joYyj8URFm+Km/qEAzJ7001GcHD5IUtxJ9kuDsaTm9zB78vR3OHPl5xmXVvvzzxMDXl3WVvUC+46OKbMx+W34D6keMQjH16yVjCFYN+xdK123z5ReP3BigY4UiqrIJRkuhqe+ua14RUZM9jaPKtUelzDpODlF6mlRYpKxQ9QchprnqRHPQRsQGlutjPN/L8R9ObeNAB6aIzOAijncU6U8WuGUv+5DzYoxEE3iGDaiuJCg== 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=ht35sNILRuy3JDoTfo8lLosxxMyf2f6Qkc+PxgdkdHs=; b=JzugVVPqp80xdQ2GOJnwptg/NAVBzTQOvNxr8QMBpKQCwSFN6vAlFtqpal4sI3Gi6JM0Vblqv64BYL/OlmHoVTNyQO8mioLzvJoy+Jo/klctT25C6BLLQQSeHE3r9OkpfWF/hUNohv9WJ6YP/vw8xlbDFg3WStPANc/NFLkhTaQ= Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by AM9PR04MB8415.eurprd04.prod.outlook.com (2603:10a6:20b:3b5::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Thu, 20 Jul 2023 07:10:38 +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.6609.022; Thu, 20 Jul 2023 07:10:38 +0000 From: Ying Liu 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" , dl-linux-imx , "alexander.stein@ew.tq-group.com" , "sam@ravnborg.org" , "jagan@amarulasolutions.com" , Rob Herring Subject: [PATCH v2 8/9] dt-bindings: display: bridge: Document Freescale i.MX93 MIPI DSI Thread-Topic: [PATCH v2 8/9] dt-bindings: display: bridge: Document Freescale i.MX93 MIPI DSI Thread-Index: Adm62UlRadPx1sNHokWiUjk2oOWebA== Date: Thu, 20 Jul 2023 07:10:38 +0000 Message-ID: <20230720071430.259892-9-victor.liu@nxp.com> References: <20230720071430.259892-1-victor.liu@nxp.com> In-Reply-To: <20230720071430.259892-1-victor.liu@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SI2PR01CA0039.apcprd01.prod.exchangelabs.com (2603:1096:4:193::16) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) x-mailer: git-send-email 2.37.1 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: AM7PR04MB7046:EE_|AM9PR04MB8415:EE_ x-ms-office365-filtering-correlation-id: e1cafc19-3a96-4641-dd0c-08db88f06bd1 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Zd+iqvl2j3CG8WqjKhjPl6G5oUE2wOY0zrEkr8nVDtMMWMCI0QtyRRgpGlNneVHWwk93ezpRPYgtekLPyDXa+RXEtJfEWRC92f1mKu36jTPIuUAB3K7nkkC7VaGjoUWyGcRu0UwiZ5ifffiBBxsxgQQdzrkbWoG12ChGyCAHLOpWDbPwMJf/I90fxuEPv4phGaWBaILLJ1pYk1b+7jC+ZqQBIoWS3eRWqj8BRKfU3NReubRNTarRZtJw1SXe2vJjO78N0tKNuLAbhbsIPm3HVugRzWsRkoybZ0QV1ePq9c1nIeb9xtLa7OPJyfYHkvj0bnjjYSqrHsBSVK/7ZIwmKezICa7dmmNF/5C7NlOiUMXEFSuPb0xBY/g3dXNMUAblUxncKhYPr9Iurlhmh+lxh8yH9uANN5VLn6tCyUJGEvcY5kAhLfGBwnmKX1tvRgYFtGezni15v/MugdQXNTOeg2WJcLe/UW/mUFEFVxahGfH7uGKDcIcLOkqzTa0gcu+LTUZJXJe2sLOqlGrITSf1YmPkigukTHB+y6pwv3a5gxpd7cIs9jxVlQslYPD3GZHuSviJH9f51Ku/6hk/PnitkgMqPRd5hwilN/R1oBjQIOYIM6hXlFCXNFD3NVJkfUy1VpGa7aNqEzSWUgJGLeNwHg== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM7PR04MB7046.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(136003)(376002)(39860400002)(346002)(396003)(451199021)(6506007)(478600001)(1076003)(26005)(6486002)(52116002)(2906002)(6512007)(71200400001)(966005)(4326008)(5660300002)(66556008)(316002)(66946007)(66476007)(83380400001)(66446008)(54906003)(110136005)(64756008)(38350700002)(36756003)(38100700002)(7416002)(8936002)(8676002)(86362001)(186003)(2616005)(41300700001)(122000001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?tLqSj8339Ee5LkSEd5UalBW?= =?iso-8859-1?q?BpM73ZB4in1jZic0nHFAvnkIwW1ThiRm6JgFTN5Jy1dZ66PrTx++uogK32TU?= =?iso-8859-1?q?B61cf5lk2r5Ls5WelgGh3OIE0zAT2UXPkWmhBKVfWK9CQ8tSSWQz2fz8Ui4a?= =?iso-8859-1?q?kLpWDRZaqi0zp3Qqi8FOrWJ7dvTNMLBEdsRUk0/oupeSdFvcyKaMWk6zQEnD?= =?iso-8859-1?q?9OF9D//0ZuPziYBN4PRcagRDT9346AFJ+sE+N2Ihj/+KJBWIV473CfH2QFll?= =?iso-8859-1?q?juOiYjj9HewQhFZVKsqkU8auu50K/qKHk7/tU6kyD0Lv5vD42HFPltU6M/Di?= =?iso-8859-1?q?4O/iTwKyO+oPyfqPRVymV01znDDazfxMR/Mn1IWN0Bicjr84XiXRcRmoPjmm?= =?iso-8859-1?q?aSy+ogQwfTSjCBHkFYLdnGZfWyt4tIll7Uw2VIddOLcjgSWd6DDc4gJdy7Xu?= =?iso-8859-1?q?r3thxLjg+6v7SP+H4c0lUQYc+8GJ1Sg6u/VmnKh0cygW5mfB/8winfp3Q0Lm?= =?iso-8859-1?q?gLRHvFGQQIF9pRv8JP1NTnV32W8DxhXF6zJ50ILLtvGZbMH89PmjqdKssm7r?= =?iso-8859-1?q?P7mQYnWG03kUN32BTbb7h2p5t6/zV4CjvjODHrXnIwfZbRUrFmxGXVMt3c5n?= =?iso-8859-1?q?5dSwOaHZ9VimKEYSWX//BahwLBi0sPTCeaBKiKaEEw2GAtTXO5VqgWUTLYCu?= =?iso-8859-1?q?ViuOQqkbxv62sxTte+FV/qi+BOrQPTQ+H7moD2pO4N/hBp7//1al9oN1qosI?= =?iso-8859-1?q?MjVknv87hpugrgv+ubO2D5Hz29WdR4Up0ohWs59uwQy/aUnU8CA90GctQgtb?= =?iso-8859-1?q?OXom4gIgxzUPULnD4zuZDHHsIgRRYL0izdESOW1ZOd0N4SqXZBAb/Zxp+WrO?= =?iso-8859-1?q?A2Vw4Yr80fQz2XshZzp15epClYYsrGM4m7QtlWz8O+zHcT4Mlhs7CnkOjuG+?= =?iso-8859-1?q?Wl7TkOY0XH2MaphwqUyvdG4Sh3XOzsnD3mbNF1R1+a5YeRMVLnE5wM5oAPJR?= =?iso-8859-1?q?nryIwf1UCsQCMw95Hx+mjHYoh2CiKvUrsHKg8UQ8vvq7zJyUbSMSSzXJbTlO?= =?iso-8859-1?q?OJuDyrEShb63r7KZE5hk3th8dHnC9y1dWrYF4slAOXWrIz2VXTEYZSbjeysh?= =?iso-8859-1?q?oxpP0wEjmcCCAmjLVXk0Aj/TQaUgn95yE0qGDoozi59zAB4lzWQOmT7t06sI?= =?iso-8859-1?q?JdelztadF81p7DkC6olyOly/gHaJu06Gkc0HCTDoH806cVc6b11rXZJQkFBZ?= =?iso-8859-1?q?buJ+t+DO2i6TkFfbBsRcB4kEXIj5uytjtienxs1KfiRAfYFjAKhMViXt2inr?= =?iso-8859-1?q?a0Kp5tH5Apu8YuM65PQqAF2sthJJ53Xdsx4vUqhax3OxZ6zuGlpfOqbOxG2y?= =?iso-8859-1?q?GKHKU4p/BTcTqhOIxq3HpQebS9yY4BClnspphB1psjDUaK5ilU4v5oUFc546?= =?iso-8859-1?q?gszEHJvE7NOHlK5gx9p47fln8Kb576RHXzVjdX+hl1fmH4+roZEa47MDmjMM?= =?iso-8859-1?q?/eiEDtptwCMtsk0OI/mVkie2NBGOE9Y03w1ev/ZWl8MZ+gICtHN85QNRlaFf?= =?iso-8859-1?q?Wt9LW3pJo8FdoojIe8JUOW39ZE8MRs4hB9xUBt4Vh0hNpWN3QelrVYZiNo6j?= =?iso-8859-1?q?MOv71ZpOp5G2XK+v3?= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e1cafc19-3a96-4641-dd0c-08db88f06bd1 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jul 2023 07:10:38.5224 (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: 7N+PbYYv2L4o+fQQdKKtrTZPXI/AxR97Uo1dVVtvS9jwNctGFPWlamW35OsaVQeDR1rGdBhJsUUNIQRVhQk80w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8415 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230720_001045_309733_F37B26C8 X-CRM114-Status: GOOD ( 11.65 ) 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 --- 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 Thu Jul 20 07:10:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13319889 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 3037BEB64DA for ; Thu, 20 Jul 2023 07:11:22 +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:In-Reply-To:References: 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=zYKY8HLYR0vf+z9rtn7vaq9cCtfodJyqA7wSkDbo7DM=; b=0gpJ0KOL62+mfa MG2UUprHOF0W6AlKMPNmUILceG2ZJrjQR7ptmzF6bHw4N0CUUPl6CRcoTB7YaPOjbUOEyimqIx998 fatUyPUODC+3RIV8YqmLY3WmJDjUPKgoOtyhrxfK8J3Yf4OZb2cB/80BwNPz3WLxP5ERRFft13/4M +AmEGV2L7wc68YlUS0MuY1X5iU3hA/bA6skbM1s6izVYq4VJ9c8IIeY3Ux0mSnA9lZbBydX/B/PGE K7LXxdQrnbvXcTLM5bQqfLRe98XtwStSfshWhrDCmNeLHidXlR71hi+1mZ66I7mPMjwQsVOaC2c/i r+od1za4m0DfwySyEPOg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qMNoT-00A4th-0J; Thu, 20 Jul 2023 07:11:01 +0000 Received: from mail-db5eur01on0603.outbound.protection.outlook.com ([2a01:111:f400:fe02::603] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qMNoF-00A4co-1t for linux-arm-kernel@lists.infradead.org; Thu, 20 Jul 2023 07:10:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nrgWIldW2PBcsUTP5+rzuaY+yfK66M3STSgU1vRj6SgCOiPzViVV8B0Kyt1togQCxeJUioqr70g2a7VeX/X3PEY2FMJKkgMdAgQQZQFhpXIQimWvXcnTwOKpwzff1msO1KQ/ZGhhyA898q2spvAdxpzs8vsxI6i2n51lX9UGHMtJVwjCuoZuYahlqbztOeaDHwO+zuyGshgpiAj9V8E1ZkRYWKSApfIj4Dh/wgFqnCJ7EKdYIMhKZtRGa4Xr5l6o9Y2LZEOwrqpzh2jmrGndW+3TOhedFTJJzMeQv8MzV43leugJT9t/N5pIKgFJwEm/Deubcnf9E6ypVM8jMHImrw== 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=/3lrrJaVWF9puU26K9AE/lNYZBZMFt7oQYQspjjUzg0=; b=H11siSJUrJOI2QROkchYV9n4hibBsKjPDuhChSQAeenlXVULQiItKEW5GPjZQxYXywa8u+/Z7z3iow+3DAs1jvYHl5o8re0mqe3/EbtCu2YfAidCmBHSIUf4Ik+Mk66PaeHRlTH6dP8veJWPYRSKa7MhgXnUUuGBEu5zekuvEyHRNLUhPEIY+aWSyRAmroNK8eK29MHixtEFpM9M4dEwX9UghpLGQKJKIdv+fg8o5WQ/u9008jckO3zSH72+OUY7mjAgrO9Fnr8UF23aZJp0yhqLZGrVeow5Gn5yOiYlbijAGhPsS2VzbjaTKNBjCQ1IRBHZqFoQh7HXQb5UKjMiqQ== 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=/3lrrJaVWF9puU26K9AE/lNYZBZMFt7oQYQspjjUzg0=; b=Kl2U8e3mfGRJatYI5Jl25jJCSvMkNwB5JDHu7f2aJiLQBSLJe7aXDtBuQ3srO7P+D4lDWKsrW2CLlHeteoAFpQi19tDY7NO1jPSkBT+ntz5VF1vL0HikzNMzIH6e4RUZcwMPbITsReqrUjM7FZIMqbSbAolbpicUJQYQ4waTVpY= Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by AM9PR04MB8415.eurprd04.prod.outlook.com (2603:10a6:20b:3b5::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Thu, 20 Jul 2023 07:10:45 +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.6609.022; Thu, 20 Jul 2023 07:10:45 +0000 From: Ying Liu 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" , dl-linux-imx , "alexander.stein@ew.tq-group.com" , "sam@ravnborg.org" , "jagan@amarulasolutions.com" Subject: [PATCH v2 9/9] drm/bridge: imx: Add i.MX93 MIPI DSI support Thread-Topic: [PATCH v2 9/9] drm/bridge: imx: Add i.MX93 MIPI DSI support Thread-Index: Adm62U00jdoocMYrckCBGGNZEWf3Tg== Date: Thu, 20 Jul 2023 07:10:45 +0000 Message-ID: <20230720071430.259892-10-victor.liu@nxp.com> References: <20230720071430.259892-1-victor.liu@nxp.com> In-Reply-To: <20230720071430.259892-1-victor.liu@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SI2PR01CA0039.apcprd01.prod.exchangelabs.com (2603:1096:4:193::16) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) x-mailer: git-send-email 2.37.1 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: AM7PR04MB7046:EE_|AM9PR04MB8415:EE_ x-ms-office365-filtering-correlation-id: 979e0573-67f9-4e7a-8164-08db88f06fb1 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: xKSxmmBEqetDjKXKdu3fZVv8fBflxdx5y/VgpiEgZHk0UQGdQZsuAMC+9jYQ/+VeIMQI24KIdhivEptFCvnDxHGwQHjullf7lDNqYBLll36Gf4A4nCAiSFtWn5A8JwOvKp5pA+QTsCmVVq/2PvEHZ3Z6vz5Ccr0V4AQ/JDlPrQbW2LVapfMyVvUt16CAv7Ykydbo+V1ZfKPauTLTuX7xsOBK9p6B4udnkWwJSqytNjm/BshLblsqSRhLkVqdvilEFZhYJpFH/ibBJWZ4BIyjxQFg7/GHN1splfKJ+VGyenz66OL8xpwi+L23jz+y3+t8oW22p8CSe4lCO2vOXLN9PENKpTFD99MUfhePtvVbRMH6wGNrinSJtlAvuiFnM2NE1mdle+mouUK4JQXKgtVCMvJ8svd7mAVScP9a9B4m9VXBHArnMSsWS7MEwzJs2ZB8OkYztEHHvAsPEHrb/BlYkRrrFiMLu6JuhNn8x9/KGtAbtfjhH2eWdRTCcpvB1/UV8l7I95ih6R8J0WIRvuE3c1xMcIjFj3IrvotI1jbFq8UcgS0baD2HaDyV/gZao3sAkSMajW4z11owEDceggcU9aX/J/3LuYRzz1e1vApcTNn85OI1g+XwreiS2lkMfl4x x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM7PR04MB7046.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(136003)(376002)(39860400002)(346002)(396003)(451199021)(6506007)(478600001)(1076003)(30864003)(26005)(6486002)(52116002)(2906002)(6512007)(71200400001)(4326008)(5660300002)(66556008)(316002)(66946007)(66476007)(83380400001)(66446008)(54906003)(110136005)(64756008)(38350700002)(36756003)(38100700002)(7416002)(8936002)(8676002)(86362001)(186003)(2616005)(41300700001)(122000001)(579004)(559001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?2vU/P5dnkqNUeGp2WbtPBbH?= =?iso-8859-1?q?/oDYTX+Fd+IVBtckjLToKKN4mJtlGycDzgeZMgce4Q8P4CyBQdmUjapvg5iw?= =?iso-8859-1?q?A9BbesS6BxraYCTK5ZwVCo02gKYVZZz+Wgc3i0IDQ+GiCpUxacaA9xADEI++?= =?iso-8859-1?q?5C0XQRNGFm74ouCZ0IEhxhdGrg4nwjdsAUlqwdkABm1Oj24TIfIRpxQR5zUV?= =?iso-8859-1?q?l/I5Ns7VRMo7CYpQeLqHPb2MaUeFwq9R8gNNkDG8QFBz9+zBsRWyHzHNavJQ?= =?iso-8859-1?q?Y98ujYqoHEd4y2onN5OYrOap/Hfm7DwCD14klomQxLa7I2Bx1/ogPRSfrrcZ?= =?iso-8859-1?q?EmMlzAS0CFEW7cPdGJxSeDasEDqR456s/SjXObbx8TOkAN+XKfYiOBdfpb7Y?= =?iso-8859-1?q?WvnrpclvkdxzRjEFXrYTLkCfWxPR595fG6grvfvd7UEc5pbiXtX9AcoUEavq?= =?iso-8859-1?q?FLMKrXBXXTcWcgYr+sWVP2WL4XXbm8Mn46v3L+U1UtCZE9vUORgzd/Yel73t?= =?iso-8859-1?q?pHaiKwnQ6zc6nc21yR4pnA14r8xkktp8lqjCR3TXBOMm+dzES3W8rFE9+NMz?= =?iso-8859-1?q?Yq9j7SICpwmpmqjfEPv2ejzZYg7ljJaXSWJg/2JA7WpITi+LCm6JKo8ZZ5+i?= =?iso-8859-1?q?8fXck6qhT97flmnY+wQuvE/bri4rO2XjT16Bhrl5wcPT7NxM2LxB2GYoM/md?= =?iso-8859-1?q?GqRvu7fQ+vEXDpR9bDYU2Cx+ivBoDrbBd+rQ+ymQk0ZaR9T7CVg+hnY1G05s?= =?iso-8859-1?q?8l+ATqrOj51LXyRS6Urj+CxcIitrxJ1Q3j+kmhP2Q+N4yOLcsIDU/O+xE66H?= =?iso-8859-1?q?FJMiSUXjG9HVK2AXg8a+DcPkIUW3GsGqz7z9ar3EphWj/dShoftmu/KPTS3p?= =?iso-8859-1?q?pfGxtMf2UluRcQoPnK2slHSjCM7c560pqtt30rSgCXw1ExsXSB7PpIpMnnfA?= =?iso-8859-1?q?uhktY7DjWelCSlmJP4uLSTJgTOhMkyacLSS8bYREXJNMhB0j5rgSLwdHdB9a?= =?iso-8859-1?q?9p5kdJbPLHmDTrhQif1RQJ+OwXhV9tutfzlNyfiBUmrcmYWPQH3zUhmRRmc2?= =?iso-8859-1?q?zOeN7N+j9ko1/xPCegWbbRhw1iIbz7E6MRprWxbEUdConE9mPwsV/7KcoqpO?= =?iso-8859-1?q?2fKL1Uvc5FiKL22yCV31HmcXDm3zfgOvWUDn93yq1kL5OsGMeAwSSreFrKKh?= =?iso-8859-1?q?GstiKkDqMcgXwz6cTXVQLftJpM92mVFDTynrblFkDhPznuJJ46yGL0Bp0cLh?= =?iso-8859-1?q?U+aHLEJ1kWfBBlTQBogy3TzTInojCT3sZIs45CcR8Yo8Z+oQlG7fFfQqWMGG?= =?iso-8859-1?q?k3dJt6nR5W7QhVA5NqL48mMIGZEzcu4NDuPVIzqPehr94wGRRHwzEYoxdRG+?= =?iso-8859-1?q?pFMEZco3hmCgOUY0xztTMpgdkyn3E8IEPJRrErDcaEAqrpS/xO3czx5qXkxw?= =?iso-8859-1?q?zEmNyBGMPPzhmOvYYgeSzqd06OX2oPMukUzrC/q060QH+0ix2gzinjLZptCY?= =?iso-8859-1?q?eJThL2FKgvHXyIWOYRH3MlGxU5hrccCELZaoM6+V0rf+CzdIJYTcHDT5qxaM?= =?iso-8859-1?q?CdgYK7H3+U777TmZzHABwfyB6t2ILlbw9EuOlzOslVS1PaCowTAGXCGyB1W7?= =?iso-8859-1?q?nzgamSAOWVKHt3o14?= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 979e0573-67f9-4e7a-8164-08db88f06fb1 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jul 2023 07:10:45.0210 (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: ZFg0eEqMgPp4ycQ1MHTvAULn0K8vR4v/5g24eRJgLbDzmzdpBjjyBhTAT0QWkfSNpVtcS8kDLQVmn7NCnRYkQw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8415 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230720_001047_775373_AF0AE2C0 X-CRM114-Status: GOOD ( 16.76 ) 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 --- 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 | 10 + drivers/gpu/drm/bridge/imx/Makefile | 1 + drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c | 917 ++++++++++++++++++++ 3 files changed, 928 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..5182298c7182 100644 --- a/drivers/gpu/drm/bridge/imx/Kconfig +++ b/drivers/gpu/drm/bridge/imx/Kconfig @@ -49,4 +49,14 @@ 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_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");