diff options
author | Rex Zhu <Rex.Zhu@amd.com> | 2018-02-27 01:09:40 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-03-05 15:38:20 -0500 |
commit | 65ad7cac3866f5fa80dcef3e5048a839046d6a46 (patch) | |
tree | 1e5e50ed45d949c0d7dd2966bee06fdad681695d /drivers/gpu | |
parent | a2c120ce6b686c753968b7b1293c7bb878440b7f (diff) |
drm/amd/pp: Refine powerplay instance
Include adev in powerplay instance.
so can visit adev directly instand of through 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')
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c | 7 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/inc/pp_instance.h | 8 |
4 files changed, 10 insertions, 12 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c index 4e87cfc129b4..20ac0fc12483 100644 --- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c +++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include "pp_instance.h" | 30 | #include "pp_instance.h" |
31 | #include "power_state.h" | 31 | #include "power_state.h" |
32 | #include "amdgpu.h" | 32 | #include "amdgpu.h" |
33 | #include "hwmgr.h" | ||
33 | 34 | ||
34 | #define PP_DPM_DISABLED 0xCCCC | 35 | #define PP_DPM_DISABLED 0xCCCC |
35 | 36 | ||
@@ -64,13 +65,10 @@ static int amd_powerplay_create(struct amdgpu_device *adev) | |||
64 | if (instance == NULL) | 65 | if (instance == NULL) |
65 | return -ENOMEM; | 66 | return -ENOMEM; |
66 | 67 | ||
67 | instance->chip_family = adev->family; | 68 | instance->parent = adev; |
68 | instance->chip_id = adev->asic_type; | ||
69 | instance->pm_en = (amdgpu_dpm != 0 && !amdgpu_sriov_vf(adev)) ? true : false; | 69 | instance->pm_en = (amdgpu_dpm != 0 && !amdgpu_sriov_vf(adev)) ? true : false; |
70 | instance->feature_mask = amdgpu_pp_feature_mask; | ||
71 | instance->device = adev->powerplay.cgs_device; | 70 | instance->device = adev->powerplay.cgs_device; |
72 | mutex_init(&instance->pp_lock); | 71 | mutex_init(&instance->pp_lock); |
73 | |||
74 | adev->powerplay.pp_handle = instance; | 72 | adev->powerplay.pp_handle = instance; |
75 | 73 | ||
76 | return 0; | 74 | return 0; |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c index 33eabc18211d..7e1bd1144f5d 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c | |||
@@ -146,10 +146,11 @@ int hwmgr_early_init(struct pp_instance *handle) | |||
146 | return -ENOMEM; | 146 | return -ENOMEM; |
147 | 147 | ||
148 | handle->hwmgr = hwmgr; | 148 | handle->hwmgr = hwmgr; |
149 | hwmgr->adev = handle->parent; | ||
149 | hwmgr->device = handle->device; | 150 | hwmgr->device = handle->device; |
150 | hwmgr->chip_family = handle->chip_family; | 151 | hwmgr->chip_family = ((struct amdgpu_device *)handle->parent)->family; |
151 | hwmgr->chip_id = handle->chip_id; | 152 | hwmgr->chip_id = ((struct amdgpu_device *)handle->parent)->asic_type; |
152 | hwmgr->feature_mask = handle->feature_mask; | 153 | hwmgr->feature_mask = amdgpu_pp_feature_mask; |
153 | hwmgr->usec_timeout = AMD_MAX_USEC_TIMEOUT; | 154 | hwmgr->usec_timeout = AMD_MAX_USEC_TIMEOUT; |
154 | hwmgr->power_source = PP_PowerSource_AC; | 155 | hwmgr->power_source = PP_PowerSource_AC; |
155 | hwmgr->pp_table_version = PP_TABLE_V1; | 156 | hwmgr->pp_table_version = PP_TABLE_V1; |
diff --git a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h index 77d7f49564c4..bb50cc2b4af1 100644 --- a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +++ b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | |||
@@ -700,6 +700,7 @@ enum PP_TABLE_VERSION { | |||
700 | * The main hardware manager structure. | 700 | * The main hardware manager structure. |
701 | */ | 701 | */ |
702 | struct pp_hwmgr { | 702 | struct pp_hwmgr { |
703 | void *adev; | ||
703 | uint32_t chip_family; | 704 | uint32_t chip_family; |
704 | uint32_t chip_id; | 705 | uint32_t chip_id; |
705 | uint32_t smu_version; | 706 | uint32_t smu_version; |
diff --git a/drivers/gpu/drm/amd/powerplay/inc/pp_instance.h b/drivers/gpu/drm/amd/powerplay/inc/pp_instance.h index 7d1eec5d2e7a..6c2fa33bd63a 100644 --- a/drivers/gpu/drm/amd/powerplay/inc/pp_instance.h +++ b/drivers/gpu/drm/amd/powerplay/inc/pp_instance.h | |||
@@ -23,14 +23,12 @@ | |||
23 | #ifndef _PP_INSTANCE_H_ | 23 | #ifndef _PP_INSTANCE_H_ |
24 | #define _PP_INSTANCE_H_ | 24 | #define _PP_INSTANCE_H_ |
25 | 25 | ||
26 | #include "hwmgr.h" | 26 | struct pp_hwmgr; |
27 | 27 | ||
28 | struct pp_instance { | 28 | struct pp_instance { |
29 | uint32_t chip_family; | 29 | void *parent; /* e.g. amdgpu_device */ |
30 | uint32_t chip_id; | 30 | void *device; /* e.g. cgs_device */ |
31 | bool pm_en; | 31 | bool pm_en; |
32 | uint32_t feature_mask; | ||
33 | void *device; | ||
34 | struct pp_hwmgr *hwmgr; | 32 | struct pp_hwmgr *hwmgr; |
35 | struct mutex pp_lock; | 33 | struct mutex pp_lock; |
36 | }; | 34 | }; |