Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2163804imm; Mon, 3 Sep 2018 21:44:20 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaA4j+rcpYOMaeQWKZiInznT3nq3MZr9H2cFlg8AeKrjMgmXpyFBB2s/TaFB+duORuobs5K X-Received: by 2002:a17:902:b282:: with SMTP id u2-v6mr26430358plr.123.1536036260506; Mon, 03 Sep 2018 21:44:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536036260; cv=none; d=google.com; s=arc-20160816; b=RI6xakCiBSFE4L7XNkNaQs8EreYH6nsk5ZkIvYd2mHeRsBE482NH/9cT5QeXWaiEmH /fy23rUw8wSR7s13zyYDqDcE76LZ6fPbnjJHabz9uMN7EJzaGeJGwVay2JyjgEjbgUX8 u/VfPJVB45c65oGpSCmleZLzzJkTkOaRGqCHNi95WFEc0J7a9nfTdBwtO9M0Xtau9v2U kbi1HRGshPnRO479nViSkuJcKFrlgHYh42sOBAgC3eqTdFN451GJoJ7AhWB9FEipO3JW 54SDYJO+MgUigdTNkWVSd+eK9gx6oXXLMYRFK8T2rk282oQVleNaJ+slSRQhfZz9V0kV Tt+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=HFUoZpRtmRW73qEn/b0R60rm2oATQydHK52aFW/KH3E=; b=mLHOegaHL1GhtdtAnzhRRcVZ+JcvruwQX/butN2p/8iWa33BgK7yTnWvGqnA329Qo0 PI+1cUtPk61Ze+bY+Gv0LaYSg+TnXD5OujRRqpZi3c9e6EOKhY4jnMw9qdF74FKz5azR QCwobmNMkVvO7IJfScddBC8iD8Sj6IUeIKycrCDERqV+Cqc1Rz5RzoFhyWxn4IO3mq54 HE8hLfpvlxtyygkOOK4np1K8/FZ7YZr0NaWwHC4QPjI5elmzPcuCtW6LzRmQQ7aZzSW+ wAK3Om/hsfk1MsQOmA7iFxRsALSSo6n5fz6l4oBjocKdN3ofyTnkTyj7dmVNBkDWws7Q GihA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w19-v6si19419074plp.25.2018.09.03.21.44.05; Mon, 03 Sep 2018 21:44:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727689AbeIDJF4 (ORCPT + 99 others); Tue, 4 Sep 2018 05:05:56 -0400 Received: from hermes.aosc.io ([199.195.250.187]:45081 "EHLO hermes.aosc.io" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727266AbeIDJF4 (ORCPT ); Tue, 4 Sep 2018 05:05:56 -0400 Received: from localhost (localhost [127.0.0.1]) (Authenticated sender: icenowy@aosc.io) by hermes.aosc.io (Postfix) with ESMTPSA id 58F83FFA39; Tue, 4 Sep 2018 04:42:32 +0000 (UTC) From: Icenowy Zheng To: Maxime Ripard , Chen-Yu Tsai , Jagan Teki , Jernej Skrabec Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-sunxi@googlegroups.com, Icenowy Zheng Subject: [PATCH v4 10/11] drm/sun4i: Add support for HDMI voltage regulator Date: Tue, 4 Sep 2018 12:40:52 +0800 Message-Id: <20180904044053.15425-11-icenowy@aosc.io> In-Reply-To: <20180904044053.15425-1-icenowy@aosc.io> References: <20180904044053.15425-1-icenowy@aosc.io> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jernej Skrabec Some boards have HDMI VCC pin connected to voltage regulator which may not be turned on by default. Add support for such boards by adding voltage regulator handling code to HDMI driver. Signed-off-by: Jernej Skrabec [Icenowy: change supply name to "hvcc"] Signed-off-by: Icenowy Zheng --- Changes in v4: - Rename the supply name to "hvcc". Changes in v3.1: - New patch. (Replaced "drm: sun4i: add support for HVCC regulator for DWC HDMI glue" by Icenowy.) drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c | 17 ++++++++++++++++- drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h | 2 ++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c index 31875b636434..ed2983770e9c 100644 --- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c +++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c @@ -125,10 +125,22 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master, return PTR_ERR(hdmi->clk_tmds); } + hdmi->regulator = devm_regulator_get(dev, "hvcc"); + if (IS_ERR(hdmi->regulator)) { + dev_err(dev, "Couldn't get regulator\n"); + return PTR_ERR(hdmi->regulator); + } + + ret = regulator_enable(hdmi->regulator); + if (ret) { + dev_err(dev, "Failed to enable regulator\n"); + return ret; + } + ret = reset_control_deassert(hdmi->rst_ctrl); if (ret) { dev_err(dev, "Could not deassert ctrl reset control\n"); - return ret; + goto err_disable_regulator; } ret = clk_prepare_enable(hdmi->clk_tmds); @@ -183,6 +195,8 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master, clk_disable_unprepare(hdmi->clk_tmds); err_assert_ctrl_reset: reset_control_assert(hdmi->rst_ctrl); +err_disable_regulator: + regulator_disable(hdmi->regulator); return ret; } @@ -196,6 +210,7 @@ static void sun8i_dw_hdmi_unbind(struct device *dev, struct device *master, sun8i_hdmi_phy_remove(hdmi); clk_disable_unprepare(hdmi->clk_tmds); reset_control_assert(hdmi->rst_ctrl); + regulator_disable(hdmi->regulator); } static const struct component_ops sun8i_dw_hdmi_ops = { diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h index aadbe0a10b0c..7fdc1ecd2892 100644 --- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h +++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h @@ -10,6 +10,7 @@ #include #include #include +#include #include #define SUN8I_HDMI_PHY_DBG_CTRL_REG 0x0000 @@ -176,6 +177,7 @@ struct sun8i_dw_hdmi { struct drm_encoder encoder; struct sun8i_hdmi_phy *phy; struct dw_hdmi_plat_data plat_data; + struct regulator *regulator; struct reset_control *rst_ctrl; }; -- 2.18.0