diff options
author | Rex Zhu <Rex.Zhu@amd.com> | 2015-09-23 15:14:54 +0800 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2015-12-21 16:42:11 -0500 |
commit | e92a0370575ab985bcdc3ba1520bf946521d62f1 (patch) | |
tree | 807566ae714c604c5ca6ba3f3f97d50ee2778b6e /drivers/gpu/drm/amd/powerplay/amd_powerplay.c | |
parent | 28a18bab2ed6e143a4671fec12ff3feeb0dc205e (diff) | |
download | blackbird-obmc-linux-e92a0370575ab985bcdc3ba1520bf946521d62f1.tar.gz blackbird-obmc-linux-e92a0370575ab985bcdc3ba1520bf946521d62f1.zip |
drm/amd/powerplay: add event manager sub-component
The event manager handles power related driver events.
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/powerplay/amd_powerplay.c')
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c index 88fdb04eebb9..1964a2add63f 100644 --- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c +++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c @@ -52,6 +52,7 @@ static int pp_sw_init(void *handle) return -EINVAL; ret = hwmgr->pptable_func->pptable_init(hwmgr); + if (ret == 0) ret = hwmgr->hwmgr_func->backend_init(hwmgr); @@ -81,6 +82,7 @@ static int pp_hw_init(void *handle) { struct pp_instance *pp_handle; struct pp_smumgr *smumgr; + struct pp_eventmgr *eventmgr; int ret = 0; if (handle == NULL) @@ -106,8 +108,14 @@ static int pp_hw_init(void *handle) smumgr->smumgr_funcs->smu_fini(smumgr); return ret; } + hw_init_power_state_table(pp_handle->hwmgr); + eventmgr = pp_handle->eventmgr; + if (eventmgr == NULL || eventmgr->pp_eventmgr_init == NULL) + return -EINVAL; + + ret = eventmgr->pp_eventmgr_init(eventmgr); return 0; } @@ -115,11 +123,17 @@ static int pp_hw_fini(void *handle) { struct pp_instance *pp_handle; struct pp_smumgr *smumgr; + struct pp_eventmgr *eventmgr; if (handle == NULL) return -EINVAL; pp_handle = (struct pp_instance *)handle; + eventmgr = pp_handle->eventmgr; + + if (eventmgr != NULL || eventmgr->pp_eventmgr_fini != NULL) + eventmgr->pp_eventmgr_fini(eventmgr); + smumgr = pp_handle->smu_mgr; if (smumgr != NULL || smumgr->smumgr_funcs != NULL || @@ -273,9 +287,15 @@ static int amd_pp_instance_init(struct amd_pp_init *pp_init, if (ret) goto fail_hwmgr; + ret = eventmgr_init(handle); + if (ret) + goto fail_eventmgr; + amd_pp->pp_handle = handle; return 0; +fail_eventmgr: + hwmgr_fini(handle->hwmgr); fail_hwmgr: smum_fini(handle->smu_mgr); fail_smum: @@ -286,9 +306,12 @@ fail_smum: static int amd_pp_instance_fini(void *handle) { struct pp_instance *instance = (struct pp_instance *)handle; + if (instance == NULL) return -EINVAL; + eventmgr_fini(instance->eventmgr); + hwmgr_fini(instance->hwmgr); smum_fini(instance->smu_mgr); |