drm/amdgpu/dpm: implement thermal sensor for CZ/ST
Subsystems (2)
PATCH 1/2 drm/amdgpu/dpm: implement thermal sensor for CZ/ST
Previous code was just a copy/paste from KV.
Signed-off-by Alex Deucher <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/cz_dpm.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/cz_dpm.c +5 -3
@@ -1514,14 +1514,16 @@ static int cz_dpm_set_powergating_state(void *handle,return 0 ; } -/* borrowed from KV, need future unify */ static int cz_dpm_get_temperature (struct amdgpu_device *adev) {int actual_temp =0 ; -uint32_t temp =RREG32_SMC (0xC0300E0C ); +uint32_t val =RREG32_SMC (ixTHM_TCON_CUR_TMP); +uint32_t temp =REG_GET_FIELD (val,THM_TCON_CUR_TMP ,CUR_TEMP ); -if (temp) +if (REG_GET_FIELD (val,THM_TCON_CUR_TMP ,CUR_TEMP_RANGE_SEL )) actual_temp =1000 * ((temp /8 ) -49 ); +else + actual_temp =1000 * (temp /8 );return actual_temp; }
Signature · 6 lines
2.5.5 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1476367726-29558-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org
PATCH 2/2 drm/amdgpu/powerplay: implement thermal sensor for CZ/ST
Add missing functionality.
Signed-off-by Alex Deucher <[email protected]>
--- drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +18 -0
@@ -1785,6 +1785,21 @@ static int cz_get_max_high_clocks(struct pp_hwmgr *hwmgr, struct amd_pp_simple_creturn 0 ; } +static int cz_thermal_get_temperature (struct pp_hwmgr *hwmgr) +{ +int actual_temp =0 ; +uint32_t val =cgs_read_ind_register (hwmgr->device, +CGS_IND_REG__SMC , ixTHM_TCON_CUR_TMP); +uint32_t temp =PHM_GET_FIELD (val,THM_TCON_CUR_TMP ,CUR_TEMP ); + +if (PHM_GET_FIELD (val,THM_TCON_CUR_TMP ,CUR_TEMP_RANGE_SEL )) + actual_temp = ((temp /8 ) -49 ) *PP_TEMPERATURE_UNITS_PER_CENTIGRADES ; +else + actual_temp = (temp /8 ) *PP_TEMPERATURE_UNITS_PER_CENTIGRADES ; + +return actual_temp; +} +static int cz_read_sensor (struct pp_hwmgr *hwmgr,int idx,int32_t *value) {struct cz_hwmgr *cz_hwmgr = (struct cz_hwmgr *)(hwmgr->backend);
@@ -1881,6 +1896,9 @@ static int cz_read_sensor(struct pp_hwmgr *hwmgr, int idx, int32_t *value)case AMDGPU_PP_SENSOR_VCE_POWER : *value = cz_hwmgr->vce_power_gated ?0 :1 ;return 0 ; +case AMDGPU_PP_SENSOR_GPU_TEMP : + *value =cz_thermal_get_temperature (hwmgr); +return 0 ;default :return -EINVAL ; }
Signature · 6 lines
2.5.5 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx