dri-devel Archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/panel: jdi-fhd-r63452: move DCS off commands to disable
@ 2024-05-09 18:14 Barnabás Czémán
  2024-05-10  0:56 ` Dmitry Baryshkov
  0 siblings, 1 reply; 6+ messages in thread
From: Barnabás Czémán @ 2024-05-09 18:14 UTC (permalink / raw
  To: Neil Armstrong, Jessica Zhang, Sam Ravnborg, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Daniel Vetter
  Cc: dri-devel, linux-kernel, Barnabás Czémán

Move DCS off commands from .unprepare to .disable so that they
actually reach the DSI host.

Signed-off-by: Barnabás Czémán <trabarni@gmail.com>
---
 drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c b/drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c
index 483dc88d16d8..f7222974d6ed 100644
--- a/drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c
+++ b/drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c
@@ -169,6 +169,15 @@ static int jdi_fhd_r63452_prepare(struct drm_panel *panel)
 }
 
 static int jdi_fhd_r63452_unprepare(struct drm_panel *panel)
+{
+	struct jdi_fhd_r63452 *ctx = to_jdi_fhd_r63452(panel);
+
+	gpiod_set_value_cansleep(ctx->reset_gpio, 1);
+
+	return 0;
+}
+
+static int jdi_fhd_r63452_disable(struct drm_panel *panel)
 {
 	struct jdi_fhd_r63452 *ctx = to_jdi_fhd_r63452(panel);
 	struct device *dev = &ctx->dsi->dev;
@@ -178,8 +187,6 @@ static int jdi_fhd_r63452_unprepare(struct drm_panel *panel)
 	if (ret < 0)
 		dev_err(dev, "Failed to un-initialize panel: %d\n", ret);
 
-	gpiod_set_value_cansleep(ctx->reset_gpio, 1);
-
 	return 0;
 }
 
@@ -219,6 +226,7 @@ static int jdi_fhd_r63452_get_modes(struct drm_panel *panel,
 static const struct drm_panel_funcs jdi_fhd_r63452_panel_funcs = {
 	.prepare = jdi_fhd_r63452_prepare,
 	.unprepare = jdi_fhd_r63452_unprepare,
+	.disable = jdi_fhd_r63452_disable,
 	.get_modes = jdi_fhd_r63452_get_modes,
 };
 

---
base-commit: 704ba27ac55579704ba1289392448b0c66b56258
change-id: 20240509-jdi-use-disable-ee29098d9c81

Best regards,
-- 
Barnabás Czémán <trabarni@gmail.com>


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/panel: jdi-fhd-r63452: move DCS off commands to disable
  2024-05-09 18:14 [PATCH] drm/panel: jdi-fhd-r63452: move DCS off commands to disable Barnabás Czémán
@ 2024-05-10  0:56 ` Dmitry Baryshkov
  2024-05-10  6:46   ` Barnabás Czémán
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Baryshkov @ 2024-05-10  0:56 UTC (permalink / raw
  To: Barnabás Czémán
  Cc: Neil Armstrong, Jessica Zhang, Sam Ravnborg, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Daniel Vetter,
	dri-devel, linux-kernel

On Thu, May 09, 2024 at 08:14:07PM +0200, Barnabás Czémán wrote:
> Move DCS off commands from .unprepare to .disable so that they
> actually reach the DSI host.
> 
> Signed-off-by: Barnabás Czémán <trabarni@gmail.com>
> ---
>  drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)

I don't think this is correct. If the driver sends enable commands in
prepare, it should be able to send commands during unprepare too.

> 
> diff --git a/drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c b/drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c
> index 483dc88d16d8..f7222974d6ed 100644
> --- a/drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c
> +++ b/drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c
> @@ -169,6 +169,15 @@ static int jdi_fhd_r63452_prepare(struct drm_panel *panel)
>  }
>  
>  static int jdi_fhd_r63452_unprepare(struct drm_panel *panel)
> +{
> +	struct jdi_fhd_r63452 *ctx = to_jdi_fhd_r63452(panel);
> +
> +	gpiod_set_value_cansleep(ctx->reset_gpio, 1);
> +
> +	return 0;
> +}
> +
> +static int jdi_fhd_r63452_disable(struct drm_panel *panel)
>  {
>  	struct jdi_fhd_r63452 *ctx = to_jdi_fhd_r63452(panel);
>  	struct device *dev = &ctx->dsi->dev;
> @@ -178,8 +187,6 @@ static int jdi_fhd_r63452_unprepare(struct drm_panel *panel)
>  	if (ret < 0)
>  		dev_err(dev, "Failed to un-initialize panel: %d\n", ret);
>  
> -	gpiod_set_value_cansleep(ctx->reset_gpio, 1);
> -
>  	return 0;
>  }
>  
> @@ -219,6 +226,7 @@ static int jdi_fhd_r63452_get_modes(struct drm_panel *panel,
>  static const struct drm_panel_funcs jdi_fhd_r63452_panel_funcs = {
>  	.prepare = jdi_fhd_r63452_prepare,
>  	.unprepare = jdi_fhd_r63452_unprepare,
> +	.disable = jdi_fhd_r63452_disable,
>  	.get_modes = jdi_fhd_r63452_get_modes,
>  };
>  
> 
> ---
> base-commit: 704ba27ac55579704ba1289392448b0c66b56258
> change-id: 20240509-jdi-use-disable-ee29098d9c81
> 
> Best regards,
> -- 
> Barnabás Czémán <trabarni@gmail.com>
> 

-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/panel: jdi-fhd-r63452: move DCS off commands to disable
  2024-05-10  0:56 ` Dmitry Baryshkov
@ 2024-05-10  6:46   ` Barnabás Czémán
  2024-05-10  7:10     ` Barnabás Czémán
  0 siblings, 1 reply; 6+ messages in thread
From: Barnabás Czémán @ 2024-05-10  6:46 UTC (permalink / raw
  To: Dmitry Baryshkov
  Cc: Neil Armstrong, Jessica Zhang, Sam Ravnborg, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Daniel Vetter,
	dri-devel, linux-kernel

On Fri, May 10, 2024 at 2:56 AM Dmitry Baryshkov
<dmitry.baryshkov@linaro.org> wrote:
>
> On Thu, May 09, 2024 at 08:14:07PM +0200, Barnabás Czémán wrote:
> > Move DCS off commands from .unprepare to .disable so that they
> > actually reach the DSI host.
> >
> > Signed-off-by: Barnabás Czémán <trabarni@gmail.com>
> > ---
> >  drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c | 12 ++++++++++--
> >  1 file changed, 10 insertions(+), 2 deletions(-)
>
> I don't think this is correct. If the driver sends enable commands in
> prepare, it should be able to send commands during unprepare too.
>
It cannot send commands in unprepare, there are multiple panel drivers
what do the same.
Every panel drivers which have DCS commands to be sent in unprepare
has similar error messages with mdp5/dpu.

[   92.322564] panel-td4320-boeplus c994000.dsi.0: sending command
0x28 failed: -22
[   92.322635] panel-td4320-boeplus c994000.dsi.0: Failed to
un-initialize panel: -22


> >
> > diff --git a/drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c b/drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c
> > index 483dc88d16d8..f7222974d6ed 100644
> > --- a/drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c
> > +++ b/drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c
> > @@ -169,6 +169,15 @@ static int jdi_fhd_r63452_prepare(struct drm_panel *panel)
> >  }
> >
> >  static int jdi_fhd_r63452_unprepare(struct drm_panel *panel)
> > +{
> > +     struct jdi_fhd_r63452 *ctx = to_jdi_fhd_r63452(panel);
> > +
> > +     gpiod_set_value_cansleep(ctx->reset_gpio, 1);
> > +
> > +     return 0;
> > +}
> > +
> > +static int jdi_fhd_r63452_disable(struct drm_panel *panel)
> >  {
> >       struct jdi_fhd_r63452 *ctx = to_jdi_fhd_r63452(panel);
> >       struct device *dev = &ctx->dsi->dev;
> > @@ -178,8 +187,6 @@ static int jdi_fhd_r63452_unprepare(struct drm_panel *panel)
> >       if (ret < 0)
> >               dev_err(dev, "Failed to un-initialize panel: %d\n", ret);
> >
> > -     gpiod_set_value_cansleep(ctx->reset_gpio, 1);
> > -
> >       return 0;
> >  }
> >
> > @@ -219,6 +226,7 @@ static int jdi_fhd_r63452_get_modes(struct drm_panel *panel,
> >  static const struct drm_panel_funcs jdi_fhd_r63452_panel_funcs = {
> >       .prepare = jdi_fhd_r63452_prepare,
> >       .unprepare = jdi_fhd_r63452_unprepare,
> > +     .disable = jdi_fhd_r63452_disable,
> >       .get_modes = jdi_fhd_r63452_get_modes,
> >  };
> >
> >
> > ---
> > base-commit: 704ba27ac55579704ba1289392448b0c66b56258
> > change-id: 20240509-jdi-use-disable-ee29098d9c81
> >
> > Best regards,
> > --
> > Barnabás Czémán <trabarni@gmail.com>
> >
>
> --
> With best wishes
> Dmitry

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/panel: jdi-fhd-r63452: move DCS off commands to disable
  2024-05-10  6:46   ` Barnabás Czémán
@ 2024-05-10  7:10     ` Barnabás Czémán
  2024-05-10 18:02       ` Dmitry Baryshkov
  0 siblings, 1 reply; 6+ messages in thread
From: Barnabás Czémán @ 2024-05-10  7:10 UTC (permalink / raw
  To: Dmitry Baryshkov
  Cc: Neil Armstrong, Jessica Zhang, Sam Ravnborg, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Daniel Vetter,
	dri-devel, linux-kernel

On Fri, May 10, 2024 at 8:46 AM Barnabás Czémán <trabarni@gmail.com> wrote:
>
> On Fri, May 10, 2024 at 2:56 AM Dmitry Baryshkov
> <dmitry.baryshkov@linaro.org> wrote:
> >
> > On Thu, May 09, 2024 at 08:14:07PM +0200, Barnabás Czémán wrote:
> > > Move DCS off commands from .unprepare to .disable so that they
> > > actually reach the DSI host.
> > >
> > > Signed-off-by: Barnabás Czémán <trabarni@gmail.com>
> > > ---
> > >  drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c | 12 ++++++++++--
> > >  1 file changed, 10 insertions(+), 2 deletions(-)
> >
> > I don't think this is correct. If the driver sends enable commands in
> > prepare, it should be able to send commands during unprepare too.
> >
> It cannot send commands in unprepare, there are multiple panel drivers
> what do the same.
> Every panel drivers which have DCS commands to be sent in unprepare
> has similar error messages with mdp5/dpu.
>
> [   92.322564] panel-td4320-boeplus c994000.dsi.0: sending command
> 0x28 failed: -22
> [   92.322635] panel-td4320-boeplus c994000.dsi.0: Failed to
> un-initialize panel: -22
>
>
Here is the error messages, these are comes from unprepare by every panel off:
[  121.295290] panel-jdi-fhd-r63452 994000.dsi.0: transmit data failed: -22
[  121.295368] panel-jdi-fhd-r63452 994000.dsi.0: Failed to
un-initialize panel: -22
[  184.783019] panel-jdi-fhd-r63452 994000.dsi.0: transmit data failed: -22
[  184.783066] panel-jdi-fhd-r63452 994000.dsi.0: Failed to
un-initialize panel: -22
with this patch these errors no more.
.prepare works because of this flag ctx->panel.prepare_prev_first = true;
> > >
> > > diff --git a/drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c b/drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c
> > > index 483dc88d16d8..f7222974d6ed 100644
> > > --- a/drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c
> > > +++ b/drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c
> > > @@ -169,6 +169,15 @@ static int jdi_fhd_r63452_prepare(struct drm_panel *panel)
> > >  }
> > >
> > >  static int jdi_fhd_r63452_unprepare(struct drm_panel *panel)
> > > +{
> > > +     struct jdi_fhd_r63452 *ctx = to_jdi_fhd_r63452(panel);
> > > +
> > > +     gpiod_set_value_cansleep(ctx->reset_gpio, 1);
> > > +
> > > +     return 0;
> > > +}
> > > +
> > > +static int jdi_fhd_r63452_disable(struct drm_panel *panel)
> > >  {
> > >       struct jdi_fhd_r63452 *ctx = to_jdi_fhd_r63452(panel);
> > >       struct device *dev = &ctx->dsi->dev;
> > > @@ -178,8 +187,6 @@ static int jdi_fhd_r63452_unprepare(struct drm_panel *panel)
> > >       if (ret < 0)
> > >               dev_err(dev, "Failed to un-initialize panel: %d\n", ret);
> > >
> > > -     gpiod_set_value_cansleep(ctx->reset_gpio, 1);
> > > -
> > >       return 0;
> > >  }
> > >
> > > @@ -219,6 +226,7 @@ static int jdi_fhd_r63452_get_modes(struct drm_panel *panel,
> > >  static const struct drm_panel_funcs jdi_fhd_r63452_panel_funcs = {
> > >       .prepare = jdi_fhd_r63452_prepare,
> > >       .unprepare = jdi_fhd_r63452_unprepare,
> > > +     .disable = jdi_fhd_r63452_disable,
> > >       .get_modes = jdi_fhd_r63452_get_modes,
> > >  };
> > >
> > >
> > > ---
> > > base-commit: 704ba27ac55579704ba1289392448b0c66b56258
> > > change-id: 20240509-jdi-use-disable-ee29098d9c81
> > >
> > > Best regards,
> > > --
> > > Barnabás Czémán <trabarni@gmail.com>
> > >
> >
> > --
> > With best wishes
> > Dmitry

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/panel: jdi-fhd-r63452: move DCS off commands to disable
  2024-05-10  7:10     ` Barnabás Czémán
@ 2024-05-10 18:02       ` Dmitry Baryshkov
  2024-05-10 21:43         ` Barnabás Czémán
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Baryshkov @ 2024-05-10 18:02 UTC (permalink / raw
  To: Barnabás Czémán
  Cc: Neil Armstrong, Jessica Zhang, Sam Ravnborg, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Daniel Vetter,
	dri-devel, linux-kernel

On Fri, May 10, 2024 at 09:10:34AM +0200, Barnabás Czémán wrote:
> On Fri, May 10, 2024 at 8:46 AM Barnabás Czémán <trabarni@gmail.com> wrote:
> >
> > On Fri, May 10, 2024 at 2:56 AM Dmitry Baryshkov
> > <dmitry.baryshkov@linaro.org> wrote:
> > >
> > > On Thu, May 09, 2024 at 08:14:07PM +0200, Barnabás Czémán wrote:
> > > > Move DCS off commands from .unprepare to .disable so that they
> > > > actually reach the DSI host.
> > > >
> > > > Signed-off-by: Barnabás Czémán <trabarni@gmail.com>
> > > > ---
> > > >  drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c | 12 ++++++++++--
> > > >  1 file changed, 10 insertions(+), 2 deletions(-)
> > >
> > > I don't think this is correct. If the driver sends enable commands in
> > > prepare, it should be able to send commands during unprepare too.
> > >
> > It cannot send commands in unprepare, there are multiple panel drivers
> > what do the same.
> > Every panel drivers which have DCS commands to be sent in unprepare
> > has similar error messages with mdp5/dpu.
> >
> > [   92.322564] panel-td4320-boeplus c994000.dsi.0: sending command
> > 0x28 failed: -22
> > [   92.322635] panel-td4320-boeplus c994000.dsi.0: Failed to
> > un-initialize panel: -22
> >
> >
> Here is the error messages, these are comes from unprepare by every panel off:
> [  121.295290] panel-jdi-fhd-r63452 994000.dsi.0: transmit data failed: -22
> [  121.295368] panel-jdi-fhd-r63452 994000.dsi.0: Failed to
> un-initialize panel: -22
> [  184.783019] panel-jdi-fhd-r63452 994000.dsi.0: transmit data failed: -22
> [  184.783066] panel-jdi-fhd-r63452 994000.dsi.0: Failed to
> un-initialize panel: -22
> with this patch these errors no more.
> .prepare works because of this flag ctx->panel.prepare_prev_first = true;

The flag should also invert the order of post_disable chain. It well
might be that the drm/msm/dsi driver shuts down the DSI link too soon.
Please consider fixing the MSM DSI driver instead.

-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/panel: jdi-fhd-r63452: move DCS off commands to disable
  2024-05-10 18:02       ` Dmitry Baryshkov
@ 2024-05-10 21:43         ` Barnabás Czémán
  0 siblings, 0 replies; 6+ messages in thread
From: Barnabás Czémán @ 2024-05-10 21:43 UTC (permalink / raw
  To: Dmitry Baryshkov
  Cc: Neil Armstrong, Jessica Zhang, Sam Ravnborg, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Daniel Vetter,
	dri-devel, linux-kernel

On Fri, May 10, 2024 at 8:02 PM Dmitry Baryshkov
<dmitry.baryshkov@linaro.org> wrote:
>
> On Fri, May 10, 2024 at 09:10:34AM +0200, Barnabás Czémán wrote:
> > On Fri, May 10, 2024 at 8:46 AM Barnabás Czémán <trabarni@gmail.com> wrote:
> > >
> > > On Fri, May 10, 2024 at 2:56 AM Dmitry Baryshkov
> > > <dmitry.baryshkov@linaro.org> wrote:
> > > >
> > > > On Thu, May 09, 2024 at 08:14:07PM +0200, Barnabás Czémán wrote:
> > > > > Move DCS off commands from .unprepare to .disable so that they
> > > > > actually reach the DSI host.
> > > > >
> > > > > Signed-off-by: Barnabás Czémán <trabarni@gmail.com>
> > > > > ---
> > > > >  drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c | 12 ++++++++++--
> > > > >  1 file changed, 10 insertions(+), 2 deletions(-)
> > > >
> > > > I don't think this is correct. If the driver sends enable commands in
> > > > prepare, it should be able to send commands during unprepare too.
> > > >
> > > It cannot send commands in unprepare, there are multiple panel drivers
> > > what do the same.
> > > Every panel drivers which have DCS commands to be sent in unprepare
> > > has similar error messages with mdp5/dpu.
> > >
> > > [   92.322564] panel-td4320-boeplus c994000.dsi.0: sending command
> > > 0x28 failed: -22
> > > [   92.322635] panel-td4320-boeplus c994000.dsi.0: Failed to
> > > un-initialize panel: -22
> > >
> > >
> > Here is the error messages, these are comes from unprepare by every panel off:
> > [  121.295290] panel-jdi-fhd-r63452 994000.dsi.0: transmit data failed: -22
> > [  121.295368] panel-jdi-fhd-r63452 994000.dsi.0: Failed to
> > un-initialize panel: -22
> > [  184.783019] panel-jdi-fhd-r63452 994000.dsi.0: transmit data failed: -22
> > [  184.783066] panel-jdi-fhd-r63452 994000.dsi.0: Failed to
> > un-initialize panel: -22
> > with this patch these errors no more.
> > .prepare works because of this flag ctx->panel.prepare_prev_first = true;
>
> The flag should also invert the order of post_disable chain. It well
> might be that the drm/msm/dsi driver shuts down the DSI link too soon.
> Please consider fixing the MSM DSI driver instead.
>
Ok, thank you i look forward to it.
> --
> With best wishes
> Dmitry

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-05-10 21:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-09 18:14 [PATCH] drm/panel: jdi-fhd-r63452: move DCS off commands to disable Barnabás Czémán
2024-05-10  0:56 ` Dmitry Baryshkov
2024-05-10  6:46   ` Barnabás Czémán
2024-05-10  7:10     ` Barnabás Czémán
2024-05-10 18:02       ` Dmitry Baryshkov
2024-05-10 21:43         ` Barnabás Czémán

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 read-only IMAP folder(s) and NNTP newsgroup(s).