linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: jagan@amarulasolutions.com (Jagan Teki)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 20/26] drm: sun4i: add support for HVCC regulator for DWC HDMI glue
Date: Fri, 18 May 2018 15:15:30 +0530	[thread overview]
Message-ID: <20180518094536.17201-21-jagan@amarulasolutions.com> (raw)
In-Reply-To: <20180518094536.17201-1-jagan@amarulasolutions.com>

From: Icenowy Zheng <icenowy@aosc.io>

Allwinner SoCs with DWC HDMI controller have a "HVCC" power pin for the
HDMI part, and on some boards it's connected to a dedicated regulator
rather than the main 3.3v.

Add support for optional HVCC regulator. For boards that doesn't use a
dedicated regulator to power it, the default dummy regulator is used.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
Changes for v2:
- none

 drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c | 14 ++++++++++++++
 drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h |  2 ++
 2 files changed, 16 insertions(+)

diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
index 9f40a44b456b..7c33faff7ad4 100644
--- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
+++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
@@ -73,6 +73,12 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master,
 	if (encoder->possible_crtcs == 0)
 		return -EPROBE_DEFER;
 
+	hdmi->vcc_hdmi = devm_regulator_get(dev, "hvcc");
+	if (IS_ERR(hdmi->vcc_hdmi)) {
+		dev_err(dev, "Could not get HDMI power supply\n");
+		return PTR_ERR(hdmi->vcc_hdmi);
+	}
+
 	hdmi->rst_ctrl = devm_reset_control_get(dev, "ctrl");
 	if (IS_ERR(hdmi->rst_ctrl)) {
 		dev_err(dev, "Could not get ctrl reset control\n");
@@ -91,6 +97,12 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master,
 		return ret;
 	}
 
+	ret = regulator_enable(hdmi->vcc_hdmi);
+	if (ret) {
+		dev_err(dev, "Cannot enable HDMI power supply\n");
+		goto err_disable_vcc;
+	}
+
 	ret = clk_prepare_enable(hdmi->clk_tmds);
 	if (ret) {
 		dev_err(dev, "Could not enable tmds clock\n");
@@ -143,6 +155,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_vcc:
+	regulator_disable(hdmi->vcc_hdmi);
 
 	return ret;
 }
diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h
index 303189d6602c..65366eeb38d8 100644
--- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h
+++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h
@@ -10,6 +10,7 @@
 #include <drm/drm_encoder.h>
 #include <linux/clk.h>
 #include <linux/regmap.h>
+#include <linux/regulator/consumer.h>
 #include <linux/reset.h>
 
 #define SUN8I_HDMI_PHY_DBG_CTRL_REG	0x0000
@@ -175,6 +176,7 @@ struct sun8i_dw_hdmi {
 	struct drm_encoder		encoder;
 	struct sun8i_hdmi_phy		*phy;
 	struct dw_hdmi_plat_data	plat_data;
+	struct regulator		*vcc_hdmi;
 	struct reset_control		*rst_ctrl;
 };
 
-- 
2.14.3

  parent reply	other threads:[~2018-05-18  9:45 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-18  9:45 [PATCH v2 00/26] arm64: allwinner: Add A64 DE2 HDMI support Jagan Teki
2018-05-18  9:45 ` [PATCH v2 01/26] dt-bindings: clock: Add compatible for A64 DE2 CCU Jagan Teki
2018-05-18  9:45 ` [PATCH v2 02/26] arm64: dts: allwinner: a64: Add " Jagan Teki
2018-05-18  9:45 ` [PATCH v2 03/26] clk: sunxi-ng: Enable DE2_CCU for SUN8I and SUN50I Jagan Teki
2018-05-18  9:45 ` [PATCH v2 04/26] clk: sunxi-ng: a64: Add minimal rate for video PLLs Jagan Teki
2018-05-18  9:45 ` [PATCH v2 05/26] drm/sun4i: DE2 mixer: Add index quirk Jagan Teki
2018-05-18  9:45 ` [PATCH v2 06/26] drm/sun4i: Add support for A64 mixer1 Jagan Teki
2018-05-18  9:45 ` [PATCH v2 07/26] dt-bindings: display: Add compatible for A64 DE2 tcon1 blocks Jagan Teki
2018-05-22 18:10   ` Rob Herring
2018-05-18  9:45 ` [PATCH v2 08/26] drm/sun4i: Add support for A64 display engine Jagan Teki
2018-05-18  9:45 ` [PATCH v2 09/26] arm64: dts: allwinner: a64: Add DE2 tcon1 pipeline Jagan Teki
2018-05-18  9:45 ` [PATCH v2 10/26] drm/sun4i: Enable DE2 Mixer for SUN8I and SUN50I Jagan Teki
2018-05-18  9:45 ` [PATCH v2 11/26] arm64: defconfig: Enable CONFIG_DRM_SUN4I Jagan Teki
2018-05-18  9:45 ` [PATCH v2 12/26] drm/sun4i: Add support for multiple DW HDMI PHY clock parents Jagan Teki
2018-05-18 10:01   ` Maxime Ripard
2018-05-18 14:46     ` Jernej Škrabec
2018-05-18 15:09       ` Sergey Suloev
2018-05-18 15:15         ` Jernej Škrabec
2018-05-18 15:21           ` Sergey Suloev
2018-05-18 15:26       ` Maxime Ripard
2018-05-18 15:34         ` Jernej Škrabec
2018-05-19  7:11         ` Jernej Škrabec
2018-05-18  9:45 ` [PATCH v2 13/26] drm/sun4i: Add support for A64 HDMI PHY Jagan Teki
2018-05-18  9:45 ` [PATCH v2 14/26] dt-bindings: display: Add compatible for A64 HDMI Jagan Teki
2018-05-22 18:10   ` Rob Herring
2018-05-18  9:45 ` [PATCH v2 15/26] dt-bindings: display: Add compatible for A64 HDMI PHY Jagan Teki
2018-05-18  9:45 ` [PATCH v2 16/26] dt-bindings: clock: sun50i-a64-ccu: Add PLL_VIDEO[0-1] macros Jagan Teki
2018-05-18 14:23   ` Rob Herring
2018-05-18  9:45 ` [PATCH v2 17/26] arm64: dts: allwinner: a64: Add HDMI support Jagan Teki
2018-05-18  9:45 ` [PATCH v2 18/26] drm/sun4i: Enable DesignWare HDMI for SUN8I and SUN50I Jagan Teki
2018-05-18  9:45 ` [PATCH v2 19/26] arm64: dts: allwinner: a64: Add HDMI pipeline Jagan Teki
2018-05-18  9:45 ` Jagan Teki [this message]
2018-05-18  9:45 ` [PATCH v2 21/26] arm64: dts: allwinner: a64: bananapi-m64: Enable HDMI output Jagan Teki
2018-05-18  9:45 ` [PATCH v2 22/26] arm64: dts: allwinner: a64: nanopi-a64: " Jagan Teki
2018-05-18  9:45 ` [PATCH v2 23/26] arm64: dts: allwinner: a64: orangepi-win: " Jagan Teki
2018-05-18  9:45 ` [PATCH v2 24/26] arm64: dts: allwinner: a64: a64-olinuxino: " Jagan Teki
2018-05-18  9:45 ` [PATCH v2 25/26] arm64: dts: allwinner: a64: pine64: " Jagan Teki
2018-05-18  9:45 ` [PATCH v2 26/26] arm64: dts: allwinner: a64: sopine: " Jagan Teki
2018-05-18  9:59 ` [PATCH v2 00/26] arm64: allwinner: Add A64 DE2 HDMI support Maxime Ripard
2018-06-05 12:53   ` [linux-sunxi] " Jagan Teki
2018-06-05 13:25     ` Maxime Ripard
2018-06-05 13:58       ` Icenowy Zheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180518094536.17201-21-jagan@amarulasolutions.com \
    --to=jagan@amarulasolutions.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).