diff options
author | Rex Zhu <Rex.Zhu@amd.com> | 2018-02-26 14:58:49 +0300 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-03-05 23:38:12 +0300 |
commit | a2c120ce6b686c753968b7b1293c7bb878440b7f (patch) | |
tree | 27496184a1031ad542f7cc3f19f1fbfb6932b500 /drivers/gpu/drm/amd/powerplay/amd_powerplay.c | |
parent | 2eeb3a839954616d6faa024da69d2990374995f0 (diff) | |
download | linux-a2c120ce6b686c753968b7b1293c7bb878440b7f.tar.xz |
drm/amd/pp: Simplify the create of powerplay instance
use adev as input parameter to create powerplay instance
directly. delete cgs wrap layer for power play create.
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/powerplay/amd_powerplay.c')
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c index 376ed2dd52c7..4e87cfc129b4 100644 --- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c +++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c @@ -29,6 +29,7 @@ #include "amd_powerplay.h" #include "pp_instance.h" #include "power_state.h" +#include "amdgpu.h" #define PP_DPM_DISABLED 0xCCCC @@ -52,28 +53,30 @@ static inline int pp_check(struct pp_instance *handle) return 0; } -static int amd_powerplay_create(struct amd_pp_init *pp_init, - void **handle) +static int amd_powerplay_create(struct amdgpu_device *adev) { struct pp_instance *instance; - if (pp_init == NULL || handle == NULL) + if (adev == NULL) return -EINVAL; instance = kzalloc(sizeof(struct pp_instance), GFP_KERNEL); if (instance == NULL) return -ENOMEM; - instance->chip_family = pp_init->chip_family; - instance->chip_id = pp_init->chip_id; - instance->pm_en = pp_init->pm_en; - instance->feature_mask = pp_init->feature_mask; - instance->device = pp_init->device; + instance->chip_family = adev->family; + instance->chip_id = adev->asic_type; + instance->pm_en = (amdgpu_dpm != 0 && !amdgpu_sriov_vf(adev)) ? true : false; + instance->feature_mask = amdgpu_pp_feature_mask; + instance->device = adev->powerplay.cgs_device; mutex_init(&instance->pp_lock); - *handle = instance; + + adev->powerplay.pp_handle = instance; + return 0; } + static int amd_powerplay_destroy(void *handle) { struct pp_instance *instance = (struct pp_instance *)handle; @@ -93,11 +96,14 @@ static int pp_early_init(void *handle) { int ret; struct pp_instance *pp_handle = NULL; + struct amdgpu_device *adev = (struct amdgpu_device *)handle; - pp_handle = cgs_register_pp_handle(handle, amd_powerplay_create); + ret = amd_powerplay_create(adev); - if (!pp_handle) - return -EINVAL; + if (ret != 0) + return ret; + + pp_handle = adev->powerplay.pp_handle; ret = hwmgr_early_init(pp_handle); if (ret) |