> Subject: [PATCH 12/16] drm/u195/de: Replace __intel_de_rmw_nowl() with
> intel_de_rmw_fw()

*i915
With that fixed
Reviewed-by: Suraj Kandpal <[email protected]>

> 
> From: Ville Syrjälä <[email protected]>
> 
> We already have the lower level intel_de_*_fw() stuff, so use that instead of
> hand rolling something custom for the DMC wakelock stuff.
> 
> As the wakelock stuff exists only on platforms supported by the xe driver this
> doesn't even result in any functional changes since xe doesn't have
> uncore.lock nor unclaimed register access detection.
> 
> Signed-off-by: Ville Syrjälä <[email protected]>
> ---
>  drivers/gpu/drm/i915/display/intel_de.h     | 21 +++++++++++++--------
>  drivers/gpu/drm/i915/display/intel_dmc_wl.c | 11 +++++------
>  2 files changed, 18 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_de.h
> b/drivers/gpu/drm/i915/display/intel_de.h
> index a82da6443af9..345b27ada04f 100644
> --- a/drivers/gpu/drm/i915/display/intel_de.h
> +++ b/drivers/gpu/drm/i915/display/intel_de.h
> @@ -83,13 +83,6 @@ intel_de_write(struct intel_display *display, i915_reg_t
> reg, u32 val)
>       intel_dmc_wl_put(display, reg);
>  }
> 
> -static inline u32
> -__intel_de_rmw_nowl(struct intel_display *display, i915_reg_t reg,
> -                 u32 clear, u32 set)
> -{
> -     return intel_uncore_rmw(__to_uncore(display), reg, clear, set);
> -}
> -
>  static inline u32
>  intel_de_rmw(struct intel_display *display, i915_reg_t reg, u32 clear, u32 
> set)
> { @@ -97,7 +90,7 @@ intel_de_rmw(struct intel_display *display, i915_reg_t
> reg, u32 clear, u32 set)
> 
>       intel_dmc_wl_get(display, reg);
> 
> -     val = __intel_de_rmw_nowl(display, reg, clear, set);
> +     val = intel_uncore_rmw(__to_uncore(display), reg, clear, set);
> 
>       intel_dmc_wl_put(display, reg);
> 
> @@ -219,6 +212,18 @@ intel_de_write_fw(struct intel_display *display,
> i915_reg_t reg, u32 val)
>       intel_uncore_write_fw(__to_uncore(display), reg, val);  }
> 
> +static inline u32
> +intel_de_rmw_fw(struct intel_display *display, i915_reg_t reg, u32
> +clear, u32 set) {
> +     u32 old, val;
> +
> +     old = intel_de_read_fw(display, reg);
> +     val = (old & ~clear) | set;
> +     intel_de_write_fw(display, reg, val);
> +
> +     return old;
> +}
> +
>  static inline u32
>  intel_de_read_notrace(struct intel_display *display, i915_reg_t reg)  { diff 
> --git
> a/drivers/gpu/drm/i915/display/intel_dmc_wl.c
> b/drivers/gpu/drm/i915/display/intel_dmc_wl.c
> index b3bb89ba34f9..869beb6f280d 100644
> --- a/drivers/gpu/drm/i915/display/intel_dmc_wl.c
> +++ b/drivers/gpu/drm/i915/display/intel_dmc_wl.c
> @@ -179,7 +179,7 @@ static void intel_dmc_wl_work(struct work_struct
> *work)
>       if (refcount_read(&wl->refcount))
>               goto out_unlock;
> 
> -     __intel_de_rmw_nowl(display, DMC_WAKELOCK1_CTL,
> DMC_WAKELOCK_CTL_REQ, 0);
> +     intel_de_rmw_fw(display, DMC_WAKELOCK1_CTL,
> DMC_WAKELOCK_CTL_REQ, 0);
> 
>       if (__intel_de_wait_for_register_atomic_nowl(display,
> DMC_WAKELOCK1_CTL,
> 
> DMC_WAKELOCK_CTL_ACK, 0,
> @@ -207,8 +207,7 @@ static void __intel_dmc_wl_take(struct intel_display
> *display)
>       if (wl->taken)
>               return;
> 
> -     __intel_de_rmw_nowl(display, DMC_WAKELOCK1_CTL, 0,
> -                         DMC_WAKELOCK_CTL_REQ);
> +     intel_de_rmw_fw(display, DMC_WAKELOCK1_CTL, 0,
> DMC_WAKELOCK_CTL_REQ);
> 
>       /*
>        * We need to use the atomic variant of the waiting routine @@ -
> 360,7 +359,7 @@ void intel_dmc_wl_enable(struct intel_display *display, u32
> dc_state)
>        * wakelock, because we're just enabling it, so call the
>        * non-locking version directly here.
>        */
> -     __intel_de_rmw_nowl(display, DMC_WAKELOCK_CFG, 0,
> DMC_WAKELOCK_CFG_ENABLE);
> +     intel_de_rmw_fw(display, DMC_WAKELOCK_CFG, 0,
> +DMC_WAKELOCK_CFG_ENABLE);
> 
>       wl->enabled = true;
> 
> @@ -402,7 +401,7 @@ void intel_dmc_wl_disable(struct intel_display
> *display)
>               goto out_unlock;
> 
>       /* Disable wakelock in DMC */
> -     __intel_de_rmw_nowl(display, DMC_WAKELOCK_CFG,
> DMC_WAKELOCK_CFG_ENABLE, 0);
> +     intel_de_rmw_fw(display, DMC_WAKELOCK_CFG,
> DMC_WAKELOCK_CFG_ENABLE,
> +0);
> 
>       wl->enabled = false;
> 
> @@ -414,7 +413,7 @@ void intel_dmc_wl_disable(struct intel_display
> *display)
>        *
>        * TODO: Get the correct expectation from the hardware team.
>        */
> -     __intel_de_rmw_nowl(display, DMC_WAKELOCK1_CTL,
> DMC_WAKELOCK_CTL_REQ, 0);
> +     intel_de_rmw_fw(display, DMC_WAKELOCK1_CTL,
> DMC_WAKELOCK_CTL_REQ, 0);
> 
>       wl->taken = false;
> 
> --
> 2.49.1

Reply via email to