mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Neil Armstrong <neil.armstrong@linaro.org>
To: "Marc-Olivier Champagne"
	<marc-olivier.champagne@savoirfairelinux.com>,
	"Jessica Zhang" <jesszhan0024@gmail.com>,
	"Guido Günther" <agx@sigxcpu.org>
Cc: Ondrej Jirman <megi@xff.cz>, Purism Kernel Team <kernel@puri.sm>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Hugo Villeneuve <hvilleneuve@dimonoff.com>,
	dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Jerome Oufella <jerome.oufella@savoirfairelinux.com>,
	Felix Boucher <felix.boucher@savoirfairelinux.com>,
	Quentin Lehoux <quentin.lehoux@savoirfairelinux.com>
Subject: Re: [PATCH 2/4] drm/panel: st7703: move init commands to prepare()
Date: Thu, 8 Oct 2026 10:24:36 +0200	[thread overview]
Message-ID: <fa64131e-52a3-4058-9655-e1a4c36de47d@linaro.org> (raw)
In-Reply-To: <20261007201859.3709656-3-marc-olivier.champagne@savoirfairelinux.com>

On 10/7/26 22:18, Marc-Olivier Champagne wrote:
> The panel init sequence is currently sent from enable(), i.e. after
> the DSI host has started the video stream. Not all DSI hosts accept
> command packets in that state, so the init sequence may never reach
> the panel.
> 
> Move the init sequence to prepare(), right after the panel reset, to
> ensure it is sent before the host enables the video stream.
> 
> Since the init sequence can now fail in prepare(), power the panel
> back down on error: the panel core does not call unprepare() when
> prepare() fails, leaving the power supplies enabled.
> 
> Both patterns are already used by other DSI panel drivers.
> 
> Suggested-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
> Signed-off-by: Marc-Olivier Champagne <marc-olivier.champagne@savoirfairelinux.com>
> ---
>   drivers/gpu/drm/panel/panel-sitronix-st7703.c | 18 +++++++++++++++---
>   1 file changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
> index 368c57591817..f4635a7327de 100644
> --- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c
> +++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
> @@ -774,8 +774,6 @@ static int st7703_enable(struct drm_panel *panel)
>   	struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
>   	struct mipi_dsi_multi_context dsi_ctx = {.dsi = dsi};
>   
> -	ctx->desc->init_sequence(&dsi_ctx);
> -
>   	mipi_dsi_dcs_exit_sleep_mode_multi(&dsi_ctx);
>   
>   	/* It takes the controller 120 msec to wake up after sleep. */
> @@ -784,7 +782,7 @@ static int st7703_enable(struct drm_panel *panel)
>   	mipi_dsi_dcs_set_display_on_multi(&dsi_ctx);
>   
>   	if (!dsi_ctx.accum_err)
> -		dev_dbg(ctx->dev, "Panel init sequence done\n");
> +		dev_dbg(ctx->dev, "Panel enable done\n");
>   
>   	return dsi_ctx.accum_err;
>   }
> @@ -819,6 +817,8 @@ static int st7703_unprepare(struct drm_panel *panel)
>   static int st7703_prepare(struct drm_panel *panel)
>   {
>   	struct st7703 *ctx = panel_to_st7703(panel);
> +	struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
> +	struct mipi_dsi_multi_context dsi_ctx = {.dsi = dsi};
>   	int ret;
>   
>   	dev_dbg(ctx->dev, "Resetting the panel\n");
> @@ -843,6 +843,18 @@ static int st7703_prepare(struct drm_panel *panel)
>   	gpiod_set_value_cansleep(ctx->reset_gpio, 0);
>   	usleep_range(15000, 20000);
>   
> +	ctx->desc->init_sequence(&dsi_ctx);
> +
> +	if (dsi_ctx.accum_err) {
> +		gpiod_set_value_cansleep(ctx->reset_gpio, 1);
> +		regulator_disable(ctx->iovcc);
> +		regulator_disable(ctx->vcc);
> +
> +		return dsi_ctx.accum_err;
> +	}
> +
> +	dev_dbg(ctx->dev, "Panel init sequence done\n");
> +
>   	return 0;
>   }
>   

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>

Thanks,
Neil

  reply	other threads:[~2026-10-08  8:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-07 20:18 [PATCH 0/4] drm/panel: st7703: add support for DCLTek DT300248 Marc-Olivier Champagne
2026-10-07 20:18 ` [PATCH 1/4] drm/panel: st7703: set prepare_prev_first Marc-Olivier Champagne
2026-10-08  8:24   ` Neil Armstrong
2026-10-07 20:18 ` [PATCH 2/4] drm/panel: st7703: move init commands to prepare() Marc-Olivier Champagne
2026-10-08  8:24   ` Neil Armstrong [this message]
2026-10-07 20:18 ` [PATCH 3/4] dt-bindings: display: panel: add compatible for DCLTek 300248 10.25in panel Marc-Olivier Champagne
2026-10-08  7:30   ` Conor Dooley
2026-10-08  7:36   ` Conor Dooley
2026-10-07 20:18 ` [PATCH 4/4] drm/panel: st7703: Add DCLTek 300248 10.25in display Marc-Olivier Champagne
2026-10-08  8:25   ` Neil Armstrong

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=fa64131e-52a3-4058-9655-e1a4c36de47d@linaro.org \
    --to=neil.armstrong@linaro.org \
    --cc=agx@sigxcpu.org \
    --cc=airlied@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=felix.boucher@savoirfairelinux.com \
    --cc=hvilleneuve@dimonoff.com \
    --cc=jerome.oufella@savoirfairelinux.com \
    --cc=jesszhan0024@gmail.com \
    --cc=kernel@puri.sm \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=marc-olivier.champagne@savoirfairelinux.com \
    --cc=megi@xff.cz \
    --cc=mripard@kernel.org \
    --cc=quentin.lehoux@savoirfairelinux.com \
    --cc=robh@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    /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

all inboxes | Powered by JetHome®