Browse Source

drm/amdgpu/atif: Send a hotplug event when we get dgpu display request

On PX systems, if the platform supports hotplug events ATIF while the
dGPU is powered down, handle the event and alert userspace.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Alex Deucher 9 years ago
parent
commit
1b0f568d24
1 changed files with 11 additions and 0 deletions
  1. 11 0
      drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c

+ 11 - 0
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c

@@ -25,6 +25,7 @@
 #include <linux/acpi.h>
 #include <linux/acpi.h>
 #include <linux/slab.h>
 #include <linux/slab.h>
 #include <linux/power_supply.h>
 #include <linux/power_supply.h>
+#include <linux/pm_runtime.h>
 #include <acpi/video.h>
 #include <acpi/video.h>
 #include <drm/drmP.h>
 #include <drm/drmP.h>
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_crtc_helper.h>
@@ -333,6 +334,16 @@ int amdgpu_atif_handler(struct amdgpu_device *adev,
 #endif
 #endif
 		}
 		}
 	}
 	}
+	if (req.pending & ATIF_DGPU_DISPLAY_EVENT) {
+		if ((adev->flags & AMD_IS_PX) &&
+		    amdgpu_atpx_dgpu_req_power_for_displays()) {
+			pm_runtime_get_sync(adev->ddev->dev);
+			/* Just fire off a uevent and let userspace tell us what to do */
+			drm_helper_hpd_irq_event(adev->ddev);
+			pm_runtime_mark_last_busy(adev->ddev->dev);
+			pm_runtime_put_autosuspend(adev->ddev->dev);
+		}
+	}
 	/* TODO: check other events */
 	/* TODO: check other events */
 
 
 	/* We've handled the event, stop the notifier chain. The ACPI interface
 	/* We've handled the event, stop the notifier chain. The ACPI interface