drm/amd/powerplay: fix fan speed percent setting error on Tonga
authorEric Huang <JinHuiEric.Huang@amd.com>
Mon, 11 Apr 2016 18:27:51 +0000 (14:27 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 5 May 2016 00:20:42 +0000 (20:20 -0400)
Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/powerplay/hwmgr/tonga_thermal.c

index 23f8463d2f53cf5116b2ffc4e8e0f4f026993de3..47ef1ca2d78bc615625727df802bb08bfd977985 100644 (file)
@@ -195,8 +195,8 @@ int tonga_fan_ctrl_set_fan_speed_percent(struct pp_hwmgr *hwmgr, uint32_t speed)
        if (0 == duty100)
                return -EINVAL;
 
-       tmp64 = (uint64_t)speed * 100;
-       do_div(tmp64, duty100);
+       tmp64 = (uint64_t)speed * duty100;
+       do_div(tmp64, 100);
        duty = (uint32_t)tmp64;
 
        PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, CG_FDO_CTRL0, FDO_STATIC_DUTY, duty);