Re: [PATCH v2 3/4] drm/panel: sitronix-st7789v: add support for partial mode

From: Maxime Ripard
Date: Fri Aug 04 2023 - 09:36:07 EST


On Fri, Aug 04, 2023 at 03:02:34PM +0200, Michael Riesch wrote:
> The ST7789V controller features support for the partial mode. Here,
> the area to be displayed can be restricted in one direction (by default,
> in vertical direction). This is useful for panels that are partially
> occluded by design. Add support for the partial mode.
>
> Signed-off-by: Michael Riesch <michael.riesch@xxxxxxxxxxxxxx>
> ---
> drivers/gpu/drm/panel/panel-sitronix-st7789v.c | 43 ++++++++++++++++++++++++--
> 1 file changed, 41 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> index 0ded72ed2fcd..ebc9a3bd6db3 100644
> --- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> +++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> @@ -118,6 +118,9 @@ struct st7789_panel_info {
> u32 bus_format;
> u32 bus_flags;
> bool invert_mode;
> + bool partial_mode;
> + u16 partial_start;
> + u16 partial_end;
> };
>
> struct st7789v {
> @@ -345,9 +348,14 @@ static enum drm_panel_orientation st7789v_get_orientation(struct drm_panel *p)
> static int st7789v_prepare(struct drm_panel *panel)
> {
> struct st7789v *ctx = panel_to_st7789v(panel);
> - u8 pixel_fmt, polarity;
> + u8 mode, pixel_fmt, polarity;
> int ret;
>
> + if (!ctx->info->partial_mode)
> + mode = ST7789V_RGBCTRL_WO;
> + else
> + mode = 0;
> +
> switch (ctx->info->bus_format) {
> case MEDIA_BUS_FMT_RGB666_1X18:
> pixel_fmt = MIPI_DCS_PIXEL_FMT_18BIT;
> @@ -487,6 +495,37 @@ static int st7789v_prepare(struct drm_panel *panel)
> MIPI_DCS_EXIT_INVERT_MODE));
> }
>
> + if (ctx->info->partial_mode) {
> + u8 area_data[4] = {
> + (ctx->info->partial_start >> 8) & 0xff,
> + (ctx->info->partial_start >> 0) & 0xff,
> + ((ctx->info->partial_end - 1) >> 8) & 0xff,
> + ((ctx->info->partial_end - 1) >> 0) & 0xff,
> + };
> +
> + /* Caution: if userspace ever pushes a mode different from the
> + * expected one (i.e., the one advertised by get_modes), we'll
> + * add margins.
> + */

The comment format is incorrect. Since Neil applied the patches already,
please send a patch to fix it.

Looks good to me otherwise, thanks for sticking up with this :)

Maxime

Attachment: signature.asc
Description: PGP signature