From patchwork Mon Aug 21 03:40:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13359048 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4F35CEE4996 for ; Mon, 21 Aug 2023 03:37:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zVfvaob1o9WQFkRI1dJv1ZxveBkHoqQL35HG6sZnDBQ=; b=GiXrAmjyfulzE8 nkNuA/95dBRYpIFrAFKcjTcQdDnC7Eqh0x7clPf7ve/Ru/APZmQENGLwCiiCPXlq+sHwdpUj1cs/s 1mszMM6X67HuRJ4R/gwtt5RTfDAuQLV8G7riPT2KGEmxvHVeLY5LAiBENItErVmUzYgY4Y8dlmONB qkhpYydJYmu+WuAfbF3VQh3EvgjzUt7+Et3HsMLhhy4tgZnrlSAYKNHzkyJ3tngXaAwGmkKBriycY +nFxiyU+Vf+7KCjFGaJdtxmd3IqXCwRGloRNM357uijV/vfsFZ32pb0OPgAG4jxjYn2bf+u1YhPiW oeB5eaPWUO4iP/Y7vWkg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qXvjC-00D0Bw-1l; Mon, 21 Aug 2023 03:37:18 +0000 Received: from mail-dbaeur03on20617.outbound.protection.outlook.com ([2a01:111:f400:fe1a::617] helo=EUR03-DBA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qXvj9-00D09a-0h for linux-arm-kernel@lists.infradead.org; Mon, 21 Aug 2023 03:37:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bm66Bj8reuknkHjYg1Judz4YAkSdC2sq4bl+G2IKdhtlji/Uu1pCuz6qiIT6kjGBrsqt8Vr7Sf8XAsN8EjvLvhzAYXgln7ZqVPJ1XiX5nXz9xsytkw8LZNM3UTZ0B/IH1u+MNnbMutjMgGsR8Jg4kilmdq6w2oeWOELittb+GOiFxrsJd8E+5SgUcKFazTGEaR4p6RHg+yugB95P8rt74i/77Oy3/Wn6Lnkein4ErOFZNx30BrgtN3yq737YWl2vTIMxeMnULmpfLcaIiPa2syJ/ORTvHQBp4V0pryBOwMmVLggFBza+bldhDzKM0HNS1tNqIvPEoIJXsDC+Cr8y2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WM7ENwdEZtTaAmUcvrIdGqtVTxouZ1RTlDFvwoB1mU8=; b=SOW15eTv/RZIZVmlWCPiUqiOeliMlSL03+Nj3fh3hJ2yl6fWhG33pqZWKBkf3ftVdZAig0yppB3LlEf3uqJFINioxjYoh3iZpaDRD4A9I2OqQfkzqP09NNNQDdPtsoIv/Le16PyVJMMtTuktGrMcvhF6xPAqxVsLK8zTVlNsBtLfk7/fsZlarDma2+CNVmZ45kCiCayKS8bHHzdeAfkfbnPu/b4Q4i14PhtEi9EwRc5S/wwIGaTneDKgnPEFutipikZzk+oFL5jR7zvjxH/SRJhl9xs9lF3vu3mYFJPLdh9ZFjMCM7f4qMymh1OJsyO9O3PH8zNcgetoXByEzWUx+g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WM7ENwdEZtTaAmUcvrIdGqtVTxouZ1RTlDFvwoB1mU8=; b=H3AAMNh0n+h8MEkN7FN/UvVlvYqrQfkIBb+ErtRg0eU1Z1rJUocnIze7poNhz1bg/ljBwmWc/JsrWSVKCwN1pWsGIEuDP0cE3sJFzHqw+UBcLXKEPq64mVpuiWdgrWX6xRAzFJVJ6UZCi9KjtxFSjEhu33SoJN9eH5Se6we6ZSo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by PA4PR04MB7758.eurprd04.prod.outlook.com (2603:10a6:102:c4::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.20; Mon, 21 Aug 2023 03:37:12 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::9018:e395:332c:e24b]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::9018:e395:332c:e24b%4]) with mapi id 15.20.6699.022; Mon, 21 Aug 2023 03:37:12 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: andrzej.hajda@intel.com, neil.armstrong@linaro.org, rfoss@kernel.org, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, airlied@gmail.com, daniel@ffwll.ch, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, alexander.stein@ew.tq-group.com, sam@ravnborg.org, jagan@amarulasolutions.com, yannick.fertre@foss.st.com, raphael.gallais-pou@foss.st.com, philippe.cornu@foss.st.com, hjc@rock-chips.com, heiko@sntech.de, zyw@rock-chips.com Subject: [PATCH v3 RESEND 4/9] drm/bridge: synopsys: dw-mipi-dsi: Add mode fixup support Date: Mon, 21 Aug 2023 11:40:03 +0800 Message-Id: <20230821034008.3876938-5-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230821034008.3876938-1-victor.liu@nxp.com> References: <20230821034008.3876938-1-victor.liu@nxp.com> X-ClientProxiedBy: SI2P153CA0025.APCP153.PROD.OUTLOOK.COM (2603:1096:4:190::12) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|PA4PR04MB7758:EE_ X-MS-Office365-Filtering-Correlation-Id: b12a76da-b188-479d-3d23-08dba1f7e7b4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JY7kP2XbWqx7zhKARuqd9vPh6nEtHsa5Bn0JNp9mUa06N2CDMVZt5+ca9fVBJI/PaehghEMmha+Q702Bq56lS44mGlNLUw6rNBnKgb/rZPozACEg9WhI7zrRuvnAPq80gcor4pmI/9Q/9O08rOW0NnVvLwMms0hixlV6O4PvfQU03FPPs7tXZo80G5mZwZ0XI+9g9zryNrUMsJcAAsYPSQYcRnIc5ofd0vUq4ra0R5mvzuyaAniJx6TLiqz9LyzVuthWTLmQTwzHalCWcdzGj2CatnrNLyBoskyPTSMO4esMGgx+0Ji0gSZr/PDCcudfCwj16POr4OhMgFHVl6BUrj11/jp2BlAFlhSYBCWBeCqo8VsRM/CMwG9DEIpxbQaqAoiDLs94i0m96p/xzduqCg9mzqceob/9MqLV2Cnj+YJfWy3GMY5miA4o8m+EkAdUxbZAgXUALrkRUwawxiWH+MjcMcI+hah2mQ35+ELcWXAGm8jaepnMjjcm3Ct1JDpfuvoYycVN0v2tU7TJuZ+hUe87M5tv9l1G8zqTNHRykB36eNNU55CMWNkHgL8eaACEB0jRvt66bt1Nbpymj/zY5sauI6NAZbOys955eQz32DpUJVXCPwCZgNHTOjYgqmIs X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM7PR04MB7046.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376002)(39860400002)(136003)(396003)(366004)(346002)(186009)(1800799009)(451199024)(1076003)(2616005)(26005)(6512007)(38350700002)(38100700002)(36756003)(86362001)(83380400001)(316002)(8936002)(8676002)(41300700001)(66476007)(66556008)(66946007)(2906002)(4326008)(478600001)(7416002)(6506007)(6486002)(6666004)(52116002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3qpoe0ekEIzfyDRcTUYvGUOwCoY6xmPwBak4BaYSKwBOKSEwgm9DS5vLcZK5zuhUm7+EaKxwJnwLoMezS2cRhvhUIS2wF29zV9sizAbwHQVRA44NrVq9y4p+PmPy11BsVDm4Z6CCBij3fbI9xwyLvpJyJkS0vJPPENseOXa/qpoMAwiZ2MTIEeChLzDnqw55tWHhvSvXE7aRPlSG9/was8GM6k8RHKYJvo6DdrJTam2qOP4Nuw9tPUvOJYBbV/ag5HMk740PvzCVKrm7kSfZkt0H5EU+MIN5S22Q5Y6S9lShmRou1B4jgk6Y18HKGMrkaqQo5ZM1YuvJugEgGXPOE+T1m6ausG9uGdBnkm9O75pdq5lvCXTcrhWVHPz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LO3LncqPDorEWUC4k4xMejlK4Nf+TrpotAUvHs77IXlhjv1CRGBnCm0viY0MoUkGVVzIYokouPWQIGPd+is3TSXVSNw46oxS/Kc1W+337/Btja76YBn7mIiD1zcZO5aJUM4wTUzg2 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b12a76da-b188-479d-3d23-08dba1f7e7b4 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2023 03:37:12.1784 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: t3FmkEvupHMYvp5BOithh9O4/jEHGKmR72s7QU0oGsRBhvgnzWKlvTOf4zTF28Odvbnt8MHCgVMsagaleoiwRQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7758 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230820_203715_257672_B4EEB7BF X-CRM114-Status: GOOD ( 13.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Vendor drivers may need to fixup mode due to pixel clock tree limitation, so introduce the ->mode_fixup() callcack to struct dw_mipi_dsi_plat_data and call it at atomic check stage if available. Signed-off-by: Liu Ying Reviewed-by: Robert Foss --- v1->v3: * No change. drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 14 ++++++++++++++ include/drm/bridge/dw_mipi_dsi.h | 3 +++ 2 files changed, 17 insertions(+) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c index ed9288a9c444..b2da803c9de7 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c @@ -573,9 +573,23 @@ static int dw_mipi_dsi_bridge_atomic_check(struct drm_bridge *bridge, struct drm_crtc_state *crtc_state, struct drm_connector_state *conn_state) { + struct dw_mipi_dsi *dsi = bridge_to_dsi(bridge); + const struct dw_mipi_dsi_plat_data *pdata = dsi->plat_data; + bool ret; + bridge_state->input_bus_cfg.flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE; + if (pdata->mode_fixup) { + ret = pdata->mode_fixup(pdata->priv_data, &crtc_state->mode, + &crtc_state->adjusted_mode); + if (!ret) { + DRM_DEBUG_DRIVER("failed to fixup mode " DRM_MODE_FMT "\n", + DRM_MODE_ARG(&crtc_state->mode)); + return -EINVAL; + } + } + return 0; } diff --git a/include/drm/bridge/dw_mipi_dsi.h b/include/drm/bridge/dw_mipi_dsi.h index 246650f2814f..65d5e68065e3 100644 --- a/include/drm/bridge/dw_mipi_dsi.h +++ b/include/drm/bridge/dw_mipi_dsi.h @@ -59,6 +59,9 @@ struct dw_mipi_dsi_plat_data { unsigned long mode_flags, u32 lanes, u32 format); + bool (*mode_fixup)(void *priv_data, const struct drm_display_mode *mode, + struct drm_display_mode *adjusted_mode); + u32 *(*get_input_bus_fmts)(void *priv_data, struct drm_bridge *bridge, struct drm_bridge_state *bridge_state,