From patchwork Tue Dec 17 22:41:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Heiko_St=C3=BCbner?= X-Patchwork-Id: 11299009 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E34A1139A for ; Tue, 17 Dec 2019 22:42:15 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id CAE3321582 for ; Tue, 17 Dec 2019 22:42:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CAE3321582 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sntech.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EDC406E183; Tue, 17 Dec 2019 22:42:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from gloria.sntech.de (gloria.sntech.de [185.11.138.130]) by gabe.freedesktop.org (Postfix) with ESMTPS id EFDE06E183 for ; Tue, 17 Dec 2019 22:42:11 +0000 (UTC) Received: from ip5f5a5f74.dynamic.kabel-deutschland.de ([95.90.95.116] helo=phil.sntech) by gloria.sntech.de with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1ihLXS-0001N7-EX; Tue, 17 Dec 2019 23:41:58 +0100 From: Heiko Stuebner To: a.hajda@samsung.com Subject: [PATCH] drm/bridge/synopsys: dsi: use mipi_dsi_device to find panel or bridge Date: Tue, 17 Dec 2019 23:41:50 +0100 Message-Id: <20191217224150.20540-1-heiko@sntech.de> X-Mailer: git-send-email 2.24.0 MIME-Version: 1.0 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: narmstrong@baylibre.com, Heiko Stuebner , philippe.cornu@st.com, dri-devel@lists.freedesktop.org, yannick.fertre@st.com, maxime@cerno.tech, christoph.muellner@theobroma-systems.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Heiko Stuebner Right now the dsi driver uses drm_of_find_panel_or_bridge() to find a connected panel or bridge. But this requires an of-graph connection between the dsi-host and dsi-device, where normal bindings for regular panels just expect the dsi device to be a subnode of the actual dsi host not requiring ports. drm_of_find_panel_or_bridge is used to find panel/bridge under the actual device-node of the dsi device, but as this happens in the dsi_host_attach callback we already have the dsi-device and its device-node available and therefore can just call the relevant panel+bridge functions ourself, making it work as well in setups without port-connections. Tested on a Rockchip px30 single-dsi with panels form Leadtek and Xinpeng as well on Gru-Scarlet (rk3399) with dual-dsi (and thus port-connections to both dsi controllers) connected to the Innotek display variant. changes in v2: - rework commit message, rereading what I had written was just too cringe-worthy ;-) Signed-off-by: Heiko Stuebner --- drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c index 981d532cdd59..4b4961e7c680 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -310,16 +311,16 @@ static int dw_mipi_dsi_host_attach(struct mipi_dsi_host *host, dsi->format = device->format; dsi->mode_flags = device->mode_flags; - ret = drm_of_find_panel_or_bridge(host->dev->of_node, 1, 0, - &panel, &bridge); - if (ret) - return ret; - - if (panel) { + panel = of_drm_find_panel(device->dev.of_node); + if (!IS_ERR(panel)) { bridge = drm_panel_bridge_add_typed(panel, DRM_MODE_CONNECTOR_DSI); if (IS_ERR(bridge)) return PTR_ERR(bridge); + } else { + bridge = of_drm_find_bridge(device->dev.of_node); + if (!bridge) + return -EPROBE_DEFER; } dsi->panel_bridge = bridge; @@ -340,6 +341,7 @@ static int dw_mipi_dsi_host_detach(struct mipi_dsi_host *host, { struct dw_mipi_dsi *dsi = host_to_dsi(host); const struct dw_mipi_dsi_plat_data *pdata = dsi->plat_data; + struct drm_bridge *bridge; int ret; if (pdata->host_ops && pdata->host_ops->detach) { @@ -348,7 +350,8 @@ static int dw_mipi_dsi_host_detach(struct mipi_dsi_host *host, return ret; } - drm_of_panel_bridge_remove(host->dev->of_node, 1, 0); + bridge = of_drm_find_bridge(device->dev.of_node); + drm_panel_bridge_remove(bridge); drm_bridge_remove(&dsi->bridge);