Re: [PATCH RFC 2/7] drm/panel: boe-tv101wum-nl6: use wrapped MIPI DCS functions
From: Doug Anderson
Date: Fri May 10 2024 - 17:46:35 EST
Hi,
On Thu, May 9, 2024 at 3:37 PM Dmitry Baryshkov
<dmitry.baryshkov@xxxxxxxxxx> wrote:
>
> Remove conditional code and always use mipi_dsi_dcs_*multi() wrappers to
> simplify driver's init/exit code.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx>
> ---
> drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c | 73 ++++++++------------------
> 1 file changed, 21 insertions(+), 52 deletions(-)
Please CC Cong Yang (CCed here) on your next version since he's also
touching this file and your changes will conflict with his.
> @@ -1508,20 +1483,14 @@ static inline struct boe_panel *to_boe_panel(struct drm_panel *panel)
>
> static int boe_panel_enter_sleep_mode(struct boe_panel *boe)
> {
> - struct mipi_dsi_device *dsi = boe->dsi;
> - int ret;
> -
> - dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
> + struct mipi_dsi_multi_context ctx = { .dsi = boe->dsi };
>
> - ret = mipi_dsi_dcs_set_display_off(dsi);
> - if (ret < 0)
> - return ret;
> + boe->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
>
> - ret = mipi_dsi_dcs_enter_sleep_mode(dsi);
> - if (ret < 0)
> - return ret;
> + mipi_dsi_dcs_set_display_off_multi(&ctx);
> + mipi_dsi_dcs_enter_sleep_mode_multi(&ctx);
>
> - return 0;
> + return ctx.accum_err;
> }
nit: since the "multi" functions print errors for you, you can get rid
of the (now duplicate) error print in the caller. I guess if you
really wanted to you could actually just inline
boe_panel_enter_sleep_mode() into its one caller and that would make
it easy to use the "_multi" version of msleep() there...
In any case, I think this looks nice:
Reviewed-by: Douglas Anderson <dianders@xxxxxxxxxxxx>