* [PATCH v3] drm/panel: novatek-nt36672a: Convert to mipi_dsi_*_multi() helpers
@ 2026-03-05 4:49 Chintan Patel
2026-03-06 17:40 ` Doug Anderson
2026-03-13 15:46 ` Doug Anderson
0 siblings, 2 replies; 5+ messages in thread
From: Chintan Patel @ 2026-03-05 4:49 UTC (permalink / raw)
To: sumit.semwal, neil.armstrong
Cc: dianders, jesszhan0024, maarten.lankhorst, mripard, tzimmermann,
airlied, simona, dri-devel, linux-kernel, Chintan Patel
Convert the driver to use the non-deprecated mipi_dsi_*_multi() helpers and
mipi_dsi_msleep().
Switch DCS command sequences to the multi context API and
accumulate errors via struct mipi_dsi_multi_context. Replace
open-coded error handling with the multi helpers and convert
nt36672a_send_cmds() and power sequencing accordingly.
This patch is intended to functionally be a no-op, though there is one
slight change. Previously a failure in regulator_bulk_disable() would
have caused nt36672a_panel_unprepare() to return an error. Now it
won't. No other errors in nt36672a_panel_unprepare() were propagated,
so this makes things consistent.
Signed-off-by: Chintan Patel <chintanlike@gmail.com>
---
Changes in v3:
- Keep local ret variable in nt36672a_panel_power_off() to preserve error code in logging.
- Change mipi_dsi_msleep() back to regular msleep(60) in power-down sequence to preserve behavior.
- Reset dsi_ctx.accum_err before set_display_off_multi() and before power-down to preserve original error-tolerant shutdown behavior.
Changes in v2:
- Address alignment feedback from Doug.
- Restore original power-down ordering.
- Drop return value from nt36672a_panel_power_off().
- Consolidate error handling around dsi_ctx.accum_err.
.../gpu/drm/panel/panel-novatek-nt36672a.c | 94 ++++++-------------
1 file changed, 30 insertions(+), 64 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36672a.c b/drivers/gpu/drm/panel/panel-novatek-nt36672a.c
index 29e1f6aea480..7e8b5e059575 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt36672a.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt36672a.c
@@ -79,70 +79,57 @@ static inline struct nt36672a_panel *to_nt36672a_panel(struct drm_panel *panel)
return container_of(panel, struct nt36672a_panel, base);
}
-static int nt36672a_send_cmds(struct drm_panel *panel, const struct nt36672a_panel_cmd *cmds,
- int num)
+static void nt36672a_send_cmds(struct mipi_dsi_multi_context *dsi_ctx,
+ const struct nt36672a_panel_cmd *cmds, int num)
{
- struct nt36672a_panel *pinfo = to_nt36672a_panel(panel);
unsigned int i;
- int err;
for (i = 0; i < num; i++) {
const struct nt36672a_panel_cmd *cmd = &cmds[i];
- err = mipi_dsi_dcs_write(pinfo->link, cmd->data[0], cmd->data + 1, 1);
-
- if (err < 0)
- return err;
+ /* cmd->data[0] is the DCS command, cmd->data[1] is the parameter */
+ mipi_dsi_dcs_write_buffer_multi(dsi_ctx, cmd->data, sizeof(cmd->data));
}
-
- return 0;
}
-static int nt36672a_panel_power_off(struct drm_panel *panel)
+static void nt36672a_panel_power_off(struct drm_panel *panel)
{
struct nt36672a_panel *pinfo = to_nt36672a_panel(panel);
- int ret = 0;
+ int ret;
gpiod_set_value(pinfo->reset_gpio, 1);
ret = regulator_bulk_disable(ARRAY_SIZE(pinfo->supplies), pinfo->supplies);
if (ret)
dev_err(panel->dev, "regulator_bulk_disable failed %d\n", ret);
-
- return ret;
}
static int nt36672a_panel_unprepare(struct drm_panel *panel)
{
struct nt36672a_panel *pinfo = to_nt36672a_panel(panel);
- int ret;
+ struct mipi_dsi_multi_context dsi_ctx = { .dsi = pinfo->link };
/* send off cmds */
- ret = nt36672a_send_cmds(panel, pinfo->desc->off_cmds,
- pinfo->desc->num_off_cmds);
+ nt36672a_send_cmds(&dsi_ctx, pinfo->desc->off_cmds,
+ pinfo->desc->num_off_cmds);
- if (ret < 0)
- dev_err(panel->dev, "failed to send DCS off cmds: %d\n", ret);
-
- ret = mipi_dsi_dcs_set_display_off(pinfo->link);
- if (ret < 0)
- dev_err(panel->dev, "set_display_off cmd failed ret = %d\n", ret);
+ /* Reset error to continue with display off even if send_cmds failed */
+ dsi_ctx.accum_err = 0;
+ mipi_dsi_dcs_set_display_off_multi(&dsi_ctx);
+ /* Reset error to continue power-down even if display off failed */
+ dsi_ctx.accum_err = 0;
/* 120ms delay required here as per DCS spec */
msleep(120);
- ret = mipi_dsi_dcs_enter_sleep_mode(pinfo->link);
- if (ret < 0)
- dev_err(panel->dev, "enter_sleep cmd failed ret = %d\n", ret);
+ mipi_dsi_dcs_enter_sleep_mode_multi(&dsi_ctx);
/* 0x3C = 60ms delay */
msleep(60);
- ret = nt36672a_panel_power_off(panel);
- if (ret < 0)
- dev_err(panel->dev, "power_off failed ret = %d\n", ret);
+ nt36672a_panel_power_off(panel);
- return ret;
+ return 0;
}
static int nt36672a_panel_power_on(struct nt36672a_panel *pinfo)
@@ -170,52 +157,31 @@ static int nt36672a_panel_power_on(struct nt36672a_panel *pinfo)
static int nt36672a_panel_prepare(struct drm_panel *panel)
{
struct nt36672a_panel *pinfo = to_nt36672a_panel(panel);
- int err;
+ struct mipi_dsi_multi_context dsi_ctx = { .dsi = pinfo->link };
- err = nt36672a_panel_power_on(pinfo);
- if (err < 0)
- goto poweroff;
+ dsi_ctx.accum_err = nt36672a_panel_power_on(pinfo);
/* send first part of init cmds */
- err = nt36672a_send_cmds(panel, pinfo->desc->on_cmds_1,
- pinfo->desc->num_on_cmds_1);
+ nt36672a_send_cmds(&dsi_ctx, pinfo->desc->on_cmds_1,
+ pinfo->desc->num_on_cmds_1);
- if (err < 0) {
- dev_err(panel->dev, "failed to send DCS Init 1st Code: %d\n", err);
- goto poweroff;
- }
-
- err = mipi_dsi_dcs_exit_sleep_mode(pinfo->link);
- if (err < 0) {
- dev_err(panel->dev, "failed to exit sleep mode: %d\n", err);
- goto poweroff;
- }
+ mipi_dsi_dcs_exit_sleep_mode_multi(&dsi_ctx);
/* 0x46 = 70 ms delay */
- msleep(70);
+ mipi_dsi_msleep(&dsi_ctx, 70);
- err = mipi_dsi_dcs_set_display_on(pinfo->link);
- if (err < 0) {
- dev_err(panel->dev, "failed to Set Display ON: %d\n", err);
- goto poweroff;
- }
+ mipi_dsi_dcs_set_display_on_multi(&dsi_ctx);
/* Send rest of the init cmds */
- err = nt36672a_send_cmds(panel, pinfo->desc->on_cmds_2,
- pinfo->desc->num_on_cmds_2);
+ nt36672a_send_cmds(&dsi_ctx, pinfo->desc->on_cmds_2,
+ pinfo->desc->num_on_cmds_2);
- if (err < 0) {
- dev_err(panel->dev, "failed to send DCS Init 2nd Code: %d\n", err);
- goto poweroff;
- }
+ mipi_dsi_msleep(&dsi_ctx, 120);
- msleep(120);
+ if (dsi_ctx.accum_err < 0)
+ gpiod_set_value(pinfo->reset_gpio, 0);
- return 0;
-
-poweroff:
- gpiod_set_value(pinfo->reset_gpio, 0);
- return err;
+ return dsi_ctx.accum_err;
}
static int nt36672a_panel_get_modes(struct drm_panel *panel,
--
2.43.0
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v3] drm/panel: novatek-nt36672a: Convert to mipi_dsi_*_multi() helpers
2026-03-05 4:49 [PATCH v3] drm/panel: novatek-nt36672a: Convert to mipi_dsi_*_multi() helpers Chintan Patel
@ 2026-03-06 17:40 ` Doug Anderson
2026-03-19 2:40 ` Chintan Patel
2026-03-13 15:46 ` Doug Anderson
1 sibling, 1 reply; 5+ messages in thread
From: Doug Anderson @ 2026-03-06 17:40 UTC (permalink / raw)
To: Chintan Patel
Cc: sumit.semwal, neil.armstrong, jesszhan0024, maarten.lankhorst,
mripard, tzimmermann, airlied, simona, dri-devel, linux-kernel
Hi,
On Wed, Mar 4, 2026 at 8:49 PM Chintan Patel <chintanlike@gmail.com> wrote:
>
> Convert the driver to use the non-deprecated mipi_dsi_*_multi() helpers and
> mipi_dsi_msleep().
>
> Switch DCS command sequences to the multi context API and
> accumulate errors via struct mipi_dsi_multi_context. Replace
> open-coded error handling with the multi helpers and convert
> nt36672a_send_cmds() and power sequencing accordingly.
>
> This patch is intended to functionally be a no-op, though there is one
> slight change. Previously a failure in regulator_bulk_disable() would
> have caused nt36672a_panel_unprepare() to return an error. Now it
> won't. No other errors in nt36672a_panel_unprepare() were propagated,
> so this makes things consistent.
>
> Signed-off-by: Chintan Patel <chintanlike@gmail.com>
> ---
> Changes in v3:
> - Keep local ret variable in nt36672a_panel_power_off() to preserve error code in logging.
> - Change mipi_dsi_msleep() back to regular msleep(60) in power-down sequence to preserve behavior.
> - Reset dsi_ctx.accum_err before set_display_off_multi() and before power-down to preserve original error-tolerant shutdown behavior.
>
> Changes in v2:
> - Address alignment feedback from Doug.
> - Restore original power-down ordering.
> - Drop return value from nt36672a_panel_power_off().
> - Consolidate error handling around dsi_ctx.accum_err.
>
> .../gpu/drm/panel/panel-novatek-nt36672a.c | 94 ++++++-------------
> 1 file changed, 30 insertions(+), 64 deletions(-)
Looks good to me now. I'll plan to apply in ~1 week if there is no
further feedback.
Reviewed-by: Douglas Anderson <dianders@chromium.org>
As per my response in v1 [1], someone could still do additional
cleanup to move away from the table-based initialization, but it
doesn't make sense to block this patch on that. :-)
[1] https://lore.kernel.org/r/CAD=FV=WtjW5WWmjeb2zwF2PjiJeZv1jZS_UKZ0bT1658=CkwVA@mail.gmail.com
-Doug
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3] drm/panel: novatek-nt36672a: Convert to mipi_dsi_*_multi() helpers
2026-03-06 17:40 ` Doug Anderson
@ 2026-03-19 2:40 ` Chintan Patel
0 siblings, 0 replies; 5+ messages in thread
From: Chintan Patel @ 2026-03-19 2:40 UTC (permalink / raw)
To: Doug Anderson
Cc: sumit.semwal, neil.armstrong, jesszhan0024, maarten.lankhorst,
mripard, tzimmermann, airlied, simona, dri-devel, linux-kernel
On 3/6/26 09:40, Doug Anderson wrote:
> Hi,
>
> On Wed, Mar 4, 2026 at 8:49 PM Chintan Patel <chintanlike@gmail.com> wrote:
>>
>> Convert the driver to use the non-deprecated mipi_dsi_*_multi() helpers and
>> mipi_dsi_msleep().
>>
>> Switch DCS command sequences to the multi context API and
>> accumulate errors via struct mipi_dsi_multi_context. Replace
>> open-coded error handling with the multi helpers and convert
>> nt36672a_send_cmds() and power sequencing accordingly.
>>
>> This patch is intended to functionally be a no-op, though there is one
>> slight change. Previously a failure in regulator_bulk_disable() would
>> have caused nt36672a_panel_unprepare() to return an error. Now it
>> won't. No other errors in nt36672a_panel_unprepare() were propagated,
>> so this makes things consistent.
>>
>> Signed-off-by: Chintan Patel <chintanlike@gmail.com>
>> ---
>> Changes in v3:
>> - Keep local ret variable in nt36672a_panel_power_off() to preserve error code in logging.
>> - Change mipi_dsi_msleep() back to regular msleep(60) in power-down sequence to preserve behavior.
>> - Reset dsi_ctx.accum_err before set_display_off_multi() and before power-down to preserve original error-tolerant shutdown behavior.
>>
>> Changes in v2:
>> - Address alignment feedback from Doug.
>> - Restore original power-down ordering.
>> - Drop return value from nt36672a_panel_power_off().
>> - Consolidate error handling around dsi_ctx.accum_err.
>>
>> .../gpu/drm/panel/panel-novatek-nt36672a.c | 94 ++++++-------------
>> 1 file changed, 30 insertions(+), 64 deletions(-)
>
> Looks good to me now. I'll plan to apply in ~1 week if there is no
> further feedback.
>
> Reviewed-by: Douglas Anderson <dianders@chromium.org>
>
> As per my response in v1 [1], someone could still do additional
> cleanup to move away from the table-based initialization, but it
> doesn't make sense to block this patch on that. :-)
>
Agree - I have plan to address as separate patch.
> [1] https://lore.kernel.org/r/CAD=FV=WtjW5WWmjeb2zwF2PjiJeZv1jZS_UKZ0bT1658=CkwVA@mail.gmail.com
>
> -Doug
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3] drm/panel: novatek-nt36672a: Convert to mipi_dsi_*_multi() helpers
2026-03-05 4:49 [PATCH v3] drm/panel: novatek-nt36672a: Convert to mipi_dsi_*_multi() helpers Chintan Patel
2026-03-06 17:40 ` Doug Anderson
@ 2026-03-13 15:46 ` Doug Anderson
2026-03-19 2:37 ` Chintan Patel
1 sibling, 1 reply; 5+ messages in thread
From: Doug Anderson @ 2026-03-13 15:46 UTC (permalink / raw)
To: Chintan Patel
Cc: sumit.semwal, neil.armstrong, jesszhan0024, maarten.lankhorst,
mripard, tzimmermann, airlied, simona, dri-devel, linux-kernel
Hi,
On Wed, Mar 4, 2026 at 8:49 PM Chintan Patel <chintanlike@gmail.com> wrote:
>
> Convert the driver to use the non-deprecated mipi_dsi_*_multi() helpers and
> mipi_dsi_msleep().
>
> Switch DCS command sequences to the multi context API and
> accumulate errors via struct mipi_dsi_multi_context. Replace
> open-coded error handling with the multi helpers and convert
> nt36672a_send_cmds() and power sequencing accordingly.
>
> This patch is intended to functionally be a no-op, though there is one
> slight change. Previously a failure in regulator_bulk_disable() would
> have caused nt36672a_panel_unprepare() to return an error. Now it
> won't. No other errors in nt36672a_panel_unprepare() were propagated,
> so this makes things consistent.
>
> Signed-off-by: Chintan Patel <chintanlike@gmail.com>
> ---
> Changes in v3:
> - Keep local ret variable in nt36672a_panel_power_off() to preserve error code in logging.
> - Change mipi_dsi_msleep() back to regular msleep(60) in power-down sequence to preserve behavior.
> - Reset dsi_ctx.accum_err before set_display_off_multi() and before power-down to preserve original error-tolerant shutdown behavior.
>
> Changes in v2:
> - Address alignment feedback from Doug.
> - Restore original power-down ordering.
> - Drop return value from nt36672a_panel_power_off().
> - Consolidate error handling around dsi_ctx.accum_err.
>
> .../gpu/drm/panel/panel-novatek-nt36672a.c | 94 ++++++-------------
> 1 file changed, 30 insertions(+), 64 deletions(-)
Pushed to drm-misc-next:
[1/1] drm/panel: novatek-nt36672a: Convert to mipi_dsi_*_multi() helpers
commit: bc4cb68a02f1a445aa65d8054bd69ba4ba3f5767
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v3] drm/panel: novatek-nt36672a: Convert to mipi_dsi_*_multi() helpers
2026-03-13 15:46 ` Doug Anderson
@ 2026-03-19 2:37 ` Chintan Patel
0 siblings, 0 replies; 5+ messages in thread
From: Chintan Patel @ 2026-03-19 2:37 UTC (permalink / raw)
To: Doug Anderson
Cc: sumit.semwal, neil.armstrong, jesszhan0024, maarten.lankhorst,
mripard, tzimmermann, airlied, simona, dri-devel, linux-kernel
On 3/13/26 08:46, Doug Anderson wrote:
> Hi,
>
> On Wed, Mar 4, 2026 at 8:49 PM Chintan Patel <chintanlike@gmail.com> wrote:
>>
>> Convert the driver to use the non-deprecated mipi_dsi_*_multi() helpers and
>> mipi_dsi_msleep().
>>
>> Switch DCS command sequences to the multi context API and
>> accumulate errors via struct mipi_dsi_multi_context. Replace
>> open-coded error handling with the multi helpers and convert
>> nt36672a_send_cmds() and power sequencing accordingly.
>>
>> This patch is intended to functionally be a no-op, though there is one
>> slight change. Previously a failure in regulator_bulk_disable() would
>> have caused nt36672a_panel_unprepare() to return an error. Now it
>> won't. No other errors in nt36672a_panel_unprepare() were propagated,
>> so this makes things consistent.
>>
>> Signed-off-by: Chintan Patel <chintanlike@gmail.com>
>> ---
>> Changes in v3:
>> - Keep local ret variable in nt36672a_panel_power_off() to preserve error code in logging.
>> - Change mipi_dsi_msleep() back to regular msleep(60) in power-down sequence to preserve behavior.
>> - Reset dsi_ctx.accum_err before set_display_off_multi() and before power-down to preserve original error-tolerant shutdown behavior.
>>
>> Changes in v2:
>> - Address alignment feedback from Doug.
>> - Restore original power-down ordering.
>> - Drop return value from nt36672a_panel_power_off().
>> - Consolidate error handling around dsi_ctx.accum_err.
>>
>> .../gpu/drm/panel/panel-novatek-nt36672a.c | 94 ++++++-------------
>> 1 file changed, 30 insertions(+), 64 deletions(-)
>
> Pushed to drm-misc-next:
>
> [1/1] drm/panel: novatek-nt36672a: Convert to mipi_dsi_*_multi() helpers
> commit: bc4cb68a02f1a445aa65d8054bd69ba4ba3f5767
Thank you Doug!
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-03-19 2:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-05 4:49 [PATCH v3] drm/panel: novatek-nt36672a: Convert to mipi_dsi_*_multi() helpers Chintan Patel
2026-03-06 17:40 ` Doug Anderson
2026-03-19 2:40 ` Chintan Patel
2026-03-13 15:46 ` Doug Anderson
2026-03-19 2:37 ` Chintan Patel
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®