mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 00:22:00 +02:00
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>
This commit is contained in:
parent
e42569d02a
commit
6d77dd9f75
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user