RE: [PATCH 03/19] drm/i915/display: Use FIELD_PREP() for DC state enable bits

Shankar, Uma
2026-04-13T20:54:13Z

> -----Original Message-----
> From: Dibin Moolakadan Subrahmanian
> <dibin.moolakadan.subrahmanian@intel.com>
> Sent: Thursday, March 26, 2026 10:46 PM
> To: intel-gfx@lists.freedesktop.org; intel-xe@lists.freedesktop.org
> Cc: Manna, Animesh <animesh.manna@intel.com>; Shankar, Uma
> <uma.shankar@intel.com>; Kurmi, Suresh Kumar
> <suresh.kumar.kurmi@intel.com>
> Subject: [PATCH 03/19] drm/i915/display: Use FIELD_PREP() for DC state enable
> bits
>
> Replace open-coded shifts with REG_GENMASK() and REG_FIELD_PREP() for
> the DC state enable field.

Looks Good to me.
Reviewed-by: Uma Shankar <uma.shankar@intel.com>

> Suggested-by: Jani Nikula <jani.nikula@linux.intel.com>
> Signed-off-by: Dibin Moolakadan Subrahmanian
> <dibin.moolakadan.subrahmanian@intel.com>
> ---
> drivers/gpu/drm/i915/display/intel_display_regs.h | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display_regs.h
> b/drivers/gpu/drm/i915/display/intel_display_regs.h
> index d0196d4ad234..2bace331437c 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_regs.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_regs.h
> @@ -3047,11 +3047,12 @@ enum skl_power_gate {
> #define DC_STATE_DC3CO_STATUS REG_BIT(29)
> #define HOLD_PHY_CLKREQ_PG1_LATCH REG_BIT(21)
> #define HOLD_PHY_PG1_LATCH REG_BIT(20)
> -#define DC_STATE_EN_UPTO_DC5 (1 << 0)
> #define DC_STATE_EN_DC9 (1 << 3)
> -#define DC_STATE_EN_UPTO_DC6 (2 << 0)
> -#define DC_STATE_EN_UPTO_DC3CO (3 << 0)
> -#define DC_STATE_EN_UPTO_DC5_DC6_MASK 0x3
> +#define DC_STATE_EN_UPTO_DC5_DC6_MASK REG_GENMASK(1, 0)
> +#define DC_STATE_EN_DISABLE
> REG_FIELD_PREP(DC_STATE_EN_UPTO_DC5_DC6_MASK, 0)
> +#define DC_STATE_EN_UPTO_DC5
> REG_FIELD_PREP(DC_STATE_EN_UPTO_DC5_DC6_MASK, 1)
> +#define DC_STATE_EN_UPTO_DC6
> REG_FIELD_PREP(DC_STATE_EN_UPTO_DC5_DC6_MASK, 2)
> +#define DC_STATE_EN_UPTO_DC3CO
> REG_FIELD_PREP(DC_STATE_EN_UPTO_DC5_DC6_MASK, 3)
>
> #define DC_STATE_DEBUG _MMIO(0x45520)
> #define DC_STATE_DEBUG_MASK_CORES (1 << 0)
> --
> 2.43.0