]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
drm/i915/cdclk: use i9xx_fsb_freq() for rawclk_freq initialization
authorJani Nikula <jani.nikula@intel.com>
Fri, 14 Jun 2024 09:22:38 +0000 (12:22 +0300)
committerJani Nikula <jani.nikula@intel.com>
Mon, 17 Jun 2024 08:54:31 +0000 (11:54 +0300)
Instead of duplicating the CLKCFG parsing, reuse i9xx_fsb_freq() to
figure out rawclk_freq where applicable.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/21511f155f1f446e066117bc6ed3165618d7afd6.1718356614.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
drivers/gpu/drm/i915/display/intel_cdclk.c

index c5bc49e48c882da76da515205ae9af1eb8f985ff..b6adcbd9025fcd7f57f7a04328b5a8838603b6a4 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <linux/time.h>
 
+#include "soc/intel_dram.h"
 #include "hsw_ips.h"
 #include "i915_reg.h"
 #include "intel_atomic.h"
@@ -3539,10 +3540,8 @@ static int vlv_hrawclk(struct drm_i915_private *dev_priv)
                                      CCK_DISPLAY_REF_CLOCK_CONTROL);
 }
 
-static int i9xx_hrawclk(struct drm_i915_private *dev_priv)
+static int i9xx_hrawclk(struct drm_i915_private *i915)
 {
-       u32 clkcfg;
-
        /*
         * hrawclock is 1/4 the FSB frequency
         *
@@ -3553,46 +3552,7 @@ static int i9xx_hrawclk(struct drm_i915_private *dev_priv)
         * don't know which registers have that information,
         * and all the relevant docs have gone to bit heaven :(
         */
-       clkcfg = intel_de_read(dev_priv, CLKCFG) & CLKCFG_FSB_MASK;
-
-       if (IS_MOBILE(dev_priv)) {
-               switch (clkcfg) {
-               case CLKCFG_FSB_400:
-                       return 100000;
-               case CLKCFG_FSB_533:
-                       return 133333;
-               case CLKCFG_FSB_667:
-                       return 166667;
-               case CLKCFG_FSB_800:
-                       return 200000;
-               case CLKCFG_FSB_1067:
-                       return 266667;
-               case CLKCFG_FSB_1333:
-                       return 333333;
-               default:
-                       MISSING_CASE(clkcfg);
-                       return 133333;
-               }
-       } else {
-               switch (clkcfg) {
-               case CLKCFG_FSB_400_ALT:
-                       return 100000;
-               case CLKCFG_FSB_533:
-                       return 133333;
-               case CLKCFG_FSB_667:
-                       return 166667;
-               case CLKCFG_FSB_800:
-                       return 200000;
-               case CLKCFG_FSB_1067_ALT:
-                       return 266667;
-               case CLKCFG_FSB_1333_ALT:
-                       return 333333;
-               case CLKCFG_FSB_1600_ALT:
-                       return 400000;
-               default:
-                       return 133333;
-               }
-       }
+       return DIV_ROUND_CLOSEST(i9xx_fsb_freq(i915), 4);
 }
 
 /**