* [PATCH v4 0/2] Add supply property for DSI controller @ 2019-05-14 9:35 Yannick Fertré 2019-05-14 9:35 ` [PATCH v4 1/2] dt-bindings: display: stm32: add supply property to " Yannick Fertré 2019-05-14 9:35 ` [PATCH v4 2/2] drm/stm: dsi: add regulator support Yannick Fertré 0 siblings, 2 replies; 5+ messages in thread From: Yannick Fertré @ 2019-05-14 9:35 UTC (permalink / raw) To: Yannick Fertre, Philippe Cornu, Benjamin Gaignard, Vincent Abriou, David Airlie, Daniel Vetter, Maxime Coquelin, Alexandre Torgue, dri-devel, linux-stm32, linux-arm-kernel, linux-kernel The DSI controller needs a new property that powers its physical layer. Binding has been updated to document this property. Device tree of stm32mp157c soc. Move reg18 & reg11 to stm32mp157c device tree file. Remove property phy-dsi-supply property to stm32mp157c-dk2.dts file. Changes in v2: - rename patch drm/stm: dsi: add support of an optional regulator - rework dw_mipi_dsi-stm probe sequence Changes in v3: - remove device-tree patches - replace the optional regulator by a regulator Changes in v4: - update patch commit - return always error code Yannick Fertré (2): dt-bindings: display: stm32: add supply property to DSI controller drm/stm: dsi: add regulator support .../devicetree/bindings/display/st,stm32-ltdc.txt | 3 ++ drivers/gpu/drm/stm/dw_mipi_dsi-stm.c | 60 ++++++++++++++++++---- 2 files changed, 52 insertions(+), 11 deletions(-) -- 2.7.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v4 1/2] dt-bindings: display: stm32: add supply property to DSI controller 2019-05-14 9:35 [PATCH v4 0/2] Add supply property for DSI controller Yannick Fertré @ 2019-05-14 9:35 ` Yannick Fertré 2019-05-17 10:14 ` Benjamin Gaignard 2019-05-14 9:35 ` [PATCH v4 2/2] drm/stm: dsi: add regulator support Yannick Fertré 1 sibling, 1 reply; 5+ messages in thread From: Yannick Fertré @ 2019-05-14 9:35 UTC (permalink / raw) To: Yannick Fertre, Philippe Cornu, Benjamin Gaignard, Vincent Abriou, David Airlie, Daniel Vetter, Maxime Coquelin, Alexandre Torgue, dri-devel, linux-stm32, linux-arm-kernel, linux-kernel This patch adds documentation of a new property phy-dsi-supply to the STM32 DSI controller. Signed-off-by: Yannick Fertré <yannick.fertre@st.com> Reviewed-by: Rob Herring <robh@kernel.org> Reviewed-by: Philippe Cornu <philippe.cornu@st.com> --- Documentation/devicetree/bindings/display/st,stm32-ltdc.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/display/st,stm32-ltdc.txt b/Documentation/devicetree/bindings/display/st,stm32-ltdc.txt index 3eb1b48..60c54da 100644 --- a/Documentation/devicetree/bindings/display/st,stm32-ltdc.txt +++ b/Documentation/devicetree/bindings/display/st,stm32-ltdc.txt @@ -40,6 +40,8 @@ Mandatory nodes specific to STM32 DSI: - panel or bridge node: A node containing the panel or bridge description as documented in [6]. - port: panel or bridge port node, connected to the DSI output port (port@1). +Optional properties: +- phy-dsi-supply: phandle of the regulator that provides the supply voltage. Note: You can find more documentation in the following references [1] Documentation/devicetree/bindings/clock/clock-bindings.txt @@ -101,6 +103,7 @@ Example 2: DSI panel clock-names = "pclk", "ref"; resets = <&rcc STM32F4_APB2_RESET(DSI)>; reset-names = "apb"; + phy-dsi-supply = <®18>; ports { #address-cells = <1>; -- 2.7.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v4 1/2] dt-bindings: display: stm32: add supply property to DSI controller 2019-05-14 9:35 ` [PATCH v4 1/2] dt-bindings: display: stm32: add supply property to " Yannick Fertré @ 2019-05-17 10:14 ` Benjamin Gaignard 0 siblings, 0 replies; 5+ messages in thread From: Benjamin Gaignard @ 2019-05-17 10:14 UTC (permalink / raw) To: Yannick Fertré Cc: Daniel Vetter, David Airlie, Philippe Cornu, ML dri-devel, Linux Kernel Mailing List, Alexandre Torgue, Maxime Coquelin, Vincent Abriou, linux-stm32, Linux ARM, Benjamin Gaignard Le mar. 14 mai 2019 à 11:36, Yannick Fertré <yannick.fertre@st.com> a écrit : > > This patch adds documentation of a new property phy-dsi-supply to the > STM32 DSI controller. > > Signed-off-by: Yannick Fertré <yannick.fertre@st.com> > Reviewed-by: Rob Herring <robh@kernel.org> > Reviewed-by: Philippe Cornu <philippe.cornu@st.com> Applied on drm-misc-next, Thanks, Benjamin > --- > Documentation/devicetree/bindings/display/st,stm32-ltdc.txt | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/Documentation/devicetree/bindings/display/st,stm32-ltdc.txt b/Documentation/devicetree/bindings/display/st,stm32-ltdc.txt > index 3eb1b48..60c54da 100644 > --- a/Documentation/devicetree/bindings/display/st,stm32-ltdc.txt > +++ b/Documentation/devicetree/bindings/display/st,stm32-ltdc.txt > @@ -40,6 +40,8 @@ Mandatory nodes specific to STM32 DSI: > - panel or bridge node: A node containing the panel or bridge description as > documented in [6]. > - port: panel or bridge port node, connected to the DSI output port (port@1). > +Optional properties: > +- phy-dsi-supply: phandle of the regulator that provides the supply voltage. > > Note: You can find more documentation in the following references > [1] Documentation/devicetree/bindings/clock/clock-bindings.txt > @@ -101,6 +103,7 @@ Example 2: DSI panel > clock-names = "pclk", "ref"; > resets = <&rcc STM32F4_APB2_RESET(DSI)>; > reset-names = "apb"; > + phy-dsi-supply = <®18>; > > ports { > #address-cells = <1>; > -- > 2.7.4 > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v4 2/2] drm/stm: dsi: add regulator support 2019-05-14 9:35 [PATCH v4 0/2] Add supply property for DSI controller Yannick Fertré 2019-05-14 9:35 ` [PATCH v4 1/2] dt-bindings: display: stm32: add supply property to " Yannick Fertré @ 2019-05-14 9:35 ` Yannick Fertré 2019-05-17 10:14 ` Benjamin Gaignard 1 sibling, 1 reply; 5+ messages in thread From: Yannick Fertré @ 2019-05-14 9:35 UTC (permalink / raw) To: Yannick Fertre, Philippe Cornu, Benjamin Gaignard, Vincent Abriou, David Airlie, Daniel Vetter, Maxime Coquelin, Alexandre Torgue, dri-devel, linux-stm32, linux-arm-kernel, linux-kernel Add support of regulator for the phy part of the DSI controller. Signed-off-by: Yannick Fertré <yannick.fertre@st.com> Acked-by: Philippe Cornu <philippe.cornu@st.com> --- drivers/gpu/drm/stm/dw_mipi_dsi-stm.c | 60 ++++++++++++++++++++++++++++------- 1 file changed, 49 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c index 1bef73e..d8e4a14 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) @@ -314,21 +316,36 @@ static int dw_mipi_dsi_stm_probe(struct platform_device *pdev) res = platform_get_resource(pdev, IORESOURCE_MEM, 0); dsi->base = devm_ioremap_resource(dev, res); if (IS_ERR(dsi->base)) { - DRM_ERROR("Unable to get dsi registers\n"); - return PTR_ERR(dsi->base); + ret = PTR_ERR(dsi->base); + DRM_ERROR("Unable to get dsi registers %d\n", ret); + return ret; + } + + dsi->vdd_supply = devm_regulator_get(dev, "phy-dsi"); + if (IS_ERR(dsi->vdd_supply)) { + ret = PTR_ERR(dsi->vdd_supply); + if (ret != -EPROBE_DEFER) + DRM_ERROR("Failed to request regulator: %d\n", ret); + return ret; + } + + ret = regulator_enable(dsi->vdd_supply); + if (ret) { + DRM_ERROR("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); - return ret; + DRM_ERROR("Unable to get pll reference clock: %d\n", ret); + goto err_clk_get; } ret = clk_prepare_enable(dsi->pllref_clk); if (ret) { - dev_err(dev, "%s: Failed to enable pllref_clk\n", __func__); - return ret; + DRM_ERROR("Failed to enable pllref_clk: %d\n", ret); + goto err_clk_get; } dw_mipi_dsi_stm_plat_data.base = dsi->base; @@ -338,20 +355,28 @@ 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"); - clk_disable_unprepare(dsi->pllref_clk); - return PTR_ERR(dsi->dsi); + ret = PTR_ERR(dsi->dsi); + DRM_ERROR("Failed to initialize mipi dsi host: %d\n", ret); + goto err_dsi_probe; } return 0; + +err_dsi_probe: + clk_disable_unprepare(dsi->pllref_clk); +err_clk_get: + regulator_disable(dsi->vdd_supply); + + return ret; } 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); dw_mipi_dsi_remove(dsi->dsi); + clk_disable_unprepare(dsi->pllref_clk); + regulator_disable(dsi->vdd_supply); return 0; } @@ -363,6 +388,7 @@ static int __maybe_unused dw_mipi_dsi_stm_suspend(struct device *dev) DRM_DEBUG_DRIVER("\n"); clk_disable_unprepare(dsi->pllref_clk); + regulator_disable(dsi->vdd_supply); return 0; } @@ -370,10 +396,22 @@ static int __maybe_unused dw_mipi_dsi_stm_suspend(struct device *dev) static int __maybe_unused dw_mipi_dsi_stm_resume(struct device *dev) { struct dw_mipi_dsi_stm *dsi = dw_mipi_dsi_stm_plat_data.priv_data; + int ret; DRM_DEBUG_DRIVER("\n"); - clk_prepare_enable(dsi->pllref_clk); + ret = regulator_enable(dsi->vdd_supply); + if (ret) { + DRM_ERROR("Failed to enable regulator: %d\n", ret); + return ret; + } + + ret = clk_prepare_enable(dsi->pllref_clk); + if (ret) { + regulator_disable(dsi->vdd_supply); + DRM_ERROR("Failed to enable pllref_clk: %d\n", ret); + return ret; + } return 0; } -- 2.7.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v4 2/2] drm/stm: dsi: add regulator support 2019-05-14 9:35 ` [PATCH v4 2/2] drm/stm: dsi: add regulator support Yannick Fertré @ 2019-05-17 10:14 ` Benjamin Gaignard 0 siblings, 0 replies; 5+ messages in thread From: Benjamin Gaignard @ 2019-05-17 10:14 UTC (permalink / raw) To: Yannick Fertré Cc: Daniel Vetter, David Airlie, Philippe Cornu, ML dri-devel, Linux Kernel Mailing List, Alexandre Torgue, Maxime Coquelin, Vincent Abriou, linux-stm32, Linux ARM, Benjamin Gaignard Le mar. 14 mai 2019 à 11:36, Yannick Fertré <yannick.fertre@st.com> a écrit : > > Add support of regulator for the phy part of the DSI > controller. > > Signed-off-by: Yannick Fertré <yannick.fertre@st.com> > Acked-by: Philippe Cornu <philippe.cornu@st.com> Applied on drm-misc-next, Thanks, Benjamin > --- > drivers/gpu/drm/stm/dw_mipi_dsi-stm.c | 60 ++++++++++++++++++++++++++++------- > 1 file changed, 49 insertions(+), 11 deletions(-) > > diff --git a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c > index 1bef73e..d8e4a14 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) > @@ -314,21 +316,36 @@ static int dw_mipi_dsi_stm_probe(struct platform_device *pdev) > res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > dsi->base = devm_ioremap_resource(dev, res); > if (IS_ERR(dsi->base)) { > - DRM_ERROR("Unable to get dsi registers\n"); > - return PTR_ERR(dsi->base); > + ret = PTR_ERR(dsi->base); > + DRM_ERROR("Unable to get dsi registers %d\n", ret); > + return ret; > + } > + > + dsi->vdd_supply = devm_regulator_get(dev, "phy-dsi"); > + if (IS_ERR(dsi->vdd_supply)) { > + ret = PTR_ERR(dsi->vdd_supply); > + if (ret != -EPROBE_DEFER) > + DRM_ERROR("Failed to request regulator: %d\n", ret); > + return ret; > + } > + > + ret = regulator_enable(dsi->vdd_supply); > + if (ret) { > + DRM_ERROR("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); > - return ret; > + DRM_ERROR("Unable to get pll reference clock: %d\n", ret); > + goto err_clk_get; > } > > ret = clk_prepare_enable(dsi->pllref_clk); > if (ret) { > - dev_err(dev, "%s: Failed to enable pllref_clk\n", __func__); > - return ret; > + DRM_ERROR("Failed to enable pllref_clk: %d\n", ret); > + goto err_clk_get; > } > > dw_mipi_dsi_stm_plat_data.base = dsi->base; > @@ -338,20 +355,28 @@ 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"); > - clk_disable_unprepare(dsi->pllref_clk); > - return PTR_ERR(dsi->dsi); > + ret = PTR_ERR(dsi->dsi); > + DRM_ERROR("Failed to initialize mipi dsi host: %d\n", ret); > + goto err_dsi_probe; > } > > return 0; > + > +err_dsi_probe: > + clk_disable_unprepare(dsi->pllref_clk); > +err_clk_get: > + regulator_disable(dsi->vdd_supply); > + > + return ret; > } > > 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); > dw_mipi_dsi_remove(dsi->dsi); > + clk_disable_unprepare(dsi->pllref_clk); > + regulator_disable(dsi->vdd_supply); > > return 0; > } > @@ -363,6 +388,7 @@ static int __maybe_unused dw_mipi_dsi_stm_suspend(struct device *dev) > DRM_DEBUG_DRIVER("\n"); > > clk_disable_unprepare(dsi->pllref_clk); > + regulator_disable(dsi->vdd_supply); > > return 0; > } > @@ -370,10 +396,22 @@ static int __maybe_unused dw_mipi_dsi_stm_suspend(struct device *dev) > static int __maybe_unused dw_mipi_dsi_stm_resume(struct device *dev) > { > struct dw_mipi_dsi_stm *dsi = dw_mipi_dsi_stm_plat_data.priv_data; > + int ret; > > DRM_DEBUG_DRIVER("\n"); > > - clk_prepare_enable(dsi->pllref_clk); > + ret = regulator_enable(dsi->vdd_supply); > + if (ret) { > + DRM_ERROR("Failed to enable regulator: %d\n", ret); > + return ret; > + } > + > + ret = clk_prepare_enable(dsi->pllref_clk); > + if (ret) { > + regulator_disable(dsi->vdd_supply); > + DRM_ERROR("Failed to enable pllref_clk: %d\n", ret); > + return ret; > + } > > return 0; > } > -- > 2.7.4 > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-05-17 10:14 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2019-05-14 9:35 [PATCH v4 0/2] Add supply property for DSI controller Yannick Fertré 2019-05-14 9:35 ` [PATCH v4 1/2] dt-bindings: display: stm32: add supply property to " Yannick Fertré 2019-05-17 10:14 ` Benjamin Gaignard 2019-05-14 9:35 ` [PATCH v4 2/2] drm/stm: dsi: add regulator support Yannick Fertré 2019-05-17 10:14 ` Benjamin Gaignard
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).