]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/amd/powerplay: Tidy up vega10_fan_ctrl_set_fan_speed_percent()
authorTom St Denis <tom.stdenis@amd.com>
Thu, 7 Sep 2017 16:41:51 +0000 (12:41 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 12 Sep 2017 18:32:07 +0000 (14:32 -0400)
Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_thermal.c

index cda7fcfeefd7b1430509477f21e583077b56cce3..7a25e226d7d3ce9f677b69cdcef796b6da18b258 100644 (file)
@@ -281,9 +281,8 @@ int vega10_fan_ctrl_set_fan_speed_percent(struct pp_hwmgr *hwmgr,
        reg = soc15_get_register_offset(THM_HWID, 0,
                        mmCG_FDO_CTRL1_BASE_IDX, mmCG_FDO_CTRL1);
 
-       duty100 = (cgs_read_register(hwmgr->device, reg) &
-                       CG_FDO_CTRL1__FMAX_DUTY100_MASK) >>
-                       CG_FDO_CTRL1__FMAX_DUTY100__SHIFT;
+       duty100 = CGS_REG_GET_FIELD(cgs_read_register(hwmgr->device, reg),
+                                   CG_FDO_CTRL1, FMAX_DUTY100);
 
        if (duty100 == 0)
                return -EINVAL;
@@ -295,9 +294,8 @@ int vega10_fan_ctrl_set_fan_speed_percent(struct pp_hwmgr *hwmgr,
        reg = soc15_get_register_offset(THM_HWID, 0,
                        mmCG_FDO_CTRL0_BASE_IDX, mmCG_FDO_CTRL0);
        cgs_write_register(hwmgr->device, reg,
-                       (cgs_read_register(hwmgr->device, reg) &
-                       ~CG_FDO_CTRL0__FDO_STATIC_DUTY_MASK) |
-                       (duty << CG_FDO_CTRL0__FDO_STATIC_DUTY__SHIFT));
+               CGS_REG_SET_FIELD(cgs_read_register(hwmgr->device, reg),
+                       CG_FDO_CTRL0, FDO_STATIC_DUTY, duty));
 
        return vega10_fan_ctrl_set_static_mode(hwmgr, FDO_PWM_MODE_STATIC);
 }