mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-19 09:04:51 +08:00
drm/amdgpu/powerplay: implement thermal sensor for CZ/ST
Add missing functionality. Reviewed-by: Tom St Denis <tom.stdenis@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
3e96dbfd58
commit
ca3d28de62
@ -1785,6 +1785,21 @@ static int cz_get_max_high_clocks(struct pp_hwmgr *hwmgr, struct amd_pp_simple_c
|
||||
return 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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user