All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Marek Vasut <marek.vasut+renesas@mailbox.org>
Cc: dri-devel@lists.freedesktop.org, David Airlie <airlied@gmail.com>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Magnus Damm <magnus.damm@gmail.com>,
	Maxime Ripard <mripard@kernel.org>,
	Simona Vetter <simona@ffwll.ch>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>,
	linux-renesas-soc@vger.kernel.org,
	Sebastian Reichel <sre@kernel.org>
Subject: Re: [PATCH 7/9] drm/rcar-du: dsi: Clean up handling of DRM mode flags
Date: Tue, 23 Sep 2025 16:26:16 +0300	[thread overview]
Message-ID: <20250923132616.GH20765@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20250922185740.153759-8-marek.vasut+renesas@mailbox.org>

Hi Marek,

On Mon, Sep 22, 2025 at 08:55:03PM +0200, Marek Vasut wrote:
> Introduce TXVMVPRMSET0R_BPP_MASK macro and use FIELD_PREP() to generate
> appropriate bitfield from mask and value without bitshift, assign this
> value into vprmset0r. Remove TXVMVPRMSET0R_CSPC_RGB which is never used,
> replace it with code comment next to TXVMVPRMSET0R_CSPC_YCbCr.
> 
> Replace (mode->flags & DRM_MODE_FLAG_P.SYNC) test with inverted conditional
> (mode->flags & DRM_MODE_FLAG_N.SYNC) and bitwise orr vprmset0r with either

I wonder if the DRM_MODE_FLAG_P[HV]SYNC flags are always the exact
opposite of DRM_MODE_FLAG_N[HV]SYNC. It's probably fine to assume that
here. A quick grep showed one panel driver setting both the N and P
flags (drivers/gpu/drm/panel/panel-sitronix-st7789v.c, see
t28cp45tn89_mode, which I assume is a bug - Sebastian, could you check
that ?).

> or both TXVMVPRMSET0R_HSPOL_LOW and TXVMVPRMSET0R_VSPOL_LOW if conditional
> matches.
> 
> Do not convert bits and bitfields to BIT() and GENMASK() yet, to be
> consisten with the current style. Conversion to BIT() and GENMASK()
> macros is done at the very end of this series in the last two patches.
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
> ---
> Cc: David Airlie <airlied@gmail.com>
> Cc: Geert Uytterhoeven <geert+renesas@glider.be>
> Cc: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
> Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Magnus Damm <magnus.damm@gmail.com>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: Simona Vetter <simona@ffwll.ch>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
> Cc: dri-devel@lists.freedesktop.org
> Cc: linux-renesas-soc@vger.kernel.org
> ---
> NOTE: No functional change expected, this is a preparatory patch which
> partly removes macros which evaluate to zeroes from rcar_mipi_dsi_regs.h .
> The other patches in this series proceed with that job, piece by piece,
> to make it all reviewable.
> ---
>  drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi.c  | 12 ++++++------
>  .../gpu/drm/renesas/rcar-du/rcar_mipi_dsi_regs.h | 16 +++++++---------
>  2 files changed, 13 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi.c b/drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi.c
> index 36bd9de61ce05..f91cc35423758 100644
> --- a/drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi.c
> +++ b/drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi.c
> @@ -489,12 +489,12 @@ static void rcar_mipi_dsi_set_display_timing(struct rcar_mipi_dsi *dsi,
>  
>  	rcar_mipi_dsi_write(dsi, TXVMSETR, setr);
>  
> -	/* Configuration for Video Parameters */
> -	vprmset0r = (mode->flags & DRM_MODE_FLAG_PVSYNC ?
> -		     TXVMVPRMSET0R_VSPOL_HIG : TXVMVPRMSET0R_VSPOL_LOW)
> -		  | (mode->flags & DRM_MODE_FLAG_PHSYNC ?
> -		     TXVMVPRMSET0R_HSPOL_HIG : TXVMVPRMSET0R_HSPOL_LOW)
> -		  | TXVMVPRMSET0R_CSPC_RGB | TXVMVPRMSET0R_BPP_24;
> +	/* Configuration for Video Parameters, input is always RGB888 */
> +	vprmset0r = FIELD_PREP(TXVMVPRMSET0R_BPP_MASK, TXVMVPRMSET0R_BPP_24);
> +	if (mode->flags & DRM_MODE_FLAG_NVSYNC)
> +		vprmset0r |= TXVMVPRMSET0R_VSPOL_LOW;
> +	if (mode->flags & DRM_MODE_FLAG_NHSYNC)
> +		vprmset0r |= TXVMVPRMSET0R_HSPOL_LOW;

Looks good.

>  
>  	vprmset1r = TXVMVPRMSET1R_VACTIVE(mode->vdisplay)
>  		  | TXVMVPRMSET1R_VSA(mode->vsync_end - mode->vsync_start);
> diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi_regs.h b/drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi_regs.h
> index 99a88ea35aacd..48c3b679b2663 100644
> --- a/drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi_regs.h
> +++ b/drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi_regs.h
> @@ -170,15 +170,13 @@
>  #define TXVMPSPHSETR_DT_YCBCR16		0x2c
>  
>  #define TXVMVPRMSET0R			0x1d0
> -#define TXVMVPRMSET0R_HSPOL_HIG		(0 << 17)
> -#define TXVMVPRMSET0R_HSPOL_LOW		(1 << 17)
> -#define TXVMVPRMSET0R_VSPOL_HIG		(0 << 16)
> -#define TXVMVPRMSET0R_VSPOL_LOW		(1 << 16)
> -#define TXVMVPRMSET0R_CSPC_RGB		(0 << 4)
> -#define TXVMVPRMSET0R_CSPC_YCbCr	(1 << 4)
> -#define TXVMVPRMSET0R_BPP_16		(0 << 0)
> -#define TXVMVPRMSET0R_BPP_18		(1 << 0)
> -#define TXVMVPRMSET0R_BPP_24		(2 << 0)
> +#define TXVMVPRMSET0R_HSPOL_LOW		(1 << 17) /* 0:High 1:Low */
> +#define TXVMVPRMSET0R_VSPOL_LOW		(1 << 16) /* 0:High 1:Low */
> +#define TXVMVPRMSET0R_CSPC_YCbCr	(1 << 4) /* 0:RGB 1:YCbCr */
> +#define TXVMVPRMSET0R_BPP_MASK		(7 << 0)
> +#define TXVMVPRMSET0R_BPP_16		0
> +#define TXVMVPRMSET0R_BPP_18		1
> +#define TXVMVPRMSET0R_BPP_24		2

Same comment as in previous patches regarding usage of FIELD_PREP().
The rest looks fine.

>  
>  #define TXVMVPRMSET1R			0x1d4
>  #define TXVMVPRMSET1R_VACTIVE(x)	(((x) & 0x7fff) << 16)

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2025-09-23 13:26 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-22 18:54 [PATCH 0/9] drm/rcar-du: dsi: Convert register bits to BIT()/GENMASK() macros Marek Vasut
2025-09-22 18:54 ` [PATCH 1/9] drm/rcar-du: dsi: Fix missing parameter in RXSETR_...EN macros Marek Vasut
2025-09-23 11:42   ` Laurent Pinchart
2025-09-22 18:54 ` [PATCH 2/9] drm/rcar-du: dsi: Deduplicate mipi_dsi_pixel_format_to_bpp() usage Marek Vasut
2025-09-23  6:47   ` Geert Uytterhoeven
2025-09-23  8:55     ` Marek Vasut
2025-09-23  8:57       ` Laurent Pinchart
2025-09-23  9:02         ` Geert Uytterhoeven
2025-09-22 18:54 ` [PATCH 3/9] drm/rcar-du: dsi: Clean up VCLKSET register macros Marek Vasut
2025-09-23  9:10   ` kernel test robot
2025-09-23 11:49   ` Laurent Pinchart
2025-09-24  0:00     ` Marek Vasut
2025-09-22 18:55 ` [PATCH 4/9] drm/rcar-du: dsi: Clean up CLOCKSET1 CLKINSEL macros Marek Vasut
2025-09-23  5:45   ` Biju Das
2025-09-23  8:58     ` Marek Vasut
2025-09-23  9:04       ` Biju Das
2025-09-23  9:11         ` Marek Vasut
2025-09-22 18:55 ` [PATCH 5/9] drm/rcar-du: dsi: Clean up TXVMPSPHSETR DT macros Marek Vasut
2025-09-23 11:52   ` Laurent Pinchart
2025-09-22 18:55 ` [PATCH 6/9] drm/rcar-du: dsi: Respect DSI mode flags Marek Vasut
2025-09-23 11:54   ` Laurent Pinchart
2025-09-22 18:55 ` [PATCH 7/9] drm/rcar-du: dsi: Clean up handling of DRM " Marek Vasut
2025-09-23 13:26   ` Laurent Pinchart [this message]
2025-09-24  0:12     ` Marek Vasut
2025-09-24  1:18     ` Sebastian Reichel
2025-09-24  2:36       ` Marek Vasut
2025-09-24 20:53         ` Laurent Pinchart
2025-09-22 18:55 ` [PATCH 8/9] drm/rcar-du: dsi: Convert register bits to BIT() macro Marek Vasut
2025-09-23 14:16   ` Laurent Pinchart
2025-09-24  0:34     ` Marek Vasut
2025-09-22 18:55 ` [PATCH 9/9] drm/rcar-du: dsi: Convert register bitfields to GENMASK() macro Marek Vasut

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250923132616.GH20765@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=geert+renesas@glider.be \
    --cc=kieran.bingham+renesas@ideasonboard.com \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=magnus.damm@gmail.com \
    --cc=marek.vasut+renesas@mailbox.org \
    --cc=mripard@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=sre@kernel.org \
    --cc=tomi.valkeinen+renesas@ideasonboard.com \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.