mbox series

[00/14] drm/panel: Transition away from using mipi_dsi_*_write_seq()

Message ID 20250206-mipi-cocci-v1-0-4ff0c69e8897@redhat.com (mailing list archive)
Headers show
Series drm/panel: Transition away from using mipi_dsi_*_write_seq() | expand

Message

Anusha Srivatsa Feb. 6, 2025, 9:05 p.m. UTC
Transition away from mipi_dsi_generic_write_seq() and
mipi_dsi_dcs_write_seq() to mipi_dsi_generic_write_seq_multi()
and mipi_dsi_dcs_write_seq_multi() respectively.

This is addressing one of the gpu todo items [1]

Used Coccinelle to make the code changes.Semantic patch:
@rule_1@
identifier dsi_var;
expression dsi_device;
expression list es;
@@
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);
+mipi_dsi_dcs_write_seq_multi(&dsi_ctx,es);
...+>

//rule_2
@rule_2@
expression dsi_var;
expression list es;
identifier jdi;
@@
static int jdi_write_dcdc_registers(struct jdi_panel *jdi)
{
+struct mipi_dsi_multi_context dsi_ctx1 = { .dsi = jdi->link1 };
+struct mipi_dsi_multi_context dsi_ctx2 = { .dsi = jdi->link2 };
<+...
-mipi_dsi_generic_write_seq(jdi->link1,es);
+mipi_dsi_generic_write_seq_multi(&dsi_ctx1,es);
-mipi_dsi_generic_write_seq(jdi->link2,es);
+mipi_dsi_generic_write_seq_multi(&dsi_ctx2,es);
...+>
}

//rule_3
@rule_3@
expression dsi_var;
expression list es;
identifier jdi;
@@
struct mipi_dsi_device *dsi0 = pinfo->dsi[0];
struct mipi_dsi_device *dsi1 = pinfo->dsi[1];
+struct mipi_dsi_multi_context dsi_ctx0 = { .dsi = dsi0 };
+struct mipi_dsi_multi_context dsi_ctx1 = { .dsi = dsi1 };
<+...
-mipi_dsi_dual_dcs_write_seq(dsi0, dsi1, es);
+mipi_dsi_dual_dcs_write_seq(dsi_ctx0, dsi_ctx1, es);
...+>

[1] -> https://docs.kernel.org/gpu/todo.html#transition-away-from-using-mipi-dsi-write-seq

Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>
---
Anusha Srivatsa (14):
      drm/panel/boe-bf060y8m-aj0: Move to using mipi_dsi_dcs_write_seq_multi()
      drm/panel/ebbg-ft8719: Move to using mipi_dsi_dcs_write_seq_multi()
      drm/panel/himax-hx8394: Move to using mipi_dsi_dcs_write_seq_multi()
      drm/panel/jdi-lpm102a188a: Move to using mipi_dsi_generic_write_seq_multi()
      drm/panel/samsung-s6d7aa0: Move to using mipi_dsi_dcs_write_seq_multi()
      drm/panel/6e88a0-ams452ef01: Move to using mipi_dsi_dcs_write_seq_multi()
      drm/panel/samsung-sofef00: Move to using mipi_dsi_dcs_write_seq_multi()
      drm/panel/ls060t1sx01: Move to using mipi_dsi_dcs_write_seq_multi()
      drm/panel/sony-td4353-jdi: Move to using mipi_dsi_dcs_write_seq_multi()
      drm/panel/visionox-r66451: Move to using mipi_dsi_dcs_write_seq_multi()
      drm/panel/xpp055c272: Move to using mipi_dsi_dcs_write_seq_multi()
      drm/panel/novatek-nt36523: Move to using mipi_dsi_dcs_write_seq_multi()
      drm/panel: Remove deprecated functions
      Documentation: Update the documentation

 Documentation/gpu/todo.rst                         |   19 -
 drivers/gpu/drm/drm_mipi_dsi.c                     |   56 -
 drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c     |   36 +-
 drivers/gpu/drm/panel/panel-ebbg-ft8719.c          |    7 +-
 drivers/gpu/drm/panel/panel-himax-hx8394.c         |  364 +++--
 drivers/gpu/drm/panel/panel-jdi-lpm102a188a.c      |   31 +-
 drivers/gpu/drm/panel/panel-novatek-nt36523.c      | 1588 ++++++++++----------
 drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c      |   88 +-
 .../drm/panel/panel-samsung-s6e88a0-ams452ef01.c   |   34 +-
 drivers/gpu/drm/panel/panel-samsung-sofef00.c      |   19 +-
 drivers/gpu/drm/panel/panel-sharp-ls060t1sx01.c    |    5 +-
 drivers/gpu/drm/panel/panel-sony-td4353-jdi.c      |   10 +-
 drivers/gpu/drm/panel/panel-visionox-r66451.c      |  118 +-
 drivers/gpu/drm/panel/panel-xinpeng-xpp055c272.c   |  113 +-
 include/drm/drm_mipi_dsi.h                         |   47 -
 15 files changed, 1244 insertions(+), 1291 deletions(-)
---
base-commit: 92514ef226f511f2ca1fb1b8752966097518edc0
change-id: 20250206-mipi-cocci-8c356b1ae765

Best regards,

Comments

Doug Anderson Feb. 8, 2025, 8:37 p.m. UTC | #1
Hi,

On Thu, Feb 6, 2025 at 1:06 PM Anusha Srivatsa <asrivats@redhat.com> wrote:
>
> Transition away from mipi_dsi_generic_write_seq() and
> mipi_dsi_dcs_write_seq() to mipi_dsi_generic_write_seq_multi()
> and mipi_dsi_dcs_write_seq_multi() respectively.
>
> This is addressing one of the gpu todo items [1]
>
> Used Coccinelle to make the code changes.

As Dmitry mentioned [1], I think a real cleanup needs more thought
than can be done in a Coccinelle script. Maybe you can make a script
that's super fancy and does a perfect conversion, but I sorta doubt it
in this case.

A few other note:

* Tejas Vipin has been slowly whittling down this TODO item. It would
be good to CC him on any attempts to avoid duplicating work. He just
submitted a patch [2] that duplicates one of the panels you ran your
script on. It would also be good to look at the patches he has been
posting to see some of the extra complexities.

* I'm happy you CCed on the cover letter, but given that I've been
helping with this TODO entry it would have been nice to have been CCed
on all the patches.

For now I'm not going to review the individual patches in this series.
If there are any where you think your Coccinelle script really got
everything adjusted perfectly then feel free to point them out and
I'll review them. If you want to help with this effort, my own
personal preference would be to at least start w/ one panel at a time
since probably review feedback on all the conversions will be similar.

Thanks!

-Doug

[1] https://lore.kernel.org/r/mz6usiheb2lx6wlk47z3btvf6t6kbo4ja4n6mli5hosrpcvdwp@wmvfvhaqhpkm
[2] http://lore.kernel.org/r/20250208051541.176667-1-tejasvipin76@gmail.com