Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Lijo Lazar and committed by
Alex Deucher
6d77dd9f e42569d0

+29 -1
+14 -1
drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h
··· 195 195 uint32_t clk_dependency; 196 196 }; 197 197 198 + enum smu_event_type { 199 + 200 + SMU_EVENT_RESET_COMPLETE = 0, 201 + }; 202 + 198 203 #define SMU_TABLE_INIT(tables, table_id, s, a, d) \ 199 204 do { \ 200 205 tables[table_id].size = s; \ ··· 342 337 uint32_t power_context_size; 343 338 struct smu_power_gate power_gate; 344 339 }; 345 - 346 340 347 341 #define SMU_FEATURE_MAX (64) 348 342 struct smu_feature ··· 1171 1167 * @set_light_sbr: Set light sbr mode for the SMU. 1172 1168 */ 1173 1169 int (*set_light_sbr)(struct smu_context *smu, bool enable); 1170 + 1171 + /** 1172 + * @wait_for_event: Wait for events from SMU. 1173 + */ 1174 + int (*wait_for_event)(struct smu_context *smu, 1175 + enum smu_event_type event, uint64_t event_arg); 1174 1176 }; 1175 1177 1176 1178 typedef enum { ··· 1292 1282 int smu_gfx_state_change_set(struct smu_context *smu, uint32_t state); 1293 1283 1294 1284 int smu_set_light_sbr(struct smu_context *smu, bool enable); 1285 + 1286 + int smu_wait_for_event(struct amdgpu_device *adev, enum smu_event_type event, 1287 + uint64_t event_arg); 1295 1288 1296 1289 #endif 1297 1290 #endif
+15
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
··· 2982 2982 .display_disable_memory_clock_switch = smu_display_disable_memory_clock_switch, 2983 2983 .get_max_sustainable_clocks_by_dc = smu_get_max_sustainable_clocks_by_dc, 2984 2984 }; 2985 + 2986 + int smu_wait_for_event(struct amdgpu_device *adev, enum smu_event_type event, 2987 + uint64_t event_arg) 2988 + { 2989 + int ret = -EINVAL; 2990 + struct smu_context *smu = &adev->smu; 2991 + 2992 + if (smu->ppt_funcs->wait_for_event) { 2993 + mutex_lock(&smu->mutex); 2994 + ret = smu->ppt_funcs->wait_for_event(smu, event, event_arg); 2995 + mutex_unlock(&smu->mutex); 2996 + } 2997 + 2998 + return ret; 2999 + }