Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/radeon/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>

+17
+17
drivers/gpu/drm/radeon/radeon_acpi.c
··· 25 25 #include <linux/acpi.h> 26 26 #include <linux/slab.h> 27 27 #include <linux/power_supply.h> 28 + #include <linux/pm_runtime.h> 28 29 #include <acpi/video.h> 29 30 #include <drm/drmP.h> 30 31 #include <drm/drm_crtc_helper.h> 31 32 #include "radeon.h" 32 33 #include "radeon_acpi.h" 33 34 #include "atom.h" 35 + 36 + #if defined(CONFIG_VGA_SWITCHEROO) 37 + bool radeon_atpx_dgpu_req_power_for_displays(void); 38 + #else 39 + static inline bool radeon_atpx_dgpu_req_power_for_displays(void) { return false; } 40 + #endif 34 41 35 42 #define ACPI_AC_CLASS "ac_adapter" 36 43 ··· 399 392 BACKLIGHT_UPDATE_HOTKEY); 400 393 } 401 394 #endif 395 + } 396 + } 397 + if (req.pending & ATIF_DGPU_DISPLAY_EVENT) { 398 + if ((rdev->flags & RADEON_IS_PX) && 399 + radeon_atpx_dgpu_req_power_for_displays()) { 400 + pm_runtime_get_sync(rdev->ddev->dev); 401 + /* Just fire off a uevent and let userspace tell us what to do */ 402 + drm_helper_hpd_irq_event(rdev->ddev); 403 + pm_runtime_mark_last_busy(rdev->ddev->dev); 404 + pm_runtime_put_autosuspend(rdev->ddev->dev); 402 405 } 403 406 } 404 407 /* TODO: check other events */