Commit 31a47dca authored by Evan Quan's avatar Evan Quan Committed by Alex Deucher
Browse files

drm/amd/powerplay: export the thermal ranges of Carrizo (V2)



V2: reuse the SMUThermal structure defined in pp_thermal.h

Signed-off-by: default avatarEvan Quan <evan.quan@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 4ba08257
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@
#include "cz_hwmgr.h"
#include "power_state.h"
#include "cz_clockpowergating.h"
#include "pp_thermal.h"

#define ixSMUSVI_NB_CURRENTVID 0xD8230044
#define CURRENT_NB_VID_MASK 0xff000000
@@ -1858,6 +1859,19 @@ static int cz_notify_cac_buffer_info(struct pp_hwmgr *hwmgr,
	return 0;
}

static int cz_get_thermal_temperature_range(struct pp_hwmgr *hwmgr,
		struct PP_TemperatureRange *thermal_data)
{
	struct cz_hwmgr *cz_hwmgr = (struct cz_hwmgr *)(hwmgr->backend);

	memcpy(thermal_data, &SMU7ThermalPolicy[0], sizeof(struct PP_TemperatureRange));

	thermal_data->max = (cz_hwmgr->thermal_auto_throttling_treshold +
			cz_hwmgr->sys_info.htc_hyst_lmt) *
			PP_TEMPERATURE_UNITS_PER_CENTIGRADES;

	return 0;
}

static const struct pp_hwmgr_func cz_hwmgr_funcs = {
	.backend_init = cz_hwmgr_backend_init,
@@ -1890,6 +1904,7 @@ static const struct pp_hwmgr_func cz_hwmgr_funcs = {
	.power_state_set = cz_set_power_state_tasks,
	.dynamic_state_management_disable = cz_disable_dpm_tasks,
	.notify_cac_buffer_info = cz_notify_cac_buffer_info,
	.get_thermal_temperature_range = cz_get_thermal_temperature_range,
};

int cz_init_function_pointers(struct pp_hwmgr *hwmgr)