diff options
author | Lijo Lazar <lijo.lazar@amd.com> | 2021-03-16 12:34:38 +0100 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2021-04-09 22:46:01 +0200 |
commit | 6d77dd9f75bc7fd6b984aeea48e4919523c2e3c9 (patch) | |
tree | 6b13f0f04cfe470513ad6a6460734e3d4f835d4b /drivers/gpu | |
parent | drm/amd/pm: Modify mode2 msg sequence on aldebaran (diff) | |
download | linux-6d77dd9f75bc7fd6b984aeea48e4919523c2e3c9.tar.xz linux-6d77dd9f75bc7fd6b984aeea48e4919523c2e3c9.zip |
drm/amd/pm: Add function to wait for smu events
v1: Add function to wait for specific event/states from PMFW
v2: Add mutex lock, simplify sequence
Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h | 15 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 15 |
2 files changed, 29 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h b/drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h index c823570ba7ef..65672bb46337 100644 --- a/drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h +++ b/drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h @@ -195,6 +195,11 @@ struct smu_user_dpm_profile { uint32_t clk_dependency; }; +enum smu_event_type { + + SMU_EVENT_RESET_COMPLETE = 0, +}; + #define SMU_TABLE_INIT(tables, table_id, s, a, d) \ do { \ tables[table_id].size = s; \ @@ -338,7 +343,6 @@ struct smu_power_context { struct smu_power_gate power_gate; }; - #define SMU_FEATURE_MAX (64) struct smu_feature { @@ -1167,6 +1171,12 @@ struct pptable_funcs { * @set_light_sbr: Set light sbr mode for the SMU. */ int (*set_light_sbr)(struct smu_context *smu, bool enable); + + /** + * @wait_for_event: Wait for events from SMU. + */ + int (*wait_for_event)(struct smu_context *smu, + enum smu_event_type event, uint64_t event_arg); }; typedef enum { @@ -1283,5 +1293,8 @@ int smu_gfx_state_change_set(struct smu_context *smu, uint32_t state); int smu_set_light_sbr(struct smu_context *smu, bool enable); +int smu_wait_for_event(struct amdgpu_device *adev, enum smu_event_type event, + uint64_t event_arg); + #endif #endif diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c index d4b804c7b986..4a3037ea5a90 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c @@ -2982,3 +2982,18 @@ static const struct amd_pm_funcs swsmu_pm_funcs = { .display_disable_memory_clock_switch = smu_display_disable_memory_clock_switch, .get_max_sustainable_clocks_by_dc = smu_get_max_sustainable_clocks_by_dc, }; + +int smu_wait_for_event(struct amdgpu_device *adev, enum smu_event_type event, + uint64_t event_arg) +{ + int ret = -EINVAL; + struct smu_context *smu = &adev->smu; + + if (smu->ppt_funcs->wait_for_event) { + mutex_lock(&smu->mutex); + ret = smu->ppt_funcs->wait_for_event(smu, event, event_arg); + mutex_unlock(&smu->mutex); + } + + return ret; +} |