Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: narmstrong@baylibre.com (Neil Armstrong)
To: linux-arm-kernel@lists.infradead.org
Subject: [RESEND PATCH 3/4] drm/meson: dw_hdmi: Add support for an optional external 5V regulator
Date: Wed,  6 Dec 2017 12:54:27 +0100	[thread overview]
Message-ID: <1512561268-29806-4-git-send-email-narmstrong@baylibre.com> (raw)
In-Reply-To: <1512561268-29806-1-git-send-email-narmstrong@baylibre.com>

On reference boards and derivatives, the HDMI Logic is powered by an external
5V regulator.
This regulator was set by the Vendor U-Boot, add optional support for it.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
 drivers/gpu/drm/meson/meson_dw_hdmi.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c
index cef4144..17de3af 100644
--- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
+++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
@@ -23,6 +23,7 @@
 #include <linux/of_graph.h>
 #include <linux/reset.h>
 #include <linux/clk.h>
+#include <linux/regulator/consumer.h>
 
 #include <drm/drmP.h>
 #include <drm/drm_edid.h>
@@ -137,6 +138,7 @@ struct meson_dw_hdmi {
 	struct reset_control *hdmitx_phy;
 	struct clk *hdmi_pclk;
 	struct clk *venci_clk;
+	struct regulator *hdmi_supply;
 	u32 irq_stat;
 };
 #define encoder_to_meson_dw_hdmi(x) \
@@ -751,6 +753,17 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
 	dw_plat_data = &meson_dw_hdmi->dw_plat_data;
 	encoder = &meson_dw_hdmi->encoder;
 
+	meson_dw_hdmi->hdmi_supply = devm_regulator_get_optional(dev, "hdmi");
+	if (IS_ERR(meson_dw_hdmi->hdmi_supply)) {
+		if (PTR_ERR(meson_dw_hdmi->hdmi_supply) == -EPROBE_DEFER)
+			return -EPROBE_DEFER;
+		meson_dw_hdmi->hdmi_supply = NULL;
+	} else {
+		ret = regulator_enable(meson_dw_hdmi->hdmi_supply);
+		if (ret)
+			return ret;
+	}
+
 	meson_dw_hdmi->hdmitx_apb = devm_reset_control_get_exclusive(dev,
 						"hdmitx_apb");
 	if (IS_ERR(meson_dw_hdmi->hdmitx_apb)) {
-- 
2.7.4

  parent reply	other threads:[~2017-12-06 11:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-06 11:54 [RESEND PATCH 0/4] drm/meson: power domain init related fixes Neil Armstrong
2017-12-06 11:54 ` [RESEND PATCH 1/4] dt-bindings: display: amlogic, meson-vpu: Add optional power domain property Neil Armstrong
2017-12-06 11:54 ` [RESEND PATCH 2/4] dt-bindings: display: amlogic, meson-dw-hdmi: Add optional HDMI 5V regulator Neil Armstrong
2017-12-06 11:54 ` Neil Armstrong [this message]
2017-12-06 11:54 ` [RESEND PATCH 4/4] drm/meson: Add missing VPU init Neil Armstrong
2017-12-06 12:02   ` Chris Wilson
2017-12-06 12:03     ` Neil Armstrong
2017-12-06 12:09       ` Chris Wilson
2017-12-08  9:04 ` [RESEND PATCH 0/4] drm/meson: power domain init related fixes Jerome Brunet
2017-12-08  9:44   ` Neil Armstrong

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=1512561268-29806-4-git-send-email-narmstrong@baylibre.com \
    --to=narmstrong@baylibre.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