From patchwork Mon Jul 17 06:18:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13315204 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2917EC001E0 for ; Mon, 17 Jul 2023 06:14:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7CF4410E1D6; Mon, 17 Jul 2023 06:13:58 +0000 (UTC) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2051.outbound.protection.outlook.com [40.107.20.51]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6766810E1D5 for ; Mon, 17 Jul 2023 06:13:56 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VLAcrJtdt6a7ufMtr2AUetUeB7iPMRaQ5FeJP4jIYfrsguxhZuRy5Mun7ONNlNaVcoD4gtwYP4KYF0XQUe7P0nRjBh7Od7qlk6t8a/iVdVuS5KFS4r/1R8atlEKhgno+JrFAutT+UB93Ehg38uE0Aqo4MLmM9ZhGaFW4aF1G6IdcsjMVTM6vIBwV2pB/n/Ian3FXaK0fVkDa+9IqkEaLzTQ9eZ+FSg+fPeYVPG5pO+d2u+VTPLLedjqSMsEGOVBSiImWfkM0TaXmJykRss7OK96MkOg+JQF01pFtNLs+q+jSxBkXdyHAGbiZxRdxWBxpU4CrpzKCGr54kXpOi3TxiQ== 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=iEkbojmuf3jtpTFeRTYFu5MyXZClQXlpI+wIIMGnPmU=; b=lMjrTsvhac3P+q2wr46KOzFyxmN2yQnfR2KoEbGjOHcLAsPewKZjmdvF7MUEbJ5aGYMmzUXLFly+t6zqkgH6lDTP7wY4RrgRSFNL1xD0FXj0yV0FjWo2GqXSvhH9maLCVg5NhVqml6jSfy/InEmbfFm0Ow20EoUn8h2+Y5cZGiY+LRWLXY6vDdyZQat6eL0S3BbGBuPlX8h5ikOipaPSvFx1SC3lg+NkxuSLx+3oBCFRMcecQ0SLdk77Y/gR8+OtKo7ExHxXc1oCb6JJrB8KCXVZ3Bu3HrcvopKqe01c5GYZ5wE6S5H5ZWfYkJ/g5m+vV2KIolkUXKyQ+8BTN/wJ2A== 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=iEkbojmuf3jtpTFeRTYFu5MyXZClQXlpI+wIIMGnPmU=; b=Ab/ldBVt2SdZjBySx1as0TQj/L/1SvvC+1BBvrNwwKbSpQhLNjtdlxgWHEpkv1wmJubApwjCiC/adaS1lzOzt/gz+sSt/65vNgzP87j6wlToZZvtEAacFLiuMaTRE+wQOlLNn4ZLlEUHM2iT0dnGrlxIajrV5y/DrSfcs8FwxDQ= 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 AS8PR04MB9189.eurprd04.prod.outlook.com (2603:10a6:20b:44c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.32; Mon, 17 Jul 2023 06:13:53 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::7af:d8d5:d0ce:f68e]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::7af:d8d5:d0ce:f68e%2]) with mapi id 15.20.6588.027; Mon, 17 Jul 2023 06:13:53 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/9] drm/bridge: synopsys: dw-mipi-dsi: Add dw_mipi_dsi_get_bridge() helper Date: Mon, 17 Jul 2023 14:18:23 +0800 Message-Id: <20230717061831.1826878-2-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230717061831.1826878-1-victor.liu@nxp.com> References: <20230717061831.1826878-1-victor.liu@nxp.com> X-ClientProxiedBy: SI1PR02CA0060.apcprd02.prod.outlook.com (2603:1096:4:1f5::17) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|AS8PR04MB9189:EE_ X-MS-Office365-Filtering-Correlation-Id: dcf7dc30-0d2d-4257-2c74-08db868cff00 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BPs6v+F4JouWDR+z27qlqqhittpOcxhqoo1IdODG0oEAy5qvjFofmS7TvT+cGQcvu6xkSRj21R3M5DNpIIvLHzSZKCeT+aRCWOh3Pv1XoFnEQAQ5mLztZKWGHbaJlLYp7K7vsveTak/bphmCt7beZc2/bEIu5OLGbxJ9VQ5OhZLYQmDfosOHjgfgRQtQNNkNSXevTgQ/lMfGDNihW3/hDucuJJeqD3QbT/zWG5mqucaeTnR7braE9P9dGa+8uV1N6Lr+6QMOkk+aWp98q13PRsppZerXUG+JoueSH47xJFcSPerrBF3Ch9K2Boc5R105v7yMNQsI7vnHxAPPoZAlS93j5BYh/TxKa+rTvqD7vJDKxas6JiS1rajptpdn79WiIp0j9uFqoT7Ok6clxSQN5UeqV0n2Zrq7WHOzjHOHQYZYdOYlQCkhwgVeA2WBmi+TviSoJBUe1Pcf7F9qENDkNk5wo/DMxRAvprYoojU+O07mF6+7sfLnp1baSxruUVJZN1ml4+ten9OAuXuK5FxuyPIglyUKcLQ1gD+sWeJqMGg+HeDudTj4PNiCELE4EjP37BYSGETQiYeRqYk1RL4KDpZG1M/YNWR+j3hz6ss7nueVnXCx1wX0nCvpks/JQDZw 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)(396003)(366004)(346002)(376002)(451199021)(478600001)(52116002)(6486002)(6666004)(186003)(1076003)(6506007)(26005)(6512007)(2906002)(41300700001)(316002)(66556008)(66476007)(4326008)(5660300002)(7416002)(36756003)(8936002)(8676002)(66946007)(38350700002)(38100700002)(86362001)(2616005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tLcgqhf5TnBC1WepEmhBaB5CRIKqyTABojpVmE7gbgi+jztA2hciAdlEefosTluKr/cowvMb0BMr5SXG4k8FzkvWTq7fybqgTWOM3+Yo0W5cz2xBKBbKMFbRFQqFxb3wA3QLizXP64kmE9yQyifS84o3Vja1L/oblNKSfNRrbl+RbKMDIx+X2I11Ojw/v6pqHWDmj3vheemPbbx3P2tzyESTjIY4ud7PzgeqYYSt1BZZNNFqMjK6G/Gal2+64vjrxr+UG9tgeC3ONk12vWyQAXBFcm2hPUZrLfLgl44alY9+nPolbTPu3aSKrR9TBq2LznWHTmJGKY6NUQqk7825TVsXCd6sA1wdhk5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BIan8k6bFapPUIyfMWi78hxOzJZbtqVFQiTcnJR3SM/DD+YER4sg36f3yyAcwD5tt55gImbeg+0ohlmZp+U0lniLjdhLdkqyyNBvHG8BBuLh955A4Ycjhxt77FBB9JgvHWcf9AP25w6sWBxmjeNzFA6bWn90GHc X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: dcf7dc30-0d2d-4257-2c74-08db868cff00 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2023 06:13:53.7934 (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: rJNUJKiC63UIDS4zruZiXhgm1MSdDIwOHJhlwAygq4l3U76ox+B14hljx4fjh9UFob4rCUYPY1cqcAcIDTbgFw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB9189 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: neil.armstrong@linaro.org, conor+dt@kernel.org, rfoss@kernel.org, krzysztof.kozlowski+dt@linaro.org, jonas@kwiboo.se, shawnguo@kernel.org, s.hauer@pengutronix.de, jernej.skrabec@gmail.com, robh+dt@kernel.org, Laurent.pinchart@ideasonboard.com, andrzej.hajda@intel.com, kernel@pengutronix.de, linux-imx@nxp.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 --- 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 Jul 17 06:18:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13315205 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 665CBEB64DC for ; Mon, 17 Jul 2023 06:14:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A68CF10E1D5; Mon, 17 Jul 2023 06:14:03 +0000 (UTC) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2084.outbound.protection.outlook.com [40.107.20.84]) by gabe.freedesktop.org (Postfix) with ESMTPS id B089B10E1D5 for ; Mon, 17 Jul 2023 06:14:01 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e4pTYKb0X+lbI46hmPIDoG69tLGjqnQ1LaIVJuxZvIhSqO79W09Y6OnbLuY9+qnqIdtURpxsYkfQ+iFdMHIRL4cvOxmpRyV5lgh2BUkIcuEG4c2TsyzMIa14ajXajVhoLri/etPiym2mhOMt6fITbcgxhuR8IR536bOUqsnuumLmkUKS4FNju+ynTF3jveYQghFM8SdCKWvM9Uz77wAJIl/YJwtDQ2pWkXRKOSy/4mqjX/crydzbRYySTrbMKxIIRFXQMN+A5qKFkwEmkq/2iOpkuKLDNQVc+SJl+3shiJD8ng4plUrdkuf9yAiPD1EejCc/UfM2Ksfb62N8Pl6sBg== 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=hvGx1zP/4y+/bB06DgRXuFtbQfWbA3mwbaUtO4739p8=; b=XwGvjhiJtp8fetpn0ZTvS+oA7PcpNUG52SYR1AHD8SpAduLRjwOqJ9u8FLkM5e3mkDuWx74GJPvdaB5Lc1rTvhMSaE8q5e2BMy2wqsMAGySQd5By0rQ80evG0QlvTm+uoCL+1T/UVX/um1tE1iNgqxO7urNDOGTjdpUnDcdY6j3qaDRxc+PW+X40hTHem7sTIUbygvRttLZMETdZrU5P/rqqvU9Ej5RM792Awhcfd4wcq74XxMPrjub59n+TgmbgyMpO3ZMd6IWQpZ4HBIXae3lD2mpdX26RpMHZO/Xw3nTegBc2g/vJ2NhuTpYBw7Q34Yj++BXK9T2Im4WyWS+8yA== 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=hvGx1zP/4y+/bB06DgRXuFtbQfWbA3mwbaUtO4739p8=; b=FJa/U/KABxm2UtFUNyGjq+w8eX3hm5d33qrvTGxQEJeEip4ldJ/iZEe1POJMwtv+6MJjYJ6HG4BUWZo7GLm1Ou2tCPIRb1cJa8ZzpvzTA2Xw25HF2LqhQwkyTcphSMKfrkzuVyU6JfHSeXd08tP3IzIigGGg5EORxsF1fcnPNm8= 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 AS8PR04MB9189.eurprd04.prod.outlook.com (2603:10a6:20b:44c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.32; Mon, 17 Jul 2023 06:13:59 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::7af:d8d5:d0ce:f68e]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::7af:d8d5:d0ce:f68e%2]) with mapi id 15.20.6588.027; Mon, 17 Jul 2023 06:13:59 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/9] drm/bridge: synopsys: dw-mipi-dsi: Add input bus format negotiation support Date: Mon, 17 Jul 2023 14:18:24 +0800 Message-Id: <20230717061831.1826878-3-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230717061831.1826878-1-victor.liu@nxp.com> References: <20230717061831.1826878-1-victor.liu@nxp.com> X-ClientProxiedBy: SI1PR02CA0060.apcprd02.prod.outlook.com (2603:1096:4:1f5::17) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|AS8PR04MB9189:EE_ X-MS-Office365-Filtering-Correlation-Id: 31f9e7b7-474a-40da-1ab3-08db868d0240 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: slSKFMAIoc2mYlycEzaf5i4gWP2oQYJBscRfQLPRBas2ji7BZwuKeUaSI6zFNyhb/AT1JJIusoQ8Omub+6mYo1vN6Z8iug4uY5/c6edZlrvB61MROW3UWxY/og4wo9BaqpsF0KGGBRJ7iuNJp4xPqjtIbcZ61JSnLJ02UXzCTo+0WXr9kiShHDjN4PhH1m3v6kNP6TVBbvmei1V0PFPAyVetL2/Hgpoqf4Hk4cxDwptpYtDw7BOMpx/Hdxq5p5bs89b/a3ZL5PAJ6PthoZJb8jNQFbkG+J38yerrH/4QBVz1X6DhQcXuwvteLjEWMQAV+U0Jxw+1hsqPhW8AbhfOeAakui2C1lxGQqGISVLH7WiNFMh19ltmYwzI+YoSs2ArtNV38lmPn+jOMLKKhC80N9osPQXiQ8mX0GNZ4EG0uHN3EFxFg2EIdSn/Akge9+3CLQE3fB0+c9Rksr4oDjBj8UnpLviXEtHYUoVsLVLHtWt0/qWUthfr6TNktXOoNNJctZSi/W7eyBLkJ76fKx1Fy9SITxkYwDlHIdxhT3T+/iGkhwrpi8UzxmpCYcYwaGQg9l9bAuShS9lsJX0jRQahDYka1vcEJ2ItOgQcTDVfQKGacQShLJMlSTbWEMZIBC/G 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)(396003)(366004)(346002)(376002)(451199021)(478600001)(52116002)(6486002)(6666004)(186003)(1076003)(6506007)(26005)(6512007)(2906002)(41300700001)(316002)(66556008)(66476007)(4326008)(5660300002)(7416002)(36756003)(8936002)(8676002)(66946007)(38350700002)(38100700002)(86362001)(2616005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4jQZuGqBn2SDhh9wDOYghyMpyKNq1J639Vbbh3PadiKKtcToZjim+HdN/lFeXAaqP5o7poaflm3y/ILzcUAhj29pKAAxjDzgxH7b3AJX8AxL2C2mGTxAeLeGIaxR8sCwToO4aboPZ5n2WFnCcX+0iRCiG7CRF5EFqYPjX05t3IDBPq6mziZveh9GExCImbof4o84+TJPt62FpeoAAQ4gtFetFD7SXsm4U7B/b2W+6gxwHejtglRx3dCom6/drnNRJ3iW7Jf8vtz3brJt39nEDwAth224PVflCQZhMyITmdRKO85lmYWQB/7hBud0ozpXELNl5x1oqky+xHEh2UCKhqXyn/1EVsger51QbvuUIj/iXKuMdzUStNCGt86O3qhBBWaerBqgIfLo9nHJ43nMzfaC9JqDOu6eb7FJb1wcDTx9KAFtU01fNrPIdjP+hJejqSuPJrEWTDlSpOuUmm8o32L6l2CrnAflT0QU90DYK/kQCBp0rUJLN9bZ04+3LIslJdpmRwDfpd3xw/VQ74pW/VygR+eClQp2b/dC5sq9r+Gpt9O6azbcQYguEb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f9e7b7-474a-40da-1ab3-08db868d0240 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2023 06:13:59.0949 (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: ZNKSqUkA5SR4u1V/Tl5s7hKVr0FiNbnVUztPoxs8htqsA63c51eZHBOjGYL9u/y2HXFuPv91O8BgNN4+HLuRFA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB9189 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: neil.armstrong@linaro.org, conor+dt@kernel.org, rfoss@kernel.org, krzysztof.kozlowski+dt@linaro.org, jonas@kwiboo.se, shawnguo@kernel.org, s.hauer@pengutronix.de, jernej.skrabec@gmail.com, robh+dt@kernel.org, Laurent.pinchart@ideasonboard.com, andrzej.hajda@intel.com, kernel@pengutronix.de, linux-imx@nxp.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 --- 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 Jul 17 06:18:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13315206 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 736B9EB64DC for ; Mon, 17 Jul 2023 06:14:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 71F4610E1D9; Mon, 17 Jul 2023 06:14:10 +0000 (UTC) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2087.outbound.protection.outlook.com [40.107.20.87]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6A5D610E1D7 for ; Mon, 17 Jul 2023 06:14:07 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cDeQrnP6LLuSa459DsBlrL+ftblN1ApqJu4d5dtMrDioXumi41C0uwiGQO5oKfeH2yhH3wdmLzMzBk7rIfFowMFf97wrzvtcBnZI25yefIsv0OZkgHSVl8jPMdVV8v/1ICzKRnpofDBhzTdiIoxB2y2Q2vlhV6/AaJyJDShBokKVevE7ZqDIEIkj8lAAcxjtZdXZV2JUi9AoqvsyRtmdTTqqM5fkLTZ7eB3rA5jKvOgw7b7umWJ44qrrwb5Rq+L8Ci9lw84rYcjJLvx1bnmo0tt2FK1/WKogetidRKNwU5HKHQjIDQaqzR7Yog+YwIGgdLNsMzfL0crDfzwCOKjstQ== 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=UuDPuIYtKN3v7MckNkncxlIEg7y6pD5uT0OBYPupYZ4=; b=lpKRoUVdNonh3TRtvhPyTzPfpZhOTzaPi9rKMiWiDpvWQOnfR+A4UU2I4ZeVPcdO6NJkoPQUm8Q+PamgJlxTwt3qiddqHcKwFCGRyK1jMwJjG9QBBwSstauH8XaQWRUfQTs74vy/Iqmnp4cR69Cae+dgt0oRjxbClypJsbVq1+3J2gyBps3VhsYpJQXx3NRaQxCkBlbrSkxRO2ci2yK9EOUFkFNUhZjjAzUIMF9/lHWG/GUw0vx8WtfVaal3jNjFN5r0jNtRlBV6W/gbbCOR5FJTydRfMKMP7kytxPpmSjW0N8PBe1Ql26+EY8WD1VkIA0/B0egzhJdxhF/3s5zOpQ== 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=UuDPuIYtKN3v7MckNkncxlIEg7y6pD5uT0OBYPupYZ4=; b=KEq9DRInNDwxXlECg4wFZH1GChhKdvW7YanA9G+YyISPT8j1OXt56ywAgWRAtjzjTY8DQfkPEd8uvhJKBpE23H4kY7lXWNsHK5Eh5prb5Ozl2RQKVtZYeQ5LPU3PLtwDRxupyODVIKouQ96DDHxFnDQAR4ZXZH7cSjZ/+BLyknQ= 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 AS8PR04MB9189.eurprd04.prod.outlook.com (2603:10a6:20b:44c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.32; Mon, 17 Jul 2023 06:14:04 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::7af:d8d5:d0ce:f68e]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::7af:d8d5:d0ce:f68e%2]) with mapi id 15.20.6588.027; Mon, 17 Jul 2023 06:14:04 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 3/9] drm/bridge: synopsys: dw-mipi-dsi: Force input bus flags Date: Mon, 17 Jul 2023 14:18:25 +0800 Message-Id: <20230717061831.1826878-4-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230717061831.1826878-1-victor.liu@nxp.com> References: <20230717061831.1826878-1-victor.liu@nxp.com> X-ClientProxiedBy: SI1PR02CA0060.apcprd02.prod.outlook.com (2603:1096:4:1f5::17) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|AS8PR04MB9189:EE_ X-MS-Office365-Filtering-Correlation-Id: 6a40b74a-4e2e-44e9-329b-08db868d0568 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1Qy9lgAGJh9ytE67+MBRIAtosBhBT9mXU85D/M6vsEZ94JavUXvd+IGAYteyYNK0vbCr8Q+8hx7luznuXx5f0zSma9Yy45dpafO8okdSzrmZE7oVn+iA5uQs+vu61CsSjQCLeA13X1rKgnNJIDCAVcMnrP+xl+AUtOWuWH5XBGFh61hhAmHyNEKgYE2VUrAQXUkuuRYj3bUZ0PA/GY/eANsGmRXb/T13caT6Auq74USvyPlFaTFnmFQtmqctTaUUUSmgFtYFjJ7v1BuDaSYhipmR1ciO0KoqawCJU/7cWhGMKthPt3DALM5kNEiSjm2Z5jrIdmAejauxKJ3q9o3j07pIQrCEMjyto2IWZxiNUxuhVCc3lcaTrxqcRI9yJIajrU+iCZU2I574pruM5Ecl4DiZXaZ4tYOWoxXOLUrEtD1fiX3fxluLfF00RW1IuT5HAuoxyjkYXVGwB7QLmhE4kFzhN8HD9+LbJi4e11DgKP8NqOES8yXiZo8z48Gg2oS24Jvp+hsmrpNNqAr0jVL7UZvA0wrPQSfFPHagmiLb4usKmROYsQp1Cay5Q+qichRR0S/fBmKuWuWFtKkoql+fXY9YqqJo+qKAxAuDupLWH0nGA/fRRTkg2dkxyDnk8U2y 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)(396003)(366004)(346002)(376002)(451199021)(478600001)(52116002)(6486002)(6666004)(186003)(1076003)(6506007)(26005)(6512007)(2906002)(41300700001)(316002)(66556008)(66476007)(4326008)(5660300002)(7416002)(36756003)(8936002)(8676002)(66946007)(38350700002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DZOX0s/MqyZhi+NUynEez+5owS+vxM0ja58h6lq3X/55sB/nhNL91a6tTaCxpW4Z6LO3JMAzApjSQUtjFW/hjcE4H5k6qs4jRORZ5U+HzXen9gk1tufbYtMW9eCNVHRj3UUXVfj6u/J/jYeGWQznmbhS6XngS2Bl8jpUUA9/plHYyiqOC5VGHZEzJRt17PVb2J7IrndsPozzdQ922PnEXHG/+ZFk2ZFJ6xjs4qaiZ3G9ukPDeq4Is66j2chF8x31GsYMJiypscS21Uf+RLi7wKNle4M2L9SkCoj+2mdPo4HpxcTJou5VoTzqRFiZYLgSqtYORWR7/d5eJpwBlLN8ffgguk2kpA8B5kWIj4M34Rje8z/yL9xJzYPKh1oiolmMBqsZZZ0gSv4rQcck9K7X3D5+JADNW6A94EV3BzBDBNVyLObXqCIu/tm4J9fOjYbtFVJ+HQdw4v5f5dFZw+P+WUW/CkT9ZU+ndLJTfWJs9o6xpaupiLE48wIWJPDs9dIWxrCghyJzKr/UvecCqyx8KppTZTiJXxg17bZnBU6dWlV+HHCLoSijPKKC3xvoVSANgfQ79VxEsMACEe80WF+x1JULEPB1z8XxtXg7JgGgva53tyjipqH1Bdr X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6a40b74a-4e2e-44e9-329b-08db868d0568 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2023 06:14:04.4700 (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: W9dvf+2M2jmHyhm7c3Kmo8sGWNX3KHq764bpLYAQZXNBkwAG5tcghr8PW+T2CGeX8lKbqFzWVPwu4bnUCK11fw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB9189 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: neil.armstrong@linaro.org, conor+dt@kernel.org, rfoss@kernel.org, krzysztof.kozlowski+dt@linaro.org, jonas@kwiboo.se, shawnguo@kernel.org, s.hauer@pengutronix.de, jernej.skrabec@gmail.com, robh+dt@kernel.org, Laurent.pinchart@ideasonboard.com, andrzej.hajda@intel.com, kernel@pengutronix.de, linux-imx@nxp.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 --- 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 Jul 17 06:18:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13315207 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EE7F8C0015E for ; Mon, 17 Jul 2023 06:14:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 09C5210E1D7; Mon, 17 Jul 2023 06:14:14 +0000 (UTC) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2063.outbound.protection.outlook.com [40.107.20.63]) by gabe.freedesktop.org (Postfix) with ESMTPS id BF65610E1D7 for ; Mon, 17 Jul 2023 06:14:12 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VdlRNXZCdiktnzgUytgUkXMYuFX/0rMVoL9zNT2H5kwGupn8nKxZEC3wety9Gycua9O4gVbGYOkaVkPfCMRk/OZVqtpG3+9+oNK3k2zarKitI3tBRlGzmKu8oexOQ43LkqhCsCLEEcRO/gnYZcWNZt9ZZabi6uuQTIofa6XPFKodiS8VEim2OhkacSqxu7KW69lRQTEHAHXW2Lz0MCBpsrQQDqWC7+yrvbKJeBdvntMM0vlaJBseiOwPJY8WGkYy+MyaARUhMCPN0Cji9l/gDipQxblRHeIULvk/2i6VaS+07GQAFJ974PPGwuzGape0EVA2nr/bpmzRuN/1AAoRQQ== 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=WtBGpIw+8nn8CYdE6ecYbiaiI2pxQc+iH/ZRZob4l+0=; b=U+10s3TWWcQbABAv9I233XJCdX3bI6wPr8UXx7oRXfM+oNVMdcrsnmnahOO3nb1tgspNJlp5C6T1W0vtIH5VPg6GpLoxnJVspLiUvOxc9Jb6T+QGPeBOu/EH5FeqqDt7mCVWG1+bukENJNKV4r2PQuq0Nu3UL4eCn/+4Ej7bOgk0oY5J4e4t4VfFs/zuMx121U+O9VVRYYJEj6C3xWLBioLGUlupe5gSJtJ5EdA0Bx1RdBcrpr+o2s8mI1YPnNAQZUm9Zxipxuweb003+dVyXebySDg1ScbtsvXE0SPIorIgeh78W8RAPCeul6p7nVjlPc3r68J5i7cweExljxToGA== 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=WtBGpIw+8nn8CYdE6ecYbiaiI2pxQc+iH/ZRZob4l+0=; b=rVghk8pDF4Bn9dWn8nFm600R/t2r38WfCGAAtyFqBBY87rMg7o1MYqYer02ROUsn9anLp4kVd08SA40OzW14qXq56G0l/4i7O4s6Zf1///8OzKfwErtA7TWo6/DeYs8j6WHRxdqdDZEG/FtQ7OQwFvLarevKF6YK6LhulXvYqNw= 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 AS8PR04MB9189.eurprd04.prod.outlook.com (2603:10a6:20b:44c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.32; Mon, 17 Jul 2023 06:14:09 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::7af:d8d5:d0ce:f68e]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::7af:d8d5:d0ce:f68e%2]) with mapi id 15.20.6588.027; Mon, 17 Jul 2023 06:14:09 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 4/9] drm/bridge: synopsys: dw-mipi-dsi: Add mode fixup support Date: Mon, 17 Jul 2023 14:18:26 +0800 Message-Id: <20230717061831.1826878-5-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230717061831.1826878-1-victor.liu@nxp.com> References: <20230717061831.1826878-1-victor.liu@nxp.com> X-ClientProxiedBy: SI1PR02CA0060.apcprd02.prod.outlook.com (2603:1096:4:1f5::17) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|AS8PR04MB9189:EE_ X-MS-Office365-Filtering-Correlation-Id: b3c59adc-d279-481a-3956-08db868d089c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: L/o8znFX//ndvNAJbjGs0ob643BIxsfCZahkxW8cwKBxizJiXBRKqhgwgt/Tg7n86/SfBXZL1FyshnCTbI7m3GyDS19MqHSuQSqLjy7zr8KFKtvm5W6UWDo2AixMeHQgfnDxWcxCiE/K1d6wjNXH3++QrlOxCfRvDu2uB73swd3ynMDT3IK4xA3aLG2xF0fDvkApYNCuqouGqL6Ed9AZXmVoPBu6YpXHSp/O5u4wGh8ugREtwSpBQcK8IXCFIFI3c5SGJQ2dSrFbmstyimrdbHuUxwl573qG3qBuHsuMVW/8jDHSIF7iuAGgrix+a3hVF8gWoG/X7nkzz2cTT1PsDgw46oFanG8bMDI2x+4A00rPMJmsupVncVN5UAmn1+hJs+8aWVpIYwJAh3D3WH4Z8SYTgXezSOiAqmdhSLc0ZVeNhKyWTcsQIn77jbBXNLjx1CShQCt2DEpOT9yze8k/Qa6/XNaOzwRoouFpvpP/VoNm2h2vDI2/JKSC9FeqhHdWYiulnhe7cNLwYBTuYcFLFnGeZed59XdP1WfYP2EimhbPnfj5qCGkQ8gQ/h1yiwvrQlRBbM6TWMoCdjGWjbCS8JZE8XuXDWkhIG3fzA4k6C3UC341NPzgvkcfhi7jo9Ub 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)(396003)(366004)(346002)(376002)(451199021)(478600001)(52116002)(6486002)(6666004)(186003)(1076003)(6506007)(26005)(6512007)(2906002)(41300700001)(316002)(66556008)(66476007)(4326008)(5660300002)(7416002)(36756003)(8936002)(8676002)(66946007)(38350700002)(38100700002)(86362001)(2616005)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: K4YYUhFk+uqJa2fdskSzn/EGbamCOyzSJPqbhzHzI6h1Gr4GA0fYioCg44nfFSRWiLbWEswSNVyD17c+4LIxM3gwLwk4qd9/uiecPPpwBymVdks1zPgRvicrXRqM3hgUFgPP29LYHJrCX4P/cRrFcSvvWwEn2SoNzZthf0FNmMB8pOQi86M9XiID8BNZqgV30uD08my4ofwHOvV7aCJ2acjcfLv6UlZkcuc2En0h8UgPvsQBEU9XJbC01w7dBdUYC2GtSfKfRn2zJ7Abh6Ln/2aECmjh7ahBExTflU48ZzeRNx2Rms7FkjckO9XofZY4CW8pKdmYIDtFsILFHpc9lR6ZSDs4v3TpEvVXV7Mce8Ur2Qv/If6xe2+fSYM5GuxgcREJ8KWl8Vip8edZttXcZXWdUIrCBSiFei8mzT3He2GCgrEP3P42Y11+8zxl5gYwcTKQmr3VGjLgkR4ADyJizOh1DX+JCMNlqRmgItEf741uexU7wQyK94KG3K9NtX44E2KGSqOVE9GND4oxK+HImdwz7VBxdq9S2iXJR7dY2v2IaIQJbE9qdqZoBuqRsb+e1nNdihEqEyLVx5kl0ktE0qSpr/vY8GK0aq6FrB8o6sJl8piTU8LZt3qZOC70N69kkRm2oxniW18YxekhcTMBnp9uWdmHMdjEqipBw0naz6iyOYyjSczGWabvQBeAHaz7wme1bgQthxtDnYNicKfu4yU5RMKgLdLUGySSH62nWm82RMRb4xinycb8PSLM0dreS+CUu5b13ZZj2xTDg0jOJcE/HNklUujaYtEYFGC1SLELmcWrcSSQPp9AZfit3lGblmX8nD0NMUJDt8ALrHutoGkmjSUoRPRQQXsneN1p7dkpV4bNFKEs1ltlGRhQuKk2Kg+HYZE9VZi6SqRPC+MQfD3EzWTgZfbT01dtrYHMNjyfiM2hT2eDbUW+ug4MjjfwsTk/0hKD3GyZrcUONxC+/otd3insTrTLmYh9fh1gFnV6eUr4CTHtxhFFT+iG3IxdlQcKnUAIR/Yg4ARO9JAcGpplEeZeGEY3QP4cxesJMZC8ZqgeqpG2EgmaIFCQCF4tG6/cRjY+5jqX4gJAUbpOCdALYViYFyMURgzLnlgPS7DmIXAzsewcV5TOQTuJM/y+Mi4QTo/P6bG+9Yn7u870QzWPeDjmwRQhle9dPG8vC7WNjq+5RJGLa1E7PT025lypEMdgafdEeiHj13UeGMXeb+5yubwAQCx+1eixrlXuAmm96iNlGJg8aQy5tHdQS2b989xvp2iYlAroWa4yQ0FRoyU3zL+j8bEw2bvfFQ69uwVNyuNq5bg7mM+SCnfpjW5+XrAXT0B2LdARf6tUEJl8CCVwoHfc5sH/6r8z231WfUNPwLy5lUTrlbeGU5XZ9nNi0D8yRrxS6AqrnmKPS3vFb6OtRO93sgl88xRWENQq/ugwvf1ce9U1HUyC1YN/L+e3RGKeGDqUpCZtlZhqrdSyHwodffmpyfwFqqUuHdCg7XBvusOQ0dK31geyysIf8IvZvXc/pXxuqW6IvXWPndMWtVB0W7bWLT4wp3LbYt31Kr4LpoE6wESQIQDP1pyKgfTw X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b3c59adc-d279-481a-3956-08db868d089c X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2023 06:14:09.8408 (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: onbQ9aGU5MhGLTMxzTWC4+vBYpSL13g7Tn1eMhcHceytqo3peJL8SOu7PHmUOqfdotHGaGQTh/ZgxCY+bDD0tQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB9189 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: neil.armstrong@linaro.org, conor+dt@kernel.org, rfoss@kernel.org, krzysztof.kozlowski+dt@linaro.org, jonas@kwiboo.se, shawnguo@kernel.org, s.hauer@pengutronix.de, jernej.skrabec@gmail.com, robh+dt@kernel.org, Laurent.pinchart@ideasonboard.com, andrzej.hajda@intel.com, kernel@pengutronix.de, linux-imx@nxp.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 --- 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 Jul 17 06:18:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13315208 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A77A4C0015E for ; Mon, 17 Jul 2023 06:14:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DB04010E1DB; Mon, 17 Jul 2023 06:14:19 +0000 (UTC) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2076.outbound.protection.outlook.com [40.107.20.76]) by gabe.freedesktop.org (Postfix) with ESMTPS id 349A110E1DB for ; Mon, 17 Jul 2023 06:14:18 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lkrIo8RVTnR4mS5V/LGZN2RvJlKj4z9cBRqo8r14rKfkQQlRlMXcpA15EnnjVWyYdppOaJ33oEdB5ZIC6CyOXL6AeQIEMPer6OqgkzG8u5l2IUcOV/GZjn5eNvwqd4xQsMXAYfDlj7veRk1nFo/tPWwZqIxykF5/JeiKWxWMIoVugqWyjrwxWsc7mlLRWHcWLknHUmXrv+NJp+6hlwUgRzDTeHaPbReax7GA5THue5nQdlBqwHPGOYecPs1F1bSppXf9/nCP95Wzcmk8wKJa9n5wOLYf7c3dIcEBjnQ6q+DKPBEHocW3oriXhkuOmMBjHfIWxL3tpIW+pl+Hr9Jn5A== 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=qab09Aji7FWDC56F3wy+x3e5aH4E6ECZ216cpHO2QtY=; b=I7ZueopOxRwjoyas37x8fDxs1m3vPIxzQJq6vMb4SjMPKJ0Kk6MsEuouOM/eKtW+qgr45uSGaVRha83t9EXNoGBHkyVDLb9IEkPBKFQ1WyKgUQIZGnzK+Mi6EzoKltdDX/BzAd5qOlNE25HACGL5CtiQlHc7CHfsfXL2iJ2/xKs45kXRPRoe8IZreaMF6AaDexD49Uaxm0mI3UuWTeRNeTMf3kdOcY2k1VpcstwzhVFmI/B5ApTFQPWpR9c7eAVWNJoAZRl8EHUQk3w2ko3qWnevIs8yABzQ6NVkdRuIms7hEiuzaL4Gw3iuZuwyJ1d734nYy9EruXIGouQG4WA7ZA== 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=qab09Aji7FWDC56F3wy+x3e5aH4E6ECZ216cpHO2QtY=; b=izXHARnq7bD2+ukfALR5eMW87tT7b7XqJOU9tLAfSbeY5PQrTlaI5jXjTHfNC9Ruz/gdVOao1cNdUNrfqpwI6E6zTr17mLpeUqqZ9JWdqOnZKXHWeRZt5cWSN3Z3pR8vnno5D6YMxs3bfbZjp7UXDLSuTcfBNwlvl/fvkfncng4= 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 AS8PR04MB9189.eurprd04.prod.outlook.com (2603:10a6:20b:44c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.32; Mon, 17 Jul 2023 06:14:15 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::7af:d8d5:d0ce:f68e]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::7af:d8d5:d0ce:f68e%2]) with mapi id 15.20.6588.027; Mon, 17 Jul 2023 06:14:15 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 5/9] drm/bridge: synopsys: dw-mipi-dsi: Use pixel clock rate to calculate lbcc Date: Mon, 17 Jul 2023 14:18:27 +0800 Message-Id: <20230717061831.1826878-6-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230717061831.1826878-1-victor.liu@nxp.com> References: <20230717061831.1826878-1-victor.liu@nxp.com> X-ClientProxiedBy: SI1PR02CA0060.apcprd02.prod.outlook.com (2603:1096:4:1f5::17) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|AS8PR04MB9189:EE_ X-MS-Office365-Filtering-Correlation-Id: 92dc31cf-e955-4119-d67f-08db868d0bcd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5VV6Eh+xHDG6aoONsse+kQf6Vy2VkKCwqOwhzomzAK9/4hh9TwxVapo/VuP09HhkGaNvKtjxel7V/UaUoxC9nbZpbVjePo2rvH7K9kWMrm4hFBpO//fqqSlNsobyqjOHGX1tG4RpD7wArhmXT89TXrRdBbbYRlE6jb4qig0+vHwYVyNGnN7qMIhWJjupnOYJHG+rTCJ0A/7CFbB1MAVfq3R6ysD1YAub6lPqDJBvyIRgtGooblLDm/EAwXmzx37sc2ITzD/H7+JqIUOSBHLro5ANZT5EbpvdpKlqhe5qYslMX8sbQRV4vzp7yccUSDzd3T0diQW1x1WSMsz/mNppS0iR9Su5bfhl3+7HykCQYETnszlJykt2VK/z7FBys0Lw0CIaH8medilxq7Hvl4/6suUmTvQpF6cDpn53LEWWgBqNOWkiRI95pyB+pcz4FG3kXShNZAb2JmSH5ybBYiZCsWsAVP8VE/PY2HuBvIUz+gy7AknpSL1OJ+eRK2ullz3EhnhxDMaAW0Dc6UfmURTlob8wmgVuEeeIIck8rA/ky6McNLra6M8G5/PDa8ZrWifam9D51Z0n0YwzhqTFtcB5qpoodBkktVCVsPtPmqwwznk= 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)(396003)(366004)(346002)(376002)(451199021)(478600001)(52116002)(6486002)(6666004)(186003)(1076003)(6506007)(26005)(6512007)(2906002)(41300700001)(316002)(66556008)(66476007)(4326008)(5660300002)(7416002)(36756003)(8936002)(8676002)(66946007)(38350700002)(38100700002)(86362001)(2616005)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +DhX6i4gXEfDid+4jYJJb4gnnfEb/p4U3ra+B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F9RZioIRt5AYS97vchUrNn0CJJ+F3BpQ9Mcck77cys7+8KwZcmm3xo1xzZcq75RiJIA+pt0I1TvHdW039jM2/DG6JS2oxw5wVX+kyq5eaJn4Rc1CpeOszL8mOeo676KLN0FHCs/NVard/gJl9OuZmReR4w0tz702Jq8c/1DHkJ0DV4G+K0jhqzemQ2S+/DqU77tEFEEk6Ut7kyUVwOsToeSOUIaPanaDmSMTFq90goFmzWsSvJ5HhbVs1iGeydc+xL/SpoxZudY4XSF9ATaY6JGAVtc/TvgYTAny3xhgtt2ffbUI+ckff8ErX+pWtIYqR2k6nK7j5zV7+w0yAPrluECZWynQlomXV1h8OyRDYtN4dgt0P/UkncyoKMvjuC8nW9+wk8DkXdZP4OjhSWs8l1q1d6MmuoQX8/7+Tm5l2ENlygIEl1emhH52s1yOfoJQjkamIiMQBQXtxQM5Qg6Vw98kjAc/PPfmbED X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 92dc31cf-e955-4119-d67f-08db868d0bcd X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2023 06:14:15.1673 (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: X1WqYm6zYWWWsXpXUkPJKWgWQ3q8QJzgo0xrOxlD9yp2jKsTGe1y5uMFoBgLeRT7YsCqfnMHzhsurNWRfd/e6g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB9189 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: neil.armstrong@linaro.org, conor+dt@kernel.org, rfoss@kernel.org, krzysztof.kozlowski+dt@linaro.org, jonas@kwiboo.se, shawnguo@kernel.org, s.hauer@pengutronix.de, jernej.skrabec@gmail.com, robh+dt@kernel.org, Laurent.pinchart@ideasonboard.com, andrzej.hajda@intel.com, kernel@pengutronix.de, linux-imx@nxp.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 --- 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 Jul 17 06:18:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13315209 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 39D68EB64DC for ; Mon, 17 Jul 2023 06:14:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 95B7110E1DD; Mon, 17 Jul 2023 06:14:24 +0000 (UTC) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2058.outbound.protection.outlook.com [40.107.20.58]) by gabe.freedesktop.org (Postfix) with ESMTPS id 73EAC10E1DC for ; Mon, 17 Jul 2023 06:14:23 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PByoydFgIGMa9GpUKCnewuATCUuyD2EwtDZNfALwvjbknWWvhg4fBth5NOQksD5vJ5BGdLbViVYqYW02fuKX/uzXcuNoq94LbMXGOucQyX5G2PoeKEa4mI9aZZjiRECWI8truRYpNK3di0rk9jiluq44RudmPOTokYnMTiOMb/dEt93KcsTMp1L+SUeGdsyQXRuFu6j5CXHflv3c+rA3Q47Wv7CicBIPMiF3ARJSEY6fX8soyySu7Hq+Jb/PE6FMNCjrO/EcjEAyw56KvXkcIYSEtGisddr3CoemdaLismkIuFvo2yv+4HcsJyz3/cgpHXO/luA9ZsyR8p+PQDygeA== 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=POi25b8s93OGGpyE7RAi7QH/scWVsemJ+1Ty7H6HYWI=; b=EsxLZFMn54K/rn26WNTkHnw0bqa48Vn1FvQYCKvitnj9ZX+IEc38T4NZS0sQafSTmRzW9ofP5A83tEQ/z+z6lXQ479n083SKRW/YtUx4iUqb23fQb0LD8THBepOhkOfDJlBwXfkRgdDuQMVpmXpd71nornDAUwhHxw+NuCwG/ZvmEO0BEjrjxepxpBnHqtRnzGP5tN4Jt+/+d5k9qmlwkPsBZdr/dsFKIfEgkhpz2ENP/DsC2YAVPQGB8CVF6s0dztGycpUUxcJtY7k3odIj/acMPEsYHpQJd1Nfm6VIBjB1Cq/nOyT9a/5pAJ9FSDzYKPuYvTX2m6RTPIk6GZUesw== 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=POi25b8s93OGGpyE7RAi7QH/scWVsemJ+1Ty7H6HYWI=; b=p09AnDz2as/NTRuKUUd/ahKgu+maFiAz4t+MyrjSHcITvybkfAbnM7TxRB2tZlUsM1Q5HG8NhRmOPxfeox+3djELdyEJx4BbacjEKJin2P012IQcz+cm66P0EcI/dgOfDuCoymckNAfMXTXkz4AuDMcnd8366ef1gWlKz99ASHw= 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 AS8PR04MB9189.eurprd04.prod.outlook.com (2603:10a6:20b:44c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.32; Mon, 17 Jul 2023 06:14:20 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::7af:d8d5:d0ce:f68e]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::7af:d8d5:d0ce:f68e%2]) with mapi id 15.20.6588.027; Mon, 17 Jul 2023 06:14:20 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 6/9] drm/bridge: synopsys: dw-mipi-dsi: Set minimum lane byte clock cycles for HSA and HBP Date: Mon, 17 Jul 2023 14:18:28 +0800 Message-Id: <20230717061831.1826878-7-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230717061831.1826878-1-victor.liu@nxp.com> References: <20230717061831.1826878-1-victor.liu@nxp.com> X-ClientProxiedBy: SI1PR02CA0060.apcprd02.prod.outlook.com (2603:1096:4:1f5::17) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|AS8PR04MB9189:EE_ X-MS-Office365-Filtering-Correlation-Id: 808be26a-a9c3-43ce-9e1a-08db868d0f06 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AsxiXmSwAOaJ42XReJNcsFUCf96q8wqBIXGtlLeKozDetGMH8RqeNjGRm+Flk+hy4/lFplzDp/rIPlRFfQxV5ZfYpOmimSn7CX7a3WXqJgtcoKad/YY3L/4Esy9Q1jWjD9e33b1b6KTZDjxMSvatF4oBQ9yK3FAedMdfcUETjAmic04E8xr/uQQV8CNsxK8o9dURHdDHsukcV41rHBYMSpjt3c0txPWgrPcQowc7gppAh6dXqoIgwh52iOjbPDzkDfS4Gko+b1D9CDNvS/S+tqPUXzDphe4cj8QwhSrbhlgMl7NGxy6xZegbnHir6uU9WD58D8dJDnKHCfXnCIoyC5z/upO2YyIHqbCP9hCcLV/deHPK9BelQzqHeXQKLmlgHORwiq/SV+xcR/ywYFvZ7DcvAAhVMwEZtvGEDARJLlzfixsE5HknOKuOgoz/JxWL1U6nTNVlsDgdon3iKeaVNgbwN8ryh/eDT40KHv0mrPu7acvXeb1qlmwKmk8qdxCfA5A9oKJw578P/6bC4k8ZzBDsdvQLHq86KDANYqmjxCfw7PLzL9yviL60ebANGkhKv0YJID7c5UOhsVhGC+N/70Q2kZH1m0Rl6E7kpb4Bw3Tt8NMXYFc7GzriFTPlpICK 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)(396003)(366004)(346002)(376002)(451199021)(478600001)(52116002)(6486002)(186003)(1076003)(6506007)(26005)(6512007)(2906002)(41300700001)(316002)(66556008)(66476007)(4326008)(5660300002)(7416002)(36756003)(8936002)(8676002)(66946007)(38350700002)(38100700002)(86362001)(2616005)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: JGJ85iDMCjK8GLPSDbQQGxG3xoUnLsm5Mn/49pJJSYtYWsGUq6maigACjBmpOmrg6vavV8K/oSlDPv7NWfRkn85kimzntMgon0pLOPuGMEER6PKdTTl5PCjXFX5rQkc6Cvd7/SEL8TJEKrBDDVi8p8NRgnq1yCs01mwELcoIL3ppF9NiIjP9pZxB+kPUefGDgw68zXgrr98nMOFl5pXUxviWvfUztrnNOfie70DSOA1si6JZVPUIsguxbgRBkmnj+8KyENlK3M/ghbRR37DqM48aX+xhQs75E71RZbX1V0rQ2e/mZU9lntUeW/zi3WS+RP7/LBxCz/RRi1uWyDHbhjmQkiQlcsHUJ475gsJ+smtT8lhrC7fXqQXBQa+f1w4wJRluvAKWKcR0VXLT4S/pF3PaoYlHmsSPdygS248fylc7MC/pmk8F0yZ2/DeQA5lGmTuCQfeHGeLcmyXWuDm2TAklOCgPGf2J2PON4hiJZwGeHg10qvllshWiug+FqUQ6K9RTXG+s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QL X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 808be26a-a9c3-43ce-9e1a-08db868d0f06 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2023 06:14:20.5373 (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: mNRSAV+l1qxXQ+GnaOkilAczwior/UcvpT0xL42cEHiW8eP75EQqz0Li29GanmXrlyXXAM+n3EeYXVI4A4sLAg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB9189 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: neil.armstrong@linaro.org, conor+dt@kernel.org, rfoss@kernel.org, krzysztof.kozlowski+dt@linaro.org, jonas@kwiboo.se, shawnguo@kernel.org, s.hauer@pengutronix.de, jernej.skrabec@gmail.com, robh+dt@kernel.org, Laurent.pinchart@ideasonboard.com, andrzej.hajda@intel.com, kernel@pengutronix.de, linux-imx@nxp.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 --- 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 Jul 17 06:18:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13315210 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5EE82C001DE for ; Mon, 17 Jul 2023 06:14:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AD78210E1DC; Mon, 17 Jul 2023 06:14:31 +0000 (UTC) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on20622.outbound.protection.outlook.com [IPv6:2a01:111:f400:7d00::622]) by gabe.freedesktop.org (Postfix) with ESMTPS id E546610E1DC for ; Mon, 17 Jul 2023 06:14:29 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VwNAnrgYMH4qs80FeYaXfkNEx4v/VDeKqzN6BgRTW53T4/wZhgd7i0F2YRyFYByQrBbjVQDSlTaJD4i8MRh2B6gKl2hhSaKwsbHLzWq5EaNpvMQlTYPLs+zZPHhO558NOFNDq2D7xwd8YcRwQM++/6hepslM188xdpzanGv0Swc4E7+VBPjOQ2S0weTqMJ7zrZxFUu9QqmItAuBC7yu5iNxoeV2Y7aZm7Ot4jnYiomLqiW/t+DlWBgJuaVTyJEYxYpJBUFXOjVbUar+YagOfAm0+pNrUsEa+lo0UB8zqWKmUvUAeaGnbU8KgMvNfJU9vV2pv7aZHrr6Yp1OydOvsFA== 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=f0cdEHcFLlJAXsmnT4mtG5zci/b3hDN6K/NgDcNZlX4=; b=ZAetXI71pjk27CGBrwpBrz2RSOGHgavmkHH2Fwo+NTWGoxf7JQDWSiHMRf7eHb+BfSStAC+DvhyxcbxTFipWIhxvFiHQgegOj1SKQkfGZlAeDgUyEim/7tLSBP0wzv7rjUyTFvyoLHdXFsaAvuxMk0Ug8DLOG9qo9K1mo+hQs2gxbGk3lkk1t55wiVRd/DI+H8w+2+sam46OUCm0zW2yagZx6xepzMolgwm1tIN0HhsAR/yG6wcdEtEKXEb8+uQQ3YYXWP229Jl+3aPJQ4wGrBX+QYuX5+4YW3uE9lj3XfhjX2ybmVL1oZL9i3/l9Q6F9BA22FCfD+X+FpTIhIeqxQ== 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=f0cdEHcFLlJAXsmnT4mtG5zci/b3hDN6K/NgDcNZlX4=; b=LkTMkfpBFymuqp9YLjePQlSJFlQNWKxSHBZnlvZ6TVZtUhJyPxwe6zKTBF3ZKKSIDxX5I7kOf7HRiHzzYs8i99B2oI+tnD0ZefMPlCDahxhl+Cs6Yffzo8zIIJXSVuPAz/UCcASqEcIGYloEOYhKn1xpZdEoUv9bXrMBzOFLf9s= 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 AS8PR04MB9189.eurprd04.prod.outlook.com (2603:10a6:20b:44c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.32; Mon, 17 Jul 2023 06:14:25 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::7af:d8d5:d0ce:f68e]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::7af:d8d5:d0ce:f68e%2]) with mapi id 15.20.6588.027; Mon, 17 Jul 2023 06:14:25 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 7/9] drm/bridge: synopsys: dw-mipi-dsi: Disable HSTX and LPRX timeout check Date: Mon, 17 Jul 2023 14:18:29 +0800 Message-Id: <20230717061831.1826878-8-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230717061831.1826878-1-victor.liu@nxp.com> References: <20230717061831.1826878-1-victor.liu@nxp.com> X-ClientProxiedBy: SI1PR02CA0060.apcprd02.prod.outlook.com (2603:1096:4:1f5::17) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|AS8PR04MB9189:EE_ X-MS-Office365-Filtering-Correlation-Id: 3234bf40-1ded-45ba-b5f6-08db868d122e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UZZnR8km/ddapPuheGRBBtCQkI4AWIPK8VclBRQMDvywlRtfhfAXBA1J7cJgfGNffw5O05k5bF5wuIFKDVhHU2AvUSJAJBjfgUpWP5JNPUzExfc6P+kPlUoHTqmbeYB4Wtos7I2WeaBfHd1n3XfSV3mFr+XR+yxlwuZd5OpQn5a1b5V277v4FEOECuDeKvuxpNJ0C1iVbRcY+zrpi3y0cZkPN7uY8dUkjQVKUrNKfLzajt+HXO3Yc/aWGJCwHLbVrPUDAA8sU0eBK6+PXImzWezO66NufHigWS0HJLmb5or8jND+uixdSoGobkYGAEJneof3zZjUOTegFKIYVBe09X7l9+1IoTO4Z2cjM6MWw+FijoLe+bFLx5pAHQearmb4XZQAsdAlnCX+MiJmTCKDniH5cjwKVH39KboxJXo3ZYYIMUlQUiazWI0lvVmFoec0j5Q+PqC7SmyCztbRNeA7d5xLmaALUbtTtyNv78EAN4KTyyburpxbhdcbpFYQOTExZo2oh143as3V5lIf/B6y2rlpIYjoBi+Y3bnof65Fc6te/jxAB8KxliQZ4G4C/Uq58RVN2dbnu2naVcPllWssE9NpTtQHgClldY4oQgmabK9JrnhvqSGCl/Da1CbsR79Q 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)(396003)(366004)(346002)(376002)(451199021)(478600001)(52116002)(6486002)(186003)(1076003)(6506007)(26005)(6512007)(2906002)(41300700001)(316002)(66556008)(66476007)(4326008)(5660300002)(7416002)(36756003)(8936002)(8676002)(66946007)(38350700002)(38100700002)(86362001)(2616005)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BU/KYHnYxBONF0wfwQc6cKdvXSvc+4xoafs1/2x8LAfXRxe98EB5hvwCSsU7i7DD+tSEzCbbad4PBO4ViwgKURkju6PZmbWNKOX1AS8p7ss8tckRFlX5Z1O7vlV2PRryaAc1eN0LY6RrEff689Xm8EWaoMUEF2OsNFGV30YY3S/HEK7VijO+nCmVNIVDQuT2jDoT13qVDUDCQA2aZQ2JtDP2DHFekiKpX7aZvJK52yIydZcjqOd2d1j+hvHUPiLQ4sU0PTf0cOe3oDcf2BhFNE/kiC8jLl26hBGXOeleqQBdVeaKpKfJgaBcdHWnEDzVzE0VgEBsdY4QNUCLnus/jsFMjz1WBn9D9NyzkiQDIJXpI2rNEJLdr1zM9xqj0MXDUMCIiPWneRDTEjGgLoLW7VL/6TQWuosW9z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ZdUgGR8L2AqSnTND3rVivd9z4M506vMUnM4eXIzIbONo9bZVsGMxrqJY/Dee360PNbDaT7Rc4K/PFOLMnW3LVDJpec8pl4Ozj X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3234bf40-1ded-45ba-b5f6-08db868d122e X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2023 06:14:25.9200 (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: dHSY1fViomqTLW5ZWCBzPV/cSMrWyEkODK5ujkIN6BGo2+X2jGnertlKzGBnYqSE8Caj3FuasNEt+lQ0sQzMaw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB9189 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: neil.armstrong@linaro.org, conor+dt@kernel.org, rfoss@kernel.org, krzysztof.kozlowski+dt@linaro.org, jonas@kwiboo.se, shawnguo@kernel.org, s.hauer@pengutronix.de, jernej.skrabec@gmail.com, robh+dt@kernel.org, Laurent.pinchart@ideasonboard.com, andrzej.hajda@intel.com, kernel@pengutronix.de, linux-imx@nxp.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 --- 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 Jul 17 06:18:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13315211 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 142D0C0015E for ; Mon, 17 Jul 2023 06:14:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 48E1F10E1DF; Mon, 17 Jul 2023 06:14:36 +0000 (UTC) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2079.outbound.protection.outlook.com [40.107.20.79]) by gabe.freedesktop.org (Postfix) with ESMTPS id A1DA410E1DF for ; Mon, 17 Jul 2023 06:14:34 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Wb9+SzTir3RDJQYzSBoyZy1vasV++Da2EzDR5dZo6yJUt8JInuQTFrjNzJy9rFQ5SlZxQnZNK5ktnRWO8TONQNqdFg5DG+YwN1BGbNcPH0V5fVji0YHUds9yA+K7Fc4a8bhxlGEBgsAmd2R0AeVp8POdFJzAfj3AHLQ5BkJ1dR10zwuNKvkRywSAvMrkO/Gr+hzxPUoHKY50kBV0uqA1zm3n3zTbb8hym5wJIFjPajchzuZ3Uh9paGVMmW4s5Emx2w8NsGkO5aqrxc5PPfeTaZM/4tVQduTZizuZy2wTeOTjq1m0l+3EzjKTaIafMMqlYR7goGBzZNtRhGHR186Aqw== 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=Ob0sIpkjIL6spa4jwGWgcCpRxAOJAnOpUMMGMWUpn8A=; b=A9VwJrcHlSi6f+n24QJ/cehueBxoW41fuBo7Ci/z/QcL7w7oarp9vT1U55+vpyyIxKcocyooLuf4sjDWarf2EWXBJQ/IPpwdrjb7e0Ue8WQkvRBXQWIM/+gH85leZqRzzZPlRg8WwLOBTdO2BQ7BXh00RsWQ/EbzV7katSI5Zqa4nfAS59DiXQR9RmdqDdmaILEQpU34JEkWK0U3sIARWtAK1cfNm2RohTrRM852k3YH9+X9Bt7klq+NU0dSd2qSrac550HuKwSMGhZeqLl/fBmxckdSeDP9lD6NeVDBlCVhGyK/OztLxmfnYE4f6LiC6Lq1ie22KL0QvY/AbPpC/Q== 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=Ob0sIpkjIL6spa4jwGWgcCpRxAOJAnOpUMMGMWUpn8A=; b=bB4qnaUaoETaaZFWarifjRUosuw1qqLHtHoypfNtk9fGBDmjLptuOtL77X+7FiJAYIBC9kX3Yo1bXgd4BWLOTVWorkQEpAdtHbqafB9Xr+6FQHsWh0hWQ9JnXVCZpibbpPcj4s01eOo9+3qW3Zk5SXEZaxPzq0xybjDMAa9szfg= 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 AS8PR04MB9189.eurprd04.prod.outlook.com (2603:10a6:20b:44c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.32; Mon, 17 Jul 2023 06:14:31 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::7af:d8d5:d0ce:f68e]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::7af:d8d5:d0ce:f68e%2]) with mapi id 15.20.6588.027; Mon, 17 Jul 2023 06:14:31 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 8/9] dt-bindings: display: bridge: Document Freescale i.MX93 MIPI DSI Date: Mon, 17 Jul 2023 14:18:30 +0800 Message-Id: <20230717061831.1826878-9-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230717061831.1826878-1-victor.liu@nxp.com> References: <20230717061831.1826878-1-victor.liu@nxp.com> X-ClientProxiedBy: SI1PR02CA0060.apcprd02.prod.outlook.com (2603:1096:4:1f5::17) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|AS8PR04MB9189:EE_ X-MS-Office365-Filtering-Correlation-Id: 2fbae979-1275-4882-7f2d-08db868d1567 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TORFTmAVY5OnSMyDZjM/OfwcaHh82h4ro06halZe0FaxWMr4Y+vhQy1g7c55vr/YJf5nVdEUg64DVIY4O+mLNSt+agD4H7gL+hEHdSZu7t1/jzM/Myb5eGA2Cs9p6AB1QAGRplMwjk39GTYXKf5AkVBYEBgdgeYiYPlPcxC08wt/Ozv+gfhSP7tbV7hsR2D0gRtMG++UVWva2DPzGluQIMqkrIXqZLBsmlxX5LAovJ3Si0/2mYG7v8LDtFBAWZwvGA3IcJvq+8+W/0E2iHCv/pDYH2h8frcof4xDwbA/uyMZ8+vswpHMRJCJhXV/WkMH1HumO8/0GpNZu5IGl5gwb5Gp3TlxThrEoyT/JTHJ1f9BK8DXEWY3bj+MYH+8p4uJlfHSKgLg23bJnj4eKnYieJPtbWAr0IsCwsej1AR4rt+BcAphZI0QtI5ha1NE1v3vfEMxmwc3/2P7zcXoNFtfOiW2YwdLpBVB8R4NLRZXq5P1/1Bmnh2j4FVzNc17hflX4zH1IZyY62943Ahbb9pXDL3hwWndOKo7yshL7q/BlJFg1UE9C7J4BQS6zAqrblHhTFVAEeChLADuO0dUT7/GEkEBZFNFUVA4rQpBb+fOJKA/uYIgTjlzAcnsbf28amUFgXz9z2MSHpOXBi5aAOhRqQ== 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)(396003)(366004)(346002)(376002)(451199021)(478600001)(52116002)(6486002)(186003)(1076003)(6506007)(26005)(6512007)(966005)(2906002)(41300700001)(316002)(66556008)(66476007)(4326008)(5660300002)(7416002)(36756003)(8936002)(8676002)(66946007)(38350700002)(38100700002)(86362001)(2616005)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wWePFywa3jt7ylS1dsjrjGv7D9uA+GQ+KWJBCgZWtOWJBKtoH2voVIG8Znc+7ig08SkKmjeONb+IC8WKt9iR8pz72dSTsm1EDfsmkb18HP1HiSUv6+pqRioTWTMsjJW1q9/sZohQ4MNymDURVXMeRaXfxTCmwuHayrG2/4slDLJs9R5nYeXGpvYGYSwFygGhvvC9WLEiSaR22+5hAWeM32fLGrjM/fiKlxnLOSPukRwoZpn4ch10RnBGY7/Yyfx8zvR3mhND+I93LOdEJzDSdBw4lGAs6z8nhFDRHtMfYtiBVcAI6qF+l5+8QlEZ/pLBomgaJggUqM5+Lwld2J/LL057Xxe9PfEOqAVyP+DiQWutww0ONcVpqhNYnf2rnh1ujTFKlqood35rL+tVA4lhtIZ5KHmgJ8N4or1T5EvXYa3DjGYPogF/0dkA23IBSVhw8i3eHBjV9Bi0fixe0Kad1nYoro+ZaJpT9cxTkPn7p7gMoiLJr859/jsJ1p9G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qvpQn/aA78GyVgfsh X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2fbae979-1275-4882-7f2d-08db868d1567 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2023 06:14:31.2347 (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: 0k+vhbI1yzPsHPWXVzURBRwLHxkOyFsPUEFiK5Z6KjEnWOuqUWI7l1WX2qqHfhKZxxSwH/G/+jLrrSaMHdaxXA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB9189 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: neil.armstrong@linaro.org, conor+dt@kernel.org, rfoss@kernel.org, krzysztof.kozlowski+dt@linaro.org, jonas@kwiboo.se, shawnguo@kernel.org, s.hauer@pengutronix.de, jernej.skrabec@gmail.com, robh+dt@kernel.org, Laurent.pinchart@ideasonboard.com, andrzej.hajda@intel.com, kernel@pengutronix.de, linux-imx@nxp.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 --- .../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 Jul 17 06:18:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13315212 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B0CF7EB64DC for ; Mon, 17 Jul 2023 06:14:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 16E9E10E1D4; Mon, 17 Jul 2023 06:14:43 +0000 (UTC) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on20627.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e1a::627]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2883210E1E0 for ; Mon, 17 Jul 2023 06:14:40 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TCmDeiXjwsXcFCGvP2w0ycitz7UrTeXDsU0xsHNinPqGTHLbPf+dMlL6qofGRhQIXwcJ3pYGQZnKfm0/wN6vO8HU5HoeBzO3uVgFLgea1V0cXiWQq3CvKO3RAe6tK8l+DHnRBOj8T566piMPESlF9peAwtb8DYnniCUmOdzfL/6ecI7rCdt7zSZ+8zWT2bnBKUqwfnRGdo6QItG7iZVAsC7IzI5ZfXXQ14mH7TEj76QyH5QR0Lv1ec6rapHmYOmHOD0hkYmtDFSiBFAFcCfSw8XOSEbJk+VFqGgkoDIlHS1UO+PZRKZwOYjJjgRHD4YqI7fPIYCCCcRk4OQ2mrdl+w== 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=1XxWByUmFftfO+2gtI9xfeJi0UP591S33JvTXJWqgMI=; b=XvWiWDsNkvtybCWoIIzwV3t3pskZSaYMBQjtKWzEXQjkN7KvSOGcpHfV1dIIYQID19vF6S4JfZgFmC8v/pmUKwRIO6zH7DGyIQFT3k7e0+sTdrHIw+I6UH5EkyiCSfK/K9ladp8dfmBTBtcVS0SBctnfRpJJzGsqLw0qk6MwaG44uhIUSDEULPomBOp0MAT4AipeRqbCrzBSFE0vOI3UBVmYt0Q2r5J8MKbA+FEBd6qA4EjHKFOYIhFdeY+QhNUsUrKTW04VqewLAuldd/hnwuSDjMvwHKfd/wvs24gf5y54d1gjuDA0Qge8LCPPTZHkp5zQkdNvuuGaCHgPcG65HQ== 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=1XxWByUmFftfO+2gtI9xfeJi0UP591S33JvTXJWqgMI=; b=OlzAMvNykzZfvaME2DRFm6Bsi09LaaJ50qYI6VI1N+YT+ZYQH8RBshhRjCrerPVmPpTf0HXhtLtglMV5xeBStVFJ8tTzElcsddAmbrtkmVe7HDIo+JDf8dKk8aRXQvlf5Tm1G/2rBdNO38EPcfIbdSVjadLVI1MAa/Y4fkheKMc= 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 AS8PR04MB9189.eurprd04.prod.outlook.com (2603:10a6:20b:44c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.32; Mon, 17 Jul 2023 06:14:36 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::7af:d8d5:d0ce:f68e]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::7af:d8d5:d0ce:f68e%2]) with mapi id 15.20.6588.027; Mon, 17 Jul 2023 06:14:36 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 9/9] drm/bridge: imx: Add i.MX93 MIPI DSI support Date: Mon, 17 Jul 2023 14:18:31 +0800 Message-Id: <20230717061831.1826878-10-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230717061831.1826878-1-victor.liu@nxp.com> References: <20230717061831.1826878-1-victor.liu@nxp.com> X-ClientProxiedBy: SI1PR02CA0060.apcprd02.prod.outlook.com (2603:1096:4:1f5::17) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|AS8PR04MB9189:EE_ X-MS-Office365-Filtering-Correlation-Id: 6dc11c6f-81a8-4375-f7a6-08db868d1891 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sSXZW0Zlg/QC14hOTzVQ/lTXNM4ZCKLewin53ugRBfzdDjz3LsuIH/roGpVHD+zS2gWCb8fJ+eEFNuLRtI+sxcZAuZBgOuCD24ji+8A3ZTa03bjjZ0pOT3lWYer9MlupUA105yFebHaD99kAZznhf/mj5E1AI2cMtBqKbgyuh6a8wCyzWf5LOOHUmdgi0Qwmm/TDyw16LXboS3EaXI7NGNH0gDnFoIQjxBhsUwzQeq+SvjdahrLtPEYyLianBkudNfAVl8uHhvRDD0CNbHabtgrmaf612Ein45Nda3xajchz9WiMWepApOIjVOiPNXWT7Z78jpPYp9YZmyfAiP96ONbdJiQJudzGDuFuXO1gABGDcEYwN7eA/eoZStEerCWfL5QLjBxjJ/qzm/e2KfJsscnoyBlDC/cGWD7+VIrjlpEHtH/YrPJZps7qi8OkSCIw0RWizNB1zvYC1lFqPRDCGtOElCYUIKZCyeemLD63/xzKHV353yuxWjWhkQaHzSYxsd1pgAHFyLjKMODPMgz9stMzko9PdkfUeIaHJ9Qd1jufyuMo7veciGVR8SZY4NudWWbGGSsmDPZpkmd18qIgJYgJHgssumNj0LrUftU/SSdpMP/Ir5ZR/xHZzsv5BzhH 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)(396003)(366004)(346002)(376002)(451199021)(478600001)(52116002)(6486002)(6666004)(186003)(1076003)(6506007)(26005)(6512007)(2906002)(30864003)(41300700001)(316002)(66556008)(66476007)(4326008)(5660300002)(7416002)(36756003)(8936002)(8676002)(66946007)(38350700002)(38100700002)(86362001)(2616005)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-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RXLvZfW9X8iX0XKj0udcsUwYoZMKoY8fs3mjWqNfsOcUILEjq0gVUNbTacWkBDzNAILv8c020Rn068RZ9Mg0s/7+iYQXyOob8rIVD3CRcMg96LNYG6Jly3vlc9LceVHBEQMnu12zadgul7Km0aRK5JQO0HnpivXFtJTOWYlCzrtbQkqgHzYxibETaRBdUJf0YaA6Z2KIaaJszWCiEulRxfT2EcHcZqnxL+kuzm2XdUyYA3IeMzO1GCPUZtN5nVHSeyzE/NKtbsKCsDJLcu2LwaQabtoW//Om9sS3erkhwkUR+BjTXllS1+b6ZuX7jDuCDdBYlBF91Vscxh6B6JEG1p+nuJD8hGRe7GBtLrSdYYFXYhI+lN4TneETIeGdhlVeMlM5Mg24UPcq7LMEuKgHpv+E++k4a7Zl3h6FJGRkfeP3gDz1KOP+LPH/EvjQR9k9GY7hSYYA4i2WL4XoEmC3ssY3QyjpPzI97e2siLhVA/AvKYy+XMs21pUGzDbyrgEZILFShlbqVc4hPKsi X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6dc11c6f-81a8-4375-f7a6-08db868d1891 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2023 06:14:36.7829 (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: aaX0E3mNd3WQdkt6De3XBG3GMFPHPE5eJxREjeeCiojqwFRB6DCAvNphoEZKaU7ETRrSpvblUlZL3u0BeWxOPQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB9189 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: neil.armstrong@linaro.org, conor+dt@kernel.org, rfoss@kernel.org, krzysztof.kozlowski+dt@linaro.org, jonas@kwiboo.se, shawnguo@kernel.org, s.hauer@pengutronix.de, jernej.skrabec@gmail.com, robh+dt@kernel.org, Laurent.pinchart@ideasonboard.com, andrzej.hajda@intel.com, kernel@pengutronix.de, linux-imx@nxp.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 --- drivers/gpu/drm/bridge/imx/Kconfig | 10 + drivers/gpu/drm/bridge/imx/Makefile | 1 + drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c | 934 ++++++++++++++++++++ 3 files changed, 945 insertions(+) create mode 100644 drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c diff --git a/drivers/gpu/drm/bridge/imx/Kconfig b/drivers/gpu/drm/bridge/imx/Kconfig index 9fae28db6aa7..5182298c7182 100644 --- a/drivers/gpu/drm/bridge/imx/Kconfig +++ b/drivers/gpu/drm/bridge/imx/Kconfig @@ -49,4 +49,14 @@ config DRM_IMX8QXP_PIXEL_LINK_TO_DPI Choose this to enable pixel link to display pixel interface(PXL2DPI) found in Freescale i.MX8qxp processor. +config DRM_IMX93_MIPI_DSI + tristate "Freescale i.MX93 specific extensions for Synopsys DW MIPI DSI" + depends on OF + depends on COMMON_CLK + select DRM_DW_MIPI_DSI + select GENERIC_PHY_MIPI_DPHY + help + Choose this to enable MIPI DSI controller found in Freescale i.MX93 + processor. + endif # ARCH_MXC || COMPILE_TEST diff --git a/drivers/gpu/drm/bridge/imx/Makefile b/drivers/gpu/drm/bridge/imx/Makefile index 8e2ebf3399a1..2b0c2e44aa1b 100644 --- a/drivers/gpu/drm/bridge/imx/Makefile +++ b/drivers/gpu/drm/bridge/imx/Makefile @@ -4,3 +4,4 @@ obj-$(CONFIG_DRM_IMX8QXP_LDB) += imx8qxp-ldb.o obj-$(CONFIG_DRM_IMX8QXP_PIXEL_COMBINER) += imx8qxp-pixel-combiner.o obj-$(CONFIG_DRM_IMX8QXP_PIXEL_LINK) += imx8qxp-pixel-link.o obj-$(CONFIG_DRM_IMX8QXP_PIXEL_LINK_TO_DPI) += imx8qxp-pxl2dpi.o +obj-$(CONFIG_DRM_IMX93_MIPI_DSI) += imx93-mipi-dsi.o diff --git a/drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c b/drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c new file mode 100644 index 000000000000..77f59e3407a0 --- /dev/null +++ b/drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c @@ -0,0 +1,934 @@ +// 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 +#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) + DRM_DEV_ERROR(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 tmp, delta; + + if (dphy_opts->hs_clk_rate < DATA_RATE_MIN_SPEED || + dphy_opts->hs_clk_rate > DATA_RATE_MAX_SPEED) { + DRM_DEV_DEBUG_DRIVER(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); + + DRM_DEV_DEBUG_DRIVER(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 */ + tmp = fout * n * fvco_div; + m = DIV_ROUND_CLOSEST(tmp, 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; + DRM_DEV_DEBUG_DRIVER(dev, "best Fout = %lu, m = %u, n = %u\n", + best_fout, cfg->m, cfg->n); + } else { + DRM_DEV_DEBUG_DRIVER(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) { + DRM_DEV_ERROR(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) { + DRM_DEV_ERROR(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) { + DRM_DEV_ERROR(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) { + DRM_DEV_ERROR(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) { + DRM_DEV_ERROR(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) { + DRM_DEV_DEBUG_DRIVER(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) { + DRM_DEV_DEBUG_DRIVER(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) { + DRM_DEV_DEBUG_DRIVER(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) { + DRM_DEV_DEBUG_DRIVER(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) { + DRM_DEV_DEBUG_DRIVER(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) { + DRM_DEV_DEBUG_DRIVER(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) { + DRM_DEV_DEBUG_DRIVER(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; + + DRM_DEV_DEBUG_DRIVER(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) { + DRM_DEV_ERROR(dsi->dev, "failed to init phy: %d\n", ret); + return ret; + } + + ret = dphy_pll_configure(dsi, &dsi->phy_cfg); + if (ret < 0) { + DRM_DEV_ERROR(dsi->dev, "failed to configure phy: %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) { + DRM_DEV_DEBUG_DRIVER(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)); + + DRM_DEV_DEBUG_DRIVER(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)) { + DRM_DEV_ERROR(dev, "failed to get phy timing for lane_mbps %u\n", + lane_mbps); + return -EINVAL; + } + + *timing = hstt_table[i].timing; + + DRM_DEV_DEBUG_DRIVER(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); + DRM_DEV_ERROR(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)) { + ret = PTR_ERR(dsi->clk_pixel); + if (ret != -EPROBE_DEFER) + DRM_DEV_ERROR(dev, "failed to get pixel clock: %d\n", ret); + return ret; + } + + dsi->clk_cfg = devm_clk_get(dev, "phy_cfg"); + if (IS_ERR(dsi->clk_cfg)) { + ret = PTR_ERR(dsi->clk_cfg); + if (ret != -EPROBE_DEFER) + DRM_DEV_ERROR(dev, "failed to get phy cfg clock: %d\n", ret); + return ret; + } + + dsi->clk_ref = devm_clk_get(dev, "phy_ref"); + if (IS_ERR(dsi->clk_ref)) { + ret = PTR_ERR(dsi->clk_ref); + if (ret != -EPROBE_DEFER) + DRM_DEV_ERROR(dev, "failed to get phy ref clock: %d\n", ret); + return ret; + } + + 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) { + DRM_DEV_ERROR(dev, "invalid phy ref clock rate %lu\n", + dsi->ref_clk_rate); + return -EINVAL; + } + DRM_DEV_DEBUG_DRIVER(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)) { + ret = PTR_ERR(dsi->dmd); + if (ret != -EPROBE_DEFER) + DRM_DEV_ERROR(dev, "failed to probe dw_mipi_dsi: %d\n", ret); + return ret; + } + + 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");