From b3b9abffe7ee85bf0884d392d3d243161efadbbe Mon Sep 17 00:00:00 2001 From: Fabiola Kwasowiec Date: Fri, 1 Dec 2023 16:57:18 +0100 Subject: [PATCH] base_fw: add DMI_FORCE_L1_EXIT FW config Add new parameter for SW to force DMI L1 exit on IPC request. Signed-off-by: Fabiola Kwasowiec --- src/audio/base_fw.c | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/src/audio/base_fw.c b/src/audio/base_fw.c index dc2d282be..dfff3ee98 100644 --- a/src/audio/base_fw.c +++ b/src/audio/base_fw.c @@ -13,6 +13,9 @@ #include #include #include +#if defined(CONFIG_SOC_SERIES_INTEL_ACE) +#include +#endif #if CONFIG_ACE_V1X_ART_COUNTER || CONFIG_ACE_V1X_RTC_COUNTER #include @@ -391,6 +394,42 @@ static int basefw_power_state_info_get(uint32_t *data_offset, char *data) return 0; } +static int fw_config_set_force_l1_exit(const struct sof_tlv *tlv) +{ +#if defined(CONFIG_SOC_SERIES_INTEL_ACE) + const uint32_t force = tlv->value[0]; + + if (force) { + tr_info(&basefw_comp_tr, "FW config set force dmi l0 state"); + intel_adsp_force_dmi_l0_state(); + } else { + tr_info(&basefw_comp_tr, "FW config set allow dmi l1 state"); + intel_adsp_allow_dmi_l1_state(); + } + + return 0; +#else + return IPC4_UNAVAILABLE; +#endif +} + +static int basefw_set_fw_config(bool first_block, + bool last_block, + uint32_t data_offset, + const char *data) +{ + const struct sof_tlv *tlv = (const struct sof_tlv *)data; + + switch (tlv->type) { + case IPC4_DMI_FORCE_L1_EXIT: + return fw_config_set_force_l1_exit(tlv); + default: + break; + } + tr_warn(&basefw_comp_tr, "returning success for Set FW_CONFIG without handling it"); + return 0; +} + static int basefw_get_large_config(struct comp_dev *dev, uint32_t param_id, bool first_block, @@ -457,8 +496,7 @@ static int basefw_set_large_config(struct comp_dev *dev, { switch (param_id) { case IPC4_FW_CONFIG: - tr_warn(&basefw_comp_tr, "returning success for Set FW_CONFIG without handling it"); - return 0; + return basefw_set_fw_config(first_block, last_block, data_offset, data); case IPC4_SYSTEM_TIME: return basefw_set_system_time(param_id, first_block, last_block, data_offset, data);