|
@@ -26,6 +26,9 @@
|
|
#include "amdgpu.h"
|
|
#include "amdgpu.h"
|
|
#include "amdgpu_gfx.h"
|
|
#include "amdgpu_gfx.h"
|
|
|
|
|
|
|
|
+/* 0.5 second timeout */
|
|
|
|
+#define GFX_OFF_DELAY_ENABLE msecs_to_jiffies(500)
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* GPU scratch registers helpers function.
|
|
* GPU scratch registers helpers function.
|
|
*/
|
|
*/
|
|
@@ -360,6 +363,7 @@ void amdgpu_gfx_off_ctrl(struct amdgpu_device *adev, bool enable)
|
|
if (!adev->powerplay.pp_funcs->set_powergating_by_smu)
|
|
if (!adev->powerplay.pp_funcs->set_powergating_by_smu)
|
|
return;
|
|
return;
|
|
|
|
|
|
|
|
+
|
|
mutex_lock(&adev->gfx.gfx_off_mutex);
|
|
mutex_lock(&adev->gfx.gfx_off_mutex);
|
|
|
|
|
|
if (!enable)
|
|
if (!enable)
|
|
@@ -368,11 +372,11 @@ void amdgpu_gfx_off_ctrl(struct amdgpu_device *adev, bool enable)
|
|
adev->gfx.gfx_off_req_count--;
|
|
adev->gfx.gfx_off_req_count--;
|
|
|
|
|
|
if (enable && !adev->gfx.gfx_off_state && !adev->gfx.gfx_off_req_count) {
|
|
if (enable && !adev->gfx.gfx_off_state && !adev->gfx.gfx_off_req_count) {
|
|
- if (!amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_GFX, true))
|
|
|
|
- adev->gfx.gfx_off_state = true;
|
|
|
|
|
|
+ schedule_delayed_work(&adev->gfx.gfx_off_delay_work, GFX_OFF_DELAY_ENABLE);
|
|
} else if (!enable && adev->gfx.gfx_off_state) {
|
|
} else if (!enable && adev->gfx.gfx_off_state) {
|
|
if (!amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_GFX, false))
|
|
if (!amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_GFX, false))
|
|
adev->gfx.gfx_off_state = false;
|
|
adev->gfx.gfx_off_state = false;
|
|
}
|
|
}
|
|
|
|
+
|
|
mutex_unlock(&adev->gfx.gfx_off_mutex);
|
|
mutex_unlock(&adev->gfx.gfx_off_mutex);
|
|
}
|
|
}
|