drm/amd/powerplay: no memory activity support on Vega10
[sfrench/cifs-2.6.git] / drivers / gpu / drm / amd / amdgpu / amdgpu_pm.c
index 2f4b03b4e882de301590e34797efbf78d77926b2..193d53720d9baeca7800e376bed88d9cc2273542 100644 (file)
@@ -22,7 +22,9 @@
  * Authors: Rafał Miłecki <zajec5@gmail.com>
  *          Alex Deucher <alexdeucher@gmail.com>
  */
-#include <drm/drmP.h>
+
+#include <drm/drm_debugfs.h>
+
 #include "amdgpu.h"
 #include "amdgpu_drv.h"
 #include "amdgpu_pm.h"
@@ -31,6 +33,7 @@
 #include "amdgpu_smu.h"
 #include "atom.h"
 #include <linux/power_supply.h>
+#include <linux/pci.h>
 #include <linux/hwmon.h>
 #include <linux/hwmon-sysfs.h>
 #include <linux/nospec.h>
@@ -686,12 +689,12 @@ static ssize_t amdgpu_set_pp_od_clk_voltage(struct device *dev,
                if (ret)
                        return -EINVAL;
        } else {
-               if (adev->powerplay.pp_funcs->odn_edit_dpm_table)
+               if (adev->powerplay.pp_funcs->odn_edit_dpm_table) {
                        ret = amdgpu_dpm_odn_edit_dpm_table(adev, type,
                                                parameter, parameter_size);
-
-               if (ret)
-                       return -EINVAL;
+                       if (ret)
+                               return -EINVAL;
+               }
 
                if (type == PP_OD_COMMIT_DPM_TABLE) {
                        if (adev->powerplay.pp_funcs->dispatch_tasks) {
@@ -1459,7 +1462,7 @@ static ssize_t amdgpu_hwmon_show_temp(struct device *dev,
        struct amdgpu_device *adev = dev_get_drvdata(dev);
        struct drm_device *ddev = adev->ddev;
        int channel = to_sensor_dev_attr(attr)->index;
-       int r, temp, size = sizeof(temp);
+       int r, temp = 0, size = sizeof(temp);
 
        /* Can't get temperature when the card is off */
        if  ((adev->flags & AMD_IS_PX) &&
@@ -2749,7 +2752,6 @@ int amdgpu_pm_load_smu_firmware(struct amdgpu_device *adev, uint32_t *smu_versio
 {
        int r;
 
-
        if (adev->powerplay.pp_funcs && adev->powerplay.pp_funcs->load_firmware) {
                r = adev->powerplay.pp_funcs->load_firmware(adev->powerplay.pp_handle);
                if (r) {
@@ -2884,7 +2886,8 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)
                return ret;
        }
        /* APU does not have its own dedicated memory */
-       if (!(adev->flags & AMD_IS_APU)) {
+       if (!(adev->flags & AMD_IS_APU) &&
+            (adev->asic_type != CHIP_VEGA10)) {
                ret = device_create_file(adev->dev,
                                &dev_attr_mem_busy_percent);
                if (ret) {
@@ -2964,7 +2967,8 @@ void amdgpu_pm_sysfs_fini(struct amdgpu_device *adev)
                device_remove_file(adev->dev,
                                &dev_attr_pp_od_clk_voltage);
        device_remove_file(adev->dev, &dev_attr_gpu_busy_percent);
-       if (!(adev->flags & AMD_IS_APU))
+       if (!(adev->flags & AMD_IS_APU) &&
+            (adev->asic_type != CHIP_VEGA10))
                device_remove_file(adev->dev, &dev_attr_mem_busy_percent);
        if (!(adev->flags & AMD_IS_APU))
                device_remove_file(adev->dev, &dev_attr_pcie_bw);