Messages in this thread | | | From | Doug Anderson <> | Date | Fri, 10 May 2024 14:45:45 -0700 | Subject | Re: [PATCH RFC 1/7] drm/mipi-dsi: wrap more functions for streamline handling |
| |
Hi,
On Thu, May 9, 2024 at 3:37 PM Dmitry Baryshkov <dmitry.baryshkov@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 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:
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
| |