The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] drm/panel: novatek-nt37801: Use mipi_dsi_*_multi() functions
@ 2026-07-01 12:56 Nicolás Antinori
  2026-07-04 15:59 ` Doug Anderson
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolás Antinori @ 2026-07-01 12:56 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Nicolás Antinori, Brigham Campbell, David Airlie,
	Douglas Anderson, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
	Neil Armstrong, Shuah Khan, Simona Vetter, Thomas Zimmermann,
	dri-devel, linux-kernel, linux-kernel-mentees

Replace mipi_dsi_* functions with their non-deprecated mipi_dsi_*_multi
counterparts. This change reduces error-checking boilerplate and improves
readability.

Signed-off-by: Nicolás Antinori <nico.antinori.7@gmail.com>
---
Note: I Compile-tested this patch since I don't own the panel to test it.

 drivers/gpu/drm/panel/panel-novatek-nt37801.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-novatek-nt37801.c b/drivers/gpu/drm/panel/panel-novatek-nt37801.c
index d6a37d7e0cc6..daa356bbc182 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt37801.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt37801.c
@@ -128,7 +128,8 @@ static int novatek_nt37801_off(struct novatek_nt37801 *ctx)
 static int novatek_nt37801_prepare(struct drm_panel *panel)
 {
 	struct novatek_nt37801 *ctx = to_novatek_nt37801(panel);
-	struct device *dev = &ctx->dsi->dev;
+	struct mipi_dsi_device *dsi = ctx->dsi;
+	struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi };
 	struct drm_dsc_picture_parameter_set pps;
 	int ret;

@@ -145,15 +146,10 @@ static int novatek_nt37801_prepare(struct drm_panel *panel)

 	drm_dsc_pps_payload_pack(&pps, &ctx->dsc);

-	ret = mipi_dsi_picture_parameter_set(ctx->dsi, &pps);
-	if (ret < 0) {
-		dev_err(panel->dev, "failed to transmit PPS: %d\n", ret);
-		goto err;
-	}
-
-	ret = mipi_dsi_compression_mode(ctx->dsi, true);
-	if (ret < 0) {
-		dev_err(dev, "failed to enable compression mode: %d\n", ret);
+	mipi_dsi_picture_parameter_set_multi(&dsi_ctx, &pps);
+	mipi_dsi_compression_mode_multi(&dsi_ctx, true);
+	if (dsi_ctx.accum_err) {
+		ret = dsi_ctx.accum_err;
 		goto err;
 	}

--
2.47.3


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

* Re: [PATCH] drm/panel: novatek-nt37801: Use mipi_dsi_*_multi() functions
  2026-07-01 12:56 [PATCH] drm/panel: novatek-nt37801: Use mipi_dsi_*_multi() functions Nicolás Antinori
@ 2026-07-04 15:59 ` Doug Anderson
  2026-07-06 12:34   ` Nicolás Antinori
  0 siblings, 1 reply; 3+ messages in thread
From: Doug Anderson @ 2026-07-04 15:59 UTC (permalink / raw)
  To: Nicolás Antinori
  Cc: Krzysztof Kozlowski, Brigham Campbell, David Airlie,
	Jessica Zhang, Maarten Lankhorst, Maxime Ripard, Neil Armstrong,
	Shuah Khan, Simona Vetter, Thomas Zimmermann, dri-devel,
	linux-kernel, linux-kernel-mentees

Hi,

On Wed, Jul 1, 2026 at 5:56 AM Nicolás Antinori
<nico.antinori.7@gmail.com> wrote:
>
> Replace mipi_dsi_* functions with their non-deprecated mipi_dsi_*_multi
> counterparts. This change reduces error-checking boilerplate and improves
> readability.
>
> Signed-off-by: Nicolás Antinori <nico.antinori.7@gmail.com>
> ---
> Note: I Compile-tested this patch since I don't own the panel to test it.
>
>  drivers/gpu/drm/panel/panel-novatek-nt37801.c | 16 ++++++----------
>  1 file changed, 6 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/panel/panel-novatek-nt37801.c b/drivers/gpu/drm/panel/panel-novatek-nt37801.c
> index d6a37d7e0cc6..daa356bbc182 100644
> --- a/drivers/gpu/drm/panel/panel-novatek-nt37801.c
> +++ b/drivers/gpu/drm/panel/panel-novatek-nt37801.c
> @@ -128,7 +128,8 @@ static int novatek_nt37801_off(struct novatek_nt37801 *ctx)
>  static int novatek_nt37801_prepare(struct drm_panel *panel)
>  {
>         struct novatek_nt37801 *ctx = to_novatek_nt37801(panel);
> -       struct device *dev = &ctx->dsi->dev;
> +       struct mipi_dsi_device *dsi = ctx->dsi;
> +       struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi };
>         struct drm_dsc_picture_parameter_set pps;
>         int ret;
>
> @@ -145,15 +146,10 @@ static int novatek_nt37801_prepare(struct drm_panel *panel)
>
>         drm_dsc_pps_payload_pack(&pps, &ctx->dsc);
>
> -       ret = mipi_dsi_picture_parameter_set(ctx->dsi, &pps);
> -       if (ret < 0) {
> -               dev_err(panel->dev, "failed to transmit PPS: %d\n", ret);
> -               goto err;
> -       }
> -
> -       ret = mipi_dsi_compression_mode(ctx->dsi, true);
> -       if (ret < 0) {
> -               dev_err(dev, "failed to enable compression mode: %d\n", ret);
> +       mipi_dsi_picture_parameter_set_multi(&dsi_ctx, &pps);
> +       mipi_dsi_compression_mode_multi(&dsi_ctx, true);
> +       if (dsi_ctx.accum_err) {
> +               ret = dsi_ctx.accum_err;
>                 goto err;
>         }

Sure, this looks pretty good.

Reviewed-by: Douglas Anderson <dianders@chromium.org>

For bonus points, I think you could change novatek_nt37801_on() to
return "void" and take a "struct mipi_dsi_multi_context". Since
drm_dsc_pps_payload_pack() is harmless, the function can now just be:

  novatek_nt37801_on(&dsi_ctx);
  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);
  if (dsi_ctx.accum_err) {
    ...
  }

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

* Re: [PATCH] drm/panel: novatek-nt37801: Use mipi_dsi_*_multi() functions
  2026-07-04 15:59 ` Doug Anderson
@ 2026-07-06 12:34   ` Nicolás Antinori
  0 siblings, 0 replies; 3+ messages in thread
From: Nicolás Antinori @ 2026-07-06 12:34 UTC (permalink / raw)
  To: Doug Anderson
  Cc: Krzysztof Kozlowski, Brigham Campbell, David Airlie,
	Jessica Zhang, Maarten Lankhorst, Maxime Ripard, Neil Armstrong,
	Shuah Khan, Simona Vetter, Thomas Zimmermann, dri-devel,
	linux-kernel, linux-kernel-mentees

On Sat Jul 4, 2026 at 12:59 PM -03, Doug Anderson wrote:
> Hi,
>
> On Wed, Jul 1, 2026 at 5:56 AM Nicolás Antinori
> <nico.antinori.7@gmail.com> wrote:
>>
>> Replace mipi_dsi_* functions with their non-deprecated mipi_dsi_*_multi
>> counterparts. This change reduces error-checking boilerplate and improves
>> readability.
>>
>> Signed-off-by: Nicolás Antinori <nico.antinori.7@gmail.com>
>> ---
>> Note: I Compile-tested this patch since I don't own the panel to test it.
>>
>>  drivers/gpu/drm/panel/panel-novatek-nt37801.c | 16 ++++++----------
>>  1 file changed, 6 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/panel/panel-novatek-nt37801.c b/drivers/gpu/drm/panel/panel-novatek-nt37801.c
>> index d6a37d7e0cc6..daa356bbc182 100644
>> --- a/drivers/gpu/drm/panel/panel-novatek-nt37801.c
>> +++ b/drivers/gpu/drm/panel/panel-novatek-nt37801.c
>> @@ -128,7 +128,8 @@ static int novatek_nt37801_off(struct novatek_nt37801 *ctx)
>>  static int novatek_nt37801_prepare(struct drm_panel *panel)
>>  {
>>         struct novatek_nt37801 *ctx = to_novatek_nt37801(panel);
>> -       struct device *dev = &ctx->dsi->dev;
>> +       struct mipi_dsi_device *dsi = ctx->dsi;
>> +       struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi };
>>         struct drm_dsc_picture_parameter_set pps;
>>         int ret;
>>
>> @@ -145,15 +146,10 @@ static int novatek_nt37801_prepare(struct drm_panel *panel)
>>
>>         drm_dsc_pps_payload_pack(&pps, &ctx->dsc);
>>
>> -       ret = mipi_dsi_picture_parameter_set(ctx->dsi, &pps);
>> -       if (ret < 0) {
>> -               dev_err(panel->dev, "failed to transmit PPS: %d\n", ret);
>> -               goto err;
>> -       }
>> -
>> -       ret = mipi_dsi_compression_mode(ctx->dsi, true);
>> -       if (ret < 0) {
>> -               dev_err(dev, "failed to enable compression mode: %d\n", ret);
>> +       mipi_dsi_picture_parameter_set_multi(&dsi_ctx, &pps);
>> +       mipi_dsi_compression_mode_multi(&dsi_ctx, true);
>> +       if (dsi_ctx.accum_err) {
>> +               ret = dsi_ctx.accum_err;
>>                 goto err;
>>         }
>
> Sure, this looks pretty good.
>
> Reviewed-by: Douglas Anderson <dianders@chromium.org>
>
> For bonus points, I think you could change novatek_nt37801_on() to
> return "void" and take a "struct mipi_dsi_multi_context". Since
> drm_dsc_pps_payload_pack() is harmless, the function can now just be:
>
>   novatek_nt37801_on(&dsi_ctx);
>   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);
>   if (dsi_ctx.accum_err) {
>     ...
>   }


Will send a v2 with those changes. Thank you for the suggestion!

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

end of thread, other threads:[~2026-07-06 12:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-01 12:56 [PATCH] drm/panel: novatek-nt37801: Use mipi_dsi_*_multi() functions Nicolás Antinori
2026-07-04 15:59 ` Doug Anderson
2026-07-06 12:34   ` Nicolás Antinori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox