drm/radeon/dpm/rs780: add some sanity checking to sclk scaling
authorAlex Deucher <alexander.deucher@amd.com>
Fri, 13 Sep 2013 13:57:50 +0000 (09:57 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 16 Sep 2013 00:27:49 +0000 (20:27 -0400)
Since the clock scaling is based on fb divider adjustments,
make sure the other pll parameters are the same.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
drivers/gpu/drm/radeon/rs780_dpm.c

index afb75845c161a366f2e71441373c71ea89a926ef..31487ce294cfafc069065da559d01546033494cf 100644 (file)
@@ -449,6 +449,12 @@ static int rs780_set_engine_clock_scaling(struct radeon_device *rdev,
        if (ret)
                return ret;
 
+       if ((min_dividers.ref_div != max_dividers.ref_div) ||
+           (min_dividers.post_div != max_dividers.post_div) ||
+           (max_dividers.ref_div != current_max_dividers.ref_div) ||
+           (max_dividers.post_div != current_max_dividers.post_div))
+               return -EINVAL;
+
        rs780_force_fbdiv(rdev, max_dividers.fb_div);
 
        if (max_dividers.fb_div > min_dividers.fb_div) {