]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drm/i915: go back to switch for VLV mem freq detection v2
authorJesse Barnes <jbarnes@virtuousgeek.org>
Thu, 2 May 2013 17:48:08 +0000 (10:48 -0700)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Fri, 10 May 2013 19:56:28 +0000 (21:56 +0200)
Both the docs and the existing code were wrong.  So fix both and use a
switch statement like we do elsewhere to make things simple & clear.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_pm.c

index 0f4b46e949324175eee0775d717e5f537ef93090..556b9892bb92d44cf62a0c3ad6832bf82dc349cf 100644 (file)
@@ -2902,7 +2902,18 @@ static void valleyview_enable_rps(struct drm_device *dev)
                   GEN7_RC_CTL_TO_MODE);
 
        valleyview_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS, &val);
-       dev_priv->mem_freq = 800 + (266 * (val >> 6) & 3);
+       switch ((val >> 6) & 3) {
+       case 0:
+       case 1:
+               dev_priv->mem_freq = 800;
+               break;
+       case 2:
+               dev_priv->mem_freq = 1066;
+               break;
+       case 3:
+               dev_priv->mem_freq = 1333;
+               break;
+       }
        DRM_DEBUG_DRIVER("DDR speed: %d MHz", dev_priv->mem_freq);
 
        DRM_DEBUG_DRIVER("GPLL enabled? %s\n", val & 0x10 ? "yes" : "no");