mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-27 00:25:21 +07:00
drm/amd/powerplay: add function to start thermal control
Add function to start thermal control for smu11 when smu hw_init. Signed-off-by: Likun Gao <Likun.Gao@amd.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Huang Rui <ray.huang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
e921ec97fe
commit
74ba3553b2
@ -518,6 +518,10 @@ static int smu_hw_init(void *handle)
|
||||
if (ret)
|
||||
goto failed;
|
||||
|
||||
ret = smu_start_thermal_control(smu);
|
||||
if (ret)
|
||||
goto failed;
|
||||
|
||||
mutex_unlock(&smu->mutex);
|
||||
|
||||
pr_info("SMU is initialized successfully!\n");
|
||||
|
@ -165,6 +165,7 @@ struct smu_table_context
|
||||
uint32_t table_count;
|
||||
struct smu_table memory_pool;
|
||||
uint16_t software_shutdown_temp;
|
||||
uint8_t thermal_controller_type;
|
||||
};
|
||||
|
||||
struct smu_dpm_context {
|
||||
@ -256,6 +257,7 @@ struct smu_funcs
|
||||
int (*get_power_limit)(struct smu_context *smu);
|
||||
int (*get_current_clk_freq)(struct smu_context *smu, uint32_t clk_id, uint32_t *value);
|
||||
int (*init_max_sustainable_clocks)(struct smu_context *smu);
|
||||
int (*start_thermal_control)(struct smu_context *smu);
|
||||
};
|
||||
|
||||
#define smu_init_microcode(smu) \
|
||||
@ -338,6 +340,8 @@ struct smu_funcs
|
||||
((smu)->funcs->get_current_clk_freq? (smu)->funcs->get_current_clk_freq((smu), (clk_id), (value)) : 0)
|
||||
#define smu_print_clk_levels(smu, type, buf) \
|
||||
((smu)->ppt_funcs->print_clk_levels ? (smu)->ppt_funcs->print_clk_levels((smu), (type), (buf)) : 0)
|
||||
#define smu_start_thermal_control(smu) \
|
||||
((smu)->funcs->start_thermal_control? (smu)->funcs->start_thermal_control((smu)) : 0)
|
||||
|
||||
#define smu_msg_get_index(smu, msg) \
|
||||
((smu)->ppt_funcs? ((smu)->ppt_funcs->get_smu_msg_index? (smu)->ppt_funcs->get_smu_msg_index((smu), (msg)) : -EINVAL) : -EINVAL)
|
||||
|
@ -963,6 +963,33 @@ static int smu_v11_0_set_thermal_fan_table(struct smu_context *smu)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int smu_v11_0_start_thermal_control(struct smu_context *smu)
|
||||
{
|
||||
int ret = 0;
|
||||
struct PP_TemperatureRange range;
|
||||
struct amdgpu_device *adev = smu->adev;
|
||||
|
||||
smu_v11_0_get_thermal_range(smu, &range);
|
||||
|
||||
if (smu->smu_table.thermal_controller_type) {
|
||||
ret = smu_v11_0_set_thermal_range(smu, &range);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = smu_v11_0_enable_thermal_alert(smu);
|
||||
if (ret)
|
||||
return ret;
|
||||
ret = smu_v11_0_set_thermal_fan_table(smu);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
adev->pm.dpm.thermal.min_temp = range.min;
|
||||
adev->pm.dpm.thermal.max_temp = range.max;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct smu_funcs smu_v11_0_funcs = {
|
||||
.init_microcode = smu_v11_0_init_microcode,
|
||||
.load_microcode = smu_v11_0_load_microcode,
|
||||
@ -994,6 +1021,7 @@ static const struct smu_funcs smu_v11_0_funcs = {
|
||||
.get_power_limit = smu_v11_0_get_power_limit,
|
||||
.get_current_clk_freq = smu_v11_0_get_current_clk_freq,
|
||||
.init_max_sustainable_clocks = smu_v11_0_init_max_sustainable_clocks,
|
||||
.start_thermal_control = smu_v11_0_start_thermal_control,
|
||||
};
|
||||
|
||||
void smu_v11_0_set_smu_funcs(struct smu_context *smu)
|
||||
|
@ -160,6 +160,7 @@ static int vega20_store_powerplay_table(struct smu_context *smu)
|
||||
sizeof(PPTable_t));
|
||||
|
||||
table_context->software_shutdown_temp = powerplay_table->usSoftwareShutdownTemp;
|
||||
table_context->thermal_controller_type = powerplay_table->ucThermalControllerType;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user