Commit 29a45960 authored by Evan Quan's avatar Evan Quan Committed by Alex Deucher
Browse files

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: default avatarEvan Quan <evan.quan@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent ce0d0ec3
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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);

+6 −0
Original line number Diff line number Diff line
@@ -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);

+10 −0
Original line number Diff line number Diff line
@@ -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);
}