From patchwork Tue Nov 30 16:25:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 12647799 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 0C411C433EF for ; Tue, 30 Nov 2021 16:25:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6CE296E4B1; Tue, 30 Nov 2021 16:25:27 +0000 (UTC) Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id E0CB16E4B1 for ; Tue, 30 Nov 2021 16:25:22 +0000 (UTC) Received: from Monstersaurus.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 3E7BC11C5; Tue, 30 Nov 2021 17:25:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1638289521; bh=z/LBr2BtXn+wKIMNsARVAwt9NM7TA7F6YebNvTByVhc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EtU0OhMtG79g7buoYwGRwDzZv146QljlzlVTwBwFTgAK/eEVKcJaWQvEhCMvvO4y2 I06YUONxUx+Gbe7HtPdyjruI2sp0TWttdChaE+WJELWVEtGlzZvnay/GAAaX2XZIjt 1N4QxB3Zb4PkPvukiUN68tzJ9Ew4LvY9hQsFXzdY= From: Kieran Bingham To: Laurent Pinchart , linux-renesas-soc@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH v2 1/2] drm: rcar-du: mipi-dsi: Support bridge probe ordering Date: Tue, 30 Nov 2021 16:25:12 +0000 Message-Id: <20211130162513.2898302-2-kieran.bingham+renesas@ideasonboard.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211130162513.2898302-1-kieran.bingham+renesas@ideasonboard.com> References: <20211130162513.2898302-1-kieran.bingham+renesas@ideasonboard.com> 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: Kieran Bingham Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The bridge probe ordering for DSI devices has been clarified and further documented in To support connecting with the SN65DSI86 device after commit c3b75d4734cb ("drm/bridge: sn65dsi86: Register and attach our DSI device at probe"), update to the new probe ordering to remove a perpetual -EPROBE_DEFER loop between the two devices. Signed-off-by: Kieran Bingham --- v2 - Remove now unused panel variable from rcar_mipi_dsi_probe() drivers/gpu/drm/rcar-du/rcar_mipi_dsi.c | 49 +++++++++++++------------ 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_mipi_dsi.c b/drivers/gpu/drm/rcar-du/rcar_mipi_dsi.c index 50e922328fed..0a9f197ef62c 100644 --- a/drivers/gpu/drm/rcar-du/rcar_mipi_dsi.c +++ b/drivers/gpu/drm/rcar-du/rcar_mipi_dsi.c @@ -637,6 +637,8 @@ static int rcar_mipi_dsi_host_attach(struct mipi_dsi_host *host, struct mipi_dsi_device *device) { struct rcar_mipi_dsi *dsi = host_to_rcar_mipi_dsi(host); + struct drm_panel *panel; + int ret; if (device->lanes > dsi->num_data_lanes) return -EINVAL; @@ -644,12 +646,36 @@ static int rcar_mipi_dsi_host_attach(struct mipi_dsi_host *host, dsi->lanes = device->lanes; dsi->format = device->format; + ret = drm_of_find_panel_or_bridge(dsi->dev->of_node, 1, 0, &panel, + &dsi->next_bridge); + if (ret) { + dev_err_probe(dsi->dev, ret, "could not find next bridge\n"); + return ret; + } + + if (!dsi->next_bridge) { + dsi->next_bridge = devm_drm_panel_bridge_add(dsi->dev, panel); + if (IS_ERR(dsi->next_bridge)) { + dev_err(dsi->dev, "failed to create panel bridge\n"); + return PTR_ERR(dsi->next_bridge); + } + } + + /* Initialize the DRM bridge. */ + dsi->bridge.funcs = &rcar_mipi_dsi_bridge_ops; + dsi->bridge.of_node = dsi->dev->of_node; + drm_bridge_add(&dsi->bridge); + return 0; } static int rcar_mipi_dsi_host_detach(struct mipi_dsi_host *host, struct mipi_dsi_device *device) { + struct rcar_mipi_dsi *dsi = host_to_rcar_mipi_dsi(host); + + drm_bridge_remove(&dsi->bridge); + return 0; } @@ -731,7 +757,6 @@ static int rcar_mipi_dsi_get_clocks(struct rcar_mipi_dsi *dsi) static int rcar_mipi_dsi_probe(struct platform_device *pdev) { struct rcar_mipi_dsi *dsi; - struct drm_panel *panel; struct resource *mem; int ret; @@ -764,21 +789,6 @@ static int rcar_mipi_dsi_probe(struct platform_device *pdev) return PTR_ERR(dsi->rstc); } - ret = drm_of_find_panel_or_bridge(dsi->dev->of_node, 1, 0, &panel, - &dsi->next_bridge); - if (ret) { - dev_err_probe(dsi->dev, ret, "could not find next bridge\n"); - return ret; - } - - if (!dsi->next_bridge) { - dsi->next_bridge = devm_drm_panel_bridge_add(dsi->dev, panel); - if (IS_ERR(dsi->next_bridge)) { - dev_err(dsi->dev, "failed to create panel bridge\n"); - return PTR_ERR(dsi->next_bridge); - } - } - /* Initialize the DSI host. */ dsi->host.dev = dsi->dev; dsi->host.ops = &rcar_mipi_dsi_host_ops; @@ -786,11 +796,6 @@ static int rcar_mipi_dsi_probe(struct platform_device *pdev) if (ret < 0) return ret; - /* Initialize the DRM bridge. */ - dsi->bridge.funcs = &rcar_mipi_dsi_bridge_ops; - dsi->bridge.of_node = dsi->dev->of_node; - drm_bridge_add(&dsi->bridge); - return 0; } @@ -798,8 +803,6 @@ static int rcar_mipi_dsi_remove(struct platform_device *pdev) { struct rcar_mipi_dsi *dsi = platform_get_drvdata(pdev); - drm_bridge_remove(&dsi->bridge); - mipi_dsi_host_unregister(&dsi->host); return 0; From patchwork Tue Nov 30 16:25:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 12647801 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 4E7F0C433F5 for ; Tue, 30 Nov 2021 16:25:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7330C6E52A; Tue, 30 Nov 2021 16:25:27 +0000 (UTC) Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id 310D76E52A for ; Tue, 30 Nov 2021 16:25:23 +0000 (UTC) Received: from Monstersaurus.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8715E1447; Tue, 30 Nov 2021 17:25:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1638289521; bh=tPTO6x4/UmqDVDNMFfhIt7vn9FEScoUNFaizGSmWb3Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Erinv4cC7+StbzjmVPXo/DMz5PnMqVrzoPrrufyUAUIgrzoA8++rt0IjABmnDrfLy cExEBcOZaZQS19qta0Ul92ePEbrOa/e8qn5v9/j78LyP1oYCYD+2TkasI5YX+RC1Rx Sdwc+lMb95uI47b+CeEQWt5HJ3EgyrSTQFc1spE0= From: Kieran Bingham To: Laurent Pinchart , linux-renesas-soc@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH v2 2/2] drm: rcar-du: mipi-dsi: Use devm_drm_of_get_bridge helper Date: Tue, 30 Nov 2021 16:25:13 +0000 Message-Id: <20211130162513.2898302-3-kieran.bingham+renesas@ideasonboard.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211130162513.2898302-1-kieran.bingham+renesas@ideasonboard.com> References: <20211130162513.2898302-1-kieran.bingham+renesas@ideasonboard.com> 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: Kieran Bingham Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Instead of open coding the calls for drm_of_find_panel_or_bridge() devm_drm_panel_bridge_add() use the devm_drm_of_get_bridge() helper directly. Signed-off-by: Kieran Bingham --- v2: - New patch drivers/gpu/drm/rcar-du/rcar_mipi_dsi.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_mipi_dsi.c b/drivers/gpu/drm/rcar-du/rcar_mipi_dsi.c index 0a9f197ef62c..1dfe20d3d0f2 100644 --- a/drivers/gpu/drm/rcar-du/rcar_mipi_dsi.c +++ b/drivers/gpu/drm/rcar-du/rcar_mipi_dsi.c @@ -637,7 +637,7 @@ static int rcar_mipi_dsi_host_attach(struct mipi_dsi_host *host, struct mipi_dsi_device *device) { struct rcar_mipi_dsi *dsi = host_to_rcar_mipi_dsi(host); - struct drm_panel *panel; + struct device *dev = dsi->dev; int ret; if (device->lanes > dsi->num_data_lanes) @@ -646,20 +646,9 @@ static int rcar_mipi_dsi_host_attach(struct mipi_dsi_host *host, dsi->lanes = device->lanes; dsi->format = device->format; - ret = drm_of_find_panel_or_bridge(dsi->dev->of_node, 1, 0, &panel, - &dsi->next_bridge); - if (ret) { - dev_err_probe(dsi->dev, ret, "could not find next bridge\n"); - return ret; - } - - if (!dsi->next_bridge) { - dsi->next_bridge = devm_drm_panel_bridge_add(dsi->dev, panel); - if (IS_ERR(dsi->next_bridge)) { - dev_err(dsi->dev, "failed to create panel bridge\n"); - return PTR_ERR(dsi->next_bridge); - } - } + dsi->next_bridge = devm_drm_of_get_bridge(dev, dev->of_node, 1, 0); + if (IS_ERR(dsi->next_bridge)) + return PTR_ERR(dsi->next_bridge); /* Initialize the DRM bridge. */ dsi->bridge.funcs = &rcar_mipi_dsi_bridge_ops;