* [PATCH] drm/stm: dsi: check hardware version
@ 2019-05-10 15:02 Yannick Fertré
2019-05-10 16:31 ` Philippe CORNU
0 siblings, 1 reply; 3+ messages in thread
From: Yannick Fertré @ 2019-05-10 15:02 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
Check version of DSI hardware IP. Only versions 1.30 & 1.31
are supported.
Signed-off-by: Yannick Fertré <yannick.fertre@st.com>
---
drivers/gpu/drm/stm/dw_mipi_dsi-stm.c | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c
index 22bd095..29105e9 100644
--- a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c
+++ b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c
@@ -227,7 +227,6 @@ dw_mipi_dsi_get_lane_mbps(void *priv_data, const struct drm_display_mode *mode,
u32 val;
/* Update lane capabilities according to hw version */
- dsi->hw_version = dsi_read(dsi, DSI_VERSION) & VERSION;
dsi->lane_min_kbps = LANE_MIN_KBPS;
dsi->lane_max_kbps = LANE_MAX_KBPS;
if (dsi->hw_version == HWVER_131) {
@@ -306,6 +305,7 @@ static int dw_mipi_dsi_stm_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct dw_mipi_dsi_stm *dsi;
+ struct clk *pclk;
struct resource *res;
int ret;
@@ -347,6 +347,28 @@ static int dw_mipi_dsi_stm_probe(struct platform_device *pdev)
goto err_clk_get;
}
+ pclk = devm_clk_get(dev, "pclk");
+ if (IS_ERR(pclk)) {
+ ret = PTR_ERR(pclk);
+ DRM_ERROR("Unable to get peripheral clock: %d\n", ret);
+ goto err_dsi_probe;
+ }
+
+ ret = clk_prepare_enable(pclk);
+ if (ret) {
+ DRM_ERROR("%s: Failed to enable peripheral clk\n", __func__);
+ goto err_dsi_probe;
+ }
+
+ dsi->hw_version = dsi_read(dsi, DSI_VERSION) & VERSION;
+ clk_disable_unprepare(pclk);
+
+ if (dsi->hw_version != HWVER_130 && dsi->hw_version != HWVER_131) {
+ ret = -ENODEV;
+ DRM_ERROR("bad dsi hardware version\n");
+ goto err_dsi_probe;
+ }
+
dw_mipi_dsi_stm_plat_data.base = dsi->base;
dw_mipi_dsi_stm_plat_data.priv_data = dsi;
--
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] 3+ messages in thread
* Re: [PATCH] drm/stm: dsi: check hardware version
2019-05-10 15:02 [PATCH] drm/stm: dsi: check hardware version Yannick Fertré
@ 2019-05-10 16:31 ` Philippe CORNU
2019-05-24 8:34 ` Benjamin Gaignard
0 siblings, 1 reply; 3+ messages in thread
From: Philippe CORNU @ 2019-05-10 16:31 UTC (permalink / raw)
To: Yannick FERTRE, Benjamin GAIGNARD, Vincent ABRIOU, David Airlie,
Daniel Vetter, Maxime Coquelin, Alexandre TORGUE, dri-devel,
linux-stm32, linux-arm-kernel, linux-kernel
Dear Yannick,
Thank you for your patch,
Acked-by: Philippe Cornu <philippe.cornu@st.com>
Dear Benjamin,
If you are fine with this patch, please push it *after* the patch named
"drm/stm: dsi: add support of an optional regulator" (if I well
understood those two patches)
Thank you
Philippe :-)
On 5/10/19 5:02 PM, Yannick Fertré wrote:
> Check version of DSI hardware IP. Only versions 1.30 & 1.31
> are supported.
>
> Signed-off-by: Yannick Fertré <yannick.fertre@st.com>
> ---
> drivers/gpu/drm/stm/dw_mipi_dsi-stm.c | 24 +++++++++++++++++++++++-
> 1 file changed, 23 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c
> index 22bd095..29105e9 100644
> --- a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c
> +++ b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c
> @@ -227,7 +227,6 @@ dw_mipi_dsi_get_lane_mbps(void *priv_data, const struct drm_display_mode *mode,
> u32 val;
>
> /* Update lane capabilities according to hw version */
> - dsi->hw_version = dsi_read(dsi, DSI_VERSION) & VERSION;
> dsi->lane_min_kbps = LANE_MIN_KBPS;
> dsi->lane_max_kbps = LANE_MAX_KBPS;
> if (dsi->hw_version == HWVER_131) {
> @@ -306,6 +305,7 @@ static int dw_mipi_dsi_stm_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> struct dw_mipi_dsi_stm *dsi;
> + struct clk *pclk;
> struct resource *res;
> int ret;
>
> @@ -347,6 +347,28 @@ static int dw_mipi_dsi_stm_probe(struct platform_device *pdev)
> goto err_clk_get;
> }
>
> + pclk = devm_clk_get(dev, "pclk");
> + if (IS_ERR(pclk)) {
> + ret = PTR_ERR(pclk);
> + DRM_ERROR("Unable to get peripheral clock: %d\n", ret);
> + goto err_dsi_probe;
> + }
> +
> + ret = clk_prepare_enable(pclk);
> + if (ret) {
> + DRM_ERROR("%s: Failed to enable peripheral clk\n", __func__);
> + goto err_dsi_probe;
> + }
> +
> + dsi->hw_version = dsi_read(dsi, DSI_VERSION) & VERSION;
> + clk_disable_unprepare(pclk);
> +
> + if (dsi->hw_version != HWVER_130 && dsi->hw_version != HWVER_131) {
> + ret = -ENODEV;
> + DRM_ERROR("bad dsi hardware version\n");
> + goto err_dsi_probe;
> + }
> +
> dw_mipi_dsi_stm_plat_data.base = dsi->base;
> dw_mipi_dsi_stm_plat_data.priv_data = dsi;
>
>
_______________________________________________
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] 3+ messages in thread
* Re: [PATCH] drm/stm: dsi: check hardware version
2019-05-10 16:31 ` Philippe CORNU
@ 2019-05-24 8:34 ` Benjamin Gaignard
0 siblings, 0 replies; 3+ messages in thread
From: Benjamin Gaignard @ 2019-05-24 8:34 UTC (permalink / raw)
To: Philippe CORNU
Cc: Benjamin GAIGNARD, David Airlie, linux-kernel, dri-devel,
Yannick FERTRE, Maxime Coquelin, Daniel Vetter, Vincent ABRIOU,
linux-stm32, linux-arm-kernel, Alexandre TORGUE
Le ven. 10 mai 2019 à 18:31, Philippe CORNU <philippe.cornu@st.com> a écrit :
>
>
> Dear Yannick,
> Thank you for your patch,
>
> Acked-by: Philippe Cornu <philippe.cornu@st.com>
>
> Dear Benjamin,
> If you are fine with this patch, please push it *after* the patch named
> "drm/stm: dsi: add support of an optional regulator" (if I well
> understood those two patches)
>
> Thank you
> Philippe :-)
Applied on drm-misc-next,
Benjamin
>
>
> On 5/10/19 5:02 PM, Yannick Fertré wrote:
> > Check version of DSI hardware IP. Only versions 1.30 & 1.31
> > are supported.
> >
> > Signed-off-by: Yannick Fertré <yannick.fertre@st.com>
> > ---
> > drivers/gpu/drm/stm/dw_mipi_dsi-stm.c | 24 +++++++++++++++++++++++-
> > 1 file changed, 23 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c
> > index 22bd095..29105e9 100644
> > --- a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c
> > +++ b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c
> > @@ -227,7 +227,6 @@ dw_mipi_dsi_get_lane_mbps(void *priv_data, const struct drm_display_mode *mode,
> > u32 val;
> >
> > /* Update lane capabilities according to hw version */
> > - dsi->hw_version = dsi_read(dsi, DSI_VERSION) & VERSION;
> > dsi->lane_min_kbps = LANE_MIN_KBPS;
> > dsi->lane_max_kbps = LANE_MAX_KBPS;
> > if (dsi->hw_version == HWVER_131) {
> > @@ -306,6 +305,7 @@ static int dw_mipi_dsi_stm_probe(struct platform_device *pdev)
> > {
> > struct device *dev = &pdev->dev;
> > struct dw_mipi_dsi_stm *dsi;
> > + struct clk *pclk;
> > struct resource *res;
> > int ret;
> >
> > @@ -347,6 +347,28 @@ static int dw_mipi_dsi_stm_probe(struct platform_device *pdev)
> > goto err_clk_get;
> > }
> >
> > + pclk = devm_clk_get(dev, "pclk");
> > + if (IS_ERR(pclk)) {
> > + ret = PTR_ERR(pclk);
> > + DRM_ERROR("Unable to get peripheral clock: %d\n", ret);
> > + goto err_dsi_probe;
> > + }
> > +
> > + ret = clk_prepare_enable(pclk);
> > + if (ret) {
> > + DRM_ERROR("%s: Failed to enable peripheral clk\n", __func__);
> > + goto err_dsi_probe;
> > + }
> > +
> > + dsi->hw_version = dsi_read(dsi, DSI_VERSION) & VERSION;
> > + clk_disable_unprepare(pclk);
> > +
> > + if (dsi->hw_version != HWVER_130 && dsi->hw_version != HWVER_131) {
> > + ret = -ENODEV;
> > + DRM_ERROR("bad dsi hardware version\n");
> > + goto err_dsi_probe;
> > + }
> > +
> > dw_mipi_dsi_stm_plat_data.base = dsi->base;
> > dw_mipi_dsi_stm_plat_data.priv_data = dsi;
> >
> >
> _______________________________________________
> 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] 3+ messages in thread
end of thread, other threads:[~2019-05-24 8:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-10 15:02 [PATCH] drm/stm: dsi: check hardware version Yannick Fertré
2019-05-10 16:31 ` Philippe CORNU
2019-05-24 8:34 ` 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).