drm/i915: Sanity check cdclk in vlv_set_cdclk()
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 24 Oct 2017 09:52:15 +0000 (12:52 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 25 Oct 2017 10:47:08 +0000 (13:47 +0300)
chv_set_cdclk() sanity checks that the cdclk frequency is one of the
legal values. Do the same in the VLV function.

Cc: Mika Kahola <mika.kahola@intel.com>
Cc: Manasi Navare <manasi.d.navare@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171024095216.1638-10-ville.syrjala@linux.intel.com
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
drivers/gpu/drm/i915/intel_cdclk.c

index 4ca4a34b7bfaf4bd79dec2a2c0624225592491fa..fedfe3c720b62af9bc7bc5ea276bd52b2db54ebd 100644 (file)
@@ -520,6 +520,18 @@ static void vlv_set_cdclk(struct drm_i915_private *dev_priv,
        int cdclk = cdclk_state->cdclk;
        u32 val, cmd = cdclk_state->voltage_level;
 
+       switch (cdclk) {
+       case 400000:
+       case 333333:
+       case 320000:
+       case 266667:
+       case 200000:
+               break;
+       default:
+               MISSING_CASE(cdclk);
+               return;
+       }
+
        /* There are cases where we can end up here with power domains
         * off and a CDCLK frequency other than the minimum, like when
         * issuing a modeset without actually changing any display after