All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Imre Deak <imre.deak@intel.com>,
	intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Cc: Imre Deak <imre.deak@gmail.com>
Subject: Re: [PATCH 11/17] drm/i915/ddi: Sanitize DDI_BUF_CTL register definitions
Date: Wed, 05 Feb 2025 14:52:08 +0200	[thread overview]
Message-ID: <87cyfw4kqv.fsf@intel.com> (raw)
In-Reply-To: <20250129200221.2508101-12-imre.deak@intel.com>

On Wed, 29 Jan 2025, Imre Deak <imre.deak@intel.com> wrote:
> From: Imre Deak <imre.deak@gmail.com>
>
> Align the DDI_BUF_CTL register flag definitions with how this is done
> elsewhere.
>
> Signed-off-by: Imre Deak <imre.deak@gmail.com>
> ---
>  drivers/gpu/drm/i915/i915_reg.h | 22 ++++++++++++----------
>  1 file changed, 12 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index 7fe4e71fc08ec..5cee6a96270af 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -3621,27 +3621,29 @@ enum skl_power_gate {
>  #define _DDI_BUF_CTL_B				0x64100
>  /* Known as DDI_CTL_DE in MTL+ */
>  #define DDI_BUF_CTL(port) _MMIO_PORT(port, _DDI_BUF_CTL_A, _DDI_BUF_CTL_B)
> -#define  DDI_BUF_CTL_ENABLE			(1 << 31)
> +#define  DDI_BUF_CTL_ENABLE			REG_BIT(31)
>  #define  XE2LPD_DDI_BUF_D2D_LINK_ENABLE		REG_BIT(29)
>  #define  XE2LPD_DDI_BUF_D2D_LINK_STATE		REG_BIT(28)
> -#define  DDI_BUF_TRANS_SELECT(n)	((n) << 24)
> -#define  DDI_BUF_EMP_MASK			(0xf << 24)
> -#define  DDI_BUF_PHY_LINK_RATE(r)		((r) << 20)
> +#define  DDI_BUF_EMP_MASK			REG_GENMASK(27, 24)
> +#define  DDI_BUF_TRANS_SELECT(n)		REG_FIELD_PREP(DDI_BUF_EMP_MASK, n)
> +#define  DDI_BUF_PHY_LINK_RATE_MASK		REG_GENMASK(23, 20)
> +#define  DDI_BUF_PHY_LINK_RATE(r)		REG_FIELD_PREP(DDI_BUF_PHY_LINK_RATE_MASK, r)

Ville has been advocating wrapping macro arguments in parens also in
these cases, and I'm starting to lean that way too.

Other than that,

Reviewed-by: Jani Nikula <jani.nikula@intel.com>


>  #define  DDI_BUF_PORT_DATA_MASK			REG_GENMASK(19, 18)
>  #define  DDI_BUF_PORT_DATA_10BIT		REG_FIELD_PREP(DDI_BUF_PORT_DATA_MASK, 0)
>  #define  DDI_BUF_PORT_DATA_20BIT		REG_FIELD_PREP(DDI_BUF_PORT_DATA_MASK, 1)
>  #define  DDI_BUF_PORT_DATA_40BIT		REG_FIELD_PREP(DDI_BUF_PORT_DATA_MASK, 2)
> -#define  DDI_BUF_PORT_REVERSAL			(1 << 16)
> +#define  DDI_BUF_PORT_REVERSAL			REG_BIT(16)
>  #define  DDI_BUF_LANE_STAGGER_DELAY_MASK	REG_GENMASK(15, 8)
>  #define  DDI_BUF_LANE_STAGGER_DELAY(symbols)	REG_FIELD_PREP(DDI_BUF_LANE_STAGGER_DELAY_MASK, \
>  							       symbols)
> -#define  DDI_BUF_IS_IDLE			(1 << 7)
> +#define  DDI_BUF_IS_IDLE			REG_BIT(7)
>  #define  DDI_BUF_CTL_TC_PHY_OWNERSHIP		REG_BIT(6)
> -#define  DDI_A_4_LANES				(1 << 4)
> -#define  DDI_PORT_WIDTH(width)			(((width) == 3 ? 4 : ((width) - 1)) << 1)
> -#define  DDI_PORT_WIDTH_MASK			(7 << 1)
> +#define  DDI_A_4_LANES				REG_BIT(4)
> +#define  DDI_PORT_WIDTH_MASK			REG_GENMASK(3, 1)
> +#define  DDI_PORT_WIDTH(width)			REG_FIELD_PREP(DDI_PORT_WIDTH_MASK, \
> +							       (width) == 3 ? 4 : (width) - 1)
>  #define  DDI_PORT_WIDTH_SHIFT			1
> -#define  DDI_INIT_DISPLAY_DETECTED		(1 << 0)
> +#define  DDI_INIT_DISPLAY_DETECTED		REG_BIT(0)
>  
>  /* DDI Buffer Translations */
>  #define _DDI_BUF_TRANS_A		0x64E00

-- 
Jani Nikula, Intel

  reply	other threads:[~2025-02-05 12:52 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-29 20:02 [PATCH 00/17] drm/i915/ddi: Fix/simplify port enabling/disabling Imre Deak
2025-01-29 20:02 ` [PATCH 01/17] drm/i915/dsi: Use TRANS_DDI_FUNC_CTL's own port width macro Imre Deak
2025-01-30 11:47   ` Jani Nikula
2025-01-29 20:02 ` [PATCH 02/17] drm/i915/ddi: Fix HDMI port width programming in DDI_BUF_CTL Imre Deak
2025-01-30 11:51   ` Jani Nikula
2025-01-30 13:33     ` Imre Deak
2025-01-29 20:02 ` [PATCH 03/17] drm/i915/ddi: Make all the PORT_WIDTH macros work the same way Imre Deak
2025-01-30 11:52   ` Jani Nikula
2025-01-29 20:02 ` [PATCH 04/17] drm/i915/ddi: Set missing TC DP PHY lane stagger delay in DDI_BUF_CTL Imre Deak
2025-02-05 12:22   ` Jani Nikula
2025-02-05 13:20     ` Imre Deak
2025-01-29 20:02 ` [PATCH 05/17] drm/i915/ddi: Simplify the port enabling via DDI_BUF_CTL Imre Deak
2025-01-30 11:55   ` Jani Nikula
2025-01-30 13:34     ` Imre Deak
2025-01-29 20:02 ` [PATCH 06/17] drm/i915/ddi: Simplify the port disabling " Imre Deak
2025-02-05 12:24   ` Jani Nikula
2025-01-29 20:02 ` [PATCH 07/17] drm/i915/ddi: Simplify waiting for a port to idle " Imre Deak
2025-02-05 12:35   ` Jani Nikula
2025-02-05 12:47     ` Imre Deak
2025-02-05 13:02       ` Jani Nikula
2025-02-12 11:48         ` Kahola, Mika
2025-01-29 20:02 ` [PATCH 08/17] drm/i915/ddi: Move platform checks within mtl_ddi_enable/disable_d2d_link() Imre Deak
2025-02-05 12:42   ` Jani Nikula
2025-02-05 13:46     ` Imre Deak
2025-01-29 20:02 ` [PATCH 09/17] drm/i915/ddi: Unify the platform specific functions disabling a port Imre Deak
2025-02-05 12:45   ` Jani Nikula
2025-01-29 20:02 ` [PATCH 10/17] drm/i915/ddi: Add a helper to enable " Imre Deak
2025-02-05 12:49   ` Jani Nikula
2025-02-05 14:43     ` Imre Deak
2025-01-29 20:02 ` [PATCH 11/17] drm/i915/ddi: Sanitize DDI_BUF_CTL register definitions Imre Deak
2025-02-05 12:52   ` Jani Nikula [this message]
2025-02-05 14:52     ` Imre Deak
2025-01-29 20:02 ` [PATCH 12/17] drm/i915/ddi: Configure/enable a port in DDI_BUF_CTL via read-modify-write Imre Deak
2025-02-10 18:13   ` Jani Nikula
2025-02-10 18:25     ` Imre Deak
2025-02-12 11:51       ` Kahola, Mika
2025-01-29 20:02 ` [PATCH 13/17] drm/i915/ddi: Factor out a helper to get DDI_BUF_CTL's config value Imre Deak
2025-02-10 18:06   ` Jani Nikula
2025-01-29 20:02 ` [PATCH 14/17] drm/i915/ddi: Reuse helper to compute the HDMI DDI_BUF_CTL config Imre Deak
2025-02-11 14:06   ` Kahola, Mika
2025-01-29 20:02 ` [PATCH 15/17] drm/i915/ddi: Reuse helper to compute the HDMI PORT_BUF_CTL1 config Imre Deak
2025-02-12  9:51   ` Kahola, Mika
2025-01-29 20:02 ` [PATCH 16/17] drm/i915/ddi: Move platform/encoder checks within adlp_tbt_to_dp_alt_switch_wa() Imre Deak
2025-02-12 11:06   ` Kahola, Mika
2025-01-29 20:02 ` [PATCH 17/17] drm/i915/ddi: Unify the platform specific functions enabling a port Imre Deak
2025-02-12 11:26   ` Kahola, Mika
2025-01-29 21:14 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915/ddi: Fix/simplify port enabling/disabling Patchwork
2025-01-29 21:14 ` ✗ Fi.CI.SPARSE: " Patchwork
2025-01-29 21:30 ` ✗ i915.CI.BAT: failure " Patchwork
2025-01-29 22:16 ` ✓ CI.Patch_applied: success " Patchwork
2025-01-29 22:17 ` ✗ CI.checkpatch: warning " Patchwork
2025-01-29 22:18 ` ✓ CI.KUnit: success " Patchwork
2025-01-29 22:34 ` ✓ CI.Build: " Patchwork
2025-01-29 22:37 ` ✓ CI.Hooks: " Patchwork
2025-01-29 22:38 ` ✗ CI.checksparse: warning " Patchwork
2025-01-30  6:22 ` ✓ Xe.CI.BAT: success " Patchwork
2025-01-30  8:27 ` ✗ Xe.CI.Full: failure " Patchwork
2025-01-31  7:42 ` Patchwork

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=87cyfw4kqv.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=imre.deak@gmail.com \
    --cc=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    /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.