From patchwork Mon Aug 21 03:40:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 715557 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2DE70EE49A6 for ; Mon, 21 Aug 2023 03:37:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232700AbjHUDh1 (ORCPT ); Sun, 20 Aug 2023 23:37:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232690AbjHUDh0 (ORCPT ); Sun, 20 Aug 2023 23:37:26 -0400 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2059.outbound.protection.outlook.com [40.107.104.59]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C436E8 for ; Sun, 20 Aug 2023 20:37:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GwJbvLfkJnjg5lH1cquNrB63HWRSKg5CaVXDdOjBsWEx+7FSTslqDgjPf71iMvrI6JcD/4Usfr+r6xdTQ8jnWdS0WunzGj69Wy+mXzjFsk17EQn6SvIiOryHdSGEjVx9bgqQ1XjY1AHn3jM1xBklAqv1S7NuEJK4eGErgkchBKLxEMg6xn7CK4Q0UFzn4Y+Z510rqzWeaFqu/7UtVS91XOWfGXuzwjdW5tRiCUangbwWZ4gla+ds5zYRaY+358uE/9ltYrU4JD/FxRYZX6WfiTKMSJLDTW+lRwPCs0FsD5X7Nf4VcEfvIYIInoyE4k2JMBnrb44WKbPr+d8vBbpKxg== 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=G9pohsnP03WT5gNWkT4QfeROXZdvrfaWd96SBV+bF+E=; b=JLDsn7X4kg5GFICvZN06yIu7UWdXnTqm6dwxFw3KfPk2gnddPIknGpcxBj300uAT29msTF5SL2WERlANYD50sHGfp1tI5vYRejlXyF4OL1UZMB0LzPojALEHN4EBKwRXWljHlDsO/0f9SVMgvZ7g8C6kgdcmgYX7ryqfQZk1vRFHmecmrS1vCKRmEwOt1Ttx51Je33Jcfm+wY0RU6/yxR9+Mb5nwRmYQdRDNkaaLYrEGPd7z/Mibuk6TWuKtK577hQuJj2pz4WLfGd2JfPfAzFDhWQc9v8VdvWPxnMucIw/hC9yuoU35NqgmH5UwXme42EGLhs7BLOa42bBxTSyqWg== 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=G9pohsnP03WT5gNWkT4QfeROXZdvrfaWd96SBV+bF+E=; b=HeMq56O5uL4bjig3zVQv77TrUz0Gg32Rzh/K+HQ9O67VwZ+GWekN+S7g+ftExprkyAx2hw/y/OFYnysBiQvq1bb4cTuoHQ26OwEEmQIQhWu80gry1oDT4QSe+m3qJCbG7rraabNcwnmF8OOtf0ixak3ck1nN84VhwGV170XJ/Dc= 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:04 +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:04 +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 3/9] drm/bridge: synopsys: dw-mipi-dsi: Force input bus flags Date: Mon, 21 Aug 2023 11:40:02 +0800 Message-Id: <20230821034008.3876938-4-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: b51e69dc-9d62-4ed1-a6d5-08dba1f7e339 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /2bXwdLl9+4ZK9KE/uRuA8sdWF7+dFmdULWNzok/AuGSBkIsHrDsUOu6l5P33//XJCHDe6sxV+6yvhVHWT4/mBZAd1JABHWSF2DTvW3Damk3mo0kiHgM3f6bYcR1C1mfjePGConE0dHgw2stoqLCKb3F6/MyNio2RJ7QQ/8Mn6ly7EYwM+ZeyD31HGyf/gTmDEf445Pjn0Xe5yqP//A/5/1FdYR/vf3+r0KOl/zws/+1nVZHqJLTmF0wvhsxYeSaYJqe7ReLIbJHmcbBInH6YeO0xr6f7v5+m9OpZGS+GSqbosEtoQbZs4wcEyyAxCZ9Ccy43RGAv0adk0fSWjcwax9kTxzHnY5ExaCQ2xPxmdi15VDePEwqa2V1lxU+KcqMssD1Z8xYVgUZJ7hR1H64CXUij6/Hhkdpp1C0c6bu3VFOpF0xxRPynAvBeyh1J3gSRlotSeny9Y58E0PZsf05w//dcSy6baRi3LfhqX5FWcAqCSi07ae8o0pLlvhPa8Ij3YruMYTahpIJNGHn37E6cpz1by5PBV6gho86UcVNV7f3zwufy6eyETpCjRWlwqbvBKhycjxjAh4mmwj74ofkqcQALQ5i8m5+ji/Sa8mJ/Xm0uNVmBi+8A6OigYgCQtdd 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)(316002)(8936002)(8676002)(41300700001)(66476007)(66556008)(66946007)(2906002)(4326008)(478600001)(7416002)(6506007)(6486002)(52116002)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount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Qi+siT0AbMpVvzzq4/pPcOEItZKbuqvHRHrCfsS+jX0j/ww6+O4bwztWm7IAyxPybiGpcOLHUIbBiNV0G8V6u87FJCQumucztUCzBWcg8mlsxSQgayBx3R/5Qt7P4dl8tgIu5oIvsehIDNqGyiYzr5lshMv+G6bookShQxIX791TkX0kQK952MYbN/UohzTPzC7tJZoS/locm4iU8tbrZCUZqqVDaFfXip4LM+UnvZOTtrta9hZ5yeUtjG7/KDQNXaGvCwBjDzNmohKflRv+jZOYnYLwNOFoAfZvaIHfWQPU29qcChj1dvB+wmeqdzJYrkhI+0GBi7MowjM5yKUmUwyX0/YLvBpWY13itoOHLMRtRdS7LLHOOoLEYX9rAJTc1Apl3VN6KqH3fRYfnwY4zh8whBDFePIMxrbL1gNNiWOqbuRgONnqozxvK9M8t42t0Bi0KreSYuwTiTJl5ZguCUIPOogE5Ucnv6zSd26d93lCdXetPhYBIJbM11Cxf9ph1GCeC5XD2q96EK+IUfdv0oGOnRSu8u5pc0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b51e69dc-9d62-4ed1-a6d5-08dba1f7e339 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:04.6711 (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: HcWkeLMGkKQyhz1QyOYnhMcORIVcY+ydWjRZL0Id27f7Kjbo93Ph8KzrwyXI0lsz0TWndz9etTRJFxg2FJKg7g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7758 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The DATAEN_ACTIVE_LOW bit in DSI_DPI_CFG_POL register is set to zero, so set the DRM_BUS_FLAG_DE_HIGH flag in input_bus_cfg.flags. It appears that the DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE flag also makes sense, so set it in input_bus_cfg.flags too. With this patch, the flags set by drm_atomic_bridge_propagate_bus_flags() are overridden (see comment in that function) in case any downstream bridges propagates invalid flags to this bridge. A real problematic case is to connect a RM67191 MIPI DSI panel whose driver sets DRM_BUS_FLAG_DE_LOW and DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE bus flags. Signed-off-by: Liu Ying Reviewed-by: Robert Foss --- v1->v3: * No change. drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c index 945d46a76995..ed9288a9c444 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 @@ -567,6 +568,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; @@ -1036,6 +1048,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_pre_enable = dw_mipi_dsi_bridge_atomic_pre_enable, .atomic_enable = dw_mipi_dsi_bridge_atomic_enable,