From patchwork Fri Nov 26 10:15:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 12640345 X-Patchwork-Delegate: kieran@bingham.xyz 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 DD1DFC433EF for ; Fri, 26 Nov 2021 10:17:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376667AbhKZKUg (ORCPT ); Fri, 26 Nov 2021 05:20:36 -0500 Received: from perceval.ideasonboard.com ([213.167.242.64]:49756 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234676AbhKZKSg (ORCPT ); Fri, 26 Nov 2021 05:18:36 -0500 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 A1D3FE2C; Fri, 26 Nov 2021 11:15:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1637921722; bh=OfttgS/xTaJk42xnYb6koDiIyJnqo0L8BOT6eZE1OgQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VZyFt9FCi9zKXqrILKVXyodaEYAj8d20xeYEKHgPaiK2Xz73/JPCtqNH2tdGA5JYk VelPUCSheUNNAWvP8TlYD1EfZ2aNZQZxutM23hRwrIgstuSIRtHSeuupde6pe/71Gc kBXCrSmgdA54f9ZfSZEteMdzAPBti9D5HtwO9d/4= From: Kieran Bingham To: Laurent Pinchart , linux-renesas-soc@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Kieran Bingham Subject: [PATCH 1/4] drm: rcar-du: Fix Makefile indentation for DSI Date: Fri, 26 Nov 2021 10:15:15 +0000 Message-Id: <20211126101518.938783-2-kieran.bingham+renesas@ideasonboard.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211126101518.938783-1-kieran.bingham+renesas@ideasonboard.com> References: <20211126101518.938783-1-kieran.bingham+renesas@ideasonboard.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org From: Kieran Bingham Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/rcar-du/Makefile b/drivers/gpu/drm/rcar-du/Makefile index adc1b49d02cf..286bc81b3e7c 100644 --- a/drivers/gpu/drm/rcar-du/Makefile +++ b/drivers/gpu/drm/rcar-du/Makefile @@ -19,7 +19,7 @@ obj-$(CONFIG_DRM_RCAR_CMM) += rcar_cmm.o obj-$(CONFIG_DRM_RCAR_DU) += rcar-du-drm.o obj-$(CONFIG_DRM_RCAR_DW_HDMI) += rcar_dw_hdmi.o obj-$(CONFIG_DRM_RCAR_LVDS) += rcar_lvds.o -obj-$(CONFIG_DRM_RCAR_MIPI_DSI) += rcar_mipi_dsi.o +obj-$(CONFIG_DRM_RCAR_MIPI_DSI) += rcar_mipi_dsi.o # 'remote-endpoint' is fixed up at run-time DTC_FLAGS_rcar_du_of_lvds_r8a7790 += -Wno-graph_endpoint From patchwork Fri Nov 26 10:15:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 12640365 X-Patchwork-Delegate: kieran@bingham.xyz 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 D93E4C433F5 for ; Fri, 26 Nov 2021 10:29:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377239AbhKZKcu (ORCPT ); Fri, 26 Nov 2021 05:32:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376831AbhKZKat (ORCPT ); Fri, 26 Nov 2021 05:30:49 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54D15C0619F1; Fri, 26 Nov 2021 02:17:25 -0800 (PST) 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 082271253; Fri, 26 Nov 2021 11:15:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1637921723; bh=/NxkguvbJpSme2X46XXvrov0xFXe3nBtHvsHHSVlCss=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pzzdZM+hekooz75iasjEsORioKOkxcFKn+cnUM0/LeFsdcLL+1vEv7atZ0R+MF5p7 qf+lNFkA+1ZhnlpSAuUFmLYzA1jUsRtu2AN/xeK7QsBTgJ8peNLsGft4RkBsBDAzLo 6/Zb9BqVBOKdwRDrAASuIXalJxDy+Jp8dCoFqcIo= From: Kieran Bingham To: Laurent Pinchart , linux-renesas-soc@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Kieran Bingham Subject: [PATCH 2/4] drm: rcar-du: Select DRM_MIPI_DSI with DRM_RCAR_MIPI_DSI Date: Fri, 26 Nov 2021 10:15:16 +0000 Message-Id: <20211126101518.938783-3-kieran.bingham+renesas@ideasonboard.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211126101518.938783-1-kieran.bingham+renesas@ideasonboard.com> References: <20211126101518.938783-1-kieran.bingham+renesas@ideasonboard.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org The RCAR_MIPI_DSI uses the DRM_MIPI_DSI interface. Ensure that it is selected when the option is enabled. Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/rcar-du/Kconfig b/drivers/gpu/drm/rcar-du/Kconfig index 8cb94fe90639..8145c6d4cbc8 100644 --- a/drivers/gpu/drm/rcar-du/Kconfig +++ b/drivers/gpu/drm/rcar-du/Kconfig @@ -41,6 +41,7 @@ config DRM_RCAR_LVDS config DRM_RCAR_MIPI_DSI tristate "R-Car DU MIPI DSI Encoder Support" depends on DRM && DRM_BRIDGE && OF + select DRM_MIPI_DSI help Enable support for the R-Car Display Unit embedded MIPI DSI encoders. From patchwork Fri Nov 26 10:15:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 12640357 X-Patchwork-Delegate: kieran@bingham.xyz 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 B9F0DC433F5 for ; Fri, 26 Nov 2021 10:19:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348127AbhKZKWi (ORCPT ); Fri, 26 Nov 2021 05:22:38 -0500 Received: from perceval.ideasonboard.com ([213.167.242.64]:49810 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376671AbhKZKUh (ORCPT ); Fri, 26 Nov 2021 05:20:37 -0500 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 65D5D1269; Fri, 26 Nov 2021 11:15:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1637921723; bh=sHtu4YZjz1duGU3+mxBG0gSBUA7LlDf0Si/PgC3rKYg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VPJe0VExl9vnJC/1txZPwDwwcwu9Ku4mPlx1l1giIS2YgUNvSRcKIs8zkxFn6X7J4 AlDrMO7TIGIqrIseVDPqgwTPdyxO6KnH7Ar31Syoxr8TsVTpPItuTq95zqzsZzu0ho +8UB0hG0NWdSKuNV8Nkm+C9KOhABEm0xU9LhOpS8= From: Kieran Bingham To: Laurent Pinchart , linux-renesas-soc@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Kieran Bingham Subject: [PATCH 3/4] drm: rcar-du: mipi-dsi: Ensure correct fout is reported Date: Fri, 26 Nov 2021 10:15:17 +0000 Message-Id: <20211126101518.938783-4-kieran.bingham+renesas@ideasonboard.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211126101518.938783-1-kieran.bingham+renesas@ideasonboard.com> References: <20211126101518.938783-1-kieran.bingham+renesas@ideasonboard.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org The debug reporting for the clock calculations was erroneously reporting the last calculation of fout, rather than the fout that was determined to have the least error, and therefore be the values chosen to operate with. Fix the reporting to show the correct output by storing the determined fout, along with the error value. Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- I spent /way/ too long confused why my clock values didn't make sense before I noticed this.. :-( drivers/gpu/drm/rcar-du/rcar_mipi_dsi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_mipi_dsi.c b/drivers/gpu/drm/rcar-du/rcar_mipi_dsi.c index e94245029f95..833f4480bdf3 100644 --- a/drivers/gpu/drm/rcar-du/rcar_mipi_dsi.c +++ b/drivers/gpu/drm/rcar-du/rcar_mipi_dsi.c @@ -168,6 +168,7 @@ static int rcar_mipi_dsi_phtw_test(struct rcar_mipi_dsi *dsi, u32 phtw) */ struct dsi_setup_info { + unsigned long fout; unsigned int err; u16 vco_cntrl; u16 prop_cntrl; @@ -247,6 +248,7 @@ static void rcar_mipi_dsi_parameters_calc(struct rcar_mipi_dsi *dsi, setup_info->m = m - 2; setup_info->n = n - 1; setup_info->err = err; + setup_info->fout = fout; if (err == 0) goto done; } @@ -256,7 +258,7 @@ static void rcar_mipi_dsi_parameters_calc(struct rcar_mipi_dsi *dsi, done: dev_dbg(dsi->dev, "%pC %lu Hz -> Fout %lu Hz (target %lu Hz, error %d.%02u%%), PLL M/N/DIV %u/%u/%u\n", - clk, fin, fout, fout_target, setup_info->err / 100, + clk, fin, setup_info->fout, fout_target, setup_info->err / 100, setup_info->err % 100, setup_info->m, setup_info->n, setup_info->div); dev_dbg(dsi->dev, From patchwork Fri Nov 26 10:15:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 12640359 X-Patchwork-Delegate: kieran@bingham.xyz 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 13F7FC433EF for ; Fri, 26 Nov 2021 10:19:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376635AbhKZKWj (ORCPT ); Fri, 26 Nov 2021 05:22:39 -0500 Received: from perceval.ideasonboard.com ([213.167.242.64]:49812 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376685AbhKZKUj (ORCPT ); Fri, 26 Nov 2021 05:20:39 -0500 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 B82CC148B; Fri, 26 Nov 2021 11:15:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1637921723; bh=qI1H7VYrHIFCPRdhdtphotkQv5wrmJn/4zKU6uqux7g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=acG8Dl7SOTF8ovCfnjpR6GAduMiAiuVuyn60hNQI92KGsFvQ+nwBHpydm8ndVOSnO mSKqwNNZbxY3cCoJ7kKDDuki/Q6lqPS77F1y12/FwMsHCTepT2VxDXIQ5fF1QxxSR0 JMcO1z0O+KczeKN39DcPZUKNyzboHfaL0eWKQRQY= From: Kieran Bingham To: Laurent Pinchart , linux-renesas-soc@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Kieran Bingham Subject: [PATCH 4/4] drm: rcar-du: mipi-dsi: Support bridge probe ordering Date: Fri, 26 Nov 2021 10:15:18 +0000 Message-Id: <20211126101518.938783-5-kieran.bingham+renesas@ideasonboard.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211126101518.938783-1-kieran.bingham+renesas@ideasonboard.com> References: <20211126101518.938783-1-kieran.bingham+renesas@ideasonboard.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org 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 --- drivers/gpu/drm/rcar-du/rcar_mipi_dsi.c | 48 +++++++++++++------------ 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_mipi_dsi.c b/drivers/gpu/drm/rcar-du/rcar_mipi_dsi.c index 833f4480bdf3..f783bacee8da 100644 --- a/drivers/gpu/drm/rcar-du/rcar_mipi_dsi.c +++ b/drivers/gpu/drm/rcar-du/rcar_mipi_dsi.c @@ -639,6 +639,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; @@ -646,12 +648,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; } @@ -766,21 +792,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; @@ -788,11 +799,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; } @@ -800,8 +806,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;