Commit 4c75b940 authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Pass dev_priv to cdclk update funcs

Unify our approach to things by passing around dev_priv instead of dev.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1477946245-14134-14-git-send-email-ville.syrjala@linux.intel.comReviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
parent 5ab0d85b
...@@ -5842,10 +5842,8 @@ static int intel_compute_max_dotclk(struct drm_i915_private *dev_priv) ...@@ -5842,10 +5842,8 @@ static int intel_compute_max_dotclk(struct drm_i915_private *dev_priv)
static int skl_calc_cdclk(int max_pixclk, int vco); static int skl_calc_cdclk(int max_pixclk, int vco);
static void intel_update_max_cdclk(struct drm_device *dev) static void intel_update_max_cdclk(struct drm_i915_private *dev_priv)
{ {
struct drm_i915_private *dev_priv = to_i915(dev);
if (IS_SKYLAKE(dev_priv) || IS_KABYLAKE(dev_priv)) { if (IS_SKYLAKE(dev_priv) || IS_KABYLAKE(dev_priv)) {
u32 limit = I915_READ(SKL_DFSM) & SKL_DFSM_CDCLK_LIMIT_MASK; u32 limit = I915_READ(SKL_DFSM) & SKL_DFSM_CDCLK_LIMIT_MASK;
int max_cdclk, vco; int max_cdclk, vco;
...@@ -5903,11 +5901,9 @@ static void intel_update_max_cdclk(struct drm_device *dev) ...@@ -5903,11 +5901,9 @@ static void intel_update_max_cdclk(struct drm_device *dev)
dev_priv->max_dotclk_freq); dev_priv->max_dotclk_freq);
} }
static void intel_update_cdclk(struct drm_device *dev) static void intel_update_cdclk(struct drm_i915_private *dev_priv)
{ {
struct drm_i915_private *dev_priv = to_i915(dev); dev_priv->cdclk_freq = dev_priv->display.get_display_clock_speed(&dev_priv->drm);
dev_priv->cdclk_freq = dev_priv->display.get_display_clock_speed(dev);
if (INTEL_GEN(dev_priv) >= 9) if (INTEL_GEN(dev_priv) >= 9)
DRM_DEBUG_DRIVER("Current CD clock rate: %d kHz, VCO: %d kHz, ref: %d kHz\n", DRM_DEBUG_DRIVER("Current CD clock rate: %d kHz, VCO: %d kHz, ref: %d kHz\n",
...@@ -6068,14 +6064,14 @@ static void bxt_set_cdclk(struct drm_i915_private *dev_priv, int cdclk) ...@@ -6068,14 +6064,14 @@ static void bxt_set_cdclk(struct drm_i915_private *dev_priv, int cdclk)
return; return;
} }
intel_update_cdclk(&dev_priv->drm); intel_update_cdclk(dev_priv);
} }
static void bxt_sanitize_cdclk(struct drm_i915_private *dev_priv) static void bxt_sanitize_cdclk(struct drm_i915_private *dev_priv)
{ {
u32 cdctl, expected; u32 cdctl, expected;
intel_update_cdclk(&dev_priv->drm); intel_update_cdclk(dev_priv);
if (dev_priv->cdclk_pll.vco == 0 || if (dev_priv->cdclk_pll.vco == 0 ||
dev_priv->cdclk_freq == dev_priv->cdclk_pll.ref) dev_priv->cdclk_freq == dev_priv->cdclk_pll.ref)
...@@ -6208,7 +6204,7 @@ void skl_set_preferred_cdclk_vco(struct drm_i915_private *dev_priv, int vco) ...@@ -6208,7 +6204,7 @@ void skl_set_preferred_cdclk_vco(struct drm_i915_private *dev_priv, int vco)
dev_priv->skl_preferred_vco_freq = vco; dev_priv->skl_preferred_vco_freq = vco;
if (changed) if (changed)
intel_update_max_cdclk(&dev_priv->drm); intel_update_max_cdclk(dev_priv);
} }
static void static void
...@@ -6294,7 +6290,6 @@ static bool skl_cdclk_wait_for_pcu_ready(struct drm_i915_private *dev_priv) ...@@ -6294,7 +6290,6 @@ static bool skl_cdclk_wait_for_pcu_ready(struct drm_i915_private *dev_priv)
static void skl_set_cdclk(struct drm_i915_private *dev_priv, int cdclk, int vco) static void skl_set_cdclk(struct drm_i915_private *dev_priv, int cdclk, int vco)
{ {
struct drm_device *dev = &dev_priv->drm;
u32 freq_select, pcu_ack; u32 freq_select, pcu_ack;
WARN_ON((cdclk == 24000) != (vco == 0)); WARN_ON((cdclk == 24000) != (vco == 0));
...@@ -6345,7 +6340,7 @@ static void skl_set_cdclk(struct drm_i915_private *dev_priv, int cdclk, int vco) ...@@ -6345,7 +6340,7 @@ static void skl_set_cdclk(struct drm_i915_private *dev_priv, int cdclk, int vco)
sandybridge_pcode_write(dev_priv, SKL_PCODE_CDCLK_CONTROL, pcu_ack); sandybridge_pcode_write(dev_priv, SKL_PCODE_CDCLK_CONTROL, pcu_ack);
mutex_unlock(&dev_priv->rps.hw_lock); mutex_unlock(&dev_priv->rps.hw_lock);
intel_update_cdclk(dev); intel_update_cdclk(dev_priv);
} }
static void skl_sanitize_cdclk(struct drm_i915_private *dev_priv); static void skl_sanitize_cdclk(struct drm_i915_private *dev_priv);
...@@ -6392,7 +6387,7 @@ static void skl_sanitize_cdclk(struct drm_i915_private *dev_priv) ...@@ -6392,7 +6387,7 @@ static void skl_sanitize_cdclk(struct drm_i915_private *dev_priv)
if ((I915_READ(SWF_ILK(0x18)) & 0x00FFFFFF) == 0) if ((I915_READ(SWF_ILK(0x18)) & 0x00FFFFFF) == 0)
goto sanitize; goto sanitize;
intel_update_cdclk(&dev_priv->drm); intel_update_cdclk(dev_priv);
/* Is PLL enabled and locked ? */ /* Is PLL enabled and locked ? */
if (dev_priv->cdclk_pll.vco == 0 || if (dev_priv->cdclk_pll.vco == 0 ||
dev_priv->cdclk_freq == dev_priv->cdclk_pll.ref) dev_priv->cdclk_freq == dev_priv->cdclk_pll.ref)
...@@ -6483,7 +6478,7 @@ static void valleyview_set_cdclk(struct drm_device *dev, int cdclk) ...@@ -6483,7 +6478,7 @@ static void valleyview_set_cdclk(struct drm_device *dev, int cdclk)
mutex_unlock(&dev_priv->sb_lock); mutex_unlock(&dev_priv->sb_lock);
intel_update_cdclk(dev); intel_update_cdclk(dev_priv);
} }
static void cherryview_set_cdclk(struct drm_device *dev, int cdclk) static void cherryview_set_cdclk(struct drm_device *dev, int cdclk)
...@@ -6524,7 +6519,7 @@ static void cherryview_set_cdclk(struct drm_device *dev, int cdclk) ...@@ -6524,7 +6519,7 @@ static void cherryview_set_cdclk(struct drm_device *dev, int cdclk)
} }
mutex_unlock(&dev_priv->rps.hw_lock); mutex_unlock(&dev_priv->rps.hw_lock);
intel_update_cdclk(dev); intel_update_cdclk(dev_priv);
} }
static int valleyview_calc_cdclk(struct drm_i915_private *dev_priv, static int valleyview_calc_cdclk(struct drm_i915_private *dev_priv,
...@@ -10188,7 +10183,7 @@ static void hsw_restore_lcpll(struct drm_i915_private *dev_priv) ...@@ -10188,7 +10183,7 @@ static void hsw_restore_lcpll(struct drm_i915_private *dev_priv)
} }
intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL); intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);
intel_update_cdclk(&dev_priv->drm); intel_update_cdclk(dev_priv);
} }
/* /*
...@@ -10368,7 +10363,7 @@ static void broadwell_set_cdclk(struct drm_device *dev, int cdclk) ...@@ -10368,7 +10363,7 @@ static void broadwell_set_cdclk(struct drm_device *dev, int cdclk)
I915_WRITE(CDCLK_FREQ, DIV_ROUND_CLOSEST(cdclk, 1000) - 1); I915_WRITE(CDCLK_FREQ, DIV_ROUND_CLOSEST(cdclk, 1000) - 1);
intel_update_cdclk(dev); intel_update_cdclk(dev_priv);
WARN(cdclk != dev_priv->cdclk_freq, WARN(cdclk != dev_priv->cdclk_freq,
"cdclk requested %d kHz but got %d kHz\n", "cdclk requested %d kHz but got %d kHz\n",
...@@ -16323,7 +16318,7 @@ void intel_modeset_init_hw(struct drm_device *dev) ...@@ -16323,7 +16318,7 @@ void intel_modeset_init_hw(struct drm_device *dev)
{ {
struct drm_i915_private *dev_priv = to_i915(dev); struct drm_i915_private *dev_priv = to_i915(dev);
intel_update_cdclk(dev); intel_update_cdclk(dev_priv);
dev_priv->atomic_cdclk_freq = dev_priv->cdclk_freq; dev_priv->atomic_cdclk_freq = dev_priv->cdclk_freq;
...@@ -16494,12 +16489,12 @@ int intel_modeset_init(struct drm_device *dev) ...@@ -16494,12 +16489,12 @@ int intel_modeset_init(struct drm_device *dev)
} }
intel_update_czclk(dev_priv); intel_update_czclk(dev_priv);
intel_update_cdclk(dev); intel_update_cdclk(dev_priv);
intel_shared_dpll_init(dev); intel_shared_dpll_init(dev);
if (dev_priv->max_cdclk_freq == 0) if (dev_priv->max_cdclk_freq == 0)
intel_update_max_cdclk(dev); intel_update_max_cdclk(dev_priv);
/* Just disable it once at startup */ /* Just disable it once at startup */
i915_disable_vga(dev); i915_disable_vga(dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment