From patchwork Mon Aug 7 05:26: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: 13343012 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 3D207C001DB for ; Mon, 7 Aug 2023 05:22:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gCxZW2w8y0H904RaatUGAidPB3KqdVx95DSyH2IKhYk=; b=QzqEpsctjiOF3b zgKVatNt0lpqwC4BWR7e44g+ZNYFZXH1cxIr6XF/U4XdPLXyVsQnGxK/tLZDUN0Q2g9By5Udl/uY7 OTOzK5JGK3m5ZVjvJUT0zsSMZtqtb9/R2jyr4AuBpZd9mNIO+uCqz4kmXyIhHSlpQXRMP6HqyJJdd eHzRgp99VJsWdkhZl1lwr8HOx12QkR42wu4IYkRZEXNBNDTCKzeq/aXvnrYLKha0zRZWJrgRZaclO 9/u5sLSxmGenQ2Pxt/fWJv5mZlNh+G0M51ODcVj2H7hlNDBh58yPmdss8Pp1kv8wZJiecNlV1xoW3 RUucLGhPR2Xg5VxebqAQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qSsgx-00GAPZ-2E; Mon, 07 Aug 2023 05:22:07 +0000 Received: from mail-am7eur03on2062a.outbound.protection.outlook.com ([2a01:111:f400:7eaf::62a] helo=EUR03-AM7-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qSsgs-00GANS-35 for linux-arm-kernel@lists.infradead.org; Mon, 07 Aug 2023 05:22:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lvTTa+zX9tfe56DrN/m+MulsmijvYELybUZ9t+O/TjvMNBH/jE6wfGxoCzoUI2U7EVVxaJjlGL3YwQSlW7JOM/0S2dacf38rQ+q0EgbR1N3XhWZ1LQH88CsVGEqeJkw0YCiYWDxL89FbopjxHzehXlKK2aNfdwNRphdlJACMd+oMK5iNN278o0zPvZ2YjK3P8beZEJt6iw59ub0mIidrbqYdXArrMJj3ewaPvOQM/BRp9rbiGhyDgNoOmVvCMzm195jCm+t/G0iqrb5dO50v10DMz+JxPUyzqjIEkAuLCijsErU3DPoN7MtjI5iCsYCmrDv8nz+MKHAdkWiMFH3NGA== 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=93iqaxoeIJuj76eeG1mP//vckwfywbOO/6nfKqCD5qo=; b=MFFR8yge2cmGIqvrJYCq8YPa+JWrY2VWXdGgUwEG7cORZPBxcVju/1H03F9fybceAQgGDB1+gBE+a8v4uDii9gRWuvaNsURRwmW2AxNRc310vza/zSUaKKEwiIxSRFlI4AfL554pAzPdWMm2B4OB7S+kV8tZwBfw/V2YQn8sUmPpP7/8QJ6gMlLMvvkpCala9dvzkhfy4yUr35j6plBtIex4Nv+aNWhNuE9o2Kzuk5GqCqn0hBqqG4zv4xEBAMdWxxJrzcMUIJptqLvqAWoZLXmFu6i7MIqN0ioZ/uY+VjE/07S8VwxcC0UxmzithhPawPD4nMSaFfe1Ex/T59IjhA== 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=93iqaxoeIJuj76eeG1mP//vckwfywbOO/6nfKqCD5qo=; b=YNMM4g/EjLBOKUtG0HLnzLyLGX3IhsHUZXdegTy9dunkxAhkuizFfTUcyJHkGtsKkW02LoIVV23TuWNdD4W3ravECHF43vEfEIGqjP2LuSpTKW11aU6KuSMlkyUn7jQGOAQLEpI2M0quFPyTCkXicZV+cuTC13eHWWeL1UT6wAQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by PA4PR04MB9390.eurprd04.prod.outlook.com (2603:10a6:102:2a9::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.25; Mon, 7 Aug 2023 05:21:53 +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.6652.026; Mon, 7 Aug 2023 05:21:53 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: andrzej.hajda@intel.com, neil.armstrong@linaro.org, rfoss@kernel.org, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, airlied@gmail.com, daniel@ffwll.ch, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, alexander.stein@ew.tq-group.com, sam@ravnborg.org, jagan@amarulasolutions.com, yannick.fertre@foss.st.com, raphael.gallais-pou@foss.st.com, philippe.cornu@foss.st.com, hjc@rock-chips.com, heiko@sntech.de, zyw@rock-chips.com Subject: [PATCH v3 1/9] drm/bridge: synopsys: dw-mipi-dsi: Add dw_mipi_dsi_get_bridge() helper Date: Mon, 7 Aug 2023 13:26:00 +0800 Message-Id: <20230807052608.3038698-2-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230807052608.3038698-1-victor.liu@nxp.com> References: <20230807052608.3038698-1-victor.liu@nxp.com> X-ClientProxiedBy: SI2PR01CA0006.apcprd01.prod.exchangelabs.com (2603:1096:4:191::14) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|PA4PR04MB9390:EE_ X-MS-Office365-Filtering-Correlation-Id: 98fa495e-4c4c-41bc-e3ae-08db970635bf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: f04FEjL7YgatDMtlLOkakGByCqWAVoC5wHntXwg2uu5MSeZk2JnfxQB8JhkIskTHkUwwfsdesEs4uiDEY2n8zvEc5bpXYwXD3oF+9SxM+PpGkVuUfvWb1US7k5wDgglbrtvAnPR4xxUB0PN1kdBINEZWaS27fygX4fWRXbLiHb9jClBtkZiyb7rVtFrL7klNhJAFQidAS+nJMD33iyBqVNhjlljP5Ti+FlRte9FxeH9sYXbvqquXIsPpwx4YiyQPbbmokvNaMYtTI1qWF625pPpcj3UCx+pMUGmTseM9wPRhRxD+e+62PLJ/EX8g9s9esTDsl0KTpKBr5nff+Re6C23406fzcH5Cosxm4k64/klNHwqVoIQUBroXj6gsp1VErNa/3ImyHOMVwSYHVP9a7P3szEMIqWL+5qru1OmIF6SOwP7ZHAMCMFmWpvG9PDx9h0R5Sju4nbhTWikVVvUB+NyqSsRJqdLzPWi8SPpCN7G+WLSPH04Lo6IFQbf9f/8F8xNJVMGMzx+XX5WAqyinSHCtTkQ7ze+eF7qw8z8J0uIvRVhOcjc8XTBrt31HX4cN7+WzCt8wxW4oBDO91gf2mxkkZsV0LW/JIOGHEzgQWQvcBjsWDyGi92qp/YpjH48s 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)(39860400002)(376002)(366004)(396003)(346002)(451199021)(1800799003)(186006)(2616005)(6486002)(52116002)(6666004)(6512007)(478600001)(86362001)(26005)(36756003)(1076003)(6506007)(41300700001)(316002)(8936002)(5660300002)(8676002)(7416002)(38350700002)(4326008)(2906002)(66946007)(66556008)(66476007)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: krDEPvXz623h6E/FN3S0DOkuFBUMum4K+6W9roK551JDokenrMcji/2L501KhiL0r/u+8OPWexX2lw4ffKJfbbO/qInzZuXDasaz+DTmWM5LUs9Rk0XwnTJ+5l8tMLYDGVwKxDVaUQdpjc7gc4MiDyZfWjuT7Kvo3VvuL71wDwgNRqrDFpAS+KDsp9pm+VkymNlyMC2aHoKb3Dcl49XqSvvGYWKs6ECX8jF0/RXA4dobiKxHTvdPdRqVEeyEEmTeMayomkPDD7v5FfaMbX3jkRdA7F8LO9PkvmFCMnGUCTX27hWys6JrZ6SmBQkzkuoxk31CnlxovRKPaIQLbYO29/nX4YGN6swseZ+Fmp2PQsY5f8u2nlGKkK5J1CdwtXUJmpFhWXL9SNzU25QHJaQqU/tkD+X/bRovhBVdtrC+wQ3k21GZVIl+9axnNB74Teem53AM/J+trO3C/In/+iFUn91q7yMvfWUpFo+WQbRZRZCfoe1FOMq9axVW5NaeCyN7Dj2YTg9f+bNGt5jhG/jpwE+TbF7VXP3zNO2wXIRvXekJ4WsKDDte0cPOb7b+ADjkYKHljG9WJ8+HC9AD7eKBOJx4ci+4OdpwQOKmmNcsKc+nUaMHtJjjX63Krhm2afNeRSFvmLwKaTNz64StBfyEeZH6FRQIgQKj9AQOW/++rdGmu87X+4YLeYmbLnDl3lEnlZ6bqAff/AnlSK+43OpzZSz5VN0rKfa4kE6GlzIyirO8oXyxcu9VGDI+0btgh6rjDVfhaAa47LwADvAwyoKwA/Tlt4KxA7Y78N6nUBlmNzUSZ+4sxPfoGk+wPlrYhsSt788mcWTocLzeaiBcx7mifLYXrv3a+OB4YpUZqrcA8g4e5FLtflBJzuDRUaBasCjgijjmJb/aMIJX2ikxQw0L9/FXllVMoMsGtfjQpyQowYAPWyUV7Pmj0G/ijr9D4dz24pvVHEeNNUNF5dA+8CNf4J00iuK+5GMdXqf5gdUsjxh0tzV7ZE9sJwrooT8D7Byoy8YdyzOGmcxuOnPM5rZ9JywWjkniS/nLYqwvu0pIpE99VjKWTF0OyZL0RAurP877Obyao9okHUvwbHEGSlGir0mOlyz47ddl+GA3jbAeF2Vn5uoAKhUKMcyqnMcP7sVI9xs/eiCP5qi9H4v9whqU4O91tdSyksyH31US+2f+U3359WOCHWj0nLz9jTO913pY6lYOYHmvQa9fq+eKWuPhhccGbBSpG12TCxCW4yJGa+f12bhvh+aKi9vPngFjAt5mWRI9d3XjirVRGf1yqrwjSv1M0tqAP+yobB9wqZufkI/lamAZV19XWweGJen0sbtH/2XJY8RkKWfiGV/9jH3Zq35kOWc3aCV1l6s0P7gqvJ+R6FsUnidi2rTla6TRDlW/zCc3tHS1rpe4MlSA7JDRLUQ8bnlIzJMRGh6BFxfzvGqjbOAj56fOqxui0k/qQce0Cnd0q/NWNiFD8sxC0sCrTtn5xAFx/NwBRTJmPOdSNjfz33cy4QFgjnzsEMs6qEp2ZrbecT4wqddpYSwXqAcTwvGFgAbJCsIK0XJUcqvox4j7aGoHCG6GnZtwwJUPKGOT X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 98fa495e-4c4c-41bc-e3ae-08db970635bf X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2023 05:21:53.2366 (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: c0urueyl7BAYnGs3lyAZNcdds72SreU3OwsKHtDvutOHiN6rxpO/MfRtW4AHz6W+yOIKTMXACq/4tpdLxx4NUA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9390 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230806_222202_994834_BD74E8C8 X-CRM114-Status: GOOD ( 10.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 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->v3: * No change. drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 6 ++++++ include/drm/bridge/dw_mipi_dsi.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c index 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 Mon Aug 7 05:26:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13343013 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 2E198C00528 for ; Mon, 7 Aug 2023 05:22:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0PydjOhu2BZsAuqU+sGc0yve9ZxnGod1y3kpfabF7fE=; b=RqGTTCV4i4YKr+ 1DJovCHN6UHikhtjGOaK+jvoJWOSOhDsLJkJOWdQ1y18VkkwwTsikWdBWOItTFAgR8HS6pFBPLd53 1sbUvYyOVemTbBeZMwYhD7TWCx6wyX2RUQUlLYrUFcbYMDBQKr+KZDSplW6GbvTul4bAjEdkGnX8W uJdFSPYG5RFtnBcC+giXigjXY0VG2/9eFrWtK0IgmQv48JkbUAwXA7M8CGhha78ujfb3NKjILzLz9 Z1joL/dmVVbj5udvef/g9IXsT23/MaXyKHSOtTZsWnDXzFLxW3GAKm6WR2v/Yfu3Ua6Vtk6AUSs8a JNhXTiGPN29u2H0oEXZQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qSsgy-00GAPs-0Q; Mon, 07 Aug 2023 05:22:08 +0000 Received: from mail-am7eur03on2062a.outbound.protection.outlook.com ([2a01:111:f400:7eaf::62a] helo=EUR03-AM7-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qSsgu-00GANS-1s for linux-arm-kernel@lists.infradead.org; Mon, 07 Aug 2023 05:22:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kDIeV9VMdYbaMtfpzA4kfIHZVT2iw/+emYSY+uABZyju7RDu8WfNmgh/7NB3Qplz/9UdvJEQKuteYDDPejCnkMyMa2Okhu6Fax/RPm3tZiK9dtawVk7AJqlqLJKb+2mdRcyCGjg+dAXfn3NZu/A9hFIVpiwIeLB4z+GNUQBnomQ3JVgF9fX4/oy0R+A63I8aZyZSUvuw+pN2aM5MCimQEwzRdVuGZ/+kor5ESRDEJm71E7cOn6ZAZCDDutzYpjIQGv6XLVjhXC1+Ld8G5cHpfaeebe3oG3/awyFfwLv8fkd6jgOPRMYWhGixfqRZl+/3G6N5e/vddXu65iLuhwyB6g== 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=SzECK82M9MNzisvsalW9kbKoYfziy5bbytBxt4RYry4=; b=eNKO4yiiL6b/2CR0hG2M2QDUbMMW01ZSN/yT7eoONcoZby+tb1SWj2PBUpw7pwvLuzSn/Wrp2hMv+kWsoQgqD3peopC2L9dPQXeRfSzK4R/aVdHT8Z78IXuTVOJ7iVCFQ7hk3PG3nSMabF7FDF+X5/gDnKJ2iw25aNcNzkwGez4u7fjSTO4FCHMpH7vaNsnh1dtLWu9xreSehGSg98cvB9lhAq9V9/crmuAYQRclwlqnPwm1qkNe+20noBMmVtrQ0OVrRbBYaN0NCcE9ALd2XXv0sJbAqrJVCahcfBdDvbwe5d9Vs1epI3pIyW+fnk7n8m0bIkbvHmjA06eesmUmpQ== 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=SzECK82M9MNzisvsalW9kbKoYfziy5bbytBxt4RYry4=; b=SjAjujmO7DQnN3AAV1TUwXmqQTsH62F6FDKyGh06tEJixAAPqRTqrVoLgyqxMd5V1feF8MPXm9yZFIFctvK347a4rzoekoyUpUPOsiQAfuHv4BgmQV65LZ8Yqi/+X8FMKPQA/neFPXaUcb/eD2XikAHQGaoKzv2pGilN6LkF72w= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by PA4PR04MB9390.eurprd04.prod.outlook.com (2603:10a6:102:2a9::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.25; Mon, 7 Aug 2023 05:22: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.6652.026; Mon, 7 Aug 2023 05:22:00 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: andrzej.hajda@intel.com, neil.armstrong@linaro.org, rfoss@kernel.org, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, airlied@gmail.com, daniel@ffwll.ch, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, alexander.stein@ew.tq-group.com, sam@ravnborg.org, jagan@amarulasolutions.com, yannick.fertre@foss.st.com, raphael.gallais-pou@foss.st.com, philippe.cornu@foss.st.com, hjc@rock-chips.com, heiko@sntech.de, zyw@rock-chips.com Subject: [PATCH v3 2/9] drm/bridge: synopsys: dw-mipi-dsi: Add input bus format negotiation support Date: Mon, 7 Aug 2023 13:26:01 +0800 Message-Id: <20230807052608.3038698-3-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230807052608.3038698-1-victor.liu@nxp.com> References: <20230807052608.3038698-1-victor.liu@nxp.com> X-ClientProxiedBy: SI2PR01CA0006.apcprd01.prod.exchangelabs.com (2603:1096:4:191::14) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|PA4PR04MB9390:EE_ X-MS-Office365-Filtering-Correlation-Id: 52bb36b2-9e50-4386-75bd-08db97063a3a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5yVQlxMemxuv6xTTq18Hmg/TFbpCkF2A/KWAz8GoJCjgi7SDDjG5trcqBqO/fmmUlSyRxXIpnibPUi9QmcRJpDmw4+lHTG/BKQFMO3sij/vFr7siHfhCGEmMH6xNMO1IDtpif97Nf9gZ2KG/K1qHrRuvJ+9VSlb1PzRj3+1ff7Uy6HOGtgCLrlw3xMk2RtlLt8OElYeMQ717cTceIB1fg8fi4FuIqIyiGxoHSiZOvlqlmr0CwG9rj46VdUv7BkjCXVALuupTr+hiUm+6UNb1iLGnY9r5cVVF2OEZNUarN2DZ6QFotU790KeeLzu7tVgTh1JQmeCzYmONNdrJyhMCp8DqJweuWrhM5LsM1l9DuOpYvs+g1jhLUXDEAqspRX5O5myebbN/1o/RrJRMn/2oJODf8I30v7JqZMdr9HOwib2N6GJPEW81m2xhGjigwac02TpFpT6OeT5f6erGou5BmuIZVFaYbmtDaEpu0DBmRj2K6/h/0A/4e9QJS+YTUzu/HMaM8BNEApxLI6e/1aBDCMoW9xJP9WO6ac4pyAfUPhhWoE9PvOFRIcB3kL213rUzCEb9iLMOpQ3nld/f5uDMIL9uQOxw1f0mvoYuFsUaWhfItg9aiBdhqxndGv5sGPWH 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)(39860400002)(376002)(366004)(396003)(346002)(451199021)(1800799003)(186006)(2616005)(6486002)(52116002)(6512007)(478600001)(86362001)(26005)(36756003)(1076003)(6506007)(41300700001)(316002)(8936002)(5660300002)(8676002)(7416002)(38350700002)(4326008)(2906002)(66946007)(66556008)(66476007)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Os7Y3jVUoG10PQM665CXZkZb6J6dwp0ypVhd9eFYvuvnLWdIInWOzkGhBCN8Q3M18BOGhWTivudWRYVf9Ui3h1Hk9isZhDXPiX35ZCdvLWcjgPZE3dWPDBLqRbjim2cWboiGdMHWK6CQnlqySlLE7alCLLAFxdTmT5YN7losIBdd3Z1r1GBg3x+Kwh/sayDYUgHmBArDLKx3FbIRWvy2VytDl7YXKuDEuo1w34Nxs+KtRoM5HI552H6T/iVcPI7xpjs17Qp2qYAv5gzN5wP38ZzLi5N4i8/3mRwnvkN49nuO7oGCwZFSsux7i4CzSqq1lpa4fOZ+dzcOwuq/YjUmp4OD3+X/OoOjwsRwL4FH+kOGe0NLVoTvetpWfpyX1d4g0tCyXmn9KOmHa2QXFT8ZIKS+e5lVqcvx9XQ9RPfY6okhg3+8BcUBNWkBKCNJ8VjTgdQUtdT4V32F5lDWgrRLDc6t4dGnO94uFIx69XPV7fPvMhdSx7FvhRl3Ec5wVBpA6sR4rLM0FDN8l3BZJaulmQ0B7MX/OVM3veq5Q4c6z5ZaoLdaBUKPFrJTdcgkI+PvjstmKTmMg7zq0U/EX/ro00vqhynvUI00fJfoKjPO4E2+1BZoh/TOIQJtoEs34dxYWfNGfTbBFyBzfL+bwCKYvsz4Xab3BvacGiIRW2GtHnJPNb9WlXdXNy37Yj/Bi4D0K6zV0FH7sqCv2Z4pqO9KHg0fY+vU7asDJOJOYPw/H/iFPsOhnuaD7RreX2BoD6kfw9UeY96XqL0OfRivemajx/39SO2TfqCJWD4Kp8dmKx8/kmLo6w11vTgL20MEC4G1uRGxBEIKEALrFDrbmsNGHQYDPoj5khdlIIg7zTf8FzNJW/I+NcREkPcLGaVqRF0U70JrfSszs7kH+gK67CWBeno89SUJvvAqQWpcRFJpEy841WQYk8+XzvkY2QnROHZS2ZV6K6/Csrb6M0hQFhIluaCe25o0iw5oBuswfx5pP693bRaQA/pIvLBRchCEoSJeCvySCI54OIwz2486UxCbn+XhZzdjMATImYKvRwr9J8bNzvgUCutorinMTl5hDi8fOIiVch+uO/TzEZJZWNQYa7g3PsFwB9emYjx3uO5pDG6DhKIpIZPYj1D8OAAx4/Q7nfAHnCYev79A2taj+vnrq4H+t970waLk82+wiw3VqodUBzTkFTUxcKQSdUBM1zim2lq2b1YIgtFjQm1qyijtq4ycm2p/hWFSaNAtqwZNt+S0D45nipO0JLoV+KCvgI6hwFEiI2rPNNobqCdpEsv6pY3pkqQq98fq2dWRND096+RjfuYbVamW6JmLV6IsT0zHZ7yQq3jYEkDVhsBbnaDy83daq1Yrlyriz1rqbyeIVBTVX7O9SJ/qtyixt8TNDGG41joYoesyU1Ml8PHTpXxdUhnHOoCoe2zMepMPlDczDOTtxPfhqIW2BilUsWIdUbqUJfNCLazNcjM404yRNaSk46FR+SMsn7jbuqWtFi9unxCBq2xLpEIZCCp+ZmTi/4p57Ed+12rhX8hMj3PgEtqZFc9nFitzKrPMWM9qFoVWZ4cNNRsNF3dHIuMurb7NpFBr X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 52bb36b2-9e50-4386-75bd-08db97063a3a X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2023 05:22:00.7605 (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: 7QfuvpvhlR/hEufSeou9PFhmN3qJESUBZqnxHX9cw3zzdz7HtlNNzijK1Es3X/vf1mrTBdbECM6GJH5Rw+eEhQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9390 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230806_222204_618080_63859C41 X-CRM114-Status: GOOD ( 13.44 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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->v3: * No change. drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 30 +++++++++++++++++++ include/drm/bridge/dw_mipi_dsi.h | 11 +++++++ 2 files changed, 41 insertions(+) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c index 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 Mon Aug 7 05:26:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13343014 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 7A89FEB64DD for ; Mon, 7 Aug 2023 05:22:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=aDzd6qPckI260myTCT3FUbYjqR89GBvTltcScVUlwu0=; b=kGAa6TJFPRDQRC hC/gehYh20+4/ddeRJl+isc8/Bnx0+SNSx/a4U/ARBy2N2GouKb3Nb61ZCy3LZCDGAMCCRo7WFxgb t8xpJzPs/rJc0kNbqs6ZF/4UCokaYitee/vZvv5aZeb8602io5UdLieZKlI2QGMKyoPIGzTmzmvRo bhCfSWUxtTMdCmJn7klZWiH/QJRl9jUC93zSszNPEAvWNok0Cszhsb7f0aGsue1Z3KBnqjh/nxwJ7 j6e0a0fEsudpfSELetq5bjXr/ms7r+N56Mt8jCnOJncbgTZU8oYyH6HNjDR8nKCTq2qSGDiN0fDoS OM/G0p1XBhCGdqtb8lTg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qSsh7-00GAT4-1O; Mon, 07 Aug 2023 05:22:17 +0000 Received: from mail-am6eur05on20608.outbound.protection.outlook.com ([2a01:111:f400:7e1b::608] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qSsh3-00GAQw-38 for linux-arm-kernel@lists.infradead.org; Mon, 07 Aug 2023 05:22:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xxj84PKW2oIczMMrRlQ2dEr0101++3qv6ThRH0HFk6DyJXzFFiMRWGHrkevSMzxdKVQ5p58TSeOM8lkn0GdygiiZf4hSGooj8aEv4TxraEwdLJrOkGhRMM/x19Jkf3o8aH7Ux0quCHmGDCPNKvj4/NdXol+V7C+gvQnvExeZRkZ/IcnUpIpc5+Q+QhvifdXRFjVMjwEdk3ZAQHg09EgEX9FRTmck8rwrM8QU90J8OGTygglevnpyFtWql4TqCGJBsT3UKIk5wzwDdSvcKhHiSDzMBnpRW75H7pJM0PT0pp7j0ii+uMwRvwJb7qgvvNtxR/3LLWzBJEbCy3cZWP+LVw== 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=HviIkpnOLXPijI+yHIE9CMnfmFAZqe/94FMKZnsVQWI=; b=RhqrP4fj8AEcpfGHdIOO1NphU+mKIVVmM2IxEBllKzdJrzTHToXMx8aPSwsrIhwxGzlFdTL3oLuz0QPCEZIIleaknODY/hIQWIWF/oB/1hJcCKrMrYm/KT42R6zRMCEuahVdn8OdgSouh5pTWhZa1ee1PKuuJOPyHrTAzzoZInocZ6kaOBPrAnT8qD9yn9qHrLbWvX0AhdgEAwubff3rswQM2X+iLo9y03in3Z2zqbQWTmkhNCqKJG9jrT4SVsbVLTBqBjkTp1xOLtHwyR3IdscsaphBDHgiLzekDKA/6hJV3bfXSyMjx4rIFFIyWIwRtlQy+zcGRbMEdfMp1SbVIA== 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=HviIkpnOLXPijI+yHIE9CMnfmFAZqe/94FMKZnsVQWI=; b=SMRsJNC5zsdBM4IfmTn7/CxFxJaj/kd0PQF5fvX0O4d7jULaa9+86d7eWH94Pl3fHosofW+szMmHpRhOmnM7Lam0u5zgh4mMP3dlOzU9Os2D7ULDiI5e2VqDFEVDENWu81dZ0LPg5XMQYNPKkPM+GV7OQpZ/JPpkkJGvFHN0A68= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by PA4PR04MB9390.eurprd04.prod.outlook.com (2603:10a6:102:2a9::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.25; Mon, 7 Aug 2023 05:22:08 +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.6652.026; Mon, 7 Aug 2023 05:22:08 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: andrzej.hajda@intel.com, neil.armstrong@linaro.org, rfoss@kernel.org, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, airlied@gmail.com, daniel@ffwll.ch, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, alexander.stein@ew.tq-group.com, sam@ravnborg.org, jagan@amarulasolutions.com, yannick.fertre@foss.st.com, raphael.gallais-pou@foss.st.com, philippe.cornu@foss.st.com, hjc@rock-chips.com, heiko@sntech.de, zyw@rock-chips.com Subject: [PATCH v3 3/9] drm/bridge: synopsys: dw-mipi-dsi: Force input bus flags Date: Mon, 7 Aug 2023 13:26:02 +0800 Message-Id: <20230807052608.3038698-4-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230807052608.3038698-1-victor.liu@nxp.com> References: <20230807052608.3038698-1-victor.liu@nxp.com> X-ClientProxiedBy: SI2PR01CA0006.apcprd01.prod.exchangelabs.com (2603:1096:4:191::14) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|PA4PR04MB9390:EE_ X-MS-Office365-Filtering-Correlation-Id: dd7446db-1d5c-4dd6-6e76-08db97063eb7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gKcKTPkV5I4ugsDLEBMd2W3kALaPmgDRIT4L/6OXexRMbmwACmE+yyGJrO14PMVRYETEFfbVIkh2rM6k3lTs667PBpKzOb+wm5pBbGKg0wLaP8ngaPEzyLjKB3v4T/jXwKo5SM8ppCGjCkULODDUahJUI+eKm3eT08pvLLFw0FKBUI7JwH8bl5qtJKEk63JIdoBw63SWAp/EJ134+EvKjKyxr9Z2J46cAU1yIE45pMz5LVPXWc1T1MbAjFrZql+GhnS561yCUwsf08cDYa/Y/Ehiaw6B5C/bpbcDZfAbeHYt6HJybuoVK/pzWeatiwSKK5lhpMqeFpVInl59/bYz1fSL4CnpUOAvn6SOg95KOBU4iXdlFzn37VFxgpnbMENwlnYrOIt3a6efArF1Ro2cen9JXxNKBfHAmBodtfDXeVdjbrW41iwMLKfGYwVPc/9p1ZmNNhasyRzuwheBpiPc32fJioNzheD3U6bdIuEO9wur/DSN/HlO8pwiTz1GV58e9Ixij60eXmTtuZ6vmfbUbGseRcV05xhhTZvQF7nREsJlHsqPqn4ZND+CaznxtXJtLy5IsW3PmCqD8Km0uUDwCj2Ye9Ppo6q7qAgTaSUvL14YEIEqNw6xS7do5+4Mq738 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)(39860400002)(376002)(366004)(396003)(346002)(451199021)(1800799003)(186006)(2616005)(6486002)(52116002)(6666004)(6512007)(478600001)(86362001)(26005)(36756003)(1076003)(6506007)(41300700001)(316002)(8936002)(5660300002)(8676002)(7416002)(38350700002)(4326008)(2906002)(66946007)(66556008)(66476007)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: a0H1NRZMmH28puT8xHmaTlYU9GcXSsLTSLmBf8BZkGMqFysQCF5Kb96Q/449DUtOmvRejMP+8CuLKap8rkrvIda5piKR05AuRZvqiEaRrrinHhmqbX4a2WxcCyldQB0zfbbvdSZKx5tevYFGeoB9wmEsFUrYLWS/AnHSEKqK0ScP7TqrBXdkqClICEpFDEAdZp1FXbH4x6MoQQmIECwb1debF0HpcG/7KyxH67cfxMOqZKlxejpIlxobWt+bFvSOXbsiftVaxlbC8qNQgrfCsf0iRWw7S4RCHGHCfBUmSVskLQmGl5qdQ1gSRzFYsf3mDDiY9kEPqP02GceHR3W3qH1ZjejhCt01VNqT6QN+/jDggmAlstJkXQJT2G3PcxC6bo3sSYm7cYXQBCLIaA6D0HtNfNoIgJUefP2WAEM19avkV5tpkgM0j8q60RWub5ino8anS/eokX2I3iysgQm5vi89AiWJXTvTjcuBfdpJbzsf44Uq19Y5ukWM5dXZahiFMABUsXHGPRxGHJ+maH2O5bbIb2akXbIY13EliknGlMRq4C93sz+lTH3IODM8pMUeD4/AMdohGLTsvzJ/odYW5rzy0QooOomdmLB7mzMOz5WXm2Dht6SsFImd/TnUs5GdaRSHMPn/Q5yLuxp8ogsnu5VnJ0UK0O0ayJeT6gA7k19oJ8qvSuBJmrQ8VBuvenL5uzIZKIecCkuEeIe/tFQs6B4y046Zj2Hhe5QBsPfu62HEpamY5L7SH8wIaoQyPQhZKwshCmTeeOdY48S/WkAhRRIfL0KsLs6IDREp2JCv1JbHavTBVsxayFrYbDVZHqaC92h+KqWg931aTDsGxcy1zexGzt85YssR3wjWiBBLPl5PjSmQ80vhYAXXUNEnXk8K6g3sXjldk7BtH8PfJVD7gd9lp+mmUBc3pCje1vpxirrR++7josNd6Ixe3GEmeCGrY4m1MW6bJaLHH27Ht91RfCtJiPMVPWTtyT3/kNjcs2W7X+e7EAUYr60WGVVS+LhDXEYLB5VbpPFzStcuphYXFjSY8OwnsknNktr3ypRs7uz1qmQI67Tmxc5p6JhDDqb/cQ15zLv7x9c6zKYaJuZi1l2tb0SztgqjF9RAhgpbzFRe8f5ksyxJVNBi4zYplb2U9p88Zkl0+Qtm/bQi00fMDSQRkYZ9qaZBfBCFo0lbDGGnGdPmUsz1Qml1j78eDBiCL1HtihBkJqs9+0qQxYp6W2LU+Lbbax4vPnWc3wvlIKAWV6gTimxTeBYToi7AiK2qHS/CQl6n8boq7ngJFIcnaulqAUjES5ad4+/GhMrbLrpuzGFT4PA5yDxgsDA0JFKG1UeS/qSEa1kc1txaRrI1nb5w1x3EOG1yPDh72sKuXyw+KkgPl2AfUvQzTRG2mr+u/pMp19mXU6HWWrc2hHJ+046EecsERndK8DnyGhMHp5AmuyDuN2L+jbWjGlYaCjkvQ5XF4n2wx1E5Edu8mkDZlXrf5wG8e2WBUlvunMfWS3eLq7B0iXRb0HDg77ogIAmZvHIFXoBf2QamRh2moovYWZT3q0SDj0FXW5KVlNP1DcsJBTt/RILICjEHxyNjKMLS X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: dd7446db-1d5c-4dd6-6e76-08db97063eb7 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2023 05:22:08.3106 (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: uNq0YassAHSpF7VKDB6xQJtkUDVxdO07Ek7CCA8HeguhzdvlwD7qygYjru9dE7IURztWepDkwqJg0Hathw7gMg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9390 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230806_222214_012357_C4481B36 X-CRM114-Status: GOOD ( 12.50 ) 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->v3: * No change. drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c index 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 Mon Aug 7 05:26:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13343015 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 563ABC001DB for ; Mon, 7 Aug 2023 05:22:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3QrIVScqEGth3OmuHpRk7rUWc17Nv2UEXMR/HEUGm2w=; b=nNYIXxsSDAsQbA VDqgdMv6cf8vA3VKxPBNrs40gnqkgBtie8wWPv5cboEFr4VDAoP9/+gVlvKsVTXi+G7I+Bj5jmn5h 05JkaAB2YLzbsrsRE9bfb8LouwOMo5kktUeEyGaeh98e31rh5Qk6U9PEoOQjBntAgY2iD4AjlEjth m3FoyjT5C+0TV2J7pA/If1gQyLeyBaEswrpRC0GJTDub2oU1+EttdjYyFmIi83aEYV3K9TI028TRG QbyHp9/MA/8VWtSROXdkNQOGF/m+sYic6P5VHjb1oEGltiI8IStbnJTNC4PLjypKtNVB2ETxB9slS ZqOEsPlCSxsYA9EslHrQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qSshH-00GAVu-15; Mon, 07 Aug 2023 05:22:27 +0000 Received: from mail-am7eur03on2062e.outbound.protection.outlook.com ([2a01:111:f400:7eaf::62e] helo=EUR03-AM7-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qSshF-00GAUi-09 for linux-arm-kernel@lists.infradead.org; Mon, 07 Aug 2023 05:22:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=POg7JdcHjbwCODhY7RpBLkN0otMZSR5m7en9jlzaaP37HJESBVM9AOmIGJGcEYvjf7scNVQ7yBpMIuLI6j+02k9V/udtZxgwsvPsJ+IUx++0NHhqRrhx7sAB5MqWgXRiX/0dghWrFHYXzCA/OYSJ0IbMPObi19/Eg/UyMkZTbmBk+UqFJ7+NC5UD7luyMyhXWEP2RQNOT6ossFtvNlXK3SvfS7B2H3A/cOHs4hztFAWQ5ZxKT4UFB5Fl8DUNG7wW4uNapHitpTgM3TbyQDCBAHfGU3JYdgRAEdKBmqBvKGW3Q8q+wBLW99Cy1PTKoMPC2lfXs3yjzBnQQszif2MSMA== 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=6nwUekE8dpN/HuRxa08DtlQXYJTUZgFn3pGifrVCQAc=; b=aNhukd+kM5exEopHVxX4shZ37kqrCNkKjiwEgTlb1dHlr1X/y9qYkxcqRFk1O5psy2a+uPsdlZze4cbCc+8ZqT6q3P956Te9HuzBLLqmdbsqQ7LScWA7qL7txxrripXba9crGQCpF1DTpY1HVvEUVwzFozSXLUiiksvWpQqOaUtC6/jueQrys1oNe9lgQyq1z1KujbCWhYvxFp1CadURILRKckF2kIRUKHZWMTqVIvz7pSIF8M841sQSxHCLtQmLTiiLkG2qjI3VhRzOVL9m35Iz3i3i08oyLgfSB13ulnVGYw/eJ0D3s/d1+RwgPcM3nhFIA1zccWE6pEat4RcVWQ== 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=6nwUekE8dpN/HuRxa08DtlQXYJTUZgFn3pGifrVCQAc=; b=Lrzpk8WTJ0LpPud3Z2r9yBtqOZ/VdubBFyQIa1ZDeiarjoI/xpXKapASC/AwOR32pL1RKl5gpzrjC/lMS1qecspuWO9rWZIhnNz9yrAs5kn8vk0LWCkg2ItxdnZTKtNHjE2V+e+PKhRYHUw9zLlm0unTe4kHB17s+9Xy1aKPt5c= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by PA4PR04MB9390.eurprd04.prod.outlook.com (2603:10a6:102:2a9::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.25; Mon, 7 Aug 2023 05:22:16 +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.6652.026; Mon, 7 Aug 2023 05:22:15 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: andrzej.hajda@intel.com, neil.armstrong@linaro.org, rfoss@kernel.org, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, airlied@gmail.com, daniel@ffwll.ch, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, alexander.stein@ew.tq-group.com, sam@ravnborg.org, jagan@amarulasolutions.com, yannick.fertre@foss.st.com, raphael.gallais-pou@foss.st.com, philippe.cornu@foss.st.com, hjc@rock-chips.com, heiko@sntech.de, zyw@rock-chips.com Subject: [PATCH v3 4/9] drm/bridge: synopsys: dw-mipi-dsi: Add mode fixup support Date: Mon, 7 Aug 2023 13:26:03 +0800 Message-Id: <20230807052608.3038698-5-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230807052608.3038698-1-victor.liu@nxp.com> References: <20230807052608.3038698-1-victor.liu@nxp.com> X-ClientProxiedBy: SI2PR01CA0006.apcprd01.prod.exchangelabs.com (2603:1096:4:191::14) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|PA4PR04MB9390:EE_ X-MS-Office365-Filtering-Correlation-Id: 74b28467-c8c8-4ea4-1942-08db97064345 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: t7ptWOq9/ZEK29E3oAkCbf0WZ4Q1i5KWQGmBDnV3l2hp66ZWEaG6fQT5dDZ3037oT6d8f/79GqlUlnznRA511frSyZhHXL5IRDyrZ5nI/Tn5F666xH3YCRjviduWTiFCy0yipBwu/LYf/oI+CzYY9UC33SJGRAG0aoNHfFLz0noChsrE+IaXMBTnhAjPiJPsG5pwUiI0XZ+v3NI/J9kACUk1s+WcEXzGC/J/EUM9A41y2SgFVrphyCGDcKRS8om4FLhvcR58bwPMsDrITDooTiaCiXWRN+1x4RJGWNVsh2nDjQ7Y2IpriFO11KMZuHXozQlszLafUoOqqVwUPGK34ryUBEwz5EE+YKBbhPgNKJfcj34OhHO8T9AJl27szjkQ1NQzeghc51i2q5k9zl53SILKj8b7Zrbnqe03e1dLwrjSLiS0P4TGTkV127hg2lhstCL/dSevDFw0yUn+rDJjfRuDN9y0K03kmlZIZNb5HpZ0ORlvgdNVma67Ngf8a61newp4/Vq+qQ0/qMk2MlECyLanD3JrDeBE6qnMjrC/ItZB6WO5SHk0V0zY5B0I+obHHCCt0YyoNygZtXlyGtuYxuJ5MwzFU4WJhxlcl4XHo3jSklXmcGMyKsXV9A/QyB1z 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)(39860400002)(376002)(366004)(396003)(346002)(451199021)(1800799003)(186006)(2616005)(6486002)(52116002)(6666004)(6512007)(478600001)(86362001)(26005)(36756003)(1076003)(6506007)(41300700001)(316002)(8936002)(5660300002)(8676002)(7416002)(38350700002)(4326008)(2906002)(66946007)(66556008)(66476007)(38100700002)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /BCD8mgL/bQN32SgMXP3Q75ez8H4JAXoyRw5vjMqxUvQnGC5UEeHlQyV/FifHSkIsu4ghLi19yi1yvBwZyZWsVl6AkX97uC7d2hAa17t8bUf4FgQ6kWZqgUCgVMwUNzB9CEG7fIRZXIyMukRj3KnYi4uPR4CXmiEqugSuqhXGJz+7yOeiot2bdDj36GS3TIQAIS4AJRyT4lndermsTAn9pMaZxyZOlkBb1mEslWBPSstva2FwM20Lu+1NyoEMqa6k7vzPcSB05WAMQhc62L0zP5Wa1eF9FnyoMWvqkERcYE+gYbgrC2q49ssFuv0tbduF+RplN2R2MMeY3pLrCw7E2m20WvD46XcrH+SDTlr9Jg5w0dBM/8YfXc5yNVOVb0n+AhQphkqWqVTGkM3MiupKOYi9rovDAblf406uF0FwC0IlAO6CETfqKGjWQ1TEiLDZGxB7XiwjeUA9Y04sBdzkkje1JP5a6uTIbIZVT+TxhcDnwxOzQniBBRi7+i33f3lX16BnVqNum8Q9xe/iLTaWAJBuGrnYaQIBFBWDcOJZxv4wssik8+G5scuGq4QfQNOERmyz0leCVLpQRGi4y/DzaVXzT25/y3ida9c3Uook26OuwCGqjkkRjHyMrdMYx6qGN94YWegyn6s046LEm/iVu+E55n8mbnz4iHcM71bWh4c4dWeYuQz6YEz8/Xy6aoFwFDggAjHjBbn4AQ9wzr1LAVTgA/63BIiX3QuSJdtVhjgnlUX8mV9S7PBMgzZehsScw5xEpnnm25GFKeMEXOh8lLsPMf1JP4XJNCPgx6SiD+ez5ZGme5ndgTj0WJY1en6hJ2OIoVpBi6S/aJxLfsKg/YuZ8ByeaQATDASzTrEXsBrxZ4WNq2R8pPKE4PKoB+TfYF2VxMpSh6adG0FUci44rIxI4z8fO1NuqrNQ5PrfUrr8c4ClkDsOWMhyMsSXXr1Xt3xRVB/eg5a9lAb/mpmOnSG8M9SdTlLhrEo6dSyDkRSLk3xT5ptgruYxNrWe/r3rGXA+HNTnb0IE69qY8GvTDet1hm8+qxYW4fbGcp7YoC6dVpyX9K5SIkHZDK+L90tL1r9DWqGrftVByuX9y8gL3r74DCatCidQ83cKvtGXS12DLEsNOvPu4anW9Knlm7hN7Jj67G/RR5/r6ZbwCElqZhjKJoUrO6e2pNaz5ExOnOAO65CE/smt8RyKqpBVhnTU2/tcRtuXJxCmEnTgKj86PLI0c3022dCqHFTmEs8ZkPJdnj8L+XGvC9pYbdvIa7UplRU9EYJSi5wXg8KTcN7rudh+fq6EUuLIaAGrbf99d8Wa3WdlDsSBDCVA1TK7cxd3TzwB/hlJtZzXin8lOWxjLH81KldlhCRgQCSW5EwagubCU38u9fueEEYNSr3MTAC0QP6+C3H4ElAkPAsTTgKr/qZ2X/J+WSsOr31zmhiApTQhbp6Brff77W8PkjZ0UjgmK4fEEF+lR7CKZDWO1WjJjTj1yvbXPBjBrmRzP/HOW7JHCj9SWt9cx4ntX3QEsCvhEiADEcl2iMb6ZgAW67+eLtS3yovsA5TIRY4E9Nw6IKGQSbRmThR0+M5df058R03 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 74b28467-c8c8-4ea4-1942-08db97064345 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2023 05:22:15.9278 (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: H5PDXDMq3asV0u8HUwDVSYtmJHPMeNYDhMUyRWWsrj/+yXAS8os3wqEVhBnmqKOjXPX9Vhi0ssUXZo+BTZKiDQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9390 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230806_222225_085593_4B87BC93 X-CRM114-Status: GOOD ( 12.94 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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->v3: * No change. drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 14 ++++++++++++++ include/drm/bridge/dw_mipi_dsi.h | 3 +++ 2 files changed, 17 insertions(+) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c index 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 Mon Aug 7 05:26:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13343016 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 235E1C04A6A for ; Mon, 7 Aug 2023 05:22: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:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=OvwK2G+o0HpD7FuLTH1tTBWIO8O9YyCLVN35TGTxFg4=; b=bKhOoCP4R1Y4dA JjLFIYhendiUb737syh1M5ICR3AJjAP8npCNILSXvaU36PU+BpCcYweRw7q/lcBscm+ybXgNoRgdH tRPm1lLqV37gKuOAejRoDrPP0ICd/QZ/9iAs7c4oJnnAlv0NWHsN3m83bQ/vHGPvDlFWWuYsANW+P ICODjkCawmVY18F9FWCEm6cm31ijj+H+KgBwxcBOJYkZfxOort93YFWFptNx31dcrCgqFX3zGyJz7 AxUk1aofeeeXd5/1iAr7fipUd3Iu39s+kyVuzh++mXIctsS8XNUp7ynflR/hq8KW14+koTaSkBE60 YIR+kvcrqqvJYNDCpytw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qSshL-00GAYS-1v; Mon, 07 Aug 2023 05:22:31 +0000 Received: from mail-am7eur03on2062e.outbound.protection.outlook.com ([2a01:111:f400:7eaf::62e] helo=EUR03-AM7-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qSshG-00GAUi-23 for linux-arm-kernel@lists.infradead.org; Mon, 07 Aug 2023 05:22:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=judhNTCadGuRJ9QhwwmOxjWldC0bnky2wcHVgn6Hfc0WUT58YLagqrmSt15oKIQy8dLRapOTsN7QeIUBa94qMFj2xjskSqAOzhK7uUP9gXm32NHhBH9VJBEZBqkc0PzPi9p3d4jp4cUoRQQ/GSlWxk3/C2lrt+TmwiCSjtm7inVKZftxAv/OAPhG/NOrRE8KLZ/JAMMRtHmG1w84P+jU4Otl71WCVRv2AH3pz5g5enq88rW7lmZkOy0XAd8x83gvzB/BCKOc2ihyaDUQSlwT1upA88fnOfGVnhcoaJu5sMmGyw1NBDBQ0TeJBvoCZDwI/sgnUE3bMoX1K29fIrimYg== 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=XPvwHyPm/+RhMw62kuGEMYt5dvTiM3F8aa/srDQdTvc=; b=OzflrwFk7h2bIT3EZiqq3Fm1ulii67edMIv61HqveG+rf6H7jWmu5V7iT3g0/ktd346iRBg+HIFppZSfmFOA+iSHSDT44vV2gA07YlU1mOF5tJ3fAW/D47+7uaAKHPXpSUIk19UwA7Lh/BwC9EWq40f/bWV7+1pelpGEmG2OF5HGajzRaimLCs26vhHRTDJmadLKpWsZFyIC2bsbCzpBMwb6o7QQ+oUf86ca/eJAoi9e3Xr2ifE2GsSsRLcdz155Kgx+eCNuTNZ6eFBIKn8awfP98CUR8QyhYGdsHysCjDkIiwTULAZSesiFi056vS+U6+rhXrteVUW1tO75Ebz1zA== 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=XPvwHyPm/+RhMw62kuGEMYt5dvTiM3F8aa/srDQdTvc=; b=OmidvkvjFy0xDT7Z6xH4E0g+eFuRlC8zU8wtiKUHNBt5AVz4qNOmXKMPwYAgj9qby2AnoBSusZHVm0umMQJfMDDMuM0joMUGMqwYuiOwN9/90oGpfAj7CBk/17OTf2I9uaV8v/26UcM88Vm/7tGpbpoxkkeCoiJHcl9cd3WfL0U= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by PA4PR04MB9390.eurprd04.prod.outlook.com (2603:10a6:102:2a9::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.25; Mon, 7 Aug 2023 05:22:23 +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.6652.026; Mon, 7 Aug 2023 05:22:23 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: andrzej.hajda@intel.com, neil.armstrong@linaro.org, rfoss@kernel.org, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, airlied@gmail.com, daniel@ffwll.ch, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, alexander.stein@ew.tq-group.com, sam@ravnborg.org, jagan@amarulasolutions.com, yannick.fertre@foss.st.com, raphael.gallais-pou@foss.st.com, philippe.cornu@foss.st.com, hjc@rock-chips.com, heiko@sntech.de, zyw@rock-chips.com Subject: [PATCH v3 5/9] drm/bridge: synopsys: dw-mipi-dsi: Use pixel clock rate to calculate lbcc Date: Mon, 7 Aug 2023 13:26:04 +0800 Message-Id: <20230807052608.3038698-6-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230807052608.3038698-1-victor.liu@nxp.com> References: <20230807052608.3038698-1-victor.liu@nxp.com> X-ClientProxiedBy: SI2PR01CA0006.apcprd01.prod.exchangelabs.com (2603:1096:4:191::14) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|PA4PR04MB9390:EE_ X-MS-Office365-Filtering-Correlation-Id: 47616819-f20d-4c08-e88a-08db970647ba X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mzM/P0Z6MCMc2dVHWzt4nTLajKDCLuAworpivIvnhwkIvGuZugAcr+0oUS3La4wmRPY3RcNbEDCrLwP7kDVCVH7/FJD4VfXflOMD8j8y65PlqiuCjjq52fiWJLEqTlzsG5/7Ths0baimuQeA3GnRcYfVn+a8fdNHG5EWLanSpdS0q14sNRqJjLa/Q0KoDx3taIc4RIaq/61GIVQDcF8/g2flUN7CH33l9puV+DD47iCN4xoCBPUktNt70CDaCb/DCRrVS3MJboqfwDktK8pBMsVdBZCm7XnBBY7TuzbtdnlW9VW6dVucgT5COz0ZwS/0t08G2IRU/HYVhbX2nURHZiJiAI160vxXMsl2kTIIC93oFSulwAI6RvgFlziFpCqdEbv50NjyZfxVUJB/AshOdYo9+x17XLzHvN7cPnJnJR29m956FqOaFpspABUTd0wbsRN+96+OoGqFRUdzL0v2DXKilw/EsK8ml8AgQSLCQ/Odnm2KYur/+smx3p2rm3iLpbx/DH1QssdQkP5r9h/toTtfbiqVqEeCHgwYF2J1KMwVb57vd8/2/Q+GprhzGKlc+JmifULEWJMyKssWe/z6ssGTXTU4ZfhqEKabygqRR1k= 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)(39860400002)(376002)(366004)(396003)(346002)(451199021)(1800799003)(186006)(2616005)(6486002)(52116002)(6666004)(6512007)(478600001)(86362001)(26005)(36756003)(1076003)(6506007)(41300700001)(316002)(8936002)(5660300002)(8676002)(7416002)(38350700002)(4326008)(2906002)(66946007)(66556008)(66476007)(38100700002)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1IQIK5DPTOpzYcMWukI4IcCA27fHF8CzMl0yfjmNerHWqQ8WewkB+Ll1IFzPx/t0s6VZ2O74ukzTjX9Dk32q7uc4QFGepejVcORO92c3jDzXdk6J8rk6HYP6CNDa9wtOXEQKqNOHuLecaWIxQh24RLPSVjJ9AsMUvwIa/C8J1P+B+oIXrWBQCoL+D9ogpbhZLtEXEDKaeIsVFHVNJU7Y9iHaLx6VNQ3bRIzN/ydRqvTBCGz4tV0F/ilLd4BBaBetyQFzQevmmYBon24Z8LtHvHscgN8Cw0IKLrcW1bMwmyAMPnrGaJj9lRU6u3+C0ltCmkxQQFFyKvRK899Ap6vTHmmWmNm4GDfK+hL3fwxQrjo3JjExLl7fW4ZnHvcsnaigd9VRFvnOZ1iUrvvsYox7Co9v+2uazXS4dsHTcCbtTS7tc1naUNYogmahJZeSkhihc6P/Bc46JKz36WkMJUMlqj4gu4JDOLKwbEsF39I4+bTKuAif5/fWWuBFxbkZdKhUlNszRapr8jdt//n0WjwtBlm5SyyLq6tDtQWvy+VUJ2A8fWPe2vC1LjP6ryhYpmOHI2KGZa4ttNeyIX0o4bj6dTWG4lc8Fax2MgI0rj13R2LmNGRhOcWBG5Q9MEkcRl+SCl5v6OWi1byQ9sSDnD8p9m2XgtH9gprXYsbFiPf9UjvZjRzyPn8POwLrwQq62YZlj0T4eiMJeqb3XUjnjgkNW1jIzMENwMQJ34EG3zqJBC3xhDGrb+WUTItBSQtMaoUHjFtfTG6wo52aZF8wCInYg3FeK07pEq3BBSB/iBprC5bvZSnSl+0mIRF0tXvdpgnzPX3g6Ct+C2RiNieBfMDw9WBcErBbu6etDBMIP/goY+ZPt7PikvAvhV3AXlJ2x8a7ux2fU2iSzdJcN197Ghu6L5sTVSjAaUSRYPDz1C5Y8grwri9lArxRScmEtJioTYFupgM8fJuDNjZz7ZzZ6X7AU/ZST9PxvoQdsk+XR74DrLt2aqmWJTQabvfNtyTQ2lCAfuH2yOuXjfEvvtAe0VNgKeJzUczp07XWn4B8qja6e9+QxRM7TpbMmyFcS2xjTjdnYUX4WAMZQFoCMUlV9CTudhZRkg4QU1gmY6pMhx1bubjzmpNlRK98PvIzVNJUCWke88WCb3YxO3vc1KjuuAKZ38xrKf23zPiNIjraadTYNDDfPKIyx9RYICKyuE+C7sn0tfvK4B/6zFS29kKJVecY7sf94ou8GlGuCjBSqE4KfHiE3MvXUBP12QUgGwgIjtR7ohBXFZzuez40o7n0UbFvszslyskuBQR73un4TfGbiBoLBg2tEG20Vj5u8RdseWYVYZsiagch9pjKO2KPCfKNeqQrDqGuKVzUBQr1WwFNPOzQ0uOQa2qxJV9PXjdc7OUk8NTS2I0KBq4w85iFLTZSw601VY9cjpTs9w/cf+r5iWsQv5ij/z736BbYeTi/bFu9vHaIiXOnq12IyvJpvMxXGUJTRiNQ0ha41cGGVsakiWpd0d/IE2OXuzoeIipTVYOJ6VpiCJj1il7Juag7mvUljFHu3bnvrzU/+IOiBE8O9f3nQj9ctvm8DzN+nspRT1W8 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 47616819-f20d-4c08-e88a-08db970647ba X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2023 05:22:23.4877 (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: QIUXFf8UJ6NbqzsC6iC9exIrkqmnst6LOJ+m4j53H4jgPzF69ON8XO0eStC3Gk7Dd53EWfBs+1al81ob3VdCpw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9390 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230806_222226_676515_0B60F951 X-CRM114-Status: GOOD ( 12.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org To get better accuration, use pixel clock rate to calculate lbcc instead of lane_mbps since the pixel clock rate is in KHz while lane_mbps is in MHz. Without this, distorted image can be seen on a HDMI monitor connected with i.MX93 11x11 EVK through ADV7535 DSI to HDMI bridge in 1920x1080p@60 video mode. Signed-off-by: Liu Ying Reviewed-by: Neil Armstrong --- v2->v3: * Add Neil's R-b tag from v1. v1->v2: * No change. drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c index 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 Mon Aug 7 05:26:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13343017 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 E8E02C04A6A for ; Mon, 7 Aug 2023 05:23:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=OqwKt14PM3S7u8oB5Mda/Gf1Y8sMysSQpcX/rhHb1/I=; b=ZoqphXk5zMKmk4 DpS7hoPiNVFtDTdEUY6LgJqP/vRNLSBtlRI907m96ywxZOGDwSIiwRNOpUaczja2+DTRkzaPUZfBO 41NoUykYO5ri+jfK0AKYHpMHs9udWT7MyiiQNz8xFtqteZuGMkAZ+5BJ+n9w1Vl3D1IWy5KQUtpjj CTgHnmri3GQACtmEUdO+etqAvxs9ITncWsVb4gmU5CQgOnGHr2g6YN39O8k94hgEqWGXJeiiIw9B4 1ABrCBjZZz4FaiIqT0j6w/qvcqNY4IDLgeBuj2nnvd7SDHKoldNhVRq3jKS10nXhsVMoeTDmG9BYL 4VdB3ba42pcKiVzG2irw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qSshS-00GAba-0w; Mon, 07 Aug 2023 05:22:38 +0000 Received: from mail-am7eur03on20625.outbound.protection.outlook.com ([2a01:111:f400:7eaf::625] helo=EUR03-AM7-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qSshP-00GAZE-0Z for linux-arm-kernel@lists.infradead.org; Mon, 07 Aug 2023 05:22:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ByWjAylLX62Cxye64VHA46WAfJJtMSeVJCx3fchDTSuzY1znOrwXc8C/QicNPq/Y+bxXv7KgKCzH0rVRQsVm8YyPCA4g0zQu8ne03VTNCZZMvW8wf7X2ePhYzx6VVzuQNlUalKDxBxWxk01U5nHPqBEPedQpH+yrv0OqiO5+Zz74VC73tN+aw2UJrTDuFQmMMVXmi+RSfwjLPG5jGtdFxllcG+XwzXEm6ssl+2KXqJdmJlOB2dIPxju0+IJobMUL+KqC7/E8+lUiTm9G/qbZdS0sU2Fk0mZFA2TvGWAGuE3hH9A+Y6EghzHdwGLNnSpx+BHzDLdUB15eDHkGVry0CQ== 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=HP+CSUUYPPxXfIYSwkFDGPmnNs8Dq19ovS0tsBKgpT8=; b=KLbUKS7mValfuZPLvUz4wL8TJzJMLTn16VsuDfG+sbG+pPHVITYv/f1nmDhe5hLZ/FctceaUKc+POatRWCX5jS6R7PfFI7YHEWQNfrxro3ZHjbBi/rqybw6fVeEa9Kj9K0t5IGV7vCHEx3BLfO5mYsC3SevLemXBne3Yri9Lfl06nJYSDkg497ghk0zMx83XRYewHsfZdu1wA0Pw42on4+D28X8cvdztmMom7O8eV7uvYq3EyqPWOzkonxzjjCJGAEAHs7Bx46ykzN9YPz0twQgPP6s8tG1QxlGksMsYoVBeSaam3d96EiMGAIoiUC3A27ncTyeFGIAwtx36svisUQ== 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=HP+CSUUYPPxXfIYSwkFDGPmnNs8Dq19ovS0tsBKgpT8=; b=ciESWa8Ck5BIApSLedJfyM2cum7VYJKZCnAqbhMYKVvrodNCTnMgEiv0PlxvO7h0QIKCUfaowhdoDI0ye8YCwvGm670ItM2TO6WYOJOhNn+8MxN6mgJQ6gbMg7JKVqE7pBxTkwt9Aq1Y+ooA/pJ1NvQfCMx3cYTe37h/1WDxbJU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by PA4PR04MB9390.eurprd04.prod.outlook.com (2603:10a6:102:2a9::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.25; Mon, 7 Aug 2023 05:22:31 +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.6652.026; Mon, 7 Aug 2023 05:22:31 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: andrzej.hajda@intel.com, neil.armstrong@linaro.org, rfoss@kernel.org, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, airlied@gmail.com, daniel@ffwll.ch, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, alexander.stein@ew.tq-group.com, sam@ravnborg.org, jagan@amarulasolutions.com, yannick.fertre@foss.st.com, raphael.gallais-pou@foss.st.com, philippe.cornu@foss.st.com, hjc@rock-chips.com, heiko@sntech.de, zyw@rock-chips.com Subject: [PATCH v3 6/9] drm/bridge: synopsys: dw-mipi-dsi: Set minimum lane byte clock cycles for HSA and HBP Date: Mon, 7 Aug 2023 13:26:05 +0800 Message-Id: <20230807052608.3038698-7-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230807052608.3038698-1-victor.liu@nxp.com> References: <20230807052608.3038698-1-victor.liu@nxp.com> X-ClientProxiedBy: SI2PR01CA0006.apcprd01.prod.exchangelabs.com (2603:1096:4:191::14) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|PA4PR04MB9390:EE_ X-MS-Office365-Filtering-Correlation-Id: 60175840-690e-4e27-07eb-08db97064c3f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hsKnxtTha/wnLGFbbqijg60wb40XGLWtM0p6PQDc8AsF4f4l/ncxFPyab4mBDn9i4vTG70sr7OLv0cIcUjKMxR0SRa5zHhBubF7SzU/yCz3BHZclnAgC0dY/2CFSRpMOOxTJ+MR12GuUwO++z17U57nsVjukgpRvYuRRE/i4zbBvU8XyH0l0k2/ZEuAmWgy8eO9wEPGokSUXK/Jj+4Ze1zwrrqzOKOk/Ns+u8GgW7PbIBhdaV4ogG5On+eoEPcehp7YQGse6ReNb/sw2OMwP4wfVqMB7gy+syQWMIxb73uuiNoaJhraHVkAkQKXYPJwXPU1azCcO6KgRK+tjTUlhIWN40ssG3C/XSolmOFgmVzrOUYFgDCLgCoAnEdsWJg3i7OG1+WQi/Ocuo10xX+6SVlDThN3dR1DD/hVNDjmp4Qp2okGuCIQWkNnmH5s1fh6vZvQkc1ArW1Z9b6AXQmRUXsOls3FyG104ORGv89XGQdk/6J9/NKP9ZWgMIMNVCEKT2nYWL8czYjxlJI1LVCXWwfc0TbxuMuSKOH2LrV5EkY31J88qMTvLHvXR4GR6igTm/AJ8ghtjKovHjDdcMFBSrStdjOzZFLpkF5LbkzyHkytHAZfEhGSud0CMuZpeQg+5 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)(39860400002)(376002)(366004)(396003)(346002)(451199021)(1800799003)(186006)(2616005)(6486002)(52116002)(6666004)(6512007)(478600001)(86362001)(26005)(36756003)(1076003)(6506007)(41300700001)(316002)(8936002)(5660300002)(8676002)(7416002)(38350700002)(4326008)(2906002)(66946007)(66556008)(66476007)(38100700002)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RaTG4Q4hyVPF+9bC16v/cNQDfzwsiQGJPQMQOM6a5NEd47TTcJmhNyudOMdpH4FGr8xajUJCq6WTt+wTAWNUnYeVqLaQEtSEtUKPcOWf8XnIRXVaxkX3efnC/RW50yDMZ0BTd6p3O072VZYyX5vrBdNyC/kPs070NhHHuIVH660V87P3hcnt4rvFb+e8HCYeS61TX4zNAc25iGV6j37mmc4iBKROQGAm+Xz9OmtXwU0oDNH3s3v9sLcWt1DVqqo7YhlKG5ak3N2B7cJP1rw3WlElod/OOYeXPLJtmTn/bg0o9Fy1sJFGAxcUJxXDlocjuUZZa0iJz2XkK8A4Y/B+BC0PDYKJSaREgwDaQAjgLf0f+jSahivY9srQ9PKFmGOY/V0b9f82VHDWb3U53zz7Z8HiBBrNxYG57hnYxs0kp4AqmDVZGVoniT/y8+U7jH6M0FqCt/FGcTrs/FbJjVfQQvBu0yJ/QYqOYqYZtLvmEA36n/dGQ4W7qVXzxEShJ2r0M3ZwicC/aCaJHuL6Q/PF1et2LLQSM6yDpvcVzTugqyex3qN6OZo+Hf2LPrBWFxzuSSuXUa6s7oAaAX6K65Ga9cWWOSbRne084PBn4VIFba2R3aOyi58rf0a5ejm2XctKOegWjTIZfbFBwiRDXuMCe6VyoBmKbfJC5UuwqGinc8LToGtDTwY4iLRiAEljkb0tM1/RtcUQJmozUiRBi2n93DoUfNUWUnpdnefNQj13exDhmq7nW2jMtq6BFftuG+cXCeORvR7AyEh8/bXBLubgBI//U3w9YG3M33Pvih5nnSzPj+Bs5M4dh0unOcuYUwQffpszBMXjcljhqM65bk2j5lS/Dgo6Gx3oLefnqkj1uB/frwMZmiKdUAwjFaCoRTddXeX3ZWDdIC4UOdA7tJElzCwn+atdHjwwGoscrw/+Jmg46BXaMe2JIohRgJsMPplNsPC3xlDvhwC5Lm5ueVQArO6opuRzyLWN8eXH1fiU6bWO/vUvSHuQx0BosQnTRro1Nfrep22joEdhrd5KT+g94TNQIULRh1l4Cbyvl80pDkgSY0uS10lAZaZJ3zF+g77kdFG8bK1A6KQjIHGhuQRxi2ZyXTY3SU52lCt/3sgxxKUJP8icj2M8v62zOPcqfZcbpl0x5js3G/CfP6fJZ1D2+VdZ/qe1ZwvmQ95XgiUx409htk3uvfRoxHsVrHvoQui6YPa91iCmnRLSSexJTD3jLNoNE3bbyYtngRbKIDXVXjuxlTuh99/SgByDBxAmCKVUBpDZ4w354wccNJ0Ymav/zTaIfWq7GU6tlqEVFYJVLNqhJOvVvs36eesFaa8ZbhpKs/eYb8/wydgDQjqzamBUe3S5IwUzc3VRlLD+AZggIp5LwzX835VUbY8BJgD+Dn3doKHzNEzfyVtCYNQ7RkV1bFjqWNAz/xJRmGNWsSkuWLtUWvZtmqgNELYpsR/WUesg2xw+BhdPDErlE5apyAazMCaWfZWNYm2hDcVxoFNKOSHPl6DPoHzHsr1BswtgJRs4lZF1CtyPpvAvw3aoH+M53y3/X8yGWMNNvwtYDQpBbaT+AHyc5nTcpU/+DICmoZFA X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 60175840-690e-4e27-07eb-08db97064c3f X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2023 05:22:30.9663 (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: kPfTQJWj92wx2jvkBSNpDbShsNi3/G3TMR9yE5hKbxc3e9SpHoKubisFzde0Ox3BiZ0zXptgO9IknJ41TkudVg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9390 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230806_222235_216970_286330F7 X-CRM114-Status: GOOD ( 14.35 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org According to Synopsys support channel, each region of HSA, HBP and HFP must have minimum number of 10 bytes where constant 4 bytes are for HSS or HSE and 6 bytes are for blanking packet(header + CRC). Hence, the below table comes in. +------------+----------+-------+ | data lanes | min lbcc | bytes | +------------+----------+-------+ | 1 | 10 | 1*10 | +------------+----------+-------+ | 2 | 5 | 2*5 | +------------+----------+-------+ | 3 | 4 | 3*4 | +------------+----------+-------+ | 4 | 3 | 4*3 | +------------+----------+-------+ Implement the minimum lbcc numbers to make sure that the values programmed into DSI_VID_HSA_TIME and DSI_VID_HBP_TIME registers meet the minimum number requirement. For DSI_VID_HLINE_TIME register, it seems that the value programmed should be based on mode->htotal as-is, instead of sum up HSA, HBP, HFP and HDISPLAY. This helps the case where Raydium RM67191 DSI panel is connected, since it's video timing for hsync length is only 2 pixels and without this patch the programmed value for DSI_VID_HSA_TIME is only 2 with 4 data lanes. Signed-off-by: Liu Ying Reviewed-by: Neil Armstrong --- v2->v3: * Add Neil's R-b tag from v1. v1->v2: * No change. drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c index 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 Mon Aug 7 05:26: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: 13343018 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 EC0ACEB64DD for ; Mon, 7 Aug 2023 05:23:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UJAJ0C8ZV4dTMOHZzDJ8gQ6DtyBDN3GU4CULsB14Dks=; b=eLH8/N6MEyQ5pb EjwJ3+Z7AH0iIyplFsyTxxZiaUDJCRkbV3OjvO1ZHm8AQuJRl0xBYORMQBOSjmB4p69IYJjIRhBsX 3jrTITC/f308xh+UfGHkk/OHb5q4soARjOOVt/8/p1wYIoKcHw0RZi7l1XYor790Jq/cx9SRdi9Uf +STkgoVReJREzja9mby6vm593wmOZjtni61A7S3LvdOpNgKQiE7pOmKdsX7G1bWyUIZSF/fKeX09I qtxlUo8JddDiC9u8+oWGa24hTSFTMaFK17V5bV86Cu+DLeQBWh56m/VALv4GXLoCxbYge+cSHVBKP 7cA1yw6D+Z8IhB0ONBuw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qSsha-00GAfG-0B; Mon, 07 Aug 2023 05:22:46 +0000 Received: from mail-am7eur03on20605.outbound.protection.outlook.com ([2a01:111:f400:7eaf::605] helo=EUR03-AM7-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qSshY-00GAch-04 for linux-arm-kernel@lists.infradead.org; Mon, 07 Aug 2023 05:22:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M2jGLgGAJAowkU2NiqYlD8k0GyIem8/AWmnOvFB8alolfsZmcppj76IqQUeO/YoAQorlZ2YPWIn9gPmqIb6Jz+BBqfFd/5qnilFfCgN+Xr3YR9Vxy6ITlfCftORn+c00/K8I8gmG4YvD/l1iQM9G6ahXrosVtoWGpdKuj92FRy6m6A4KwcCmM7T3ecpj10Ln0AiditpSy1/UBON1u4+QfiTQ2sxMQXXRO+DmW3dD2GAzwYrhUJcGwlWPnJcQcSAaiURNRQOmpEVCUGtjC2sGnkaKboDq374nhRQ42cZ4Z59HWfbCTp1buILNbC0nWBzHJwTccSjeE1l7nXGInODcLQ== 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=Xe5geADEsl789VjDFDG0Q9VvJIFDaDW6dcVWrYwiJjw=; b=nHSN/ykBaXH3IoCxPLIWDKuCbQtduea3CCEh5k/EOp3vtqcGpgtZRmgoxwf6eQqzrkEMmLS78bvcGybFvTi0ip9xDHUJnRBscD+dQD39Xfsvz/VZ9MHuGeFTi719r8zmK1FJ5Mmwds3NsQExEUfcmIu2ccuf5tWfoU/XswgqHtMtW2LOqCvayN55VcvxUyEQUTzLu/rpzfbZX1fb53bJ/VmDEo+bUWKW0Auifgueamcmgqroz+tZNmH99c8dN7CnnHCvkXtFjvAO+6JnLqEsCk9+l/MBnut3i7ZjtXsDjOJVOcH1YvO8oBYh5PUywEb3LoyXwcQjCSDaGAtegAU5Jg== 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=Xe5geADEsl789VjDFDG0Q9VvJIFDaDW6dcVWrYwiJjw=; b=AMLM4VVc/P2SwFfrCenQhcSMPLqnhuDtA+OXTNBC9MieuCu818rst64Rb7J/9z3i/CafVNVwIp0nigiUrXkX7uj9eJgHRZf6U10H4vaiIirelJJKK7Ex9aUmRt5jfXcG4b6S8fwQJZuAyDuRQS8PE+2yFwKfcXSLz2fpP7YCy+A= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by PA4PR04MB9390.eurprd04.prod.outlook.com (2603:10a6:102:2a9::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.25; Mon, 7 Aug 2023 05:22: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.6652.026; Mon, 7 Aug 2023 05:22:38 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: andrzej.hajda@intel.com, neil.armstrong@linaro.org, rfoss@kernel.org, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, airlied@gmail.com, daniel@ffwll.ch, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, alexander.stein@ew.tq-group.com, sam@ravnborg.org, jagan@amarulasolutions.com, yannick.fertre@foss.st.com, raphael.gallais-pou@foss.st.com, philippe.cornu@foss.st.com, hjc@rock-chips.com, heiko@sntech.de, zyw@rock-chips.com Subject: [PATCH v3 7/9] drm/bridge: synopsys: dw-mipi-dsi: Disable HSTX and LPRX timeout check Date: Mon, 7 Aug 2023 13:26:06 +0800 Message-Id: <20230807052608.3038698-8-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230807052608.3038698-1-victor.liu@nxp.com> References: <20230807052608.3038698-1-victor.liu@nxp.com> X-ClientProxiedBy: SI2PR01CA0006.apcprd01.prod.exchangelabs.com (2603:1096:4:191::14) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|PA4PR04MB9390:EE_ X-MS-Office365-Filtering-Correlation-Id: f77eef7d-b439-4c9b-1553-08db970650b0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: USX3AEuhrOo5AAqxOc8sLh78KQ2bPusLhkWBKW7ssLFe578rgManQDFDG3b+KR/KnJ0mh82ftWpWZoZKnSpdQo3d0J9kZEQCkk8r6isoijvGPr9LluQT+s0lytAo7KzM4xyraLO0XXjUJHyVofwoNjcNdt6z5/u5Budmru2ASBZb1IB4V262s3QET4l3T9uAX9Yd7oLQf3kPJdl9UgiuK0Qg2KC6/QJsRtVQgq51xsS3p5Dl2tkemo8dEKO1nb1DCOVNtKT83q9XoGgCP+tvMsGn9spyiV5YogouxZXrSRhlbxW0xGWZwwQ+jBhBgVp1XxYzKc7WsSGN/BuWPRFDRX5WE9UcxA8cr6R974nMpTwodRtw77YYZpgYY6Q8EQabR2z2Ux1PZvFzJ2I+44+Y1Ka7UWfHBSkUt7NuSkWRVE6ziRte+f7asxqzt8X/BsrrN7Y6BD4l3LVJ1CSW6Z4d6AOYs+fL9GxvJKvS3gvDmfPH1RDgkgxB1LNn0rs0jCx3HqioAP9uQT7jR196tqn7tOl+CRILPOw4EC/Ocj1K2hLH1Ca6W++1FBSiyLB5u6mNgCexCTbidLFOi9d2xxC2pBTuuvWA7fSruVWztxNhMXCs3B60EMPfbBqGM4Q/QR8e 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)(39860400002)(376002)(366004)(396003)(346002)(451199021)(1800799003)(186006)(2616005)(6486002)(52116002)(6666004)(6512007)(478600001)(86362001)(26005)(36756003)(1076003)(6506007)(41300700001)(316002)(8936002)(5660300002)(8676002)(7416002)(38350700002)(4326008)(2906002)(66946007)(66556008)(66476007)(38100700002)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xYVz2tQGXL6P4J616qAFa/SveDHt7v+CX48cGwaXedV012aZlyGLYahM3wed2a5aQosXFIpG1ki8RE2f4g8QsOZ1V3OS7qS/zwsqYoYMl2hrN8A0v2fp3gR0WU+aGm61vaV1Iqc3gd3ALkCEuH4vykXb9lKkaJNh+fN5cQDt9ioJCvyK+CbWaLgw5oVTELC8vV7byds8mj+ni3fVHYwTf5hei2WjLLwKIU7dvAMhK7QddCNcyp31w4VmLiN0gVYRBEsIDO9PcurT6V9i7CBmS8cbRkHFgsNSIO/boTWKoa7IICiyZpYc7zEIMw6QHdXeErfzY1HXlHzFRmwErDlHNezF6elcm/3yXvDHgtyAkeL8MhMR+vkqYxbK/lKHSJhyM2lbovpnNH8It3rgUQ08HSsVf5LaaoCSTDabor7CKLT2f3A6IbtAr82G6NRcFQxmHM+mRztX0j3W3XsJS6SH0pPuBdrVR3kDkFZRkeXO4qFO4YGE6Hgf1ScCjoi/y3kjIClySc6/aLfNIH8Jpi5gE2o7uGsqp+TDbh52PcitDQjGD7B3WLXB2bGqT/iuo3wnRXdw6Jl8+pnFBYIOBYuNQmeqx/DAyjTNRhaqm/hl/kEM7ZD5vaI0mlZCd+/VXSZ1cnrK7m4ZF1sjcUE94jeh6Sf3oyqh+wzn7oat7jYUNkpssfhyiZHS6cxOd/xfJD3K3xzp1EnN5zWbMCIBqPt/Xm5i6Joy9ZFtaMf2URZSUuXlnWc3a0iWRlLv+vkHgwL+I1NCRtfVVIH//GvKt4fmgOYAOtGEaaw6rU5ohZD/Rq0Pyk9t1J1ZjAWod65EoP63WCcXFqHK9gmFEZwD11rpc/+jwjkGrIh47zRVMQg9e1t48ihYY88zYBBFj7cRvhH7zGJx/pb7O1Egv5IkKeqkSFZhTWwY2XvYHycaykblGw0BzS7fw5RfhsI7y4udpIawqOmp7w90T1eMNR/LUswGE38E/Wf7ZqMqZqdiqoj3sv1c8LjcDyhYJBQjKn9dv75nOKIv9uxeE18pJKbwYV2/VRCoJoaxJBOouyirNRe4HKPG8n3czVXy+SZ1XKJH5Nu6iPnGMWACNxpUbXqlvgL1ElZgb6usW/4yws4fZdsZvVrtJsXROeWrtU8/Mkpm4W1/50E5aENY7nwxFh2iFRcemGCT7Kywwkaw58ry/ZpevtR69SXkDUSZ81euZNX9n4AfbCwzuWx3Du11Ci/+X9zazJlSXn+C1Pz2IK64Z8sv0aT8N7jaLaXmvF0niEoUn0kSifTbK7KJD3u/DGXwd6CdvDQ19PSz0gMO6NvQ/6q37iwjBss9U5L8DxlXvn/gfSIWwa5AA3WAw7yKvbdslvQy5KZNaKbWIjETOkmjgOPlGd8RorNBCCJgfJ3CBwumRwX6CndmSoRZddap/0xjXgUfw8rpa9PkcqUQMZ2b1GFzsk1yTS9NxirE2oremJKSq8y5PqovBqNAUinqR/G4GuxXox2WBHZ9PzbolXGdhDoKcVb34aCDVgXYGd4SnYv8h91Bt2UTHpOaxz1LXe4qHnJCBu65Xdb2en0Q4IQslVRvzNJHmXVSXmAszWauxdnYaUwW X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f77eef7d-b439-4c9b-1553-08db970650b0 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2023 05:22:38.5143 (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: TZC8lxTIjBIE4J8BrKV1Bzz3FRYqhEQZcxwTicl0g/bkLETGIAcJ1gJl81F04LAkUKXHbnQZQwRRwMYDlRVhuQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9390 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230806_222244_061078_DA4B397A X-CRM114-Status: GOOD ( 13.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org According to Synopsys DW MIPI DSI host databook, HSTX and LPRX timeout contention detections are measured in TO_CLK_DIVISION cycles. However, the current driver programs magic values to TO_CLK_DIVISION, HSTX_TO_CNT and LPRX_TO_CNT register fields, which makes timeout error event wrongly happen for some video modes, at least for the typical 1920x1080p@60 video mode read from a HDMI monitor driven by ADV7535 DSI to HDMI bridge. While at it, the current driver doesn't enable interrupt to handle or complain about the error status, so true error just happens silently except for display distortions by visual check. Disable the timeout check by setting those timeout register fields to zero for now until someone comes along with better computations for the timeout values. Although the databook doesn't mention what happens when they are set to zero, it turns out the false error doesn't happen for the 1920x1080p@60 video mode at least. Signed-off-by: Liu Ying Reviewed-by: Neil Armstrong --- v2->v3: * Add Neil's R-b tag from v1. v1->v2: * No change. drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c index 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 Mon Aug 7 05:26:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13343019 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 C25B7EB64DD for ; Mon, 7 Aug 2023 05:23: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:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jFspaEZmRmKQbcAQzuaerccT1FO4/6G5qD5wKEr+OFs=; b=LEai6VCpXR5+bG 1Cb85J5mONAqUHzwAruDOqyDZQda5mKKZR1RGmiVvGt4i9QgGp3sKgfRtMWPaplvQHBBUQfVBJyT7 J9l/UmNKqV5GxVnNbCBn+/VoOdClvYGI5kVMP03uaj5zlchWvTMr64KCKm+R3X+5AANhYRd+tqqHW mcfDd2/6DRwC22vMVtwbUAwdSa0hsQhOmwzowAoKNPHcX+SwreDCNp5Rp67QtQb2qSee+pDUHwXOh 9j1cl3u7au7H31vpG71JYH6osZI5+KNwaQ068oZEiYrm0lSMVs6FWR22sRm2Qo5wEN4UkSyRt+PFu kFFJSQvKCbNMZSbodvJQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qSshk-00GAkr-1W; Mon, 07 Aug 2023 05:22:56 +0000 Received: from mail-am7eur03on2061b.outbound.protection.outlook.com ([2a01:111:f400:7eaf::61b] helo=EUR03-AM7-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qSshe-00GAgV-2E for linux-arm-kernel@lists.infradead.org; Mon, 07 Aug 2023 05:22:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JN44cXCyIcdjz75jWYlCF2ql+/YZIzF/Ou6h4chyoXDJ19CuxxpBrW15Q84IrOhKhSuyQ7BGRJBvEW++hbJbvo5+pQsdsROAcQWezKYiuMzuZIUmSytn0xjAEBTQR2YJZd+y+z6GGwNku98b+lSZN/hDMHUf3OnByrB3o+IHafNEpKNBA8gOteFevoX4zPClWXR/I0cp7UCTClsAvEM8TRWKSDO/6Cs2+kLbLm024bSOTF6aXxkFPDVRvYPvadeITe8cTFPcPVRNO8HigfMkZkpzTKtrtEawhqUFjMRXoh1xw8GNqrXVQtOP6j1T02rOR7F/H0xdvFp5NfFOAvutMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=QaSy5Q0CXsysYWOiOideIJmkgVMU5fTcbKDsyETU8EA=; b=dMYUvb6ugZ4ga6WknMBPpd7GDbK/iAJQq/iIuhTk3Lh3DR4xDUu91I86D5TpeCdGIeos+3t7U1JQh3UCL5ypecIY1KGWwsMtndA6rf4F7y1UXxeMC6o7kXT40FOCcTDXr7r1YUiinvYyqUlQJauYzePTFG1BMjjMJK+R7vtX/3DfAhIL+Q13xPnRgJ1EibFb0tHnQVNbaZvZ+oUIgNk5Dzbyb87wl/hEFgx/1OPeTgqsFXaBayWBLgfa3RmuU5osQkGcOKgVeFA66tfL0qJcuLYDClcBEscr/auWtNcj818MXkl6f53k9pQtbt09HdhKpahHRAw/3P4d3xw+/F9x3A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QaSy5Q0CXsysYWOiOideIJmkgVMU5fTcbKDsyETU8EA=; b=jS/wFCMv8CRQ8IWyK61m+sUSPULmNtgkPBrP31H7ScPoo12vtOp6iJEvmWQIKopOOvOyAXnrrPLfTpp7/feaSDdRNAKOIXWH19wq38dn7dgZWx3SwdlJvwJs6XfTzY3tWP2K2smzg477Z+05GGn/8kmDk4fO3XaXDdpVN/JZXPU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by PA4PR04MB9390.eurprd04.prod.outlook.com (2603:10a6:102:2a9::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.25; Mon, 7 Aug 2023 05:22:46 +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.6652.026; Mon, 7 Aug 2023 05:22:46 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: andrzej.hajda@intel.com, neil.armstrong@linaro.org, rfoss@kernel.org, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, airlied@gmail.com, daniel@ffwll.ch, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, alexander.stein@ew.tq-group.com, sam@ravnborg.org, jagan@amarulasolutions.com, yannick.fertre@foss.st.com, raphael.gallais-pou@foss.st.com, philippe.cornu@foss.st.com, hjc@rock-chips.com, heiko@sntech.de, zyw@rock-chips.com, Rob Herring Subject: [PATCH v3 8/9] dt-bindings: display: bridge: Document Freescale i.MX93 MIPI DSI Date: Mon, 7 Aug 2023 13:26:07 +0800 Message-Id: <20230807052608.3038698-9-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230807052608.3038698-1-victor.liu@nxp.com> References: <20230807052608.3038698-1-victor.liu@nxp.com> X-ClientProxiedBy: SI2PR01CA0006.apcprd01.prod.exchangelabs.com (2603:1096:4:191::14) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|PA4PR04MB9390:EE_ X-MS-Office365-Filtering-Correlation-Id: 6104382d-7767-4f93-42ba-08db97065585 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UT35+6FAvWXpTHNOtLRLydFqVNPg2JKbQp2Dw2GYyOSO9n/rlyQdXJyw4ydP1GExVZJnwxqjx53vscX5YDjfT+fzfn3DlhQFlmV8RAWDP2iW7NqqFPjSl1d1kUJv/GwxvemMhPPq6aKNDt3XQAbCUBW8LuN7xUGwyXvD2lOkh9htkmPIcr06GRWJMoeWq6MynDZl8DZ5oSh9GoeqiH+w7dHHWIGPEnT36tXAwCzZtMJNaHtQx87TJKSFqkyCekQbt3cDAhN2XAHeS7tAKuTM4LxPXClkgpQgt+QYWLv1gXw+L9fw5hdqt+HXuBhaB9yGqN6M+OXBH3yDru1ol6U7yJ1F6n3Izp5VJnX5p0e8MDSAKHsfn2MW0dT9oK0/nE4uPIbvWyOq3ooN/pk7UKx1JdhamN0ZW0usTGVBeD5k9DEvqUrvbTs1yDBNPHKfwDjtcI81Yc4esxw3FeBAIWXyAU06+N8MXDZA6fXhJMo5kzP6f+LTf3AbHCSNGnFzQe2VCk80cWsDQl4nfxv2n7zXLGZyo7sLydopJaMTGv8ha4tN2k4vE7Gkbzdd5xc5LEAEVL2ml6gd2A0y34Wn/NFhPYk5/UftIkLO4qo3jJ+PS3fAYwZ1DgfASFOXpQhSZGRU3YIebuomxl8tLhczbzk/Jw== 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)(39860400002)(376002)(366004)(396003)(346002)(451199021)(1800799003)(186006)(2616005)(6486002)(52116002)(6666004)(6512007)(478600001)(86362001)(966005)(26005)(36756003)(1076003)(6506007)(41300700001)(316002)(8936002)(5660300002)(8676002)(7416002)(38350700002)(4326008)(2906002)(66946007)(66556008)(66476007)(38100700002)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: o0Bkq0DhcuoGiAjEo62bFfQMUDvbZcKIKsRMpVaEykSekD/Gk+YvEw9UYkQrROM478QV+xpZfSnJq2EOT69qLvVu7vjMOzND8p0O+DMPU8QDOWtseJdVtqODkL3OKvzFcLuhHY4vV6UaeT/vRTqKOgjTYpPxqijU2cuawPsE3ZESJZbQpWDwxLgNWZuU6Aa60KUcC7ikeM9AknKY4QKWZbI0k6QvhbCvO1HbGx7fHko4ed3uTCcvI9rZwICu095DKUl4NuzHaofj+543PDSQTMbKeq2Esc2kUoAGwb78R5pkmvo8YJTT7WRRgXsj6LgeMTSHM4xwl6sbgebOtU19EVzgvwjyIX4zEcc0SRm40uxZDoVA+zA8MWQ/RCy7oQyMnhLk9XSu4d8ALbGI+CzSRB897xmMsk+RLIyyThPlPAsJUB28wb92tLy9zFaarCC844C2ff9qaNoGCemHfQ5x9qyoln8yGVBXXLRe7vvjgSIEE7uo1HlINRUPOr/xI6Y6dUJ/w3o9vunGsSgJTHW9VK16YLvuDoYkcbahaxEiUq4tm7D9DhwF0M+/0YEU083Fslt8VjyPUH5hRutm5ZHMjhHQ2aKY+gwOsucU7pL8tMfHZyPQXYJnLg2NwZJWOArJqruSahcwTdG5MCxse4OHoSoxZBYyVBE0D7dpc16AGXBR3rrizkUS5HxKoUEgtot+0HPRVbRKOtlDp5y/w5cxuA7SXnUxDmmPdXudraQQvU+hSh42fCWbtzM+XJO4KCY/jWzkMrW41IuhW7q3MmL9JUl/EEwCAAfR66d3e9aLOtQ0dDi6NlatA13Prx/+zh/KU4BGXxb1awiVFDI8NunVj8SP3/ZOymWL/qm5jnoE109KTPqWcttRj/PgrnJQaA2Nv8s3F2J1GQEZPsKWwskSlSu5pBq9NbUdGUtv+Cw91ND4kFVaQCOZ0J9P9V+sYcynhaf/g5l49rFzkTHfJcNQeRByDJSA9PVz0QrrOacGeHvwtcgQpWhLUA3UrzLXmU+gs98R6xvr63cIL2MKyzusr4CcPgZDNpoeGwN4FRj82ypcWJAj9ZAG+MRYs+cAdnYYWp4ViBh4uihqjZr2hyUT6J7diJ+eA3r44jCVVBX2aX/P44CsLF+G36drnTsNBNfy4V98V2+vMWbh6bPVU1yizZ7tlYx4Xse5UvoscmqbnlBB2y0GVlgw7RPHJa0CF0bCFrPDp+vL1FPrcRYnSj3a8j5l7bXgGNXOfbtfYq2P0shY86MYKNlWJK8P4o+Fl0VPs4SN835pim5PSyee+N1+2/hp2Um4JHtE6CBmrrjSujAYzWPxPFWdRXvM2j41KuCILB9+xLfKi2X6cllD6l7RHDjGBL19IZTi8og6vPNb8A+0bNDDGuFbVZ0rVQslm09bcE+3sBfto0mepvyAemFrK9MHYMTRk048M+31417HRsMYWBd/rRR14JrZCbIyTUqZcZNiJMe8bdYjjEbhatX044L1WadtoOw4VIcPUMkLB8OWaq/c+XjHzrKbVhA3Pge+dswhRaHjrrbJlwNo0a1/C4TgYWsHwIA9PYD6mz714NwOwXJ8yRCLqbAqBQ2n8NZK X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6104382d-7767-4f93-42ba-08db97065585 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2023 05:22:46.5788 (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: QlZy5OZW4cmHHTqt2YXyVX3C0GTH34Xnvt6WHp4mNVs4ebB0rePHQuJ6ZT4yDl8HQLKluxcmKzZkaxbv7gRRUA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9390 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230806_222250_741353_34A2A685 X-CRM114-Status: GOOD ( 12.26 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Freescale i.MX93 SoC embeds a Synopsys Designware MIPI DSI host controller and a Synopsys Designware MIPI DPHY. Some configurations and extensions to them are controlled by i.MX93 media blk-ctrl. Signed-off-by: Liu Ying Reviewed-by: Rob Herring --- v2->v3: * No change. v1->v2: * Add Rob's R-b tag. .../display/bridge/fsl,imx93-mipi-dsi.yaml | 115 ++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/bridge/fsl,imx93-mipi-dsi.yaml diff --git a/Documentation/devicetree/bindings/display/bridge/fsl,imx93-mipi-dsi.yaml b/Documentation/devicetree/bindings/display/bridge/fsl,imx93-mipi-dsi.yaml new file mode 100644 index 000000000000..d6e51d0cf546 --- /dev/null +++ b/Documentation/devicetree/bindings/display/bridge/fsl,imx93-mipi-dsi.yaml @@ -0,0 +1,115 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/bridge/fsl,imx93-mipi-dsi.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Freescale i.MX93 specific extensions to Synopsys Designware MIPI DSI + +maintainers: + - Liu Ying + +description: | + There is a Synopsys Designware MIPI DSI Host Controller and a Synopsys + Designware MIPI DPHY embedded in Freescale i.MX93 SoC. Some configurations + and extensions to them are controlled by i.MX93 media blk-ctrl. + +allOf: + - $ref: snps,dw-mipi-dsi.yaml# + +properties: + compatible: + const: fsl,imx93-mipi-dsi + + clocks: + items: + - description: apb clock + - description: pixel clock + - description: PHY configuration clock + - description: PHY reference clock + + clock-names: + items: + - const: pclk + - const: pix + - const: phy_cfg + - const: phy_ref + + interrupts: + maxItems: 1 + + fsl,media-blk-ctrl: + $ref: /schemas/types.yaml#/definitions/phandle + description: + i.MX93 media blk-ctrl, as a syscon, controls pixel component bit map + configurations from LCDIF display controller to the MIPI DSI host + controller and MIPI DPHY PLL related configurations through PLL SoC + interface. + + power-domains: + maxItems: 1 + +required: + - compatible + - interrupts + - fsl,media-blk-ctrl + - power-domains + +unevaluatedProperties: false + +examples: + - | + #include + #include + #include + #include + + dsi@4ae10000 { + compatible = "fsl,imx93-mipi-dsi"; + reg = <0x4ae10000 0x10000>; + interrupts = ; + clocks = <&clk IMX93_CLK_MIPI_DSI_GATE>, + <&clk IMX93_CLK_MEDIA_DISP_PIX>, + <&clk IMX93_CLK_MIPI_PHY_CFG>, + <&clk IMX93_CLK_24M>; + clock-names = "pclk", "pix", "phy_cfg", "phy_ref"; + fsl,media-blk-ctrl = <&media_blk_ctrl>; + power-domains = <&media_blk_ctrl IMX93_MEDIABLK_PD_MIPI_DSI>; + #address-cells = <1>; + #size-cells = <0>; + + panel@0 { + compatible = "raydium,rm67191"; + reg = <0>; + reset-gpios = <&adp5585gpio 6 GPIO_ACTIVE_LOW>; + dsi-lanes = <4>; + video-mode = <2>; + + port { + panel_in: endpoint { + remote-endpoint = <&dsi_out>; + }; + }; + }; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + + dsi_to_lcdif: endpoint { + remote-endpoint = <&lcdif_to_dsi>; + }; + }; + + port@1 { + reg = <1>; + + dsi_out: endpoint { + remote-endpoint = <&panel_in>; + }; + }; + }; + }; From patchwork Mon Aug 7 05:26:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13343020 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 096C1C001DB for ; Mon, 7 Aug 2023 05:23:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=R6T3dxVGVeKOD04gZ/q7Vrthm/jT1YAVtPihmMt8WlQ=; b=uRZoXkaf9GYrgD eENtCsHuiz78XX8TkIjinYjt2yall9clQTVRifBsn29WrHWiM6TP1S/lFque6xLjSO3Ml7rRancHq xJyGt5LwaBwhygvrNVwec0TOnX1GkQ/+w2dqYepeDfoBYTBDeYOP09tMxuFJTkIDJJdS/lSjrmMCP q45qnum8/rys6Fx8W7WfYy3yWY9Ijs0h1Um2ZI2jHWsR1SolCweZUttqwNlIus+xYaBTgJ2mOFMro cu77WFSF2vGjzWyEd9CbYKujr+BzOOAxbYBbWmWD+GIRwMXXlsylVP09azCpx42FdZIxtUPTry38t 7Cvt72ucuaquqnmtwSIQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qSsht-00GApT-2E; Mon, 07 Aug 2023 05:23:05 +0000 Received: from mail-am7eur03on20614.outbound.protection.outlook.com ([2a01:111:f400:7eaf::614] helo=EUR03-AM7-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qSshm-00GAko-1c for linux-arm-kernel@lists.infradead.org; Mon, 07 Aug 2023 05:23:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M4sPlAMy7FZj4nkbF5yPpC0ae3dgRD5HoPjlnMgFtziJg4qCavuKwAqtmJ+czghzpx2Klah5jekFYdf1VG1JIhDoqS6fqj1O2A7jiRuC9N3CN7y17gCt37f0GLdFJfls9hpSm9prYePUfBuEbKfDxlXbxikjm+f6JXFIhw+arkjhEcD1odRh007M5Dedm05eOOaoa1DbqCMmPgnZ9YvQKUHjL1DHRuqZmDojkFpVjir7WHxG3K6Q6XGdMlsbXFvBp/6fpRDHRqIjcxCh/wYA9apVRdv54AJOsSAX5nQ8GKuvLxiD3Fi/jizv25d1cXk3odBSf2LfVmzbQ5QKolaOyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1q9U4p8M3eCr1pPQLE1PqxC7716K2kLcf/CpA5FfdLs=; b=RtRP37+aZ2WWRCGwgWSgT/fV9wxdo44ieAki3D5dsJDdKk85HOGlf9fCabw8L31nlFWafP04tTezRkfK209j+VUFABMROzGe13GDzzKNknvlWNOb8juLcuAwpJSMhGztW6HDq5+TcqVtocOrX3kq4leWARGtsi+dOdxbngAltFCY0wTZOWdi0ukee6D39YxUwwkmCneFj1ljvvRsPtxzMgpd2F2Sben4O9AQ4ooG6vh4fv9D9Avo9FMLkMQbiiEL++McZsJUg0D8uVdxWDESrpTLks+zNdd+D9flZKHdPUCK5NoO8exHh1A6DIGFqcJnm2e20GYugrmnWwOjv9n6GA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1q9U4p8M3eCr1pPQLE1PqxC7716K2kLcf/CpA5FfdLs=; b=iXMhr6djaC0biE8mifqzPo8twsIPrGMkwjOCVLEtTM2aVs+NIdgAaqdXZHtAuefyakM19h2lf5J/wxNuv3KhXUKcvc8jMtjiAeox7GyIcHG8Be8ZtvCHUZZYqkLVtUcpW1jY9Vx8nJx7PJvqbw9dbY6T0JRn4KIOhN4KGqhdMKc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by PA4PR04MB9390.eurprd04.prod.outlook.com (2603:10a6:102:2a9::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.25; Mon, 7 Aug 2023 05:22: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.6652.026; Mon, 7 Aug 2023 05:22:54 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: andrzej.hajda@intel.com, neil.armstrong@linaro.org, rfoss@kernel.org, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, airlied@gmail.com, daniel@ffwll.ch, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, alexander.stein@ew.tq-group.com, sam@ravnborg.org, jagan@amarulasolutions.com, yannick.fertre@foss.st.com, raphael.gallais-pou@foss.st.com, philippe.cornu@foss.st.com, hjc@rock-chips.com, heiko@sntech.de, zyw@rock-chips.com Subject: [PATCH v3 9/9] drm/bridge: imx: Add i.MX93 MIPI DSI support Date: Mon, 7 Aug 2023 13:26:08 +0800 Message-Id: <20230807052608.3038698-10-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230807052608.3038698-1-victor.liu@nxp.com> References: <20230807052608.3038698-1-victor.liu@nxp.com> X-ClientProxiedBy: SI2PR01CA0006.apcprd01.prod.exchangelabs.com (2603:1096:4:191::14) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|PA4PR04MB9390:EE_ X-MS-Office365-Filtering-Correlation-Id: 3669c50a-5434-4658-16d7-08db970659fb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LqYoOCigORnKM9uMEkvjNOCr1xrdilrD9lnj/T9Ph0GLY+QUVVvmDbI+T65TnWwjOi5YNv/Cuy0L+StBbFqGdZLzO57baMWYXcoiVjSrUxCzu/chveIPunFIOHN1Z/+HM8JR5EOS2+skwZyjLGQ8M0DiJWOCf2oHIXZfkVx4CMZTJuXelkE65/02TVa8f9m4KDCKeDpBDI4vMJIdqr8sho0lcXcI3yiisenIhnUP8ynBBsmH+kFodzI9V7fE4IzxLCUb/tt+rMxjI0RNZWmdQmvtqJFoQDTdh5uLTZRVhq7PDxAeIniLL0jgdINQ8GK9rWNg+FqOg9LFW8EAeBs6fCb1zUTmNjdRzeZC+EarxF42MooH1B8+bfEZ74SFvToGI9aicy3V07lG2HuKYgYxtuqjKuLLhroDJ6LzCE1NuV0oxubqWFfIH59sfqW9VQQbwZzApegZAq334iL76mUOBctZY8ZeCSJXHzvYW/WsQMiqBK1F2dzyjAT191l1WLgl8qwhzbKrqEd78AvWX5nPiXMx5w1mZQIh3mIJopf8RilQOURRreTWBxdqSi+xRFea7U6IoPlFWAqXYWVUDeuRgLHrCDlRjKkxUWptK2D2EbkCz2A+mlOvUySzRu5+7Ody 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)(39860400002)(376002)(366004)(396003)(346002)(451199021)(1800799003)(186006)(2616005)(6486002)(52116002)(6666004)(6512007)(478600001)(86362001)(26005)(36756003)(1076003)(6506007)(41300700001)(316002)(30864003)(8936002)(5660300002)(8676002)(7416002)(38350700002)(4326008)(2906002)(66946007)(66556008)(66476007)(38100700002)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: TawSUP6ammjb9DU5LXj1iNM0GdK6UY0K8dyohBeCYSwEOYR0eNpb3464rUzQ8PxGK+QaBVFOiMa0JxV5DSBo6sqlIxnP7KgI3TRohjJM5SQIiH0WC4SusIxGDJ7ovp4sLaLjYlzJ7R1OXORY0tsbOGceAS76BKElaaDdueHBkwUug9YBcmdns0sp7sDKv+RjmL2dvkTPwIJ72ua2dRRuTNxOgyW8MyCdTKFM3r+ePk2llmP5hNyvITwYTjBNiJyIdiZFvSfbT1nbBHxiJeM6/9brA/q8dJSxQWfVqJustGfePeE+OigTXoRYFMfLS7UztkYILSPt4gpxeEaMp49Edc9k1HLIMwOvLuQujiouzEH6YUwINiwgucn2Jrg8v4BrfHu1SAHwl5ESlT64jJWqriWn/ziW7rJT7bTDOK6vwXy7MzcSKYzFlCkYIO4xI52wWzAo9LFdd+O3BoRd67igbnvmQbwqz9S1OrL/ir7CpN2JN+9MIIl5iQf/FhIpF3LNPZU84zN3yd3ViOqeV7A5XqfaYz1X3N7SqFLcljn9aXtM8ZjgYpuH/eyQX7EnLA0uOm6v+dGRnAa1ZDAYjEpT2GJg0M1sx1TGy1D/jOomemYkYKs+JktnQ3jkU2vKgd5UtxlqLgZp5Uo8eSRWQovEPR3JaB7+jXuz/Tkfbf5vBvSGbZI6BLO8sKdR54AV4J1Dw8b0ytTuh0W87km9h7u0Rh828D7Ni6J/fhu1nXIeg208NSCp/e4zgB1kw6e5tIOhg9QZvzbgitaIx2rWbOXCAxxDZcmVspFTFVtUTTNvVTiuZ5bcQlKeaHz2DX2DSgzwcehAHrr3ICIpvvIp7Jz+XONHdKpurKHxurNgwRJd16IMlg60HkevpuSsORogqAm4B6OxAneDM57zqdT7BX0mzlzCUUU88ghJ5yjupezXcoIkspMJg45kVkBp12jM/SUX9TFX+9bStq/fITNyN4/jV9zplSBTSPlfjNxXg/Ra8E5+a3TJyHF5wEMrf0csZM8LfB9anbW7c4JZgaQ9BRhXvwgLdQAoUw7Amt3sBYsBxxmVfxdfGGmurLKT5aANC1weCj4YsLbXh04lx24O2cTwZyhDfyWGJrvx3u0qXhx3T6I/+98C88F7M7WO96qWrgodB8tUBr9f00QE0Hvy2QHohZM16zvaWT4Ex5fjgo8Rfq4P0unRSxu3jdr+bN00atFi+0e9SigqUDlCC9U7nA4Yv0WzWWgT3ArTt2nQTcjWLdfn1GVVritMN+yTuWhc40YznQ2n8qdynwE5u+bGpIuQi9l+DRb4Rzul6qiD95y5Efh41QJFXUzFyy6md3MVtghufGC2ZRT4xoQfeJKIBeiV3NkkL2bCdiQQIr8sZT9aPnl3amizKa6LWy4+bNNM0ioPRO+PuoFSCZwTt27Hhr5rTBW9+1IoQyg7jnSZuJ9WDlJKdCgCgJ9bXoXgw41Y2izCLak0w6q6E8zx4zZTjVcjBMZD0Td2xnnOLY64u+RxFghkmUYd30ITB9QR+7cTlRQXEiWNaVpRmLcS00yCJcRr1LkxGRnPTjSn8tW8BtzlRUEwZ/RqEguz/yalK3xwBwIf X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3669c50a-5434-4658-16d7-08db970659fb X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2023 05:22:54.1808 (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: grS+hz10fbygtKuYV/IH2awZm2+O1yj6DWgrLZzHfrYujk2ygwz0yBRVrmFsrrA5ryjKgoy1vgMdZUq3vec8Rw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9390 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230806_222258_691450_A5A44BD3 X-CRM114-Status: GOOD ( 16.05 ) 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 --- v2->v3: * Select GENERIC_PHY to fix Kconfig warning for GENERIC_PHY_MIPI_DPHY dependency. v1->v2: * Use dev_err_probe() to replace DRM_DEV_ERROR(). (Sam and Alexander) * Use dev_*() to replace DRM_*(). (Sam) * Fix build for arm architecture. (Reported-by: kernel test robot ) * Improve error messages for imx93_dsi_phy_init(). drivers/gpu/drm/bridge/imx/Kconfig | 11 + drivers/gpu/drm/bridge/imx/Makefile | 1 + drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c | 917 ++++++++++++++++++++ 3 files changed, 929 insertions(+) create mode 100644 drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c diff --git a/drivers/gpu/drm/bridge/imx/Kconfig b/drivers/gpu/drm/bridge/imx/Kconfig index 9fae28db6aa7..5a4f3d58501e 100644 --- a/drivers/gpu/drm/bridge/imx/Kconfig +++ b/drivers/gpu/drm/bridge/imx/Kconfig @@ -49,4 +49,15 @@ config DRM_IMX8QXP_PIXEL_LINK_TO_DPI Choose this to enable pixel link to display pixel interface(PXL2DPI) found in Freescale i.MX8qxp processor. +config DRM_IMX93_MIPI_DSI + tristate "Freescale i.MX93 specific extensions for Synopsys DW MIPI DSI" + depends on OF + depends on COMMON_CLK + select DRM_DW_MIPI_DSI + select GENERIC_PHY + select GENERIC_PHY_MIPI_DPHY + help + Choose this to enable MIPI DSI controller found in Freescale i.MX93 + processor. + endif # ARCH_MXC || COMPILE_TEST diff --git a/drivers/gpu/drm/bridge/imx/Makefile b/drivers/gpu/drm/bridge/imx/Makefile index 8e2ebf3399a1..2b0c2e44aa1b 100644 --- a/drivers/gpu/drm/bridge/imx/Makefile +++ b/drivers/gpu/drm/bridge/imx/Makefile @@ -4,3 +4,4 @@ obj-$(CONFIG_DRM_IMX8QXP_LDB) += imx8qxp-ldb.o obj-$(CONFIG_DRM_IMX8QXP_PIXEL_COMBINER) += imx8qxp-pixel-combiner.o obj-$(CONFIG_DRM_IMX8QXP_PIXEL_LINK) += imx8qxp-pixel-link.o obj-$(CONFIG_DRM_IMX8QXP_PIXEL_LINK_TO_DPI) += imx8qxp-pxl2dpi.o +obj-$(CONFIG_DRM_IMX93_MIPI_DSI) += imx93-mipi-dsi.o diff --git a/drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c b/drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c new file mode 100644 index 000000000000..3ff30ce80c5b --- /dev/null +++ b/drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c @@ -0,0 +1,917 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/* + * Copyright 2022,2023 NXP + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +/* DPHY PLL configuration registers */ +#define DSI_REG 0x4c +#define CFGCLKFREQRANGE_MASK GENMASK(5, 0) +#define CFGCLKFREQRANGE(x) FIELD_PREP(CFGCLKFREQRANGE_MASK, (x)) +#define CLKSEL_MASK GENMASK(7, 6) +#define CLKSEL_STOP FIELD_PREP(CLKSEL_MASK, 0) +#define CLKSEL_GEN FIELD_PREP(CLKSEL_MASK, 1) +#define CLKSEL_EXT FIELD_PREP(CLKSEL_MASK, 2) +#define HSFREQRANGE_MASK GENMASK(14, 8) +#define HSFREQRANGE(x) FIELD_PREP(HSFREQRANGE_MASK, (x)) +#define UPDATE_PLL BIT(17) +#define SHADOW_CLR BIT(18) +#define CLK_EXT BIT(19) + +#define DSI_WRITE_REG0 0x50 +#define M_MASK GENMASK(9, 0) +#define M(x) FIELD_PREP(M_MASK, ((x) - 2)) +#define N_MASK GENMASK(13, 10) +#define N(x) FIELD_PREP(N_MASK, ((x) - 1)) +#define VCO_CTRL_MASK GENMASK(19, 14) +#define VCO_CTRL(x) FIELD_PREP(VCO_CTRL_MASK, (x)) +#define PROP_CTRL_MASK GENMASK(25, 20) +#define PROP_CTRL(x) FIELD_PREP(PROP_CTRL_MASK, (x)) +#define INT_CTRL_MASK GENMASK(31, 26) +#define INT_CTRL(x) FIELD_PREP(INT_CTRL_MASK, (x)) + +#define DSI_WRITE_REG1 0x54 +#define GMP_CTRL_MASK GENMASK(1, 0) +#define GMP_CTRL(x) FIELD_PREP(GMP_CTRL_MASK, (x)) +#define CPBIAS_CTRL_MASK GENMASK(8, 2) +#define CPBIAS_CTRL(x) FIELD_PREP(CPBIAS_CTRL_MASK, (x)) +#define PLL_SHADOW_CTRL BIT(9) + +/* display mux control register */ +#define DISPLAY_MUX 0x60 +#define MIPI_DSI_RGB666_MAP_CFG GENMASK(7, 6) +#define RGB666_CONFIG1 FIELD_PREP(MIPI_DSI_RGB666_MAP_CFG, 0) +#define RGB666_CONFIG2 FIELD_PREP(MIPI_DSI_RGB666_MAP_CFG, 1) +#define MIPI_DSI_RGB565_MAP_CFG GENMASK(5, 4) +#define RGB565_CONFIG1 FIELD_PREP(MIPI_DSI_RGB565_MAP_CFG, 0) +#define RGB565_CONFIG2 FIELD_PREP(MIPI_DSI_RGB565_MAP_CFG, 1) +#define RGB565_CONFIG3 FIELD_PREP(MIPI_DSI_RGB565_MAP_CFG, 2) +#define LCDIF_CROSS_LINE_PATTERN GENMASK(3, 0) +#define RGB888_TO_RGB888 FIELD_PREP(LCDIF_CROSS_LINE_PATTERN, 0) +#define RGB888_TO_RGB666 FIELD_PREP(LCDIF_CROSS_LINE_PATTERN, 6) +#define RGB565_TO_RGB565 FIELD_PREP(LCDIF_CROSS_LINE_PATTERN, 7) + +#define MHZ(x) ((x) * 1000000UL) + +#define REF_CLK_RATE_MAX MHZ(64) +#define REF_CLK_RATE_MIN MHZ(2) +#define FOUT_MAX MHZ(1250) +#define FOUT_MIN MHZ(40) +#define FVCO_DIV_FACTOR MHZ(80) + +#define MBPS(x) ((x) * 1000000UL) + +#define DATA_RATE_MAX_SPEED MBPS(2500) +#define DATA_RATE_MIN_SPEED MBPS(80) + +#define M_MAX 625UL +#define M_MIN 64UL + +#define N_MAX 16U +#define N_MIN 1U + +struct imx93_dsi { + struct device *dev; + struct regmap *regmap; + struct clk *clk_pixel; + struct clk *clk_ref; + struct clk *clk_cfg; + struct dw_mipi_dsi *dmd; + struct dw_mipi_dsi_plat_data pdata; + union phy_configure_opts phy_cfg; + unsigned long ref_clk_rate; + u32 format; +}; + +struct dphy_pll_cfg { + u32 m; /* PLL Feedback Multiplication Ratio */ + u32 n; /* PLL Input Frequency Division Ratio */ +}; + +struct dphy_pll_vco_prop { + unsigned long max_fout; + u8 vco_cntl; + u8 prop_cntl; +}; + +struct dphy_pll_hsfreqrange { + unsigned long max_mbps; + u8 hsfreqrange; +}; + +/* DPHY Databook Table 3-13 Charge-pump Programmability */ +static const struct dphy_pll_vco_prop vco_prop_map[] = { + { 55, 0x3f, 0x0d }, + { 82, 0x37, 0x0d }, + { 110, 0x2f, 0x0d }, + { 165, 0x27, 0x0d }, + { 220, 0x1f, 0x0d }, + { 330, 0x17, 0x0d }, + { 440, 0x0f, 0x0d }, + { 660, 0x07, 0x0d }, + { 1149, 0x03, 0x0d }, + { 1152, 0x01, 0x0d }, + { 1250, 0x01, 0x0e }, +}; + +/* DPHY Databook Table 5-7 Frequency Ranges and Defaults */ +static const struct dphy_pll_hsfreqrange hsfreqrange_map[] = { + { 89, 0x00 }, + { 99, 0x10 }, + { 109, 0x20 }, + { 119, 0x30 }, + { 129, 0x01 }, + { 139, 0x11 }, + { 149, 0x21 }, + { 159, 0x31 }, + { 169, 0x02 }, + { 179, 0x12 }, + { 189, 0x22 }, + { 204, 0x32 }, + { 219, 0x03 }, + { 234, 0x13 }, + { 249, 0x23 }, + { 274, 0x33 }, + { 299, 0x04 }, + { 324, 0x14 }, + { 349, 0x25 }, + { 399, 0x35 }, + { 449, 0x05 }, + { 499, 0x16 }, + { 549, 0x26 }, + { 599, 0x37 }, + { 649, 0x07 }, + { 699, 0x18 }, + { 749, 0x28 }, + { 799, 0x39 }, + { 849, 0x09 }, + { 899, 0x19 }, + { 949, 0x29 }, + { 999, 0x3a }, + { 1049, 0x0a }, + { 1099, 0x1a }, + { 1149, 0x2a }, + { 1199, 0x3b }, + { 1249, 0x0b }, + { 1299, 0x1b }, + { 1349, 0x2b }, + { 1399, 0x3c }, + { 1449, 0x0c }, + { 1499, 0x1c }, + { 1549, 0x2c }, + { 1599, 0x3d }, + { 1649, 0x0d }, + { 1699, 0x1d }, + { 1749, 0x2e }, + { 1799, 0x3e }, + { 1849, 0x0e }, + { 1899, 0x1e }, + { 1949, 0x2f }, + { 1999, 0x3f }, + { 2049, 0x0f }, + { 2099, 0x40 }, + { 2149, 0x41 }, + { 2199, 0x42 }, + { 2249, 0x43 }, + { 2299, 0x44 }, + { 2349, 0x45 }, + { 2399, 0x46 }, + { 2449, 0x47 }, + { 2499, 0x48 }, + { 2500, 0x49 }, +}; + +static void dphy_pll_write(struct imx93_dsi *dsi, unsigned int reg, u32 value) +{ + int ret; + + ret = regmap_write(dsi->regmap, reg, value); + if (ret < 0) + dev_err(dsi->dev, "failed to write 0x%08x to pll reg 0x%x: %d\n", + value, reg, ret); +} + +static inline unsigned long data_rate_to_fout(unsigned long data_rate) +{ + /* Fout is half of data rate */ + return data_rate / 2; +} + +static int +dphy_pll_get_configure_from_opts(struct imx93_dsi *dsi, + struct phy_configure_opts_mipi_dphy *dphy_opts, + struct dphy_pll_cfg *cfg) +{ + struct device *dev = dsi->dev; + unsigned long fin = dsi->ref_clk_rate; + unsigned long fout; + unsigned long best_fout = 0; + unsigned int fvco_div; + unsigned int min_n, max_n, n, best_n; + unsigned long m, best_m; + unsigned long min_delta = ULONG_MAX; + unsigned long delta; + u64 tmp; + + if (dphy_opts->hs_clk_rate < DATA_RATE_MIN_SPEED || + dphy_opts->hs_clk_rate > DATA_RATE_MAX_SPEED) { + dev_dbg(dev, "invalid data rate per lane: %lu\n", + dphy_opts->hs_clk_rate); + return -EINVAL; + } + + fout = data_rate_to_fout(dphy_opts->hs_clk_rate); + + /* DPHY Databook 3.3.6.1 Output Frequency */ + /* Fout = Fvco / Fvco_div = (Fin * M) / (Fvco_div * N) */ + /* Fvco_div could be 1/2/4/8 according to Fout range. */ + fvco_div = 8UL / min(DIV_ROUND_UP(fout, FVCO_DIV_FACTOR), 8UL); + + /* limitation: 2MHz <= Fin / N <= 8MHz */ + min_n = DIV_ROUND_UP_ULL((u64)fin, MHZ(8)); + max_n = DIV_ROUND_DOWN_ULL((u64)fin, MHZ(2)); + + /* clamp possible N(s) */ + min_n = clamp(min_n, N_MIN, N_MAX); + max_n = clamp(max_n, N_MIN, N_MAX); + + dev_dbg(dev, "Fout = %lu, Fvco_div = %u, n_range = [%u, %u]\n", + fout, fvco_div, min_n, max_n); + + for (n = min_n; n <= max_n; n++) { + /* M = (Fout * N * Fvco_div) / Fin */ + m = DIV_ROUND_CLOSEST(fout * n * fvco_div, fin); + + /* check M range */ + if (m < M_MIN || m > M_MAX) + continue; + + /* calculate temporary Fout */ + tmp = m * fin; + do_div(tmp, n * fvco_div); + if (tmp < FOUT_MIN || tmp > FOUT_MAX) + continue; + + delta = abs(fout - tmp); + if (delta < min_delta) { + best_n = n; + best_m = m; + min_delta = delta; + best_fout = tmp; + } + } + + if (best_fout) { + cfg->m = best_m; + cfg->n = best_n; + dev_dbg(dev, "best Fout = %lu, m = %u, n = %u\n", + best_fout, cfg->m, cfg->n); + } else { + dev_dbg(dev, "failed to find best Fout\n"); + return -EINVAL; + } + + return 0; +} + +static void dphy_pll_clear_shadow(struct imx93_dsi *dsi) +{ + /* Reference DPHY Databook Figure 3-3 Initialization Timing Diagram. */ + /* Select clock generation first. */ + dphy_pll_write(dsi, DSI_REG, CLKSEL_GEN); + + /* Clear shadow after clock selection is done a while. */ + fsleep(1); + dphy_pll_write(dsi, DSI_REG, CLKSEL_GEN | SHADOW_CLR); + + /* A minimum pulse of 5ns on shadow_clear signal. */ + fsleep(1); + dphy_pll_write(dsi, DSI_REG, CLKSEL_GEN); +} + +static unsigned long dphy_pll_get_cfgclkrange(struct imx93_dsi *dsi) +{ + /* + * DPHY Databook Table 4-4 System Control Signals mentions an equation + * for cfgclkfreqrange[5:0]. + */ + return (clk_get_rate(dsi->clk_cfg) / MHZ(1) - 17) * 4; +} + +static u8 +dphy_pll_get_hsfreqrange(struct phy_configure_opts_mipi_dphy *dphy_opts) +{ + unsigned long mbps = dphy_opts->hs_clk_rate / MHZ(1); + int i; + + for (i = 0; i < ARRAY_SIZE(hsfreqrange_map); i++) + if (mbps <= hsfreqrange_map[i].max_mbps) + return hsfreqrange_map[i].hsfreqrange; + + return 0; +} + +static u8 dphy_pll_get_vco(struct phy_configure_opts_mipi_dphy *dphy_opts) +{ + unsigned long fout = data_rate_to_fout(dphy_opts->hs_clk_rate) / MHZ(1); + int i; + + for (i = 0; i < ARRAY_SIZE(vco_prop_map); i++) + if (fout <= vco_prop_map[i].max_fout) + return vco_prop_map[i].vco_cntl; + + return 0; +} + +static u8 dphy_pll_get_prop(struct phy_configure_opts_mipi_dphy *dphy_opts) +{ + unsigned long fout = data_rate_to_fout(dphy_opts->hs_clk_rate) / MHZ(1); + int i; + + for (i = 0; i < ARRAY_SIZE(vco_prop_map); i++) + if (fout <= vco_prop_map[i].max_fout) + return vco_prop_map[i].prop_cntl; + + return 0; +} + +static int dphy_pll_update(struct imx93_dsi *dsi) +{ + int ret; + + ret = regmap_update_bits(dsi->regmap, DSI_REG, UPDATE_PLL, UPDATE_PLL); + if (ret < 0) { + dev_err(dsi->dev, "failed to set UPDATE_PLL: %d\n", ret); + return ret; + } + + /* + * The updatepll signal should be asserted for a minimum of four clkin + * cycles, according to DPHY Databook Figure 3-3 Initialization Timing + * Diagram. + */ + fsleep(10); + + ret = regmap_update_bits(dsi->regmap, DSI_REG, UPDATE_PLL, 0); + if (ret < 0) { + dev_err(dsi->dev, "failed to clear UPDATE_PLL: %d\n", ret); + return ret; + } + + return 0; +} + +static int dphy_pll_configure(struct imx93_dsi *dsi, union phy_configure_opts *opts) +{ + struct dphy_pll_cfg cfg = { 0 }; + u32 val; + int ret; + + ret = dphy_pll_get_configure_from_opts(dsi, &opts->mipi_dphy, &cfg); + if (ret) { + dev_err(dsi->dev, "failed to get phy pll cfg %d\n", ret); + return ret; + } + + dphy_pll_clear_shadow(dsi); + + /* DSI_REG */ + val = CLKSEL_GEN | + CFGCLKFREQRANGE(dphy_pll_get_cfgclkrange(dsi)) | + HSFREQRANGE(dphy_pll_get_hsfreqrange(&opts->mipi_dphy)); + dphy_pll_write(dsi, DSI_REG, val); + + /* DSI_WRITE_REG0 */ + val = M(cfg.m) | N(cfg.n) | INT_CTRL(0) | + VCO_CTRL(dphy_pll_get_vco(&opts->mipi_dphy)) | + PROP_CTRL(dphy_pll_get_prop(&opts->mipi_dphy)); + dphy_pll_write(dsi, DSI_WRITE_REG0, val); + + /* DSI_WRITE_REG1 */ + dphy_pll_write(dsi, DSI_WRITE_REG1, GMP_CTRL(1) | CPBIAS_CTRL(0x10)); + + ret = clk_prepare_enable(dsi->clk_ref); + if (ret < 0) { + dev_err(dsi->dev, "failed to enable ref clock: %d\n", ret); + return ret; + } + + /* + * At least 10 refclk cycles are required before updatePLL assertion, + * according to DPHY Databook Figure 3-3 Initialization Timing Diagram. + */ + fsleep(10); + + ret = dphy_pll_update(dsi); + if (ret < 0) { + clk_disable_unprepare(dsi->clk_ref); + return ret; + } + + return 0; +} + +static void dphy_pll_clear_reg(struct imx93_dsi *dsi) +{ + dphy_pll_write(dsi, DSI_REG, 0); + dphy_pll_write(dsi, DSI_WRITE_REG0, 0); + dphy_pll_write(dsi, DSI_WRITE_REG1, 0); +} + +static int dphy_pll_init(struct imx93_dsi *dsi) +{ + int ret; + + ret = clk_prepare_enable(dsi->clk_cfg); + if (ret < 0) { + dev_err(dsi->dev, "failed to enable config clock: %d\n", ret); + return ret; + } + + dphy_pll_clear_reg(dsi); + + return 0; +} + +static void dphy_pll_uninit(struct imx93_dsi *dsi) +{ + dphy_pll_clear_reg(dsi); + clk_disable_unprepare(dsi->clk_cfg); +} + +static void dphy_pll_power_off(struct imx93_dsi *dsi) +{ + dphy_pll_clear_reg(dsi); + clk_disable_unprepare(dsi->clk_ref); +} + +static int imx93_dsi_get_phy_configure_opts(struct imx93_dsi *dsi, + const struct drm_display_mode *mode, + union phy_configure_opts *phy_cfg, + u32 lanes, u32 format) +{ + struct device *dev = dsi->dev; + int bpp; + int ret; + + bpp = mipi_dsi_pixel_format_to_bpp(format); + if (bpp < 0) { + dev_dbg(dev, "failed to get bpp for pixel format %d\n", format); + return -EINVAL; + } + + ret = phy_mipi_dphy_get_default_config(mode->clock * MSEC_PER_SEC, bpp, + lanes, &phy_cfg->mipi_dphy); + if (ret < 0) { + dev_dbg(dev, "failed to get default phy cfg %d\n", ret); + return ret; + } + + return 0; +} + +static enum drm_mode_status +imx93_dsi_validate_mode(struct imx93_dsi *dsi, const struct drm_display_mode *mode) +{ + struct drm_bridge *bridge = dw_mipi_dsi_get_bridge(dsi->dmd); + + /* Get the last bridge */ + while (drm_bridge_get_next_bridge(bridge)) + bridge = drm_bridge_get_next_bridge(bridge); + + if ((bridge->ops & DRM_BRIDGE_OP_DETECT) && + (bridge->ops & DRM_BRIDGE_OP_EDID)) { + unsigned long pixel_clock_rate = mode->clock * 1000; + unsigned long rounded_rate; + + /* Allow +/-0.5% pixel clock rate deviation */ + rounded_rate = clk_round_rate(dsi->clk_pixel, pixel_clock_rate); + if (rounded_rate < pixel_clock_rate * 995 / 1000 || + rounded_rate > pixel_clock_rate * 1005 / 1000) { + dev_dbg(dsi->dev, "failed to round clock for mode " DRM_MODE_FMT "\n", + DRM_MODE_ARG(mode)); + return MODE_NOCLOCK; + } + } + + return MODE_OK; +} + +static enum drm_mode_status +imx93_dsi_validate_phy(struct imx93_dsi *dsi, const struct drm_display_mode *mode, + unsigned long mode_flags, u32 lanes, u32 format) +{ + union phy_configure_opts phy_cfg; + struct dphy_pll_cfg cfg = { 0 }; + struct device *dev = dsi->dev; + int ret; + + ret = imx93_dsi_get_phy_configure_opts(dsi, mode, &phy_cfg, lanes, + format); + if (ret < 0) { + dev_dbg(dev, "failed to get phy cfg opts %d\n", ret); + return MODE_ERROR; + } + + ret = dphy_pll_get_configure_from_opts(dsi, &phy_cfg.mipi_dphy, &cfg); + if (ret < 0) { + dev_dbg(dev, "failed to get phy pll cfg %d\n", ret); + return MODE_NOCLOCK; + } + + return MODE_OK; +} + +static enum drm_mode_status +imx93_dsi_mode_valid(void *priv_data, const struct drm_display_mode *mode, + unsigned long mode_flags, u32 lanes, u32 format) +{ + struct imx93_dsi *dsi = priv_data; + struct device *dev = dsi->dev; + enum drm_mode_status ret; + + ret = imx93_dsi_validate_mode(dsi, mode); + if (ret != MODE_OK) { + dev_dbg(dev, "failed to validate mode " DRM_MODE_FMT "\n", + DRM_MODE_ARG(mode)); + return ret; + } + + ret = imx93_dsi_validate_phy(dsi, mode, mode_flags, lanes, format); + if (ret != MODE_OK) { + dev_dbg(dev, "failed to validate phy for mode " DRM_MODE_FMT "\n", + DRM_MODE_ARG(mode)); + return ret; + } + + return MODE_OK; +} + +static bool imx93_dsi_mode_fixup(void *priv_data, + const struct drm_display_mode *mode, + struct drm_display_mode *adjusted_mode) +{ + struct imx93_dsi *dsi = priv_data; + unsigned long pixel_clock_rate; + unsigned long rounded_rate; + + pixel_clock_rate = mode->clock * 1000; + rounded_rate = clk_round_rate(dsi->clk_pixel, pixel_clock_rate); + + memcpy(adjusted_mode, mode, sizeof(*mode)); + adjusted_mode->clock = rounded_rate / 1000; + + dev_dbg(dsi->dev, "adj clock %d for mode " DRM_MODE_FMT "\n", + adjusted_mode->clock, DRM_MODE_ARG(mode)); + + return true; +} + +static u32 *imx93_dsi_get_input_bus_fmts(void *priv_data, + struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state, + u32 output_fmt, + unsigned int *num_input_fmts) +{ + u32 *input_fmts, input_fmt; + + *num_input_fmts = 0; + + switch (output_fmt) { + case MEDIA_BUS_FMT_RGB888_1X24: + case MEDIA_BUS_FMT_RGB666_1X18: + case MEDIA_BUS_FMT_FIXED: + input_fmt = MEDIA_BUS_FMT_RGB888_1X24; + break; + case MEDIA_BUS_FMT_RGB565_1X16: + input_fmt = output_fmt; + break; + default: + return NULL; + } + + input_fmts = kmalloc(sizeof(*input_fmts), GFP_KERNEL); + if (!input_fmts) + return NULL; + input_fmts[0] = input_fmt; + *num_input_fmts = 1; + + return input_fmts; +} + +static int imx93_dsi_phy_init(void *priv_data) +{ + struct imx93_dsi *dsi = priv_data; + unsigned int fmt = 0; + int ret; + + switch (dsi->format) { + case MIPI_DSI_FMT_RGB888: + fmt = RGB888_TO_RGB888; + break; + case MIPI_DSI_FMT_RGB666: + fmt = RGB888_TO_RGB666; + regmap_update_bits(dsi->regmap, DISPLAY_MUX, + MIPI_DSI_RGB666_MAP_CFG, RGB666_CONFIG2); + break; + case MIPI_DSI_FMT_RGB666_PACKED: + fmt = RGB888_TO_RGB666; + regmap_update_bits(dsi->regmap, DISPLAY_MUX, + MIPI_DSI_RGB666_MAP_CFG, RGB666_CONFIG1); + break; + case MIPI_DSI_FMT_RGB565: + fmt = RGB565_TO_RGB565; + regmap_update_bits(dsi->regmap, DISPLAY_MUX, + MIPI_DSI_RGB565_MAP_CFG, RGB565_CONFIG1); + break; + } + + regmap_update_bits(dsi->regmap, DISPLAY_MUX, LCDIF_CROSS_LINE_PATTERN, fmt); + + ret = dphy_pll_init(dsi); + if (ret < 0) { + dev_err(dsi->dev, "failed to init phy pll: %d\n", ret); + return ret; + } + + ret = dphy_pll_configure(dsi, &dsi->phy_cfg); + if (ret < 0) { + dev_err(dsi->dev, "failed to configure phy pll: %d\n", ret); + dphy_pll_uninit(dsi); + return ret; + } + + return 0; +} + +static void imx93_dsi_phy_power_off(void *priv_data) +{ + struct imx93_dsi *dsi = priv_data; + + dphy_pll_power_off(dsi); + dphy_pll_uninit(dsi); +} + +static int +imx93_dsi_get_lane_mbps(void *priv_data, const struct drm_display_mode *mode, + unsigned long mode_flags, u32 lanes, u32 format, + unsigned int *lane_mbps) +{ + struct imx93_dsi *dsi = priv_data; + union phy_configure_opts phy_cfg; + struct device *dev = dsi->dev; + int ret; + + ret = imx93_dsi_get_phy_configure_opts(dsi, mode, &phy_cfg, lanes, + format); + if (ret < 0) { + dev_dbg(dev, "failed to get phy cfg opts %d\n", ret); + return ret; + } + + *lane_mbps = DIV_ROUND_UP(phy_cfg.mipi_dphy.hs_clk_rate, USEC_PER_SEC); + + memcpy(&dsi->phy_cfg, &phy_cfg, sizeof(phy_cfg)); + + dev_dbg(dev, "get lane_mbps %u for mode " DRM_MODE_FMT "\n", + *lane_mbps, DRM_MODE_ARG(mode)); + + return 0; +} + +/* High-Speed Transition Times */ +struct hstt { + unsigned int maxfreq; + struct dw_mipi_dsi_dphy_timing timing; +}; + +#define HSTT(_maxfreq, _c_lp2hs, _c_hs2lp, _d_lp2hs, _d_hs2lp) \ +{ \ + .maxfreq = (_maxfreq), \ + .timing = { \ + .clk_lp2hs = (_c_lp2hs), \ + .clk_hs2lp = (_c_hs2lp), \ + .data_lp2hs = (_d_lp2hs), \ + .data_hs2lp = (_d_hs2lp), \ + } \ +} + +/* DPHY Databook Table A-4 High-Speed Transition Times */ +static const struct hstt hstt_table[] = { + HSTT(80, 21, 17, 15, 10), + HSTT(90, 23, 17, 16, 10), + HSTT(100, 22, 17, 16, 10), + HSTT(110, 25, 18, 17, 11), + HSTT(120, 26, 20, 18, 11), + HSTT(130, 27, 19, 19, 11), + HSTT(140, 27, 19, 19, 11), + HSTT(150, 28, 20, 20, 12), + HSTT(160, 30, 21, 22, 13), + HSTT(170, 30, 21, 23, 13), + HSTT(180, 31, 21, 23, 13), + HSTT(190, 32, 22, 24, 13), + HSTT(205, 35, 22, 25, 13), + HSTT(220, 37, 26, 27, 15), + HSTT(235, 38, 28, 27, 16), + HSTT(250, 41, 29, 30, 17), + HSTT(275, 43, 29, 32, 18), + HSTT(300, 45, 32, 35, 19), + HSTT(325, 48, 33, 36, 18), + HSTT(350, 51, 35, 40, 20), + HSTT(400, 59, 37, 44, 21), + HSTT(450, 65, 40, 49, 23), + HSTT(500, 71, 41, 54, 24), + HSTT(550, 77, 44, 57, 26), + HSTT(600, 82, 46, 64, 27), + HSTT(650, 87, 48, 67, 28), + HSTT(700, 94, 52, 71, 29), + HSTT(750, 99, 52, 75, 31), + HSTT(800, 105, 55, 82, 32), + HSTT(850, 110, 58, 85, 32), + HSTT(900, 115, 58, 88, 35), + HSTT(950, 120, 62, 93, 36), + HSTT(1000, 128, 63, 99, 38), + HSTT(1050, 132, 65, 102, 38), + HSTT(1100, 138, 67, 106, 39), + HSTT(1150, 146, 69, 112, 42), + HSTT(1200, 151, 71, 117, 43), + HSTT(1250, 153, 74, 120, 45), + HSTT(1300, 160, 73, 124, 46), + HSTT(1350, 165, 76, 130, 47), + HSTT(1400, 172, 78, 134, 49), + HSTT(1450, 177, 80, 138, 49), + HSTT(1500, 183, 81, 143, 52), + HSTT(1550, 191, 84, 147, 52), + HSTT(1600, 194, 85, 152, 52), + HSTT(1650, 201, 86, 155, 53), + HSTT(1700, 208, 88, 161, 53), + HSTT(1750, 212, 89, 165, 53), + HSTT(1800, 220, 90, 171, 54), + HSTT(1850, 223, 92, 175, 54), + HSTT(1900, 231, 91, 180, 55), + HSTT(1950, 236, 95, 185, 56), + HSTT(2000, 243, 97, 190, 56), + HSTT(2050, 248, 99, 194, 58), + HSTT(2100, 252, 100, 199, 59), + HSTT(2150, 259, 102, 204, 61), + HSTT(2200, 266, 105, 210, 62), + HSTT(2250, 269, 109, 213, 63), + HSTT(2300, 272, 109, 217, 65), + HSTT(2350, 281, 112, 225, 66), + HSTT(2400, 283, 115, 226, 66), + HSTT(2450, 282, 115, 226, 67), + HSTT(2500, 281, 118, 227, 67), +}; + +static int imx93_dsi_phy_get_timing(void *priv_data, unsigned int lane_mbps, + struct dw_mipi_dsi_dphy_timing *timing) +{ + struct imx93_dsi *dsi = priv_data; + struct device *dev = dsi->dev; + int i; + + for (i = 0; i < ARRAY_SIZE(hstt_table); i++) + if (lane_mbps <= hstt_table[i].maxfreq) + break; + + if (i == ARRAY_SIZE(hstt_table)) { + dev_err(dev, "failed to get phy timing for lane_mbps %u\n", + lane_mbps); + return -EINVAL; + } + + *timing = hstt_table[i].timing; + + dev_dbg(dev, "get phy timing for %u <= %u (lane_mbps)\n", + lane_mbps, hstt_table[i].maxfreq); + + return 0; +} + +static const struct dw_mipi_dsi_phy_ops imx93_dsi_phy_ops = { + .init = imx93_dsi_phy_init, + .power_off = imx93_dsi_phy_power_off, + .get_lane_mbps = imx93_dsi_get_lane_mbps, + .get_timing = imx93_dsi_phy_get_timing, +}; + +static int imx93_dsi_host_attach(void *priv_data, struct mipi_dsi_device *device) +{ + struct imx93_dsi *dsi = priv_data; + + dsi->format = device->format; + + return 0; +} + +static const struct dw_mipi_dsi_host_ops imx93_dsi_host_ops = { + .attach = imx93_dsi_host_attach, +}; + +static int imx93_dsi_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct device_node *np = dev->of_node; + struct imx93_dsi *dsi; + int ret; + + dsi = devm_kzalloc(dev, sizeof(*dsi), GFP_KERNEL); + if (!dsi) + return -ENOMEM; + + dsi->regmap = syscon_regmap_lookup_by_phandle(np, "fsl,media-blk-ctrl"); + if (IS_ERR(dsi->regmap)) { + ret = PTR_ERR(dsi->regmap); + dev_err(dev, "failed to get block ctrl regmap: %d\n", ret); + return ret; + } + + dsi->clk_pixel = devm_clk_get(dev, "pix"); + if (IS_ERR(dsi->clk_pixel)) + return dev_err_probe(dev, PTR_ERR(dsi->clk_pixel), + "failed to get pixel clock\n"); + + dsi->clk_cfg = devm_clk_get(dev, "phy_cfg"); + if (IS_ERR(dsi->clk_cfg)) + return dev_err_probe(dev, PTR_ERR(dsi->clk_cfg), + "failed to get phy cfg clock\n"); + + dsi->clk_ref = devm_clk_get(dev, "phy_ref"); + if (IS_ERR(dsi->clk_ref)) + return dev_err_probe(dev, PTR_ERR(dsi->clk_ref), + "failed to get phy ref clock\n"); + + dsi->ref_clk_rate = clk_get_rate(dsi->clk_ref); + if (dsi->ref_clk_rate < REF_CLK_RATE_MIN || + dsi->ref_clk_rate > REF_CLK_RATE_MAX) { + dev_err(dev, "invalid phy ref clock rate %lu\n", + dsi->ref_clk_rate); + return -EINVAL; + } + dev_dbg(dev, "phy ref clock rate: %lu\n", dsi->ref_clk_rate); + + dsi->dev = dev; + dsi->pdata.max_data_lanes = 4; + dsi->pdata.mode_valid = imx93_dsi_mode_valid; + dsi->pdata.mode_fixup = imx93_dsi_mode_fixup; + dsi->pdata.get_input_bus_fmts = imx93_dsi_get_input_bus_fmts; + dsi->pdata.phy_ops = &imx93_dsi_phy_ops; + dsi->pdata.host_ops = &imx93_dsi_host_ops; + dsi->pdata.priv_data = dsi; + platform_set_drvdata(pdev, dsi); + + dsi->dmd = dw_mipi_dsi_probe(pdev, &dsi->pdata); + if (IS_ERR(dsi->dmd)) + return dev_err_probe(dev, PTR_ERR(dsi->dmd), + "failed to probe dw_mipi_dsi\n"); + + return 0; +} + +static void imx93_dsi_remove(struct platform_device *pdev) +{ + struct imx93_dsi *dsi = platform_get_drvdata(pdev); + + dw_mipi_dsi_remove(dsi->dmd); +} + +static const struct of_device_id imx93_dsi_dt_ids[] = { + { .compatible = "fsl,imx93-mipi-dsi", }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, imx93_dsi_dt_ids); + +static struct platform_driver imx93_dsi_driver = { + .probe = imx93_dsi_probe, + .remove_new = imx93_dsi_remove, + .driver = { + .of_match_table = imx93_dsi_dt_ids, + .name = "imx93_mipi_dsi", + }, +}; +module_platform_driver(imx93_dsi_driver); + +MODULE_DESCRIPTION("Freescale i.MX93 MIPI DSI driver"); +MODULE_AUTHOR("Liu Ying "); +MODULE_LICENSE("GPL");