Commit 56a207c3 authored by Mario Limonciello's avatar Mario Limonciello Committed by Alex Deucher
Browse files

drm/amd: Remove second call to set_power_limit()



The min/max limits only make sense for default PPT. Restructure
smu_set_power_limit() to only use them in that case.

Reviewed-by: default avatarLijo Lazar <lijo.lazar@amd.com>
Signed-off-by: default avatarMario Limonciello <mario.limonciello@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 5f4f49a4
Loading
Loading
Loading
Loading
+9 −12
Original line number Diff line number Diff line
@@ -2966,19 +2966,16 @@ static int smu_set_power_limit(void *handle, uint32_t limit_type, uint32_t limit
	if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled)
		return -EOPNOTSUPP;

	if (limit_type != SMU_DEFAULT_PPT_LIMIT)
		if (smu->ppt_funcs->set_power_limit)
			return smu->ppt_funcs->set_power_limit(smu, limit_type, limit);

	if (limit_type == SMU_DEFAULT_PPT_LIMIT) {
		if (!limit)
			limit = smu->current_power_limit;
		if ((limit > smu->max_power_limit) || (limit < smu->min_power_limit)) {
			dev_err(smu->adev->dev,
				"New power limit (%d) is out of range [%d,%d]\n",
				limit, smu->min_power_limit, smu->max_power_limit);
			return -EINVAL;
		}

	if (!limit)
		limit = smu->current_power_limit;
	}

	if (smu->ppt_funcs->set_power_limit) {
		ret = smu->ppt_funcs->set_power_limit(smu, limit_type, limit);