Commit 6d77dd9f authored by Lijo Lazar's avatar Lijo Lazar Committed by Alex Deucher

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: default avatarLijo Lazar <lijo.lazar@amd.com>
Reviewed-by: default avatarFeifei Xu <Feifei.Xu@amd.com>
Reviewed-by: default avatarHawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent e42569d0
......@@ -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
......@@ -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;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment