diff options
author | Rex Zhu <Rex.Zhu@amd.com> | 2017-09-25 08:46:37 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-09-28 16:03:34 -0400 |
commit | 139a285f8124577ed816f63d9e950b01dfaa5401 (patch) | |
tree | 18c0834f954917e089dfedf9bf9d988b6137e640 /drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c | |
parent | ba89a3ec61bde7d37225edf01f9e3c0c81de7f0f (diff) |
drm/amdgpu: create powerplay by cgs interface
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c | 30 |
1 files changed, 3 insertions, 27 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c index eb886654ce44..1649b1e3f23d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c | |||
@@ -34,24 +34,6 @@ | |||
34 | #include "cik_dpm.h" | 34 | #include "cik_dpm.h" |
35 | #include "vi_dpm.h" | 35 | #include "vi_dpm.h" |
36 | 36 | ||
37 | static int amdgpu_create_pp_handle(struct amdgpu_device *adev) | ||
38 | { | ||
39 | struct amd_pp_init pp_init; | ||
40 | struct amd_powerplay *amd_pp; | ||
41 | int ret; | ||
42 | |||
43 | amd_pp = &(adev->powerplay); | ||
44 | pp_init.chip_family = adev->family; | ||
45 | pp_init.chip_id = adev->asic_type; | ||
46 | pp_init.pm_en = (amdgpu_dpm != 0 && !amdgpu_sriov_vf(adev)) ? true : false; | ||
47 | pp_init.feature_mask = amdgpu_pp_feature_mask; | ||
48 | pp_init.device = amd_pp->cgs_device; | ||
49 | ret = amd_powerplay_create(&pp_init, &(amd_pp->pp_handle)); | ||
50 | if (ret) | ||
51 | return -EINVAL; | ||
52 | return 0; | ||
53 | } | ||
54 | |||
55 | static int amdgpu_pp_early_init(void *handle) | 37 | static int amdgpu_pp_early_init(void *handle) |
56 | { | 38 | { |
57 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | 39 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
@@ -73,8 +55,6 @@ static int amdgpu_pp_early_init(void *handle) | |||
73 | case CHIP_VEGA10: | 55 | case CHIP_VEGA10: |
74 | case CHIP_RAVEN: | 56 | case CHIP_RAVEN: |
75 | amd_pp->cgs_device = amdgpu_cgs_create_device(adev); | 57 | amd_pp->cgs_device = amdgpu_cgs_create_device(adev); |
76 | if (amdgpu_create_pp_handle(adev)) | ||
77 | return -EINVAL; | ||
78 | amd_pp->ip_funcs = &pp_ip_funcs; | 58 | amd_pp->ip_funcs = &pp_ip_funcs; |
79 | amd_pp->pp_funcs = &pp_dpm_funcs; | 59 | amd_pp->pp_funcs = &pp_dpm_funcs; |
80 | break; | 60 | break; |
@@ -97,8 +77,6 @@ static int amdgpu_pp_early_init(void *handle) | |||
97 | amd_pp->pp_funcs = &ci_dpm_funcs; | 77 | amd_pp->pp_funcs = &ci_dpm_funcs; |
98 | } else { | 78 | } else { |
99 | amd_pp->cgs_device = amdgpu_cgs_create_device(adev); | 79 | amd_pp->cgs_device = amdgpu_cgs_create_device(adev); |
100 | if (amdgpu_create_pp_handle(adev)) | ||
101 | return -EINVAL; | ||
102 | amd_pp->ip_funcs = &pp_ip_funcs; | 80 | amd_pp->ip_funcs = &pp_ip_funcs; |
103 | amd_pp->pp_funcs = &pp_dpm_funcs; | 81 | amd_pp->pp_funcs = &pp_dpm_funcs; |
104 | } | 82 | } |
@@ -117,7 +95,8 @@ static int amdgpu_pp_early_init(void *handle) | |||
117 | 95 | ||
118 | if (adev->powerplay.ip_funcs->early_init) | 96 | if (adev->powerplay.ip_funcs->early_init) |
119 | ret = adev->powerplay.ip_funcs->early_init( | 97 | ret = adev->powerplay.ip_funcs->early_init( |
120 | adev->powerplay.pp_handle); | 98 | amd_pp->cgs_device ? amd_pp->cgs_device : |
99 | amd_pp->pp_handle); | ||
121 | 100 | ||
122 | if (ret == PP_DPM_DISABLED) { | 101 | if (ret == PP_DPM_DISABLED) { |
123 | adev->pm.dpm_enabled = false; | 102 | adev->pm.dpm_enabled = false; |
@@ -206,11 +185,8 @@ static void amdgpu_pp_late_fini(void *handle) | |||
206 | adev->powerplay.ip_funcs->late_fini( | 185 | adev->powerplay.ip_funcs->late_fini( |
207 | adev->powerplay.pp_handle); | 186 | adev->powerplay.pp_handle); |
208 | 187 | ||
209 | 188 | if (adev->powerplay.cgs_device) | |
210 | if (adev->powerplay.cgs_device) { | ||
211 | amd_powerplay_destroy(adev->powerplay.pp_handle); | ||
212 | amdgpu_cgs_destroy_device(adev->powerplay.cgs_device); | 189 | amdgpu_cgs_destroy_device(adev->powerplay.cgs_device); |
213 | } | ||
214 | } | 190 | } |
215 | 191 | ||
216 | static int amdgpu_pp_suspend(void *handle) | 192 | static int amdgpu_pp_suspend(void *handle) |