From patchwork Tue Jan 17 13:51:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 13104691 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 4C539C678D4 for ; Tue, 17 Jan 2023 13:53:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229667AbjAQNxs (ORCPT ); Tue, 17 Jan 2023 08:53:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229753AbjAQNxG (ORCPT ); Tue, 17 Jan 2023 08:53:06 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5408F3CE0D for ; Tue, 17 Jan 2023 05:52:16 -0800 (PST) Received: from desky.lan (91-154-32-225.elisa-laajakaista.fi [91.154.32.225]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A48B14DA; Tue, 17 Jan 2023 14:52:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1673963534; bh=gqEoZlraEbJMlFqHIIVcwSD4C6uq/6FiErgijUHtE68=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sGst5Ep6px+bRn3jaPjTxWE4iOOW7p8VEFILJT408Jw8JYCL9v1Jy5cbaQZD25P+2 p4ZMFosyGsHY7VgYLqysuOcJmn4/DA9GOq8E4GjAqLe1TlEVQRY99NscTtBK6xkEJv HAlU+uQzSmRmeOP3mgIGncICTPc0x7zeHxZ6QIi4= From: Tomi Valkeinen To: Laurent Pinchart , Kieran Bingham , dri-devel@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org Cc: Koji Matsuoka , LUU HOAI , Tomi Valkeinen Subject: [PATCH 2/6] drm: rcar-du: lvds: Add reset control Date: Tue, 17 Jan 2023 15:51:50 +0200 Message-Id: <20230117135154.387208-3-tomi.valkeinen+renesas@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230117135154.387208-1-tomi.valkeinen+renesas@ideasonboard.com> References: <20230117135154.387208-1-tomi.valkeinen+renesas@ideasonboard.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org From: Koji Matsuoka Reset LVDS using the reset control as CPG reset/release is required in H/W manual sequence. Signed-off-by: Koji Matsuoka Signed-off-by: LUU HOAI [tomi.valkeinen: Rewrite the patch description] Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/rcar-du/Kconfig | 1 + drivers/gpu/drm/rcar-du/rcar_lvds.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/drivers/gpu/drm/rcar-du/Kconfig b/drivers/gpu/drm/rcar-du/Kconfig index a8f862c68b4f..151e400b996d 100644 --- a/drivers/gpu/drm/rcar-du/Kconfig +++ b/drivers/gpu/drm/rcar-du/Kconfig @@ -43,6 +43,7 @@ config DRM_RCAR_LVDS select DRM_PANEL select OF_FLATTREE select OF_OVERLAY + select RESET_CONTROLLER config DRM_RCAR_USE_MIPI_DSI bool "R-Car DU MIPI DSI Encoder Support" diff --git a/drivers/gpu/drm/rcar-du/rcar_lvds.c b/drivers/gpu/drm/rcar-du/rcar_lvds.c index 81a060c2fe3f..674b727cdaa2 100644 --- a/drivers/gpu/drm/rcar-du/rcar_lvds.c +++ b/drivers/gpu/drm/rcar-du/rcar_lvds.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -60,6 +61,7 @@ struct rcar_lvds_device_info { struct rcar_lvds { struct device *dev; const struct rcar_lvds_device_info *info; + struct reset_control *rstc; struct drm_bridge bridge; @@ -316,6 +318,8 @@ int rcar_lvds_pclk_enable(struct drm_bridge *bridge, unsigned long freq) dev_dbg(lvds->dev, "enabling LVDS PLL, freq=%luHz\n", freq); + reset_control_deassert(lvds->rstc); + ret = clk_prepare_enable(lvds->clocks.mod); if (ret < 0) return ret; @@ -338,6 +342,8 @@ void rcar_lvds_pclk_disable(struct drm_bridge *bridge) rcar_lvds_write(lvds, LVDPLLCR, 0); clk_disable_unprepare(lvds->clocks.mod); + + reset_control_assert(lvds->rstc); } EXPORT_SYMBOL_GPL(rcar_lvds_pclk_disable); @@ -396,6 +402,8 @@ static void __rcar_lvds_atomic_enable(struct drm_bridge *bridge, u32 lvdcr0; int ret; + reset_control_deassert(lvds->rstc); + ret = clk_prepare_enable(lvds->clocks.mod); if (ret < 0) return; @@ -552,6 +560,7 @@ static void rcar_lvds_atomic_disable(struct drm_bridge *bridge, old_bridge_state); clk_disable_unprepare(lvds->clocks.mod); + reset_control_assert(lvds->rstc); } static bool rcar_lvds_mode_fixup(struct drm_bridge *bridge, @@ -844,6 +853,12 @@ static int rcar_lvds_probe(struct platform_device *pdev) if (ret < 0) return ret; + lvds->rstc = devm_reset_control_get(&pdev->dev, NULL); + if (IS_ERR(lvds->rstc)) { + dev_err(&pdev->dev, "failed to get cpg reset\n"); + return PTR_ERR(lvds->rstc); + } + drm_bridge_add(&lvds->bridge); return 0;