Message ID | 20250305-mipi-synaptic-1-v1-1-92017cd19ef6@redhat.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | drm/panel/synaptics-r63353: Use _multi variants | expand |
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@bootlin.com> > Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> > Cc: Tejas Vipin <tejasvipin76@gmail.com> > Cc: Doug Anderson <dianders@chromium.org> > Signed-off-by: Anusha Srivatsa <asrivats@redhat.com> > --- > 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@gmail.com/#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)
Hi Anusha, 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) { > -... > -} > ...+> The point of sending a single patch was to review the coccinelle script, so you must put the entire script you used here. > Cc: Maxime Ripard <maxime.ripard@bootlin.com> That hasn't been my email address for 6 years :) Maxime
diff --git a/drivers/gpu/drm/panel/panel-synaptics-r63353.c b/drivers/gpu/drm/panel/panel-synaptics-r63353.c index 17349825543fe6a117bbfd9cb92a564ce433d13a..9cb1fe985a6fde7a475746019e89bd1dcee898ff 100644 --- a/drivers/gpu/drm/panel/panel-synaptics-r63353.c +++ b/drivers/gpu/drm/panel/panel-synaptics-r63353.c @@ -106,53 +106,32 @@ static int r63353_panel_power_off(struct r63353_panel *rpanel) static int r63353_panel_activate(struct r63353_panel *rpanel) { struct mipi_dsi_device *dsi = rpanel->dsi; - struct device *dev = &dsi->dev; - int i, ret; + struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi }; + int i; - ret = mipi_dsi_dcs_soft_reset(dsi); - if (ret < 0) { - dev_err(dev, "Failed to do Software Reset (%d)\n", ret); - goto fail; - } + mipi_dsi_dcs_soft_reset_multi(&dsi_ctx); - usleep_range(15000, 17000); + mipi_dsi_usleep_range(&dsi_ctx, 15000, 17000); - ret = mipi_dsi_dcs_enter_sleep_mode(dsi); - if (ret < 0) { - dev_err(dev, "Failed to enter sleep mode (%d)\n", ret); - goto fail; - } + mipi_dsi_dcs_enter_sleep_mode_multi(&dsi_ctx); for (i = 0; i < rpanel->pdata->init_length; i++) { const struct r63353_instr *instr = &rpanel->pdata->init[i]; - ret = mipi_dsi_dcs_write_buffer(dsi, instr->data, instr->len); - if (ret < 0) - goto fail; + mipi_dsi_dcs_write_buffer_multi(&dsi_ctx, instr->data, + instr->len); } - msleep(120); + mipi_dsi_msleep(&dsi_ctx, 120); - ret = mipi_dsi_dcs_exit_sleep_mode(dsi); - if (ret < 0) { - dev_err(dev, "Failed to exit sleep mode (%d)\n", ret); - goto fail; - } + mipi_dsi_dcs_exit_sleep_mode_multi(&dsi_ctx); - usleep_range(5000, 10000); + mipi_dsi_usleep_range(&dsi_ctx, 5000, 10000); - 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; - return ret; } static int r63353_panel_prepare(struct drm_panel *panel) @@ -181,24 +160,15 @@ static int r63353_panel_prepare(struct drm_panel *panel) static int r63353_panel_deactivate(struct r63353_panel *rpanel) { struct mipi_dsi_device *dsi = rpanel->dsi; - struct device *dev = &dsi->dev; - int ret; + struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi }; - ret = mipi_dsi_dcs_set_display_off(dsi); - if (ret < 0) { - dev_err(dev, "Failed to set display OFF (%d)\n", ret); - return ret; - } + mipi_dsi_dcs_set_display_off_multi(&dsi_ctx); - usleep_range(5000, 10000); + mipi_dsi_usleep_range(&dsi_ctx, 5000, 10000); - ret = mipi_dsi_dcs_enter_sleep_mode(dsi); - if (ret < 0) { - dev_err(dev, "Failed to enter sleep mode (%d)\n", ret); - return ret; - } + mipi_dsi_dcs_enter_sleep_mode_multi(&dsi_ctx); - return 0; + return dsi_ctx.accum_err; } static int r63353_panel_unprepare(struct drm_panel *panel)
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@bootlin.com> Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Cc: Tejas Vipin <tejasvipin76@gmail.com> Cc: Doug Anderson <dianders@chromium.org> Signed-off-by: Anusha Srivatsa <asrivats@redhat.com> --- 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@gmail.com/#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(-) --- base-commit: ced7486468ac3b38d59a69fca5d97998499c936b change-id: 20250305-mipi-synaptic-1-a2043543cd3a Best regards,