diff mbox

[1/6] drm/amdgpu/atpx: track whether if this is a hybrid graphics platform

Message ID 1464874417-27272-1-git-send-email-alexander.deucher@amd.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alex Deucher June 2, 2016, 1:33 p.m. UTC
hybrid graphics in this case refers to systems which use the new
platform d3 cold ACPI methods as opposed to ATPX for dGPU power
control.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h              | 2 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 9 ++++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

Comments

Christian König June 2, 2016, 2:20 p.m. UTC | #1
Am 02.06.2016 um 15:33 schrieb Alex Deucher:
> hybrid graphics in this case refers to systems which use the new
> platform d3 cold ACPI methods as opposed to ATPX for dGPU power
> control.
>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

Acked-by: Christian König <christian.koenig@amd.com>

I'm wondering if I should get deeper into this?

Regards,
Christian.

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu.h              | 2 ++
>   drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 9 ++++++++-
>   2 files changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index 19d15dc..c6b5ce3 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -2394,10 +2394,12 @@ bool amdgpu_device_is_px(struct drm_device *dev);
>   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);
>   #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; }
>   #endif
>   
>   /*
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c
> index 90dfedc..3e973c7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c
> @@ -28,6 +28,7 @@ struct amdgpu_atpx_functions {
>   struct amdgpu_atpx {
>   	acpi_handle handle;
>   	struct amdgpu_atpx_functions functions;
> +	bool is_hybrid;
>   };
>   
>   static struct amdgpu_atpx_priv {
> @@ -68,6 +69,10 @@ bool amdgpu_has_atpx_dgpu_power_cntl(void) {
>   	return amdgpu_atpx_priv.atpx.functions.power_cntl;
>   }
>   
> +bool amdgpu_is_atpx_hybrid(void) {
> +	return amdgpu_atpx_priv.atpx.is_hybrid;
> +}
> +
>   /**
>    * amdgpu_atpx_call - call an ATPX method
>    *
> @@ -192,9 +197,11 @@ static int amdgpu_atpx_validate(struct amdgpu_atpx *atpx)
>   			  ATPX_DYNAMIC_DGPU_POWER_OFF_SUPPORTED))
>   		atpx->functions.power_cntl = true;
>   
> +	atpx->is_hybrid = false;
>   	if (valid_bits & ATPX_MS_HYBRID_GFX_SUPPORTED) {
> -		printk("Hybrid Graphics, ATPX dGPU power cntl disabled\n");
> +		printk("ATPX Hybrid Graphics\n");
>   		atpx->functions.power_cntl = false;
> +		atpx->is_hybrid = true;
>   	}
>   
>   	return 0;
diff mbox

Patch

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 19d15dc..c6b5ce3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -2394,10 +2394,12 @@  bool amdgpu_device_is_px(struct drm_device *dev);
 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);
 #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; }
 #endif
 
 /*
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c
index 90dfedc..3e973c7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c
@@ -28,6 +28,7 @@  struct amdgpu_atpx_functions {
 struct amdgpu_atpx {
 	acpi_handle handle;
 	struct amdgpu_atpx_functions functions;
+	bool is_hybrid;
 };
 
 static struct amdgpu_atpx_priv {
@@ -68,6 +69,10 @@  bool amdgpu_has_atpx_dgpu_power_cntl(void) {
 	return amdgpu_atpx_priv.atpx.functions.power_cntl;
 }
 
+bool amdgpu_is_atpx_hybrid(void) {
+	return amdgpu_atpx_priv.atpx.is_hybrid;
+}
+
 /**
  * amdgpu_atpx_call - call an ATPX method
  *
@@ -192,9 +197,11 @@  static int amdgpu_atpx_validate(struct amdgpu_atpx *atpx)
 			  ATPX_DYNAMIC_DGPU_POWER_OFF_SUPPORTED))
 		atpx->functions.power_cntl = true;
 
+	atpx->is_hybrid = false;
 	if (valid_bits & ATPX_MS_HYBRID_GFX_SUPPORTED) {
-		printk("Hybrid Graphics, ATPX dGPU power cntl disabled\n");
+		printk("ATPX Hybrid Graphics\n");
 		atpx->functions.power_cntl = false;
+		atpx->is_hybrid = true;
 	}
 
 	return 0;