drm/amdgpu/atpx: check for ATIF dGPU wake for display events support
Subsystems (2)
PATCH 1/4 drm/amdgpu/atpx: check for ATIF dGPU wake for display events support
Some ATPX laptops implement special circuitry to generate display hotplug events via ACPI when the dGPU is powered off. Check if this is supported.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 9 +++++++++ 2 files changed, 11 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
@@ -2463,11 +2463,13 @@ void amdgpu_register_atpx_handler(void);void amdgpu_unregister_atpx_handler (void );bool amdgpu_has_atpx_dgpu_power_cntl (void );bool amdgpu_is_atpx_hybrid (void ); +bool amdgpu_atpx_dgpu_req_power_for_displays (void );#else static inline void amdgpu_register_atpx_handler (void ) {}static inline void amdgpu_unregister_atpx_handler (void ) {}static inline bool amdgpu_has_atpx_dgpu_power_cntl (void ) {return false; }static inline bool amdgpu_is_atpx_hybrid (void ) {return false; } +static inline bool amdgpu_atpx_dgpu_req_power_for_displays (void ) {return false; }#endif /*
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +9 -0
@@ -29,6 +29,7 @@ struct amdgpu_atpx {acpi_handle handle;struct amdgpu_atpx_functions functions;bool is_hybrid; +bool dgpu_req_power_for_displays; }; static struct amdgpu_atpx_priv {
@@ -73,6 +74,10 @@ bool amdgpu_is_atpx_hybrid(void) {return amdgpu_atpx_priv.atpx.is_hybrid; } +bool amdgpu_atpx_dgpu_req_power_for_displays (void ) { +return amdgpu_atpx_priv.atpx.dgpu_req_power_for_displays; +} +/** * amdgpu_atpx_call - call an ATPX method *
@@ -213,6 +218,10 @@ static int amdgpu_atpx_validate(struct amdgpu_atpx *atpx) atpx->is_hybrid = true; } + atpx->dgpu_req_power_for_displays = false; +if (valid_bits &ATPX_DGPU_REQ_POWER_FOR_DISPLAYS ) + atpx->dgpu_req_power_for_displays = true; +return 0 ; }
Signature · 6 lines
2.5.5 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1473878944-30900-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org
PATCH 2/4 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.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +11 -0
@@ -25,6 +25,7 @@#include <linux/acpi.h> #include <linux/slab.h> #include <linux/power_supply.h> +#include <linux/pm_runtime.h> #include <acpi/video.h> #include <drm/drmP.h> #include <drm/drm_crtc_helper.h>
@@ -333,6 +334,16 @@ int amdgpu_atif_handler(struct amdgpu_device *adev,#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 */ /* We've handled the event, stop the notifier chain. The ACPI interface
Signature · 6 lines
2.5.5 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/4 drm/radeon/atpx: check for ATIF dGPU wake for display events support
In reply to a message not in the archiveSome ATPX laptops implement special circuitry to generate display hotplug events via ACPI when the dGPU is powered off. Check if this is supported.
--- drivers/gpu/drm/radeon/radeon_atpx_handler.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/radeon/radeon_atpx_handler.c +5 -0
@@ -29,6 +29,7 @@ struct radeon_atpx {acpi_handle handle;struct radeon_atpx_functions functions;bool is_hybrid; +bool dgpu_req_power_for_displays; }; static struct radeon_atpx_priv {
@@ -72,6 +73,10 @@ bool radeon_is_atpx_hybrid(void) {return radeon_atpx_priv.atpx.is_hybrid; } +bool radeon_atpx_dgpu_req_power_for_displays (void ) { +return radeon_atpx_priv.atpx.dgpu_req_power_for_displays; +} +/** * radeon_atpx_call - call an ATPX method *
Signature · 6 lines
2.5.5 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1473878944-30900-3-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 3/4] drm/radeon/atpx: check for ATIF dGPU wake for display events support
Quoted 5 lines · Alex Deucher
Some ATPX laptops implement special circuitry to generate display hotplug events via ACPI when the dGPU is powered off. Check if this is supported.
Signed-off-by Alex Deucher <[email protected]>
This patch is missing a dgpu_req_power_for_displays, shouldn't you check for the flag like you did in amdgpu?
Other than that, the patches look good to me.
Peter
Quoted 30 lines
--- drivers/gpu/drm/radeon/radeon_atpx_handler.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/gpu/drm/radeon/radeon_atpx_handler.c +5
-0@@ -29,6 +29,7 @@ struct radeon_atpx {acpi_handle handle;struct radeon_atpx_functions functions;bool is_hybrid; +bool dgpu_req_power_for_displays; }; static struct radeon_atpx_priv {@@ -72,6 +73,10 @@ bool radeon_is_atpx_hybrid(void) {return radeon_atpx_priv.atpx.is_hybrid; } +bool radeon_atpx_dgpu_req_power_for_displays (void ) { +return radeon_atpx_priv.atpx.dgpu_req_power_for_displays; +} +/** * radeon_atpx_call - call an ATPX method * Signature · 1 line
2.5.5
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/4 drm/radeon/atif: Send a hotplug event when we get dgpu display request
In reply to a message not in the archiveOn PX systems, if the platform supports hotplug events ATIF while the dGPU is powered down, handle the event and alert userspace.
--- drivers/gpu/drm/radeon/radeon_acpi.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/gpu/drm/radeon/radeon_acpi.c +17 -0
@@ -25,6 +25,7 @@#include <linux/acpi.h> #include <linux/slab.h> #include <linux/power_supply.h> +#include <linux/pm_runtime.h> #include <acpi/video.h> #include <drm/drmP.h> #include <drm/drm_crtc_helper.h>
@@ -32,6 +33,12 @@#include "radeon_acpi.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"extern void radeon_pm_acpi_event_handler (struct radeon_device *rdev);
@@ -394,6 +401,16 @@ int radeon_atif_handler(struct radeon_device *rdev,#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 */ /* We've handled the event, stop the notifier chain. The ACPI interface
Signature · 6 lines
2.5.5 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 5 lines · Alex Deucher
Some ATPX laptops implement special circuitry to generate display hotplug events via ACPI when the dGPU is powered off. Check if this is supported.
Signed-off-by Alex Deucher <[email protected]>
Ping on this series?
Alex
Quoted 58 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 9 +++++++++ 2 files changed, 11 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu.h +2
-0@@ -2463,11 +2463,13 @@ void amdgpu_register_atpx_handler(void);void amdgpu_unregister_atpx_handler (void );bool amdgpu_has_atpx_dgpu_power_cntl (void );bool amdgpu_is_atpx_hybrid (void ); +bool amdgpu_atpx_dgpu_req_power_for_displays (void );#else static inline void amdgpu_register_atpx_handler (void ) {}static inline void amdgpu_unregister_atpx_handler (void ) {}static inline bool amdgpu_has_atpx_dgpu_power_cntl (void ) {return false; }static inline bool amdgpu_is_atpx_hybrid (void ) {return false; } +static inline bool amdgpu_atpx_dgpu_req_power_for_displays (void ) {return false; }#endif /* drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +9
-1@@ -29,6 +29,7 @@ struct amdgpu_atpx {acpi_handle handle;struct amdgpu_atpx_functions functions;bool is_hybrid; +bool dgpu_req_power_for_displays; }; static struct amdgpu_atpx_priv {@@ -73,6 +74,10 @@ bool amdgpu_is_atpx_hybrid(void) {return amdgpu_atpx_priv.atpx.is_hybrid; } +bool amdgpu_atpx_dgpu_req_power_for_displays (void ) { +return amdgpu_atpx_priv.atpx.dgpu_req_power_for_displays; +} +/** * amdgpu_atpx_call - call an ATPX method * @@ -213,6 +218,10 @@ static int amdgpu_atpx_validate(struct amdgpu_atpx *atpx) atpx->is_hybrid = true; } + atpx->dgpu_req_power_for_displays = false; +if (valid_bits &ATPX_DGPU_REQ_POWER_FOR_DISPLAYS ) + atpx->dgpu_req_power_for_displays = true; +return 0 ; } --
Quoted 2 lines
2.5.5
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx