aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
index 1cdb26471a03..11d4d9f93b95 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
@@ -26,6 +26,9 @@
26#include "amdgpu.h" 26#include "amdgpu.h"
27#include "amdgpu_gfx.h" 27#include "amdgpu_gfx.h"
28 28
29/* 0.5 second timeout */
30#define GFX_OFF_DELAY_ENABLE msecs_to_jiffies(500)
31
29/* 32/*
30 * GPU scratch registers helpers function. 33 * GPU scratch registers helpers function.
31 */ 34 */
@@ -360,6 +363,7 @@ void amdgpu_gfx_off_ctrl(struct amdgpu_device *adev, bool enable)
360 if (!adev->powerplay.pp_funcs->set_powergating_by_smu) 363 if (!adev->powerplay.pp_funcs->set_powergating_by_smu)
361 return; 364 return;
362 365
366
363 mutex_lock(&adev->gfx.gfx_off_mutex); 367 mutex_lock(&adev->gfx.gfx_off_mutex);
364 368
365 if (!enable) 369 if (!enable)
@@ -368,11 +372,11 @@ void amdgpu_gfx_off_ctrl(struct amdgpu_device *adev, bool enable)
368 adev->gfx.gfx_off_req_count--; 372 adev->gfx.gfx_off_req_count--;
369 373
370 if (enable && !adev->gfx.gfx_off_state && !adev->gfx.gfx_off_req_count) { 374 if (enable && !adev->gfx.gfx_off_state && !adev->gfx.gfx_off_req_count) {
371 if (!amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_GFX, true)) 375 schedule_delayed_work(&adev->gfx.gfx_off_delay_work, GFX_OFF_DELAY_ENABLE);
372 adev->gfx.gfx_off_state = true;
373 } else if (!enable && adev->gfx.gfx_off_state) { 376 } else if (!enable && adev->gfx.gfx_off_state) {
374 if (!amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_GFX, false)) 377 if (!amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_GFX, false))
375 adev->gfx.gfx_off_state = false; 378 adev->gfx.gfx_off_state = false;
376 } 379 }
380
377 mutex_unlock(&adev->gfx.gfx_off_mutex); 381 mutex_unlock(&adev->gfx.gfx_off_mutex);
378} 382}