From: Philippe CORNU <philippe.cornu@st.com>
To: Yannick FERTRE <yannick.fertre@st.com>,
Benjamin GAIGNARD <benjamin.gaignard@st.com>,
Vincent ABRIOU <vincent.abriou@st.com>,
David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre TORGUE <alexandre.torgue@st.com>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"linux-stm32@st-md-mailman.stormreply.com"
<linux-stm32@st-md-mailman.stormreply.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1 2/5] drm/stm: dw_mipi_dsi-stm: add support of an optional regulator
Date: Fri, 5 Apr 2019 16:34:35 +0000 [thread overview]
Message-ID: <f66fe75c-c288-82ef-71d7-5d15b9b8e4b3@st.com> (raw)
In-Reply-To: <1554279389-27377-3-git-send-email-yannick.fertre@st.com>
On 4/3/19 10:16 AM, Yannick Fertré wrote:
> Add support of an optional regulator for the phy part of the DSI
> controller.
>
> Signed-off-by: Yannick Fertré <yannick.fertre@st.com>
> ---
> drivers/gpu/drm/stm/dw_mipi_dsi-stm.c | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c
> index a672b59..84703d0 100644
> --- a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c
> +++ b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c
> @@ -9,6 +9,7 @@
> #include <linux/clk.h>
> #include <linux/iopoll.h>
> #include <linux/module.h>
> +#include <linux/regulator/consumer.h>
> #include <drm/drmP.h>
> #include <drm/drm_mipi_dsi.h>
> #include <drm/bridge/dw_mipi_dsi.h>
> @@ -76,6 +77,7 @@ struct dw_mipi_dsi_stm {
> u32 hw_version;
> int lane_min_kbps;
> int lane_max_kbps;
> + struct regulator *vdd_supply;
> };
>
> static inline void dsi_write(struct dw_mipi_dsi_stm *dsi, u32 reg, u32 val)
> @@ -318,16 +320,32 @@ static int dw_mipi_dsi_stm_probe(struct platform_device *pdev)
> return PTR_ERR(dsi->base);
> }
>
> + dsi->vdd_supply = devm_regulator_get_optional(dev, "phy-dsi");
> + if (IS_ERR(dsi->vdd_supply)) {
> + ret = PTR_ERR(dsi->vdd_supply);
> + if (ret != -EPROBE_DEFER)
> + dev_err(dev, "failed to request regulator: %d\n", ret);
> + return ret;
> + }
> +
> + ret = regulator_enable(dsi->vdd_supply);
> + if (ret) {
> + dev_err(dev, "failed to enable regulator: %d\n", ret);
> + return ret;
> + }
> +
> dsi->pllref_clk = devm_clk_get(dev, "ref");
> if (IS_ERR(dsi->pllref_clk)) {
> ret = PTR_ERR(dsi->pllref_clk);
> dev_err(dev, "Unable to get pll reference clock: %d\n", ret);
> + regulator_disable(dsi->vdd_supply);
> return ret;
> }
>
> ret = clk_prepare_enable(dsi->pllref_clk);
> if (ret) {
> dev_err(dev, "%s: Failed to enable pllref_clk\n", __func__);
> + regulator_disable(dsi->vdd_supply);
> return ret;
> }
>
> @@ -339,6 +357,7 @@ static int dw_mipi_dsi_stm_probe(struct platform_device *pdev)
> dsi->dsi = dw_mipi_dsi_probe(pdev, &dw_mipi_dsi_stm_plat_data);
> if (IS_ERR(dsi->dsi)) {
> DRM_ERROR("Failed to initialize mipi dsi host\n");
> + regulator_disable(dsi->vdd_supply);
> clk_disable_unprepare(dsi->pllref_clk);
> return PTR_ERR(dsi->dsi);
> }
> @@ -351,6 +370,7 @@ static int dw_mipi_dsi_stm_remove(struct platform_device *pdev)
> struct dw_mipi_dsi_stm *dsi = platform_get_drvdata(pdev);
>
> clk_disable_unprepare(dsi->pllref_clk);
> + regulator_disable(dsi->vdd_supply);
Dear Yannick,
Acked-by: Philippe Cornu <philippe.cornu@st.com>
Philippe
> dw_mipi_dsi_remove(dsi->dsi);
>
> return 0;
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2019-04-05 16:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-03 8:16 [PATCH v1 0/5] Add supply property for DSI controller Yannick Fertré
2019-04-03 8:16 ` [PATCH v1 1/5] dt-bindings: display: stm32: add supply property to " Yannick Fertré
2019-04-05 16:33 ` Philippe CORNU
2019-04-06 6:06 ` Rob Herring
2019-04-03 8:16 ` [PATCH v1 2/5] drm/stm: dw_mipi_dsi-stm: add support of an optional regulator Yannick Fertré
2019-04-05 16:34 ` Philippe CORNU [this message]
2019-04-03 8:16 ` [PATCH v1 3/5] ARM: dts: stm32: add phy-dsi-supply property on stm32mp157c Yannick Fertré
2019-04-03 8:16 ` [PATCH v1 4/5] ARM: dts: stm32: move fixe regulators reg11 & reg18 Yannick Fertré
2019-04-03 8:16 ` [PATCH v1 5/5] ARM: dts: stm32: remove phy-dsi-supply property on stm32mp157c-dk2 board Yannick Fertré
2019-04-10 13:48 ` [PATCH v1 0/5] Add supply property for DSI controller Alexandre Torgue
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=f66fe75c-c288-82ef-71d7-5d15b9b8e4b3@st.com \
--to=philippe.cornu@st.com \
--cc=airlied@linux.ie \
--cc=alexandre.torgue@st.com \
--cc=benjamin.gaignard@st.com \
--cc=daniel@ffwll.ch \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mark.rutland@arm.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=robh+dt@kernel.org \
--cc=vincent.abriou@st.com \
--cc=yannick.fertre@st.com \
/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).