LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Icenowy Zheng <icenowy@aosc.io>
To: Maxime Ripard <maxime.ripard@bootlin.com>,
	Jagan Teki <jagan@amarulasolutions.com>
Cc: Chen-Yu Tsai <wens@csie.org>,
	Jernej Skrabec <jernej.skrabec@siol.net>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	David Airlie <airlied@linux.ie>,
	dri-devel@lists.freedesktop.org,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>,
	linux-clk@vger.kernel.org,
	Michael Trimarchi <michael@amarulasolutions.com>,
	linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com
Subject: Re: [PATCH 15/21] drm: sun4i: add support for HVCC regulator for DWC HDMI glue
Date: Wed, 02 May 2018 19:51:37 +0800	[thread overview]
Message-ID: <2E519B6E-D1BA-4C6F-9105-446E564FBBB6@aosc.io> (raw)
In-Reply-To: <20180502114843.ou4qczp5eaigrdfo@flea>



于 2018年5月2日 GMT+08:00 下午7:48:43, Maxime Ripard <maxime.ripard@bootlin.com> 写到:
>On Mon, Apr 30, 2018 at 05:10:52PM +0530, Jagan Teki wrote:
>> 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>
>> ---
>>  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);
>> +	}
>> +
>
>You're not making it optional here, unlike what your commit log
>says. Not that I'm fine with both, but we need to be consistent :)

If it's not set, regulator subsystem will generate a dummy
regulator as a spaceholder, except using the exclusive variant
of the function.

The word "optional" is from DT perspectove, as it's possible that
it's bound to some critical regulators.

>
>>  	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);
>
>
>The err_disable_vcc label will disable the regulator, but if there's
>an error in regulator_enable, it will disable it while it wasn't
>enabled in the first place, which is not really something we want to
>do.
>
>Maxime

  reply	other threads:[~2018-05-02 11:52 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-30 11:40 [PATCH 00/21] arm64: allwinner: Add A64 DE2 HDMI support Jagan Teki
2018-04-30 11:40 ` [PATCH 01/21] dt-bindings: clock: Add compatible for A64 DE2 CCU Jagan Teki
2018-05-01 16:16   ` Rob Herring
2018-05-01 16:19     ` Chen-Yu Tsai
2018-05-01 16:34       ` Rob Herring
2018-04-30 11:40 ` [PATCH 02/21] arm64: dts: allwinner: a64: Add " Jagan Teki
2018-05-02 11:32   ` Maxime Ripard
2018-05-02 11:34     ` [linux-sunxi] " Icenowy Zheng
2018-05-02 11:49       ` Maxime Ripard
2018-05-02 11:50       ` Jagan Teki
2018-05-02 11:55         ` Icenowy Zheng
2018-04-30 11:40 ` [PATCH 03/21] clk: sunxi-ng: Enable DE2_CCU for Allwinner 64-bit SoCs Jagan Teki
2018-05-01 16:23   ` Chen-Yu Tsai
2018-05-14  8:20     ` Jagan Teki
2018-05-14 16:43       ` Chen-Yu Tsai
2018-04-30 11:40 ` [PATCH 04/21] bindings: display: Add compatible for A64 DE2 pipeline Jagan Teki
2018-05-01 16:17   ` Rob Herring
2018-05-01 16:31     ` Chen-Yu Tsai
2018-05-01 16:34       ` Rob Herring
2018-04-30 11:40 ` [PATCH 05/21] drm/sun4i: Add support for A64 display engine Jagan Teki
2018-04-30 11:40 ` [PATCH 06/21] arm64: defconfig: Enable CONFIG_DRM_SUN4I Jagan Teki
2018-04-30 11:40 ` [PATCH 07/21] bindings: display: Add compatible for A64 HDMI Jagan Teki
2018-04-30 11:40 ` [PATCH 08/21] bindings: display: Add compatible for A64 HDMI PHY Jagan Teki
2018-05-01 16:19   ` Rob Herring
2018-05-02  6:27     ` Jagan Teki
2018-05-02 12:37       ` Rob Herring
2018-04-30 11:40 ` [PATCH 09/21] arm64: dts: allwinner: a64: Add HDMI support Jagan Teki
2018-05-01 16:20   ` Rob Herring
2018-05-02 11:34   ` Maxime Ripard
2018-05-14  8:33     ` Jagan Teki
2018-05-14  8:40       ` Maxime Ripard
2018-05-14 10:31         ` Jagan Teki
2018-05-15 11:19           ` Maxime Ripard
2018-04-30 11:40 ` [PATCH 10/21] drm/sun4i: Enable DesignWare HDMI for Allwinner 64-bit SoCs Jagan Teki
2018-05-01 16:20   ` Chen-Yu Tsai
2018-04-30 11:40 ` [PATCH 11/21] bindings: display: Add compatible for A64 Mixer1 Jagan Teki
2018-05-01 16:21   ` Rob Herring
2018-04-30 11:40 ` [PATCH 12/21] bindings: display: Add compatible for A64 tcon-tv Jagan Teki
2018-05-01 16:22   ` Rob Herring
2018-04-30 11:40 ` [PATCH 13/21] drm/sun4i: Enable DE2 Mixer for Allwinner 64-bit SoCs Jagan Teki
2018-04-30 11:40 ` [PATCH 14/21] arm64: dts: allwinner: a64: Add HDMI pipeline Jagan Teki
2018-04-30 11:40 ` [PATCH 15/21] drm: sun4i: add support for HVCC regulator for DWC HDMI glue Jagan Teki
2018-05-02 11:48   ` Maxime Ripard
2018-05-02 11:51     ` Icenowy Zheng [this message]
2018-04-30 11:40 ` [PATCH 16/21] arm64: dts: allwinner: a64: bananapi-m64: Enable HDMI output Jagan Teki
2018-04-30 11:40 ` [PATCH 17/21] arm64: dts: allwinner: a64: nanopi-a64: " Jagan Teki
2018-04-30 11:40 ` [PATCH 18/21] arm64: dts: allwinner: a64: orangepi-win: " Jagan Teki
2018-04-30 11:40 ` [PATCH 19/21] arm64: dts: allwinner: a64: a64-olinuxino: " Jagan Teki
2018-04-30 11:40 ` [PATCH 20/21] arm64: dts: allwinner: a64: pine64: " Jagan Teki
2018-04-30 11:40 ` [PATCH 21/21] arm64: dts: allwinner: a64: sopine: " Jagan Teki

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=2E519B6E-D1BA-4C6F-9105-446E564FBBB6@aosc.io \
    --to=icenowy@aosc.io \
    --cc=airlied@linux.ie \
    --cc=catalin.marinas@arm.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jagan@amarulasolutions.com \
    --cc=jernej.skrabec@siol.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@googlegroups.com \
    --cc=mark.rutland@arm.com \
    --cc=maxime.ripard@bootlin.com \
    --cc=michael@amarulasolutions.com \
    --cc=mturquette@baylibre.com \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=wens@csie.org \
    --cc=will.deacon@arm.com \
    --subject='Re: [PATCH 15/21] drm: sun4i: add support for HVCC regulator for DWC HDMI glue' \
    /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

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).