On Thu, Feb 06, 2025 at 04:05:56PM -0500, Anusha Srivatsa wrote:
> Use mipi_dsi_dcs_write_seq_multi() instead of
> mipi_dsi_dcs_write_seq()
> 
> Used Coccinelle to do this change. SmPl 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);

This is not enough. All the commands and sleeps inbetween should also be
converted to _multi(), so that there is a single return at the end or
even a return via the context. Most of foo_on() functions can take
context as a param and return void, having error code in the context.

> ...+>
> 
> Signed-off-by: Anusha Srivatsa <asriv...@redhat.com>
> ---
>  drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c | 36 
> ++++++++++++++------------
>  1 file changed, 19 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c 
> b/drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c
> index 
> 7e66db4a88bbed27920107458d01efd9cf4986df..640312096c1370c293c84431efa6fd17dc520f2e
>  100644
> --- a/drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c
> +++ b/drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c
> @@ -55,15 +55,17 @@ static void boe_bf060y8m_aj0_reset(struct 
> boe_bf060y8m_aj0 *boe)
>  static int boe_bf060y8m_aj0_on(struct boe_bf060y8m_aj0 *boe)
>  {
>       struct mipi_dsi_device *dsi = boe->dsi;
> +     struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi };
>       struct device *dev = &dsi->dev;
>       int ret;
>  
> -     mipi_dsi_dcs_write_seq(dsi, 0xb0, 0xa5, 0x00);
> -     mipi_dsi_dcs_write_seq(dsi, 0xb2, 0x00, 0x4c);
> -     mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_SET_3D_CONTROL, 0x10);
> -     mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_WRITE_POWER_SAVE, 
> DCS_ALLOW_HBM_RANGE);
> -     mipi_dsi_dcs_write_seq(dsi, 0xf8,
> -                            0x00, 0x08, 0x10, 0x00, 0x22, 0x00, 0x00, 0x2d);
> +     mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xb0, 0xa5, 0x00);
> +     mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xb2, 0x00, 0x4c);
> +     mipi_dsi_dcs_write_seq_multi(&dsi_ctx, MIPI_DCS_SET_3D_CONTROL, 0x10);
> +     mipi_dsi_dcs_write_seq_multi(&dsi_ctx, MIPI_DCS_WRITE_POWER_SAVE,
> +                                  DCS_ALLOW_HBM_RANGE);
> +     mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf8, 0x00, 0x08, 0x10, 0x00,
> +                                  0x22, 0x00, 0x00, 0x2d);
>  
>       ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
>       if (ret < 0) {
> @@ -72,17 +74,17 @@ static int boe_bf060y8m_aj0_on(struct boe_bf060y8m_aj0 
> *boe)
>       }
>       msleep(30);
>  
> -     mipi_dsi_dcs_write_seq(dsi, 0xb0, 0xa5, 0x00);
> -     mipi_dsi_dcs_write_seq(dsi, 0xc0,
> -                            0x08, 0x48, 0x65, 0x33, 0x33, 0x33,
> -                            0x2a, 0x31, 0x39, 0x20, 0x09);
> -     mipi_dsi_dcs_write_seq(dsi, 0xc1, 0x00, 0x00, 0x00, 0x1f, 0x1f,
> -                            0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f,
> -                            0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f);
> -     mipi_dsi_dcs_write_seq(dsi, 0xe2, 0x20, 0x04, 0x10, 0x12, 0x92,
> -                            0x4f, 0x8f, 0x44, 0x84, 0x83, 0x83, 0x83,
> -                            0x5c, 0x5c, 0x5c);
> -     mipi_dsi_dcs_write_seq(dsi, 0xde, 0x01, 0x2c, 0x00, 0x77, 0x3e);
> +     mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xb0, 0xa5, 0x00);
> +     mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xc0, 0x08, 0x48, 0x65, 0x33,
> +                                  0x33, 0x33, 0x2a, 0x31, 0x39, 0x20, 0x09);
> +     mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xc1, 0x00, 0x00, 0x00, 0x1f,
> +                                  0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f,
> +                                  0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f);
> +     mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xe2, 0x20, 0x04, 0x10, 0x12,
> +                                  0x92, 0x4f, 0x8f, 0x44, 0x84, 0x83, 0x83,
> +                                  0x83, 0x5c, 0x5c, 0x5c);
> +     mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xde, 0x01, 0x2c, 0x00, 0x77,
> +                                  0x3e);
>  
>       msleep(30);
>  
> 
> -- 
> 2.47.0
> 

-- 
With best wishes
Dmitry

Reply via email to