From patchwork Sat Oct 22 19:18:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ayaka X-Patchwork-Id: 9391651 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 00B916077A for ; Mon, 24 Oct 2016 08:35:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E327828D08 for ; Mon, 24 Oct 2016 08:35:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D4A7B28D4D; Mon, 24 Oct 2016 08:35:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 42C2E28D08 for ; Mon, 24 Oct 2016 08:35:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3A8336E3A6; Mon, 24 Oct 2016 08:32:31 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from kozue.soulik.info (kozue.soulik.info [IPv6:2001:19f0:7000:8404:5054:ff:fe75:428f]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0D9A76E1AC for ; Sat, 22 Oct 2016 19:19:10 +0000 (UTC) Received: from ritsuko.sumomo.pri (ritsuko.soulik.info [IPv6:2001:470:b30d:2:210:18ff:fe06:921]) by kozue.soulik.info (Postfix) with ESMTPA id 12F7C102878; Sun, 23 Oct 2016 04:19:38 +0900 (JST) From: Randy Li To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/rockchip: analogix_dp: add supports for regulators in edp IP Date: Sun, 23 Oct 2016 03:18:53 +0800 Message-Id: <1477163933-13140-1-git-send-email-ayaka@soulik.info> X-Mailer: git-send-email 2.7.4 X-Mailman-Approved-At: Mon, 24 Oct 2016 08:31:09 +0000 Cc: Randy Li , randy.li@rock-chips.com, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP I found if eDP_AVDD_1V0 and eDP_AVDD_1V8 are not been power at RK3288, once trying to enable the pclk clock, the kernel would dead. This patch would try to enable them first. The eDP_AVDD_1V8 more likely to be applied to eDP phy, but I have no time to confirmed it yet. Signed-off-by: Randy Li --- drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c index 8548e82..6bf0441 100644 --- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -70,6 +71,7 @@ struct rockchip_dp_device { struct clk *grfclk; struct regmap *grf; struct reset_control *rst; + struct regulator_bulk_data supplies[2]; struct work_struct psr_work; spinlock_t psr_lock; @@ -146,6 +148,13 @@ static int rockchip_dp_poweron(struct analogix_dp_plat_data *plat_data) cancel_work_sync(&dp->psr_work); + ret = regulator_bulk_enable(ARRAY_SIZE(dp->supplies), + dp->supplies); + if (ret) { + dev_err(dp->dev, "failed to enable vdd supply %d\n", ret); + return ret; + } + ret = clk_prepare_enable(dp->pclk); if (ret < 0) { dev_err(dp->dev, "failed to enable pclk %d\n", ret); @@ -168,6 +177,9 @@ static int rockchip_dp_powerdown(struct analogix_dp_plat_data *plat_data) clk_disable_unprepare(dp->pclk); + regulator_bulk_disable(ARRAY_SIZE(dp->supplies), + dp->supplies); + return 0; } @@ -323,6 +335,19 @@ static int rockchip_dp_init(struct rockchip_dp_device *dp) return PTR_ERR(dp->rst); } + dp->supplies[0].supply = "vcc"; + dp->supplies[1].supply = "vccio"; + ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(dp->supplies), + dp->supplies); + if (ret < 0) { + dev_err(dev, "failed to get regulators: %d\n", ret); + } + ret = regulator_bulk_enable(ARRAY_SIZE(dp->supplies), + dp->supplies); + if (ret < 0) { + dev_err(dev, "failed to enable regulators: %d\n", ret); + } + ret = clk_prepare_enable(dp->pclk); if (ret < 0) { dev_err(dp->dev, "failed to enable pclk %d\n", ret);