aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_ddi.c
diff options
context:
space:
mode:
authorPaulo Zanoni <paulo.r.zanoni@intel.com>2013-05-03 16:23:42 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2013-05-21 05:54:41 -0400
commitb2b877ffe37d699f77f45e993590b66010491c52 (patch)
tree89ec101e0d39294e1d9ae182c997b38099a1748e /drivers/gpu/drm/i915/intel_ddi.c
parenteaa591ec528ad75bb4c77606c5cb671f05e04db6 (diff)
drm/i915: make intel_ddi_get_cdclk_freq return values in KHz
With this, that 338 can finally become the correct 337500. Due to the change we need to adjust the intel_dp_aux_ch function to set the correct value, so adjust the division and also use DIV_ROUND_CLOSEST instead of the old "round down" behavior because the spec says the value "should be programmed to get as close as possible to the ideal rate of 2MHz". Quoting Paulo's follow-up to a question from Chris Wilson to explain what exactly will change: I use the 337500 value on the next patch, when setting the ips_linetime value. The correct frequency is 337500, not 338000. ips_linetime = DIV_ROUND_CLOSEST(mode->htotal * 1000 * 8, intel_ddi_get_cdclk_freq); For a mode with htotal of 2640 [0] we'll have: (i) (2640 * 1000 * 8) / 338000 = 62.48, resulting in 62 and (ii) (2640 * 1000 * 8) / 337500 = 62.57 resulting in 63. For the case inside intel_dp.c: Previously we were using 338. So with the old formula we were writing 338/2 = 169 to the register. And 337500 / 169 = 1997.04 (we use 337500 here because it's the real clock value). With the new value of 337500/2000 we'll have 168.75, which is 168 on the round-down case and 169 on the round-closest case. If we write 168 to the register, 337500 / 168 = 2008.92, and 2008.92 is more distant from 2000 than 1997.04. So with this patch we're changing the formula but still writing the same correct value to the DP AUX register. [0]: That's 1920x1080@50Hz on my DP monitor. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com> [danvet: Pimp the commit message with Paulo's follow-up.] Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_ddi.c')
-rw-r--r--drivers/gpu/drm/i915/intel_ddi.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index e66852186751..1fdd3b0b7040 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -1153,14 +1153,14 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder)
1153int intel_ddi_get_cdclk_freq(struct drm_i915_private *dev_priv) 1153int intel_ddi_get_cdclk_freq(struct drm_i915_private *dev_priv)
1154{ 1154{
1155 if (I915_READ(HSW_FUSE_STRAP) & HSW_CDCLK_LIMIT) 1155 if (I915_READ(HSW_FUSE_STRAP) & HSW_CDCLK_LIMIT)
1156 return 450; 1156 return 450000;
1157 else if ((I915_READ(LCPLL_CTL) & LCPLL_CLK_FREQ_MASK) == 1157 else if ((I915_READ(LCPLL_CTL) & LCPLL_CLK_FREQ_MASK) ==
1158 LCPLL_CLK_FREQ_450) 1158 LCPLL_CLK_FREQ_450)
1159 return 450; 1159 return 450000;
1160 else if (IS_ULT(dev_priv->dev)) 1160 else if (IS_ULT(dev_priv->dev))
1161 return 338; 1161 return 337500;
1162 else 1162 else
1163 return 540; 1163 return 540000;
1164} 1164}
1165 1165
1166void intel_ddi_pll_init(struct drm_device *dev) 1166void intel_ddi_pll_init(struct drm_device *dev)
@@ -1173,7 +1173,7 @@ void intel_ddi_pll_init(struct drm_device *dev)
1173 * Don't even try to turn it on. 1173 * Don't even try to turn it on.
1174 */ 1174 */
1175 1175
1176 DRM_DEBUG_KMS("CDCLK running at %dMHz\n", 1176 DRM_DEBUG_KMS("CDCLK running at %dKHz\n",
1177 intel_ddi_get_cdclk_freq(dev_priv)); 1177 intel_ddi_get_cdclk_freq(dev_priv));
1178 1178
1179 if (val & LCPLL_CD_SOURCE_FCLK) 1179 if (val & LCPLL_CD_SOURCE_FCLK)