[PATCH RFC 1/7] drm/mipi-dsi: wrap more functions for streamline handling
Dmitry Baryshkov
dmitry.baryshkov at linaro.org
Fri May 10 22:22:58 UTC 2024
On Fri, May 10, 2024 at 02:45:45PM -0700, Doug Anderson wrote:
> Hi,
>
> On Thu, May 9, 2024 at 3:37 PM Dmitry Baryshkov
> <dmitry.baryshkov at linaro.org> wrote:
> >
> > +/**
> > + * mipi_dsi_compression_mode_ext() - enable/disable DSC on the peripheral
> > + * @ctx: Context for multiple DSI transactions
> > + * @enable: Whether to enable or disable the DSC
> > + * @algo: Selected compression algorithm
> > + * @pps_selector: Select PPS from the table of pre-stored or uploaded PPS entries
> > + *
> > + * Like mipi_dsi_compression_mode_ext_multi() but deals with errors in a way that
> > + * makes it convenient to make several calls in a row.
>
> Your comment is backward. The name of the function is
True, my bad.
> mipi_dsi_compression_mode_ext_multi() not
> mipi_dsi_compression_mode_ext(). ...and it's like
> mipi_dsi_compression_mode_ext() not like
> mipi_dsi_compression_mode_ext_multi().
>
>
> > @@ -338,6 +345,18 @@ int mipi_dsi_dcs_set_display_brightness_large(struct mipi_dsi_device *dsi,
> > int mipi_dsi_dcs_get_display_brightness_large(struct mipi_dsi_device *dsi,
> > u16 *brightness);
> >
> > +void mipi_dsi_dcs_nop_multi(struct mipi_dsi_multi_context *ctx);
> > +void mipi_dsi_dcs_enter_sleep_mode_multi(struct mipi_dsi_multi_context *ctx);
> > +void mipi_dsi_dcs_exit_sleep_mode_multi(struct mipi_dsi_multi_context *ctx);
> > +void mipi_dsi_dcs_set_display_off_multi(struct mipi_dsi_multi_context *ctx);
> > +void mipi_dsi_dcs_set_display_on_multi(struct mipi_dsi_multi_context *ctx);
> > +void mipi_dsi_dcs_set_tear_on_multi(struct mipi_dsi_multi_context *ctx,
> > + enum mipi_dsi_dcs_tear_mode mode);
> > +
> > +#define mipi_dsi_msleep(ctx, delay) \
> > + if (!ctx.accum_err) \
> > + msleep(delay) \
>
> Please enclose the above in a "do { ... } while (0)" as typical for
> macros. Otherwise you could possibly get some very surprising
> behavior:
Ack.
>
> if (needs_big_delay)
> mipi_dsi_msleep(ctx, 50)
> else
> mipi_dsi_msleep(ctx, 10)
>
> ...with your macro as it is I think the "else" will match up against
> the "if !(ctx.accum_err)" inside the macro and not against the "if
> (needs_big_delay)"
>
> Also: nit that the mipi_dsi_msleep() should probably be defined above
> the "mipi_dsi_dcs" section.
>
>
> -Doug
--
With best wishes
Dmitry
More information about the dri-devel
mailing list