mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Neil Armstrong <neil.armstrong@linaro.org>
To: Qianhui Xu <xiaqinghuan@mail.ustc.edu.cn>,
	Jessica Zhang <jesszhan0024@gmail.com>,
	dri-devel@lists.freedesktop.org
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v3 3/4] drm/panel: novatek-nt36536: power off on any prepare failure
Date: Thu, 3 Dec 2026 11:19:01 +0100	[thread overview]
Message-ID: <7b327751-9f4a-442d-a398-79c736f57461@linaro.org> (raw)
In-Reply-To: <20261202090911.3987891-4-xiaqinghuan@mail.ustc.edu.cn>

On 12/2/26 10:09, Qianhui Xu wrote:
> prepare() only undid the power-up when the initialisation sequence
> failed. Failures of the picture parameter set, the compression mode
> commands or the backlight enable were ignored, leaving the panel powered
> with a wrong state and -- for the backlight -- with the error swallowed.
> Use a single power_off label for all error paths and also check
> dsi_ctx.accum_err after the batched MIPI writes, as those helpers only
> record their error there.
> 
> Fixes: 75a5dbd1f4f7 ("drm/panel: Add Novatek NT36536 panel driver")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Qianhui Xu <xiaqinghuan@mail.ustc.edu.cn>
> ---
>   drivers/gpu/drm/panel/panel-novatek-nt36536.c | 19 ++++++++++++++-----
>   1 file changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36536.c b/drivers/gpu/drm/panel/panel-novatek-nt36536.c
> index 7aa26796e2a90..e372e346d8b77 100644
> --- a/drivers/gpu/drm/panel/panel-novatek-nt36536.c
> +++ b/drivers/gpu/drm/panel/panel-novatek-nt36536.c
> @@ -100,18 +100,27 @@ static int novatek_prepare(struct drm_panel *panel)
>   	ret = ctx->desc->init_sequence(&dsi_ctx);
>   	if (ret < 0) {
>   		dev_err(dev, "Failed to initialize panel: %d\n", ret);
> -		gpiod_set_value_cansleep(ctx->reset_gpio, 1);
> -		regulator_bulk_disable(ARRAY_SIZE(novatek_supplies),
> -				       ctx->supplies);
> -		return ret;
> +		goto power_off;
>   	}
>   
>   	drm_dsc_pps_payload_pack(&pps, &ctx->dsc);
>   	mipi_dsi_picture_parameter_set_multi(&dsi_ctx, &pps);
>   	mipi_dsi_compression_mode_multi(&dsi_ctx, true);
>   	mipi_dsi_msleep(&dsi_ctx, 28);
> +	ret = dsi_ctx.accum_err;
> +	if (ret)
> +		goto power_off;
> +
> +	ret = backlight_enable(ctx->backlight);
> +	if (ret)
> +		goto power_off;
> +
> +	return 0;
>   
> -	return backlight_enable(ctx->backlight);
> +power_off:
> +	gpiod_set_value_cansleep(ctx->reset_gpio, 1);
> +	regulator_bulk_disable(ARRAY_SIZE(novatek_supplies), ctx->supplies);
> +	return ret;
>   }
>   
>   static int novatek_off(struct mipi_dsi_multi_context *dsi_ctx)

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

Thanks,
Neil

  reply	other threads:[~2026-12-03 10:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02  9:09 [PATCH v3 0/4] drm/panel: novatek-nt36536: add 40/24 Hz modes, fix lifecycle Qianhui Xu
2026-12-02  9:09 ` [PATCH v3 1/4] drm/panel: novatek-nt36536: add 40Hz and 24Hz modes for CSOT PP8807HB1-1 Qianhui Xu
2026-12-02  9:09 ` [PATCH v3 2/4] drm/panel: novatek-nt36536: finish setup before attaching DSI devices Qianhui Xu
2026-12-03 10:18   ` Neil Armstrong
2026-12-02  9:09 ` [PATCH v3 3/4] drm/panel: novatek-nt36536: power off on any prepare failure Qianhui Xu
2026-12-03 10:19   ` Neil Armstrong [this message]
2026-12-02  9:09 ` [PATCH v3 4/4] drm/panel: novatek-nt36536: reject enable when prepare failed Qianhui Xu
2026-12-03 10:20   ` Neil Armstrong
2026-12-03 14:37     ` Qianhui Xu

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=7b327751-9f4a-442d-a398-79c736f57461@linaro.org \
    --to=neil.armstrong@linaro.org \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jesszhan0024@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=stable@vger.kernel.org \
    --cc=tzimmermann@suse.de \
    --cc=xiaqinghuan@mail.ustc.edu.cn \
    /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®