mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexey Minnekhanov <alexeymin@minlexx.ru>
To: Chintan Patel <chintanlike@gmail.com>,
	sumit.semwal@linaro.org, neil.armstrong@linaro.org
Cc: dianders@chromium.org, jesszhan0024@gmail.com,
	maarten.lankhorst@linux.intel.com, mripard@kernel.org,
	tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] drm/panel: novatek-nt36672a: Inline panel init sequences
Date: Mon, 25 May 2026 17:46:02 +0300	[thread overview]
Message-ID: <ace48664-cd7e-4cb8-8940-04ffe6f93e19@minlexx.ru> (raw)
In-Reply-To: <20260523035734.6602-1-chintanlike@gmail.com>

On 23.05.2026 06:57, Chintan Patel wrote:
> Inline the panel initialization command sequences and remove the
> table-based command abstraction used by the NT36672A panel driver.
> 
> Replace the nt36672a_panel_cmd tables and nt36672a_send_cmds()
> helper with explicit initialization functions using
> mipi_dsi_dcs_write_seq_multi() and
> mipi_dsi_dcs_write_var_seq_multi() directly.
> 
> This improves readability by making the panel programming sequence
> explicit in code and allows future sharing of common command
> subsequences between panels. It also removes an unnecessary wrapper
> around the MIPI DSI helpers.
> 
> Additionally, compress repeated register writes into small loops where
> appropriate to reduce duplication in the initialization sequences.
> 
> Add:
> tianma_fhd_video_send_init_cmds_1()
> tianma_fhd_video_send_init_cmds_2()
> tianma_fhd_video_send_deinit_cmds()
> 
> Update nt36672a_panel_desc to use function pointers for panel init
> sequences and invoke them directly from prepare/unprepare paths.
> 
> Signed-off-by: Chintan Patel <chintanlike@gmail.com>
> Reviewed-by: Douglas Anderson <dianders@chromium.org>
> ---
> Changes in v3:
> - Rename on_init_1/on_init_2/off_init to send_init_cmds_1/send_init_cmds_2/send_deinit_cmds
> - Convert all hex values to lowercase (0xFF → 0xff) per kernel coding standards
> 
> Changes in v2:
> - Replace command tables with explicit init functions
> - Remove nt36672a_send_cmds() helper entirely
> - Use mipi_dsi_dcs_write_seq_multi() directly
> - Use mipi_dsi_dcs_write_var_seq_multi() loops for repeated register writes
> - Convert nt36672a_panel_desc command table fields to function pointers
> ---
>   .../gpu/drm/panel/panel-novatek-nt36672a.c    | 522 +++++++-----------
>   1 file changed, 186 insertions(+), 336 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36672a.c b/drivers/gpu/drm/panel/panel-novatek-nt36672a.c
> index 7e8b5e059575..464d9ce47d87 100644
> --- a/drivers/gpu/drm/panel/panel-novatek-nt36672a.c
> +++ b/drivers/gpu/drm/panel/panel-novatek-nt36672a.c

...

> @@ -162,8 +141,8 @@ static int nt36672a_panel_prepare(struct drm_panel *panel)
>   	dsi_ctx.accum_err = nt36672a_panel_power_on(pinfo);
>   
>   	/* send first part of init cmds */
> -	nt36672a_send_cmds(&dsi_ctx, pinfo->desc->on_cmds_1,
> -			   pinfo->desc->num_on_cmds_1);
> +	if (pinfo->desc->send_init_cmds_1)
> +		pinfo->desc->send_init_cmds_1(&dsi_ctx);
>   
>   	mipi_dsi_dcs_exit_sleep_mode_multi(&dsi_ctx);
>   
> @@ -173,8 +152,8 @@ static int nt36672a_panel_prepare(struct drm_panel *panel)
>   	mipi_dsi_dcs_set_display_on_multi(&dsi_ctx);
>   
>   	/* Send rest of the init cmds */
> -	nt36672a_send_cmds(&dsi_ctx, pinfo->desc->on_cmds_2,
> -			   pinfo->desc->num_on_cmds_2);
> +	if (pinfo->desc->send_init_cmds_2)
> +		pinfo->desc->send_init_cmds_2(&dsi_ctx);
>   
>   	mipi_dsi_msleep(&dsi_ctx, 120);
>   

Hi!

Here, the split of panel init sequence into 2 separate functions _1 / _2
is completely artificial and completely unnecessary. For some unknown
reason the initial version of driver had initialization procedure cut in
2 parts on the boundary of exit_sleep_mode + set_display_on commands.

I think the whole init sequence should be glued together into one big
send_init_cmds() callback and have all these calls:

     mipi_dsi_dcs_exit_sleep_mode_multi(&dsi_ctx);
     /* 0x46 = 70 ms delay */
     mipi_dsi_msleep(&dsi_ctx, 70);
     mipi_dsi_dcs_set_display_on_multi(&dsi_ctx);


included in the middle. This opens up a possibility for other panels
based on nt36672a to be supported in this driver, which don't have the
init sequence split this way. The location of exit_sleep_mode and
set_display_on commands there is different. And, importantly, the delay
is different too.

I once did a very similar change to this driver [1] to add support for
more panels (ignore touchscreen changes there, look only at panel).
What is also important, that change was also tested on Xiaomi Poco F1
(xiaomi-beryllium) phone, which is the main user of this panel.
Unfortunately I never got to send it, even though I wanted to..

What do you think?

[1] https://gitlab.com/sdm845-mainline/linux/-/merge_requests/131

--
Regards,
Alexey Minnekhanov

  reply	other threads:[~2026-05-25 15:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-23  3:57 Chintan Patel
2026-05-25 14:46 ` Alexey Minnekhanov [this message]
2026-05-27  4:17   ` Chintan Patel
2026-06-03  1:06     ` Doug Anderson
2026-06-04 21:22 ` Doug Anderson

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=ace48664-cd7e-4cb8-8940-04ffe6f93e19@minlexx.ru \
    --to=alexeymin@minlexx.ru \
    --cc=airlied@gmail.com \
    --cc=chintanlike@gmail.com \
    --cc=dianders@chromium.org \
    --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=neil.armstrong@linaro.org \
    --cc=simona@ffwll.ch \
    --cc=sumit.semwal@linaro.org \
    --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®