From patchwork Thu Jul 20 07:10:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13319876 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 BD2FDEB64DA for ; Thu, 20 Jul 2023 07:10:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C76DA10E567; Thu, 20 Jul 2023 07:10:13 +0000 (UTC) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on062d.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe02::62d]) by gabe.freedesktop.org (Postfix) with ESMTPS id 16C3F10E567 for ; Thu, 20 Jul 2023 07:10:11 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bo1d3ynAPtQ02ZEwHe7iiZ+wjvIcUi48AlhylN0aO4oOpFh2BEkVN8u6kCTAVxjTrbXuCaWRS/FMaiXp6BfR2A2W0EHWtY7qCHdFU3snvpb1lVbMAJVKdbey+sukA5vdyKkq8/m1XN5hjOiqztyvn0qOCi9q+9HV1pHR9yABa52EnV6/UlpTcIuie4DCyoTvezbeuy8rS4D2Aiv9QwkDBAKxX9oaCaZFgLTXhPqKw6IL9q5t8SCOkDC2zeyWwZ4awYQl4Kx/USUeKCPwWq71LwY0duWp45mPoWcaxb9lANXkwsSY+lc6h7LORfRDwofP7eBbw/AEM2AGNENTv/4RLw== 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=6BTL19AEog0wfHvJBaYbx4+o0nMsy/EIbPzhBO7+D58=; b=JtAuQhos2JWANKYBmC97I9eHMQz/qr9hO5ZppAaUuyr+V8wjVlhABFa8n1EmGAkEVdCLdeq+YHR2j/I9uw4KDnnPKCX1UA+HuPpExptWdRIOjHfJF/ENTFGjb1Ng0JJgvIiG7y0FxxJYzDJfQM/DsZeUna8FJcMAFBODnMcGlnYBv5LfT3nSztGhz5TwkjJ4ZjfTc+tIZnqXJvu/1uZMeHXna8WRE9bKMZNqALeI4BE1h4lvp2Ybt3nlf5yO8Qr2+O7uIu/zSBFL8o8fZrfF/ASMTgro+rKb5a2z9Paa/7FZ/6PfxQ/uGOIM/VoVjJwHEAn8sGd7D+NoWAV6DGGbBA== 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=6BTL19AEog0wfHvJBaYbx4+o0nMsy/EIbPzhBO7+D58=; b=iGaMjaL7qcWDklOBHXvGBfUERJpIBITJHFWCI7vKsH1wR8nwamZwL6qfngnS/wvW25oQYQn5nXfWagWf+L6aR9ddx8wxOXjAg7FVs4FxzKzZdvqbbpzRuPW6ZsNSzhnV3h/iVZcbTa7v+hUIGAfkVy/92HiNyIA0bxl18gOI+00= Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by AM9PR04MB8415.eurprd04.prod.outlook.com (2603:10a6:20b:3b5::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Thu, 20 Jul 2023 07:10:06 +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.6609.022; Thu, 20 Jul 2023 07:10:06 +0000 From: Ying Liu To: "dri-devel@lists.freedesktop.org" , "devicetree@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" Subject: [PATCH v2 3/9] drm/bridge: synopsys: dw-mipi-dsi: Force input bus flags Thread-Topic: [PATCH v2 3/9] drm/bridge: synopsys: dw-mipi-dsi: Force input bus flags Thread-Index: Adm62TZXrb2BNeOVFECO4yk1+av6XQ== Date: Thu, 20 Jul 2023 07:10:06 +0000 Message-ID: <20230720071430.259892-4-victor.liu@nxp.com> References: <20230720071430.259892-1-victor.liu@nxp.com> In-Reply-To: <20230720071430.259892-1-victor.liu@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SI2PR01CA0039.apcprd01.prod.exchangelabs.com (2603:1096:4:193::16) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) x-mailer: git-send-email 2.37.1 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: AM7PR04MB7046:EE_|AM9PR04MB8415:EE_ x-ms-office365-filtering-correlation-id: 38b87bdf-7560-45bd-0121-08db88f058d3 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: NU8uMLmZsB09bW1pL6ggEe+w516rajxzxPFu9DV8IklCoedasObbZBVjfaVaFDqSxyQcBqNpfC3tUXz5yT5fGmcW2cnZcjGLpKoL66AT8sjuk9exldIo9H97n5B0Wr91b0exQYsUizT/upvYX/7HKXMokmMqzmkA4uRckkdFABFYw95abFLLck2y8v6YH7XPxMlhdIamdcV+JcxvkUu5xB4wJGCYrKsTyTAgZxH0HzspspUfS/QRuxXtRVyCFdZWQzLRQL9DLiYNWaVWz1C3ZupXRXpwvLwqefw78E8fsZj3gl2zBZ2BzVMpZ8CxYxM0CqLllb33N9vnoXDarpjGcqrUt6eptqyHeug2Vm1q/xrLN5REHqQd2i099ysUq8E5V91H6bO8frml1j+WHsb6e+qY3gO/8GCmmOe+JkcD/c5z33l62JG4eQ3M83VinyEUUcw5mMfsOys1eQRFahyJ+NQlT35Xh1I9qfIB0XvPY/kHfEgVZ8cHr8QgEXthhGwqQLNNg3JAVsHe+0gUef0W3Nz9SE8R/kAm0fu4lpIboF9utahTNPrghw7m2FNgsynvS3FV/zc7nq7xz5C/ZSPvNgsNRJ9kdKtN4AILd22Ql258ktXIWtFgsXU4jHpgISLs 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)(366004)(136003)(376002)(39860400002)(346002)(396003)(451199021)(6506007)(478600001)(1076003)(26005)(6486002)(52116002)(2906002)(6512007)(71200400001)(4326008)(5660300002)(66556008)(316002)(66946007)(66476007)(66446008)(54906003)(110136005)(64756008)(38350700002)(36756003)(38100700002)(7416002)(8936002)(8676002)(86362001)(186003)(2616005)(41300700001)(122000001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?zIHFoBxf8NMFAXTa5Z1RM9p?= =?iso-8859-1?q?BGdHvLPb0yeF2O4p3ST/Pi9Xc+L2ORWRuhpNpILRfDlFzuvhUEbBRSjdTGYI?= =?iso-8859-1?q?5HvyQp3w1hckEUfiVIvhcvLcix1ozzMnXKnDHT/r81qv+gvnjKrHA8fpyBFh?= =?iso-8859-1?q?2yxbelo7JlPMNV2vcKkwT/IjyZbgtCxUjVbXtv3t8Jj+cjFI7neHN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E1K9ZB9OIR/1O1ohEyPtU7nSWiOORaM3UwawT1FrLNDkO6rUK0iQD?= =?iso-8859-1?q?UDMerQK3BraOY9mHgvReaLECjUtgskLpyIUHVgOQXp4Qnv2CeR30QzapjCXi?= =?iso-8859-1?q?BPLf6y/98RBE390Masc4PElLrlVZPp4bNjiKKc37btaUB+moQ/rNpcgE1/t8?= =?iso-8859-1?q?TKrNdImk20vbcs++4WZmU52rZIpkahwNITNQ44KyBumo/urCesoAYcbvfT9w?= =?iso-8859-1?q?kZdthyan62Ue6UTsa6vMfaEG8/coRYaSzMh1Id6Ez4FYlrvagWm+rEBwCWs4?= =?iso-8859-1?q?R/GzqUzokMse1h0b+TEyuyPa9K9ruK8S8f/rj25cZ2Hgoy/IpLt04Q3miI1E?= =?iso-8859-1?q?5SZqjvkYmIO3itAwee8qrcuJjL/2cuUNCZ2MaadcLSI3gzGCR23Pmgj6y6PW?= =?iso-8859-1?q?gMCYBwQ2EzVxS2j9K10nyHvMceP66DDJzEYkWORpB2PWlimE/Zr8XyG/9XhR?= =?iso-8859-1?q?XY7z4FGyX5kOL6A42Y02Uley9399QI+8UZ1Y4rcMraF7cn36mSWOdcEBjaSf?= =?iso-8859-1?q?AnxhA9uN458qgmQT7?= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 38b87bdf-7560-45bd-0121-08db88f058d3 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jul 2023 07:10:06.6794 (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: uaFbzr3wEexWGxkY1BKL9COdyLd9Uo5TUYHJovibrOApMaDek8AqKpG/hocgohmSU3EfLysonS92BD/VSmUfOQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8415 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" , "alexander.stein@ew.tq-group.com" , "shawnguo@kernel.org" , "s.hauer@pengutronix.de" , "jernej.skrabec@gmail.com" , "sam@ravnborg.org" , "jagan@amarulasolutions.com" , "robh+dt@kernel.org" , "Laurent.pinchart@ideasonboard.com" , "andrzej.hajda@intel.com" , "kernel@pengutronix.de" , dl-linux-imx 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 --- v1->v2: * No change. drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c index 8580b8a97fb1..8cd89a63b5f2 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -565,6 +566,17 @@ dw_mipi_dsi_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge, return input_fmts; } +static int dw_mipi_dsi_bridge_atomic_check(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state) +{ + bridge_state->input_bus_cfg.flags = + DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE; + + return 0; +} + static void dw_mipi_dsi_video_mode_config(struct dw_mipi_dsi *dsi) { u32 val; @@ -1033,6 +1045,7 @@ static const struct drm_bridge_funcs dw_mipi_dsi_bridge_funcs = { .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, .atomic_get_input_bus_fmts = dw_mipi_dsi_bridge_atomic_get_input_bus_fmts, + .atomic_check = dw_mipi_dsi_bridge_atomic_check, .atomic_reset = drm_atomic_helper_bridge_reset, .atomic_enable = dw_mipi_dsi_bridge_atomic_enable, .atomic_post_disable = dw_mipi_dsi_bridge_post_atomic_disable,