summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
diff options
context:
space:
mode:
authorKevin Wang <Kevin1.Wang@amd.com>2019-01-17 13:15:48 +0800
committerAlex Deucher <alexander.deucher@amd.com>2019-03-19 15:03:58 -0500
commit0989532330e1e7d25693c14b3d57288aa4915f81 (patch)
tree34002bb1560b8bcea5af25b91d130970b59d6d4c /drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
parent143c75d6514dd65ba49d3846a5a02c45a4b7f15b (diff)
downloadlinux-stable-0989532330e1e7d25693c14b3d57288aa4915f81.tar.gz
linux-stable-0989532330e1e7d25693c14b3d57288aa4915f81.tar.bz2
linux-stable-0989532330e1e7d25693c14b3d57288aa4915f81.zip
drm/amd/powerplay: implement sysfs of get num states function
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>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
index 53b470c30da4..5eda007ea632 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -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);