drm/amdgpu/atpx: check for ATIF dGPU wake for display events support
authorAlex Deucher <alexander.deucher@amd.com>
Wed, 14 Sep 2016 18:01:41 +0000 (14:01 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 22 Sep 2016 14:30:30 +0000 (10:30 -0400)
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 <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu.h
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c

index 44255cb0bb5099cb460e97c0157bff26e73be353..9d79e4ba0213be8c85a60d4fb6ebb58a60a055b1 100644 (file)
@@ -2450,11 +2450,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
 
 /*
index 49de92600074dd3f16f117553ae44368b6b1d0d8..550c5ee704ec4af5af6a0f376f93b890c052c52c 100644 (file)
@@ -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;
 }