From patchwork Mon Aug 7 05:26:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13343005 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 4B079C001DB for ; Mon, 7 Aug 2023 05:22:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C193210E1C4; Mon, 7 Aug 2023 05:22:25 +0000 (UTC) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2061.outbound.protection.outlook.com [40.107.22.61]) by gabe.freedesktop.org (Postfix) with ESMTPS id 444AE10E1C2 for ; Mon, 7 Aug 2023 05:22:18 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=POg7JdcHjbwCODhY7RpBLkN0otMZSR5m7en9jlzaaP37HJESBVM9AOmIGJGcEYvjf7scNVQ7yBpMIuLI6j+02k9V/udtZxgwsvPsJ+IUx++0NHhqRrhx7sAB5MqWgXRiX/0dghWrFHYXzCA/OYSJ0IbMPObi19/Eg/UyMkZTbmBk+UqFJ7+NC5UD7luyMyhXWEP2RQNOT6ossFtvNlXK3SvfS7B2H3A/cOHs4hztFAWQ5ZxKT4UFB5Fl8DUNG7wW4uNapHitpTgM3TbyQDCBAHfGU3JYdgRAEdKBmqBvKGW3Q8q+wBLW99Cy1PTKoMPC2lfXs3yjzBnQQszif2MSMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6nwUekE8dpN/HuRxa08DtlQXYJTUZgFn3pGifrVCQAc=; b=aNhukd+kM5exEopHVxX4shZ37kqrCNkKjiwEgTlb1dHlr1X/y9qYkxcqRFk1O5psy2a+uPsdlZze4cbCc+8ZqT6q3P956Te9HuzBLLqmdbsqQ7LScWA7qL7txxrripXba9crGQCpF1DTpY1HVvEUVwzFozSXLUiiksvWpQqOaUtC6/jueQrys1oNe9lgQyq1z1KujbCWhYvxFp1CadURILRKckF2kIRUKHZWMTqVIvz7pSIF8M841sQSxHCLtQmLTiiLkG2qjI3VhRzOVL9m35Iz3i3i08oyLgfSB13ulnVGYw/eJ0D3s/d1+RwgPcM3nhFIA1zccWE6pEat4RcVWQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6nwUekE8dpN/HuRxa08DtlQXYJTUZgFn3pGifrVCQAc=; b=Lrzpk8WTJ0LpPud3Z2r9yBtqOZ/VdubBFyQIa1ZDeiarjoI/xpXKapASC/AwOR32pL1RKl5gpzrjC/lMS1qecspuWO9rWZIhnNz9yrAs5kn8vk0LWCkg2ItxdnZTKtNHjE2V+e+PKhRYHUw9zLlm0unTe4kHB17s+9Xy1aKPt5c= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by PA4PR04MB9390.eurprd04.prod.outlook.com (2603:10a6:102:2a9::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.25; Mon, 7 Aug 2023 05:22:16 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::9018:e395:332c:e24b]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::9018:e395:332c:e24b%4]) with mapi id 15.20.6652.026; Mon, 7 Aug 2023 05:22:15 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 4/9] drm/bridge: synopsys: dw-mipi-dsi: Add mode fixup support Date: Mon, 7 Aug 2023 13:26:03 +0800 Message-Id: <20230807052608.3038698-5-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230807052608.3038698-1-victor.liu@nxp.com> References: <20230807052608.3038698-1-victor.liu@nxp.com> X-ClientProxiedBy: SI2PR01CA0006.apcprd01.prod.exchangelabs.com (2603:1096:4:191::14) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|PA4PR04MB9390:EE_ X-MS-Office365-Filtering-Correlation-Id: 74b28467-c8c8-4ea4-1942-08db97064345 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: t7ptWOq9/ZEK29E3oAkCbf0WZ4Q1i5KWQGmBDnV3l2hp66ZWEaG6fQT5dDZ3037oT6d8f/79GqlUlnznRA511frSyZhHXL5IRDyrZ5nI/Tn5F666xH3YCRjviduWTiFCy0yipBwu/LYf/oI+CzYY9UC33SJGRAG0aoNHfFLz0noChsrE+IaXMBTnhAjPiJPsG5pwUiI0XZ+v3NI/J9kACUk1s+WcEXzGC/J/EUM9A41y2SgFVrphyCGDcKRS8om4FLhvcR58bwPMsDrITDooTiaCiXWRN+1x4RJGWNVsh2nDjQ7Y2IpriFO11KMZuHXozQlszLafUoOqqVwUPGK34ryUBEwz5EE+YKBbhPgNKJfcj34OhHO8T9AJl27szjkQ1NQzeghc51i2q5k9zl53SILKj8b7Zrbnqe03e1dLwrjSLiS0P4TGTkV127hg2lhstCL/dSevDFw0yUn+rDJjfRuDN9y0K03kmlZIZNb5HpZ0ORlvgdNVma67Ngf8a61newp4/Vq+qQ0/qMk2MlECyLanD3JrDeBE6qnMjrC/ItZB6WO5SHk0V0zY5B0I+obHHCCt0YyoNygZtXlyGtuYxuJ5MwzFU4WJhxlcl4XHo3jSklXmcGMyKsXV9A/QyB1z X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR04MB7046.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(136003)(39860400002)(376002)(366004)(396003)(346002)(451199021)(1800799003)(186006)(2616005)(6486002)(52116002)(6666004)(6512007)(478600001)(86362001)(26005)(36756003)(1076003)(6506007)(41300700001)(316002)(8936002)(5660300002)(8676002)(7416002)(38350700002)(4326008)(2906002)(66946007)(66556008)(66476007)(38100700002)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /BCD8mgL/bQN32SgMXP3Q75ez8H4JAXoyRw5vjMqxUvQnGC5UEeHlQyV/FifHSkIsu4ghLi19yi1yvBwZyZWsVl6AkX97uC7d2hAa17t8bUf4FgQ6kWZqgUCgVMwUNzB9CEG7fIRZXIyMukRj3KnYi4uPR4CXmiEqugSuqhXGJz+7yOeiot2bdDj36GS3TIQAIS4AJRyT4lndermsTAn9pMaZxyZOlkBb1mEslWBPSstva2FwM20Lu+1NyoEMqa6k7vzPcSB05WAMQhc62L0zP5Wa1eF9FnyoMWvqkERcYE+gYbgrC2q49ssFuv0tbduF+RplN2R2MMeY3pLrCw7E2m20WvD46XcrH+SDTlr9Jg5w0dBM/8YfXc5yNVOVb0n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PkjZ0UjgmK4fEEF+lR7CKZDWO1WjJjTj1yvbXPBjBrmRzP/HOW7JHCj9SWt9cx4ntX3QEsCvhEiADEcl2iMb6ZgAW67+eLtS3yovsA5TIRY4E9Nw6IKGQSbRmThR0+M5df058R03 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 74b28467-c8c8-4ea4-1942-08db97064345 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2023 05:22:15.9278 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: H5PDXDMq3asV0u8HUwDVSYtmJHPMeNYDhMUyRWWsrj/+yXAS8os3wqEVhBnmqKOjXPX9Vhi0ssUXZo+BTZKiDQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9390 X-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: andrzej.hajda@intel.com, alexander.stein@ew.tq-group.com, Laurent.pinchart@ideasonboard.com, krzysztof.kozlowski+dt@linaro.org, zyw@rock-chips.com, rfoss@kernel.org, sam@ravnborg.org, raphael.gallais-pou@foss.st.com, jernej.skrabec@gmail.com, jagan@amarulasolutions.com, linux-imx@nxp.com, conor+dt@kernel.org, kernel@pengutronix.de, jonas@kwiboo.se, s.hauer@pengutronix.de, robh+dt@kernel.org, neil.armstrong@linaro.org, yannick.fertre@foss.st.com, hjc@rock-chips.com, philippe.cornu@foss.st.com, shawnguo@kernel.org 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 --- v1->v3: * No change. drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 14 ++++++++++++++ include/drm/bridge/dw_mipi_dsi.h | 3 +++ 2 files changed, 17 insertions(+) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c index 8cd89a63b5f2..c754d55f71d1 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c @@ -571,9 +571,23 @@ static int dw_mipi_dsi_bridge_atomic_check(struct drm_bridge *bridge, struct drm_crtc_state *crtc_state, struct drm_connector_state *conn_state) { + struct dw_mipi_dsi *dsi = bridge_to_dsi(bridge); + const struct dw_mipi_dsi_plat_data *pdata = dsi->plat_data; + bool ret; + bridge_state->input_bus_cfg.flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE; + if (pdata->mode_fixup) { + ret = pdata->mode_fixup(pdata->priv_data, &crtc_state->mode, + &crtc_state->adjusted_mode); + if (!ret) { + DRM_DEBUG_DRIVER("failed to fixup mode " DRM_MODE_FMT "\n", + DRM_MODE_ARG(&crtc_state->mode)); + return -EINVAL; + } + } + return 0; } diff --git a/include/drm/bridge/dw_mipi_dsi.h b/include/drm/bridge/dw_mipi_dsi.h index 246650f2814f..65d5e68065e3 100644 --- a/include/drm/bridge/dw_mipi_dsi.h +++ b/include/drm/bridge/dw_mipi_dsi.h @@ -59,6 +59,9 @@ struct dw_mipi_dsi_plat_data { unsigned long mode_flags, u32 lanes, u32 format); + bool (*mode_fixup)(void *priv_data, const struct drm_display_mode *mode, + struct drm_display_mode *adjusted_mode); + u32 *(*get_input_bus_fmts)(void *priv_data, struct drm_bridge *bridge, struct drm_bridge_state *bridge_state,