Commit 73559847 authored by Alex Deucher's avatar Alex Deucher

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: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 47771669
...@@ -25,6 +25,7 @@ ...@@ -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>
...@@ -32,6 +33,12 @@ ...@@ -32,6 +33,12 @@
#include "radeon_acpi.h" #include "radeon_acpi.h"
#include "atom.h" #include "atom.h"
#if defined(CONFIG_VGA_SWITCHEROO)
bool radeon_atpx_dgpu_req_power_for_displays(void);
#else
static inline bool radeon_atpx_dgpu_req_power_for_displays(void) { return false; }
#endif
#define ACPI_AC_CLASS "ac_adapter" #define ACPI_AC_CLASS "ac_adapter"
extern void radeon_pm_acpi_event_handler(struct radeon_device *rdev); extern void radeon_pm_acpi_event_handler(struct radeon_device *rdev);
...@@ -394,6 +401,16 @@ int radeon_atif_handler(struct radeon_device *rdev, ...@@ -394,6 +401,16 @@ int radeon_atif_handler(struct radeon_device *rdev,
#endif #endif
} }
} }
if (req.pending & ATIF_DGPU_DISPLAY_EVENT) {
if ((rdev->flags & RADEON_IS_PX) &&
radeon_atpx_dgpu_req_power_for_displays()) {
pm_runtime_get_sync(rdev->ddev->dev);
/* Just fire off a uevent and let userspace tell us what to do */
drm_helper_hpd_irq_event(rdev->ddev);
pm_runtime_mark_last_busy(rdev->ddev->dev);
pm_runtime_put_autosuspend(rdev->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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment