Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/i915/cdclk: Extract hsw_ips_min_cdclk()

Pull the whole BDW IPS min CDCLK stuff into the IPS code
so that all the details around IPS are contained in once
place.

Note that while
- min_cdclk = DIV_ROUND_UP(min_cdclk * 100, 95);
vs.
+ min_cdclk = max(DIV_ROUND_UP(crtc_state->pixel_rate * 100, 95), min_cdclk)
may look different, they are in fact the same because
min_cdclk==crtc_state->pixel_rate at this point in
intel_crtc_compute_min_cdclk() on BDW.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241029215217.3697-4-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>

+19 -8
+15 -1
drivers/gpu/drm/i915/display/hsw_ips.c
··· 188 188 return HAS_IPS(to_i915(crtc->base.dev)) && crtc->pipe == PIPE_A; 189 189 } 190 190 191 - bool hsw_crtc_state_ips_capable(const struct intel_crtc_state *crtc_state) 191 + static bool hsw_crtc_state_ips_capable(const struct intel_crtc_state *crtc_state) 192 192 { 193 193 struct intel_display *display = to_intel_display(crtc_state); 194 194 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); ··· 216 216 return false; 217 217 218 218 return true; 219 + } 220 + 221 + int hsw_ips_min_cdclk(const struct intel_crtc_state *crtc_state) 222 + { 223 + struct drm_i915_private *i915 = to_i915(crtc_state->uapi.crtc->dev); 224 + 225 + if (!IS_BROADWELL(i915)) 226 + return 0; 227 + 228 + if (!hsw_crtc_state_ips_capable(crtc_state)) 229 + return 0; 230 + 231 + /* pixel rate mustn't exceed 95% of cdclk with IPS on BDW */ 232 + return DIV_ROUND_UP(crtc_state->pixel_rate * 100, 95); 219 233 } 220 234 221 235 int hsw_ips_compute_config(struct intel_atomic_state *state,
+3 -3
drivers/gpu/drm/i915/display/hsw_ips.h
··· 19 19 void hsw_ips_post_update(struct intel_atomic_state *state, 20 20 struct intel_crtc *crtc); 21 21 bool hsw_crtc_supports_ips(struct intel_crtc *crtc); 22 - bool hsw_crtc_state_ips_capable(const struct intel_crtc_state *crtc_state); 22 + int hsw_ips_min_cdclk(const struct intel_crtc_state *crtc_state); 23 23 int hsw_ips_compute_config(struct intel_atomic_state *state, 24 24 struct intel_crtc *crtc); 25 25 void hsw_ips_get_config(struct intel_crtc_state *crtc_state); ··· 42 42 { 43 43 return false; 44 44 } 45 - static inline bool hsw_crtc_state_ips_capable(const struct intel_crtc_state *crtc_state) 45 + static inline int hsw_ips_min_cdclk(const struct intel_crtc_state *crtc_state) 46 46 { 47 - return false; 47 + return 0; 48 48 } 49 49 static inline int hsw_ips_compute_config(struct intel_atomic_state *state, 50 50 struct intel_crtc *crtc)
+1 -4
drivers/gpu/drm/i915/display/intel_cdclk.c
··· 2857 2857 return 0; 2858 2858 2859 2859 min_cdclk = intel_pixel_rate_to_cdclk(crtc_state); 2860 - 2861 - /* pixel rate mustn't exceed 95% of cdclk with IPS on BDW */ 2862 - if (IS_BROADWELL(dev_priv) && hsw_crtc_state_ips_capable(crtc_state)) 2863 - min_cdclk = DIV_ROUND_UP(min_cdclk * 100, 95); 2860 + min_cdclk = max(hsw_ips_min_cdclk(crtc_state), min_cdclk); 2864 2861 2865 2862 /* BSpec says "Do not use DisplayPort with CDCLK less than 432 MHz, 2866 2863 * audio enabled, port width x4, and link rate HBR2 (5.4 GHz), or else