lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAD=FV=U=YJu-QS9qck-Q89UxwEEfitJHyk6-gGX7zCGNz9xF0w@mail.gmail.com>
Date: Mon, 8 Jul 2024 17:27:51 -0700
From: Doug Anderson <dianders@...omium.org>
To: Tejas Vipin <tejasvipin76@...il.com>
Cc: neil.armstrong@...aro.org, quic_jesszhan@...cinc.com, 
	maarten.lankhorst@...ux.intel.com, mripard@...nel.org, tzimmermann@...e.de, 
	airlied@...il.com, daniel@...ll.ch, dri-devel@...ts.freedesktop.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] drm/panel: startek-kd070fhfid015: transition to
 mipi_dsi wrapped functions

Hi,

On Fri, Jun 28, 2024 at 11:25 AM Tejas Vipin <tejasvipin76@...il.com> wrote:
>
> @@ -52,92 +52,63 @@ static inline struct stk_panel *to_stk_panel(struct drm_panel *panel)
>  static int stk_panel_init(struct stk_panel *stk)
>  {
>         struct mipi_dsi_device *dsi = stk->dsi;
> -       struct device *dev = &stk->dsi->dev;
> -       int ret;
> +       struct mipi_dsi_multi_context dsi_ctx = {.dsi = dsi};
>
> -       ret = mipi_dsi_dcs_soft_reset(dsi);
> -       if (ret < 0) {
> -               dev_err(dev, "failed to mipi_dsi_dcs_soft_reset: %d\n", ret);
> -               return ret;
> -       }
> -       mdelay(5);
> +       mipi_dsi_dcs_soft_reset_multi(&dsi_ctx);
>
> -       ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
> -       if (ret < 0) {
> -               dev_err(dev, "failed to set exit sleep mode: %d\n", ret);
> -               return ret;
> -       }
> -       msleep(120);
> +       if (!dsi_ctx.accum_err)
> +               mdelay(5);

I'm curious: why isn't the above just "mipi_dsi_msleep(5)" and get rid
of the "if" test?


> +       mipi_dsi_dcs_exit_sleep_mode_multi(&dsi_ctx);
>
> -       mipi_dsi_generic_write_seq(dsi, DSI_REG_MCAP, 0x04);
> +       mipi_dsi_msleep(&dsi_ctx, 120);
> +
> +       mipi_dsi_generic_write_seq_multi(&dsi_ctx, DSI_REG_MCAP, 0x04);
>
>         /* Interface setting, video mode */
> -       mipi_dsi_generic_write_seq(dsi, DSI_REG_IS, 0x14, 0x08, 0x00, 0x22, 0x00);
> -       mipi_dsi_generic_write_seq(dsi, DSI_REG_IIS, 0x0C, 0x00);
> -       mipi_dsi_generic_write_seq(dsi, DSI_REG_CTRL, 0x3A, 0xD3);
> +       mipi_dsi_generic_write_seq_multi(&dsi_ctx, DSI_REG_IS, 0x14, 0x08, 0x00, 0x22, 0x00);
> +       mipi_dsi_generic_write_seq_multi(&dsi_ctx, DSI_REG_IIS, 0x0C, 0x00);
> +       mipi_dsi_generic_write_seq_multi(&dsi_ctx, DSI_REG_CTRL, 0x3A, 0xD3);

nit: While touching these lines, it'd be nice to transition them to
lower case hex (3a vs 3A).


> -       ret = mipi_dsi_dcs_set_display_brightness(dsi, 0x77);
> -       if (ret < 0) {
> -               dev_err(dev, "failed to write display brightness: %d\n", ret);
> -               return ret;
> -       }
> +       mipi_dsi_dcs_set_display_brightness_multi(&dsi_ctx, 0x77);
>
> -       mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_WRITE_CONTROL_DISPLAY,
> -                              MIPI_DCS_WRITE_MEMORY_START);
> +       mipi_dsi_dcs_write_seq_multi(&dsi_ctx, MIPI_DCS_WRITE_CONTROL_DISPLAY,
> +                                    MIPI_DCS_WRITE_MEMORY_START);
>
> -       ret = mipi_dsi_dcs_set_pixel_format(dsi, 0x77);
> -       if (ret < 0) {
> -               dev_err(dev, "failed to set pixel format: %d\n", ret);
> -               return ret;
> -       }
> +       mipi_dsi_dcs_set_pixel_format_multi(&dsi_ctx, 0x77);
>
> -       ret = mipi_dsi_dcs_set_column_address(dsi, 0, stk->mode->hdisplay - 1);
> -       if (ret < 0) {
> -               dev_err(dev, "failed to set column address: %d\n", ret);
> -               return ret;
> -       }
> +       mipi_dsi_dcs_set_column_address_multi(&dsi_ctx, 0, stk->mode->hdisplay - 1);
>
> -       ret = mipi_dsi_dcs_set_page_address(dsi, 0, stk->mode->vdisplay - 1);
> -       if (ret < 0) {
> -               dev_err(dev, "failed to set page address: %d\n", ret);
> -               return ret;
> -       }
> +       mipi_dsi_dcs_set_page_address_multi(&dsi_ctx, 0, stk->mode->vdisplay - 1);

Nice to get rid of all of these special case "if" tests and error handling! :-)

optional nit: it feels like there are two many blank lines separating
single line statements. Maybe get rid of a few of the blank lines?

>
> -       return 0;
> +       return dsi_ctx.accum_err;
>  }
>
>  static int stk_panel_on(struct stk_panel *stk)
>  {
>         struct mipi_dsi_device *dsi = stk->dsi;
> -       struct device *dev = &stk->dsi->dev;
> -       int ret;
> +       struct mipi_dsi_multi_context dsi_ctx = {.dsi = dsi};
>
> -       ret = mipi_dsi_dcs_set_display_on(dsi);
> -       if (ret < 0)
> -               dev_err(dev, "failed to set display on: %d\n", ret);
> +       mipi_dsi_dcs_set_display_on_multi(&dsi_ctx);
>
> -       mdelay(20);
> +       if (!dsi_ctx.accum_err)
> +               mdelay(20);

Like above, not sure why this isn't mipi_dsi_msleep(20).


-Doug

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ