drm/amd/pm: modify the power limit level parameter from bool to enum type
The original smu_get_power_limit callback accepts the power limit level parameter as bool which limits to max and current. For possible needs to retrieve other level like min, extend the parameter type using enum. Signed-off-by: Xiaomeng Hou <Xiaomeng.Hou@amd.com> Reviewed-by: Lijo Lazar <lijo.lazar@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
b36c1024dc
commit
52d720b1a8
@ -3073,7 +3073,7 @@ static ssize_t amdgpu_hwmon_show_power_cap_max(struct device *dev,
|
||||
}
|
||||
|
||||
if (is_support_sw_smu(adev)) {
|
||||
smu_get_power_limit(&adev->smu, &limit, true);
|
||||
smu_get_power_limit(&adev->smu, &limit, SMU_PPT_LIMIT_MAX);
|
||||
size = snprintf(buf, PAGE_SIZE, "%u\n", limit * 1000000);
|
||||
} else if (adev->powerplay.pp_funcs && adev->powerplay.pp_funcs->get_power_limit) {
|
||||
adev->powerplay.pp_funcs->get_power_limit(adev->powerplay.pp_handle, &limit, true);
|
||||
@ -3107,7 +3107,7 @@ static ssize_t amdgpu_hwmon_show_power_cap(struct device *dev,
|
||||
}
|
||||
|
||||
if (is_support_sw_smu(adev)) {
|
||||
smu_get_power_limit(&adev->smu, &limit, false);
|
||||
smu_get_power_limit(&adev->smu, &limit, SMU_PPT_LIMIT_CURRENT);
|
||||
size = snprintf(buf, PAGE_SIZE, "%u\n", limit * 1000000);
|
||||
} else if (adev->powerplay.pp_funcs && adev->powerplay.pp_funcs->get_power_limit) {
|
||||
adev->powerplay.pp_funcs->get_power_limit(adev->powerplay.pp_handle, &limit, false);
|
||||
|
@ -161,6 +161,13 @@ enum smu_power_src_type
|
||||
SMU_POWER_SOURCE_COUNT,
|
||||
};
|
||||
|
||||
enum smu_ppt_limit_level
|
||||
{
|
||||
SMU_PPT_LIMIT_MIN = -1,
|
||||
SMU_PPT_LIMIT_CURRENT,
|
||||
SMU_PPT_LIMIT_MAX,
|
||||
};
|
||||
|
||||
enum smu_memory_pool_size
|
||||
{
|
||||
SMU_MEMORY_POOL_SIZE_ZERO = 0,
|
||||
@ -1218,7 +1225,7 @@ int smu_set_fan_speed_rpm(struct smu_context *smu, uint32_t speed);
|
||||
|
||||
int smu_get_power_limit(struct smu_context *smu,
|
||||
uint32_t *limit,
|
||||
bool max_setting);
|
||||
enum smu_ppt_limit_level limit_level);
|
||||
|
||||
int smu_set_power_limit(struct smu_context *smu, uint32_t limit);
|
||||
int smu_print_clk_levels(struct smu_context *smu, enum smu_clk_type clk_type, char *buf);
|
||||
|
@ -2044,14 +2044,23 @@ int smu_set_fan_speed_rpm(struct smu_context *smu, uint32_t speed)
|
||||
|
||||
int smu_get_power_limit(struct smu_context *smu,
|
||||
uint32_t *limit,
|
||||
bool max_setting)
|
||||
enum smu_ppt_limit_level limit_level)
|
||||
{
|
||||
if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
mutex_lock(&smu->mutex);
|
||||
|
||||
*limit = (max_setting ? smu->max_power_limit : smu->current_power_limit);
|
||||
switch (limit_level) {
|
||||
case SMU_PPT_LIMIT_CURRENT:
|
||||
*limit = smu->current_power_limit;
|
||||
break;
|
||||
case SMU_PPT_LIMIT_MAX:
|
||||
*limit = smu->max_power_limit;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
mutex_unlock(&smu->mutex);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user