drm/amd/powerplay: Tidy up vega10_fan_ctrl_get_fan_speed_rpm()
authorTom St Denis <tom.stdenis@amd.com>
Thu, 7 Sep 2017 14:36:40 +0000 (10:36 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 12 Sep 2017 18:31:46 +0000 (14:31 -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 eee143ad60a25163da2032aaa563aa0ad2ca0a6c..f62b85237236eb4a1150a3fac918bdedb6fa2d43 100644 (file)
@@ -104,14 +104,15 @@ int vega10_fan_ctrl_get_fan_speed_rpm(struct pp_hwmgr *hwmgr, uint32_t *speed)
        if (hwmgr->thermal_controller.fanInfo.bNoFan)
                return -1;
 
-       if (data->smu_features[GNLD_FAN_CONTROL].supported)
+       if (data->smu_features[GNLD_FAN_CONTROL].supported) {
                result = vega10_get_current_rpm(hwmgr, speed);
-       else {
+       else {
                uint32_t reg = soc15_get_register_offset(THM_HWID, 0,
                                mmCG_TACH_STATUS_BASE_IDX, mmCG_TACH_STATUS);
-               tach_period = (cgs_read_register(hwmgr->device,
-                               reg) & CG_TACH_STATUS__TACH_PERIOD_MASK) >>
-                               CG_TACH_STATUS__TACH_PERIOD__SHIFT;
+               tach_period =
+                       CGS_REG_GET_FIELD(cgs_read_register(hwmgr->device, reg),
+                                         CG_TACH_STATUS,
+                                         TACH_PERIOD);
 
                if (tach_period == 0)
                        return -EINVAL;