mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 13:31:02 +07:00
drm/amd/powerplay: refine code to support no-dpm case
With "dpm=0", there will be no DPM enabled. The code needs to be refined to support this. Signed-off-by: Evan Quan <evan.quan@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
ce0d0ec339
commit
29a4596064
@ -927,9 +927,12 @@ static int pp_dpm_set_mp1_state(void *handle, enum pp_mp1_state mp1_state)
|
||||
{
|
||||
struct pp_hwmgr *hwmgr = handle;
|
||||
|
||||
if (!hwmgr || !hwmgr->pm_en)
|
||||
if (!hwmgr)
|
||||
return -EINVAL;
|
||||
|
||||
if (!hwmgr->pm_en)
|
||||
return 0;
|
||||
|
||||
if (hwmgr->hwmgr_func->set_mp1_state)
|
||||
return hwmgr->hwmgr_func->set_mp1_state(hwmgr, mp1_state);
|
||||
|
||||
|
@ -1363,6 +1363,9 @@ static int smu_hw_fini(void *handle)
|
||||
smu_powergate_jpeg(&adev->smu, true);
|
||||
}
|
||||
|
||||
if (!smu->pm_enabled)
|
||||
return 0;
|
||||
|
||||
if (!amdgpu_sriov_vf(adev)){
|
||||
ret = smu_stop_thermal_control(smu);
|
||||
if (ret) {
|
||||
@ -1435,6 +1438,9 @@ static int smu_suspend(void *handle)
|
||||
struct smu_context *smu = &adev->smu;
|
||||
bool baco_feature_is_enabled = false;
|
||||
|
||||
if (!smu->pm_enabled)
|
||||
return 0;
|
||||
|
||||
if(!smu->is_apu)
|
||||
baco_feature_is_enabled = smu_feature_is_enabled(smu, SMU_FEATURE_BACO_BIT);
|
||||
|
||||
|
@ -2176,8 +2176,12 @@ static const struct i2c_algorithm arcturus_i2c_eeprom_i2c_algo = {
|
||||
static int arcturus_i2c_eeprom_control_init(struct i2c_adapter *control)
|
||||
{
|
||||
struct amdgpu_device *adev = to_amdgpu_device(control);
|
||||
struct smu_context *smu = &adev->smu;
|
||||
int res;
|
||||
|
||||
if (!smu->pm_enabled)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
control->owner = THIS_MODULE;
|
||||
control->class = I2C_CLASS_SPD;
|
||||
control->dev.parent = &adev->pdev->dev;
|
||||
@ -2193,6 +2197,12 @@ static int arcturus_i2c_eeprom_control_init(struct i2c_adapter *control)
|
||||
|
||||
static void arcturus_i2c_eeprom_control_fini(struct i2c_adapter *control)
|
||||
{
|
||||
struct amdgpu_device *adev = to_amdgpu_device(control);
|
||||
struct smu_context *smu = &adev->smu;
|
||||
|
||||
if (!smu->pm_enabled)
|
||||
return;
|
||||
|
||||
i2c_del_adapter(control);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user