]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/amd/powerplay: implement sysfs of get num states function
authorKevin Wang <Kevin1.Wang@amd.com>
Thu, 17 Jan 2019 05:15:48 +0000 (13:15 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 19 Mar 2019 20:03:58 +0000 (15:03 -0500)
add function smu_get_power_num_state function for sw-smu.
it's only for sysfs interface, the power state feature is not ready for sw-smu.

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h

index 53b470c30da46653b2698efd32aa404163f4b76b..5eda007ea6328bf33570227db989d365c87b0db6 100644 (file)
@@ -350,9 +350,13 @@ static ssize_t amdgpu_get_pp_num_states(struct device *dev,
        struct drm_device *ddev = dev_get_drvdata(dev);
        struct amdgpu_device *adev = ddev->dev_private;
        struct pp_states_info data;
-       int i, buf_len;
+       int i, buf_len, ret;
 
-       if (adev->powerplay.pp_funcs->get_pp_num_states)
+       if (is_support_sw_smu(adev)) {
+               ret = smu_get_power_num_states(&adev->smu, &data);
+               if (ret)
+                       return ret;
+       } else if (adev->powerplay.pp_funcs->get_pp_num_states)
                amdgpu_dpm_get_pp_num_states(adev, &data);
 
        buf_len = snprintf(buf, PAGE_SIZE, "states: %d\n", data.nums);
index 012d2790da8a145fd907b7795f504dc420cfff42..b4d6046d5f23e2e96fc169475f4f0d51023110b8 100644 (file)
 #include "smu_v11_0.h"
 #include "atom.h"
 
+int smu_get_power_num_states(struct smu_context *smu,
+                            struct pp_states_info *state_info)
+{
+       if (!state_info)
+               return -EINVAL;
+
+       /* not support power state */
+       memset(state_info, 0, sizeof(struct pp_states_info));
+       state_info->nums = 0;
+
+       return 0;
+}
+
 int smu_common_read_sensor(struct smu_context *smu, enum amd_pp_sensors sensor,
                           void *data, uint32_t *size)
 {
index 2e89a59ed06c22ecea9041d44e466207d77eeaef..4498059f5e05fa3e2970e7baebb525cd32c4c692 100644 (file)
@@ -381,5 +381,6 @@ int smu_common_read_sensor(struct smu_context *smu, enum amd_pp_sensors sensor,
                           void *data, uint32_t *size);
 int smu_sys_get_pp_table(struct smu_context *smu, void **table);
 int smu_sys_set_pp_table(struct smu_context *smu,  void *buf, size_t size);
+int smu_get_power_num_states(struct smu_context *smu, struct pp_states_info *state_info);
 
 #endif