Commit ad13d604 authored by Damien Lespiau's avatar Damien Lespiau Committed by Daniel Vetter

drm/i915: Split the CDCLK retrieval per-platform

This is only going to get worse, so split it now to avoid adding more
cases to the if/else ladder.
Suggested-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: default avatarDamien Lespiau <damien.lespiau@intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent d664c0ce
...@@ -1192,31 +1192,52 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder) ...@@ -1192,31 +1192,52 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder)
} }
} }
int intel_ddi_get_cdclk_freq(struct drm_i915_private *dev_priv) static int bdw_get_cdclk_freq(struct drm_i915_private *dev_priv)
{ {
struct drm_device *dev = dev_priv->dev;
uint32_t lcpll = I915_READ(LCPLL_CTL); uint32_t lcpll = I915_READ(LCPLL_CTL);
uint32_t freq = lcpll & LCPLL_CLK_FREQ_MASK; uint32_t freq = lcpll & LCPLL_CLK_FREQ_MASK;
if (lcpll & LCPLL_CD_SOURCE_FCLK) { if (lcpll & LCPLL_CD_SOURCE_FCLK)
return 800000; return 800000;
} else if (I915_READ(FUSE_STRAP) & HSW_CDCLK_LIMIT) { else if (I915_READ(FUSE_STRAP) & HSW_CDCLK_LIMIT)
return 450000; return 450000;
} else if (freq == LCPLL_CLK_FREQ_450) { else if (freq == LCPLL_CLK_FREQ_450)
return 450000; return 450000;
} else if (IS_HASWELL(dev)) { else if (freq == LCPLL_CLK_FREQ_54O_BDW)
if (IS_ULT(dev))
return 337500;
else
return 540000;
} else {
if (freq == LCPLL_CLK_FREQ_54O_BDW)
return 540000; return 540000;
else if (freq == LCPLL_CLK_FREQ_337_5_BDW) else if (freq == LCPLL_CLK_FREQ_337_5_BDW)
return 337500; return 337500;
else else
return 675000; return 675000;
} }
static int hsw_get_cdclk_freq(struct drm_i915_private *dev_priv)
{
struct drm_device *dev = dev_priv->dev;
uint32_t lcpll = I915_READ(LCPLL_CTL);
uint32_t freq = lcpll & LCPLL_CLK_FREQ_MASK;
if (lcpll & LCPLL_CD_SOURCE_FCLK)
return 800000;
else if (I915_READ(FUSE_STRAP) & HSW_CDCLK_LIMIT)
return 450000;
else if (freq == LCPLL_CLK_FREQ_450)
return 450000;
else if (IS_ULT(dev))
return 337500;
else
return 540000;
}
int intel_ddi_get_cdclk_freq(struct drm_i915_private *dev_priv)
{
struct drm_device *dev = dev_priv->dev;
if (IS_BROADWELL(dev))
return bdw_get_cdclk_freq(dev_priv);
/* Haswell */
return hsw_get_cdclk_freq(dev_priv);
} }
static void hsw_ddi_pll_enable(struct drm_i915_private *dev_priv, static void hsw_ddi_pll_enable(struct drm_i915_private *dev_priv,
......
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