aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/files/0206-drm-amdgpu-pm-add-some-checks-for-PX.patch
diff options
context:
space:
mode:
Diffstat (limited to 'common/recipes-kernel/linux/files/0206-drm-amdgpu-pm-add-some-checks-for-PX.patch')
-rw-r--r--common/recipes-kernel/linux/files/0206-drm-amdgpu-pm-add-some-checks-for-PX.patch81
1 files changed, 81 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/files/0206-drm-amdgpu-pm-add-some-checks-for-PX.patch b/common/recipes-kernel/linux/files/0206-drm-amdgpu-pm-add-some-checks-for-PX.patch
new file mode 100644
index 00000000..1685b35c
--- /dev/null
+++ b/common/recipes-kernel/linux/files/0206-drm-amdgpu-pm-add-some-checks-for-PX.patch
@@ -0,0 +1,81 @@
+From 8e7dc1e0ce2344e3d42e0ee1e2498c7bc753246b Mon Sep 17 00:00:00 2001
+From: Alex Deucher <alexander.deucher@amd.com>
+Date: Fri, 19 Feb 2016 15:30:15 -0500
+Subject: [PATCH 0206/1110] drm/amdgpu/pm: add some checks for PX
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+I.e., doesn't make sense to change power states or check the
+temperature when the asic is powered off.
+
+Reviewed-by: Christian König <christian.koenig@amd.com>
+Acked-by: Harry Wentland <harry.wentland@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 21 ++++++++++++++++++++-
+ 1 file changed, 20 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+index e9ad9a5..95a4a25 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+@@ -113,6 +113,10 @@ static ssize_t amdgpu_get_dpm_forced_performance_level(struct device *dev,
+ struct drm_device *ddev = dev_get_drvdata(dev);
+ struct amdgpu_device *adev = ddev->dev_private;
+
++ if ((adev->flags & AMD_IS_PX) &&
++ (ddev->switch_power_state != DRM_SWITCH_POWER_ON))
++ return snprintf(buf, PAGE_SIZE, "off\n");
++
+ if (adev->pp_enabled) {
+ enum amd_dpm_forced_level level;
+
+@@ -140,6 +144,11 @@ static ssize_t amdgpu_set_dpm_forced_performance_level(struct device *dev,
+ enum amdgpu_dpm_forced_level level;
+ int ret = 0;
+
++ /* Can't force performance level when the card is off */
++ if ((adev->flags & AMD_IS_PX) &&
++ (ddev->switch_power_state != DRM_SWITCH_POWER_ON))
++ return -EINVAL;
++
+ if (strncmp("low", buf, strlen("low")) == 0) {
+ level = AMDGPU_DPM_FORCED_LEVEL_LOW;
+ } else if (strncmp("high", buf, strlen("high")) == 0) {
+@@ -181,8 +190,14 @@ static ssize_t amdgpu_hwmon_show_temp(struct device *dev,
+ char *buf)
+ {
+ struct amdgpu_device *adev = dev_get_drvdata(dev);
++ struct drm_device *ddev = adev->ddev;
+ int temp;
+
++ /* Can't get temperature when the card is off */
++ if ((adev->flags & AMD_IS_PX) &&
++ (ddev->switch_power_state != DRM_SWITCH_POWER_ON))
++ return -EINVAL;
++
+ if (!adev->pp_enabled && !adev->pm.funcs->get_temperature)
+ temp = 0;
+ else
+@@ -847,12 +862,16 @@ static int amdgpu_debugfs_pm_info(struct seq_file *m, void *data)
+ struct drm_info_node *node = (struct drm_info_node *) m->private;
+ struct drm_device *dev = node->minor->dev;
+ struct amdgpu_device *adev = dev->dev_private;
++ struct drm_device *ddev = adev->ddev;
+
+ if (!adev->pm.dpm_enabled) {
+ seq_printf(m, "dpm not enabled\n");
+ return 0;
+ }
+- if (adev->pp_enabled) {
++ if ((adev->flags & AMD_IS_PX) &&
++ (ddev->switch_power_state != DRM_SWITCH_POWER_ON)) {
++ seq_printf(m, "PX asic powered off\n");
++ } else if (adev->pp_enabled) {
+ amdgpu_dpm_debugfs_print_current_performance_level(adev, m);
+ } else {
+ mutex_lock(&adev->pm.mutex);
+--
+2.7.4
+