diff options
| author | Rex Zhu <Rex.Zhu@amd.com> | 2016-09-18 04:52:03 -0400 |
|---|---|---|
| committer | Alex Deucher <alexander.deucher@amd.com> | 2016-09-22 10:24:18 -0400 |
| commit | 465f96e21365c3df7b992692393834e984db306c (patch) | |
| tree | 8addfeccf75b8345d71b5998359c99eb77d5d07f /drivers/gpu/drm/amd/powerplay | |
| parent | 664a08bb906bd946a4c3963d5f92518e5ff19bd8 (diff) | |
drm/amd/powerplay: export function to help to set cg by smu.
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/powerplay')
| -rw-r--r-- | drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 77 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/powerplay/inc/amd_powerplay.h | 2 |
2 files changed, 5 insertions, 74 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c index 212ec2fd97ed..7174f7a68266 100644 --- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c +++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c | |||
| @@ -191,11 +191,9 @@ static int pp_sw_reset(void *handle) | |||
| 191 | } | 191 | } |
| 192 | 192 | ||
| 193 | 193 | ||
| 194 | static int pp_set_clockgating_state(void *handle, | 194 | int amd_set_clockgating_by_smu(void *handle, uint32_t msg_id) |
| 195 | enum amd_clockgating_state state) | ||
| 196 | { | 195 | { |
| 197 | struct pp_hwmgr *hwmgr; | 196 | struct pp_hwmgr *hwmgr; |
| 198 | uint32_t msg_id, pp_state; | ||
| 199 | 197 | ||
| 200 | if (handle == NULL) | 198 | if (handle == NULL) |
| 201 | return -EINVAL; | 199 | return -EINVAL; |
| @@ -209,76 +207,7 @@ static int pp_set_clockgating_state(void *handle, | |||
| 209 | return 0; | 207 | return 0; |
| 210 | } | 208 | } |
| 211 | 209 | ||
| 212 | if (state == AMD_CG_STATE_UNGATE) | 210 | return hwmgr->hwmgr_func->update_clock_gatings(hwmgr, &msg_id); |
| 213 | pp_state = 0; | ||
| 214 | else | ||
| 215 | pp_state = PP_STATE_CG | PP_STATE_LS; | ||
| 216 | |||
| 217 | /* Enable/disable GFX blocks clock gating through SMU */ | ||
| 218 | msg_id = PP_CG_MSG_ID(PP_GROUP_GFX, | ||
| 219 | PP_BLOCK_GFX_CG, | ||
| 220 | PP_STATE_SUPPORT_CG | PP_STATE_SUPPORT_LS, | ||
| 221 | pp_state); | ||
| 222 | hwmgr->hwmgr_func->update_clock_gatings(hwmgr, &msg_id); | ||
| 223 | msg_id = PP_CG_MSG_ID(PP_GROUP_GFX, | ||
| 224 | PP_BLOCK_GFX_3D, | ||
| 225 | PP_STATE_SUPPORT_CG | PP_STATE_SUPPORT_LS, | ||
| 226 | pp_state); | ||
| 227 | hwmgr->hwmgr_func->update_clock_gatings(hwmgr, &msg_id); | ||
| 228 | msg_id = PP_CG_MSG_ID(PP_GROUP_GFX, | ||
| 229 | PP_BLOCK_GFX_RLC, | ||
| 230 | PP_STATE_SUPPORT_CG | PP_STATE_SUPPORT_LS, | ||
| 231 | pp_state); | ||
| 232 | hwmgr->hwmgr_func->update_clock_gatings(hwmgr, &msg_id); | ||
| 233 | msg_id = PP_CG_MSG_ID(PP_GROUP_GFX, | ||
| 234 | PP_BLOCK_GFX_CP, | ||
| 235 | PP_STATE_SUPPORT_CG | PP_STATE_SUPPORT_LS, | ||
| 236 | pp_state); | ||
| 237 | hwmgr->hwmgr_func->update_clock_gatings(hwmgr, &msg_id); | ||
| 238 | msg_id = PP_CG_MSG_ID(PP_GROUP_GFX, | ||
| 239 | PP_BLOCK_GFX_MG, | ||
| 240 | PP_STATE_SUPPORT_CG | PP_STATE_SUPPORT_LS, | ||
| 241 | pp_state); | ||
| 242 | hwmgr->hwmgr_func->update_clock_gatings(hwmgr, &msg_id); | ||
| 243 | |||
| 244 | /* Enable/disable System blocks clock gating through SMU */ | ||
| 245 | msg_id = PP_CG_MSG_ID(PP_GROUP_SYS, | ||
| 246 | PP_BLOCK_SYS_BIF, | ||
| 247 | PP_STATE_SUPPORT_CG | PP_STATE_SUPPORT_LS, | ||
| 248 | pp_state); | ||
| 249 | hwmgr->hwmgr_func->update_clock_gatings(hwmgr, &msg_id); | ||
| 250 | msg_id = PP_CG_MSG_ID(PP_GROUP_SYS, | ||
| 251 | PP_BLOCK_SYS_BIF, | ||
| 252 | PP_STATE_SUPPORT_CG | PP_STATE_SUPPORT_LS, | ||
| 253 | pp_state); | ||
| 254 | hwmgr->hwmgr_func->update_clock_gatings(hwmgr, &msg_id); | ||
| 255 | msg_id = PP_CG_MSG_ID(PP_GROUP_SYS, | ||
| 256 | PP_BLOCK_SYS_MC, | ||
| 257 | PP_STATE_SUPPORT_CG | PP_STATE_SUPPORT_LS, | ||
| 258 | pp_state); | ||
| 259 | hwmgr->hwmgr_func->update_clock_gatings(hwmgr, &msg_id); | ||
| 260 | msg_id = PP_CG_MSG_ID(PP_GROUP_SYS, | ||
| 261 | PP_BLOCK_SYS_ROM, | ||
| 262 | PP_STATE_SUPPORT_CG | PP_STATE_SUPPORT_LS, | ||
| 263 | pp_state); | ||
| 264 | hwmgr->hwmgr_func->update_clock_gatings(hwmgr, &msg_id); | ||
| 265 | msg_id = PP_CG_MSG_ID(PP_GROUP_SYS, | ||
| 266 | PP_BLOCK_SYS_DRM, | ||
| 267 | PP_STATE_SUPPORT_CG | PP_STATE_SUPPORT_LS, | ||
| 268 | pp_state); | ||
| 269 | hwmgr->hwmgr_func->update_clock_gatings(hwmgr, &msg_id); | ||
| 270 | msg_id = PP_CG_MSG_ID(PP_GROUP_SYS, | ||
| 271 | PP_BLOCK_SYS_HDP, | ||
| 272 | PP_STATE_SUPPORT_CG | PP_STATE_SUPPORT_LS, | ||
| 273 | pp_state); | ||
| 274 | hwmgr->hwmgr_func->update_clock_gatings(hwmgr, &msg_id); | ||
| 275 | msg_id = PP_CG_MSG_ID(PP_GROUP_SYS, | ||
| 276 | PP_BLOCK_SYS_SDMA, | ||
| 277 | PP_STATE_SUPPORT_CG | PP_STATE_SUPPORT_LS, | ||
| 278 | pp_state); | ||
| 279 | hwmgr->hwmgr_func->update_clock_gatings(hwmgr, &msg_id); | ||
| 280 | |||
| 281 | return 0; | ||
| 282 | } | 211 | } |
| 283 | 212 | ||
| 284 | static int pp_set_powergating_state(void *handle, | 213 | static int pp_set_powergating_state(void *handle, |
| @@ -362,7 +291,7 @@ const struct amd_ip_funcs pp_ip_funcs = { | |||
| 362 | .is_idle = pp_is_idle, | 291 | .is_idle = pp_is_idle, |
| 363 | .wait_for_idle = pp_wait_for_idle, | 292 | .wait_for_idle = pp_wait_for_idle, |
| 364 | .soft_reset = pp_sw_reset, | 293 | .soft_reset = pp_sw_reset, |
| 365 | .set_clockgating_state = pp_set_clockgating_state, | 294 | .set_clockgating_state = NULL, |
| 366 | .set_powergating_state = pp_set_powergating_state, | 295 | .set_powergating_state = pp_set_powergating_state, |
| 367 | }; | 296 | }; |
| 368 | 297 | ||
diff --git a/drivers/gpu/drm/amd/powerplay/inc/amd_powerplay.h b/drivers/gpu/drm/amd/powerplay/inc/amd_powerplay.h index 3d74043c0e08..3fb5e57a378b 100644 --- a/drivers/gpu/drm/amd/powerplay/inc/amd_powerplay.h +++ b/drivers/gpu/drm/amd/powerplay/inc/amd_powerplay.h | |||
| @@ -390,4 +390,6 @@ int amd_powerplay_get_clock_by_type(void *handle, | |||
| 390 | int amd_powerplay_get_display_mode_validation_clocks(void *handle, | 390 | int amd_powerplay_get_display_mode_validation_clocks(void *handle, |
| 391 | struct amd_pp_simple_clock_info *output); | 391 | struct amd_pp_simple_clock_info *output); |
| 392 | 392 | ||
| 393 | int amd_set_clockgating_by_smu(void *handle, uint32_t msg_id); | ||
| 394 | |||
| 393 | #endif /* _AMD_POWERPLAY_H_ */ | 395 | #endif /* _AMD_POWERPLAY_H_ */ |
