drm/amdgpu/swSMU: handle manual AC/DC notifications
For boards that do not support automatic AC/DC transitions in firmware, manually tell the firmware when the status changes. Bug: https://gitlab.freedesktop.org/drm/amd/issues/1043 Reviewed-by: Evan Quan <evan.quan@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
f5cdd2bdd9
commit
9644bf5f4a
|
@ -92,6 +92,9 @@ void amdgpu_pm_acpi_event_handler(struct amdgpu_device *adev)
|
|||
if (adev->powerplay.pp_funcs->enable_bapm)
|
||||
amdgpu_dpm_enable_bapm(adev, adev->pm.ac_power);
|
||||
mutex_unlock(&adev->pm.mutex);
|
||||
|
||||
if (is_support_sw_smu(adev))
|
||||
smu_set_ac_dc(&adev->smu);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2087,6 +2087,29 @@ int smu_set_watermarks_for_clock_ranges(struct smu_context *smu,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int smu_set_ac_dc(struct smu_context *smu)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
/* controlled by firmware */
|
||||
if (smu->dc_controlled_by_gpio)
|
||||
return 0;
|
||||
|
||||
mutex_lock(&smu->mutex);
|
||||
if (smu->ppt_funcs->set_power_source) {
|
||||
if (smu->adev->pm.ac_power)
|
||||
ret = smu_set_power_source(smu, SMU_POWER_SOURCE_AC);
|
||||
else
|
||||
ret = smu_set_power_source(smu, SMU_POWER_SOURCE_DC);
|
||||
if (ret)
|
||||
pr_err("Failed to switch to %s mode!\n",
|
||||
smu->adev->pm.ac_power ? "AC" : "DC");
|
||||
}
|
||||
mutex_unlock(&smu->mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
const struct amd_ip_funcs smu_ip_funcs = {
|
||||
.name = "smu",
|
||||
.early_init = smu_early_init,
|
||||
|
|
|
@ -720,6 +720,7 @@ int smu_get_dpm_level_range(struct smu_context *smu, enum smu_clk_type clk_type,
|
|||
enum amd_dpm_forced_level smu_get_performance_level(struct smu_context *smu);
|
||||
int smu_force_performance_level(struct smu_context *smu, enum amd_dpm_forced_level level);
|
||||
int smu_set_display_count(struct smu_context *smu, uint32_t count);
|
||||
int smu_set_ac_dc(struct smu_context *smu);
|
||||
bool smu_clk_dpm_is_enabled(struct smu_context *smu, enum smu_clk_type clk_type);
|
||||
const char *smu_get_message_name(struct smu_context *smu, enum smu_message_type type);
|
||||
const char *smu_get_feature_name(struct smu_context *smu, enum smu_feature_mask feature);
|
||||
|
|
Loading…
Reference in New Issue