summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
diff options
context:
space:
mode:
authorJernej Skrabec <jernej.skrabec@siol.net>2018-09-04 12:40:52 +0800
committerMaxime Ripard <maxime.ripard@bootlin.com>2018-09-05 09:20:28 +0200
commit633ba1e086e1abbeef1ffd899911de8cf3987d9f (patch)
treedf2c74c9f296e748109a0df731543551c18174ec /drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
parent50414b954ba647693db655fb753811dc895e8cbe (diff)
downloadtalos-op-linux-633ba1e086e1abbeef1ffd899911de8cf3987d9f.tar.gz
talos-op-linux-633ba1e086e1abbeef1ffd899911de8cf3987d9f.zip
drm/sun4i: Add support for HDMI voltage regulator
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 <jernej.skrabec@siol.net> [Icenowy: change supply name to "hvcc"] Signed-off-by: Icenowy Zheng <icenowy@aosc.io> Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com> Link: https://patchwork.freedesktop.org/patch/msgid/20180904044053.15425-11-icenowy@aosc.io
Diffstat (limited to 'drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c')
-rw-r--r--drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c17
1 files changed, 16 insertions, 1 deletions
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 @@ err_disable_clk_tmds:
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 = {
OpenPOWER on IntegriCloud