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>
 {
        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);
 
 
                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) {
        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);
 
 
 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;
 
 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);
 }