diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2024-04-11 03:27:40 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2024-04-11 03:27:40 +0000 |
commit | c7a8c589dfd777e04e2a31a911ed5ab65406c080 (patch) | |
tree | 5e4440a75e5dbbbbd868b3001cfbd57febec4a64 /sys | |
parent | 730872c08fdfd890da6c8f739d7f64c0b10c8512 (diff) |
drm/amd: Add concept of running prepare_suspend() sequence for IP blocks
From Mario Limonciello
da67a1139f054fc59c9c18f135729bc16aef93d4 in linux-6.6.y/6.6.26
cb11ca3233aa3303dc11dca25977d2e7f24be00f in mainline linux
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c | 12 | ||||
-rw-r--r-- | sys/dev/pci/drm/amd/include/amd_shared.h | 1 |
2 files changed, 12 insertions, 1 deletions
diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c index 3029753b497..1363d4c3668 100644 --- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c +++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c @@ -4218,7 +4218,7 @@ static int amdgpu_device_evict_resources(struct amdgpu_device *adev) int amdgpu_device_prepare(struct drm_device *dev) { struct amdgpu_device *adev = drm_to_adev(dev); - int r; + int i, r; if (dev->switch_power_state == DRM_SWITCH_POWER_OFF) return 0; @@ -4228,6 +4228,16 @@ int amdgpu_device_prepare(struct drm_device *dev) if (r) return r; + for (i = 0; i < adev->num_ip_blocks; i++) { + if (!adev->ip_blocks[i].status.valid) + continue; + if (!adev->ip_blocks[i].version->funcs->prepare_suspend) + continue; + r = adev->ip_blocks[i].version->funcs->prepare_suspend((void *)adev); + if (r) + return r; + } + return 0; } diff --git a/sys/dev/pci/drm/amd/include/amd_shared.h b/sys/dev/pci/drm/amd/include/amd_shared.h index abe829bbd54..a9880fc5319 100644 --- a/sys/dev/pci/drm/amd/include/amd_shared.h +++ b/sys/dev/pci/drm/amd/include/amd_shared.h @@ -295,6 +295,7 @@ struct amd_ip_funcs { int (*hw_init)(void *handle); int (*hw_fini)(void *handle); void (*late_fini)(void *handle); + int (*prepare_suspend)(void *handle); int (*suspend)(void *handle); int (*resume)(void *handle); bool (*is_idle)(void *handle); |