|
19 | 19 | #include <sof/audio/module_adapter/module/generic.h> |
20 | 20 | #include <sof/schedule/dp_schedule.h> |
21 | 21 | #include <sof/schedule/ll_schedule.h> |
22 | | -#include "adsp_debug_window.h" |
| 22 | +#include <sof/debug/telemetry/telemetry.h> |
| 23 | +/* FIXME: |
| 24 | + * Builds for some platforms like tgl fail because their defines related to memory windows are |
| 25 | + * already defined somewhere else. Remove this ifdef after it's cleaned up |
| 26 | + */ |
| 27 | +#ifdef CONFIG_SOF_TELEMETRY |
23 | 28 | #include "mem_window.h" |
| 29 | +#include "adsp_debug_window.h" |
| 30 | +#endif |
24 | 31 |
|
25 | 32 | #if CONFIG_ACE_V1X_ART_COUNTER || CONFIG_ACE_V1X_RTC_COUNTER |
26 | 33 | #include <zephyr/device.h> |
@@ -497,6 +504,33 @@ int schedulers_info_get(uint32_t *data_off_size, |
497 | 504 | return 0; |
498 | 505 | } |
499 | 506 |
|
| 507 | +int set_perf_meas_state(const char *data) |
| 508 | +{ |
| 509 | +#ifdef CONFIG_SOF_TELEMETRY |
| 510 | + enum ipc4_perf_measurements_state_set state = *data; |
| 511 | + |
| 512 | + struct telemetry_wnd_data *wnd_data = |
| 513 | + (struct telemetry_wnd_data *)ADSP_DW->slots[SOF_DW_TELEMETRY_SLOT]; |
| 514 | + struct system_tick_info *systick_info = |
| 515 | + (struct system_tick_info *)wnd_data->system_tick_info; |
| 516 | + |
| 517 | + switch (state) { |
| 518 | + case IPC4_PERF_MEASUREMENTS_DISABLED: |
| 519 | + break; |
| 520 | + case IPC4_PERF_MEASUREMENTS_STOPPED: |
| 521 | + for (int i = 0; i < CONFIG_MAX_CORE_COUNT; i++) |
| 522 | + systick_info[i].peak_utilization = 0; |
| 523 | + break; |
| 524 | + case IPC4_PERF_MEASUREMENTS_STARTED: |
| 525 | + case IPC4_PERF_MEASUREMENTS_PAUSED: |
| 526 | + break; |
| 527 | + default: |
| 528 | + return -EINVAL; |
| 529 | + } |
| 530 | +#endif |
| 531 | + return IPC4_SUCCESS; |
| 532 | +} |
| 533 | + |
500 | 534 | static int basefw_get_large_config(struct comp_dev *dev, |
501 | 535 | uint32_t param_id, |
502 | 536 | bool first_block, |
@@ -572,7 +606,7 @@ static int basefw_set_large_config(struct comp_dev *dev, |
572 | 606 | case IPC4_FW_CONFIG: |
573 | 607 | return basefw_set_fw_config(first_block, last_block, data_offset, data); |
574 | 608 | case IPC4_PERF_MEASUREMENTS_STATE: |
575 | | - return 0; |
| 609 | + return set_perf_meas_state(data); |
576 | 610 | case IPC4_SYSTEM_TIME: |
577 | 611 | return basefw_set_system_time(param_id, first_block, |
578 | 612 | last_block, data_offset, data); |
|
0 commit comments