Re: [PATCH] drm/panel/synaptics-r63353: Use _multi variants
From: Dmitry Baryshkov
Date: Wed Mar 05 2025 - 21:06:37 EST
On Wed, Mar 05, 2025 at 07:01:41PM -0500, Anusha Srivatsa wrote:
> Move away from using deprecated API and use _multi
> variants if available. Use mipi_dsi_msleep()
> and mipi_dsi_usleep_range() instead of msleep()
> and usleep_range() respectively.
>
> Used Coccinelle to find the multiple occurences.
> SmPl patch:
> @rule@
> identifier dsi_var;
> identifier r;
> identifier func;
> type t;
> position p;
> expression dsi_device;
> expression list es;
> @@
> t func(...) {
> ...
> struct mipi_dsi_device *dsi_var = dsi_device;
> +struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi_var };
> <+...
> (
> -mipi_dsi_dcs_write_seq(dsi_var,es)@p;
> +mipi_dsi_dcs_write_seq_multi(&dsi_ctx,es);
> |
> -mipi_dsi_generic_write_seq(dsi_var,es)@p;
> +mipi_dsi_generic_write_seq_multi(&dsi_ctx,es);
> |
> -mipi_dsi_generic_write(dsi_var,es)@p;
> +mipi_dsi_generic_write_multi(&dsi_ctx,es);
> |
> -r = mipi_dsi_dcs_nop(dsi_var)@p;
> +mipi_dsi_dcs_nop_multi(&dsi_ctx);
> |
> ....rest of API
> ..
> )
> -if(r < 0) {
> -...
> -}
> ...+>
>
> Cc: Maxime Ripard <maxime.ripard@xxxxxxxxxxx>
> Cc: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx>
> Cc: Tejas Vipin <tejasvipin76@xxxxxxxxx>
> Cc: Doug Anderson <dianders@xxxxxxxxxxxx>
> Signed-off-by: Anusha Srivatsa <asrivats@xxxxxxxxxx>
> ---
> Previous attempt for this change was addressed in:[1]
> The series did not handle returns properly and still
> used msleep() and usleep_range() API.
> It also collided with an Tejas's similar efforts.
>
> Will be sending the patches per driver instead of
> major haul of changes.
>
> Following [2] for reference.
>
> [1] -> https://patchwork.freedesktop.org/series/144824/
> [2] -> https://lore.kernel.org/dri-devel/20250220045721.145905-1-tejasvipin76@xxxxxxxxx/#iZ31drivers:gpu:drm:panel:panel-sony-td4353-jdi.c
> ---
> drivers/gpu/drm/panel/panel-synaptics-r63353.c | 64 +++++++-------------------
> 1 file changed, 17 insertions(+), 47 deletions(-)
>
>
> - ret = mipi_dsi_dcs_set_display_on(dsi);
> - if (ret < 0) {
> - dev_err(dev, "Failed to set display ON (%d)\n", ret);
> - goto fail;
> - }
> -
> - return 0;
> + mipi_dsi_dcs_set_display_on_multi(&dsi_ctx);
>
> -fail:
> - gpiod_set_value(rpanel->reset_gpio, 0);
> + return dsi_ctx.accum_err;
You've lost panel reset in case of an error. The rest LGTM.
>
> - return ret;
> }
>
> static int r63353_panel_prepare(struct drm_panel *panel)
--
With best wishes
Dmitry