Skip to content

Commit

Permalink
audio: base_fw: add platform layer to fw_config data
Browse files Browse the repository at this point in the history
Some of the IPC4 FW_CONFIG fields are platform specific and cannot be
filled with generic code.

Handle this data by adding a call to platform_basefw_fw_config()
and add an implementation for all current platforms with IPC4
support.

Signed-off-by: Kai Vehmanen <[email protected]>
  • Loading branch information
kv2019i committed Apr 18, 2024
1 parent aab5e4e commit 7bd44a3
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/audio/base_fw.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ static int basefw_config(uint32_t *data_offset, char *data)
uint16_t version[4] = {SOF_MAJOR, SOF_MINOR, SOF_MICRO, SOF_BUILD};
struct sof_tlv *tuple = (struct sof_tlv *)data;
struct ipc4_scheduler_config sche_cfg;
uint32_t plat_data_offset = 0;
uint32_t log_bytes_size = 0;

tlv_value_set(tuple, IPC4_FW_VERSION_FW_CFG, sizeof(version), version);
Expand All @@ -71,15 +72,6 @@ static int basefw_config(uint32_t *data_offset, char *data)
IPC4_SLOW_CLOCK_FREQ_HZ_FW_CFG,
clock_get_freq(CPU_LOWEST_FREQ_IDX));

tuple = tlv_next(tuple);
tlv_value_uint32_set(tuple, IPC4_SLOW_CLOCK_FREQ_HZ_FW_CFG, IPC4_ALH_CAVS_1_8);

tuple = tlv_next(tuple);
tlv_value_uint32_set(tuple, IPC4_UAOL_SUPPORT, 0);

tuple = tlv_next(tuple);
tlv_value_uint32_set(tuple, IPC4_ALH_SUPPORT_LEVEL_FW_CFG, IPC4_ALH_CAVS_1_8);

tuple = tlv_next(tuple);
tlv_value_uint32_set(tuple, IPC4_DL_MAILBOX_BYTES_FW_CFG, MAILBOX_HOSTBOX_SIZE);

Expand Down Expand Up @@ -134,7 +126,11 @@ static int basefw_config(uint32_t *data_offset, char *data)
IS_ENABLED(CONFIG_ADSP_IMR_CONTEXT_SAVE));

tuple = tlv_next(tuple);
*data_offset = (int)((char *)tuple - data);

/* add platform specific tuples */
platform_basefw_fw_config(&plat_data_offset, (char *)tuple);

*data_offset = (int)((char *)tuple - data) + plat_data_offset;

return 0;
}
Expand Down
9 changes: 9 additions & 0 deletions src/include/ipc4/base_fw_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@
#ifndef __SOF_IPC4_BASE_FW_PLATFORM_H__
#define __SOF_IPC4_BASE_FW_PLATFORM_H__

/**
* \brief Platform specific routine to add data tuples to FW_CONFIG
* structure sent to host via IPC.
* \param[out] data_offset data offset after tuples added
* \param[in] data pointer where to add new entries
* \return 0 if successful, error code otherwise.
*/
int platform_basefw_fw_config(uint32_t *data_offset, char *data);

/**
* \brief Platform specific routine to add data tuples to HW_CONFIG
* structure sent to host via IPC.
Expand Down
18 changes: 18 additions & 0 deletions src/platform/intel/ace/lib/base_fw_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,24 @@
#include <sof/lib/dai.h>
#include <ipc4/base_fw.h>

int platform_basefw_fw_config(uint32_t *data_offset, char *data)
{
struct sof_tlv *tuple = (struct sof_tlv *)data;

tlv_value_uint32_set(tuple, IPC4_SLOW_CLOCK_FREQ_HZ_FW_CFG, IPC4_ALH_CAVS_1_8);

tuple = tlv_next(tuple);
tlv_value_uint32_set(tuple, IPC4_UAOL_SUPPORT, 0);

tuple = tlv_next(tuple);
tlv_value_uint32_set(tuple, IPC4_ALH_SUPPORT_LEVEL_FW_CFG, IPC4_ALH_CAVS_1_8);

tuple = tlv_next(tuple);
*data_offset = (int)((char *)tuple - data);

return 0;
}

int platform_basefw_hw_config(uint32_t *data_offset, char *data)
{
struct sof_tlv *tuple = (struct sof_tlv *)data;
Expand Down
7 changes: 7 additions & 0 deletions src/platform/posix/base_fw_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
#include <stdint.h>
#include <ipc4/base_fw_platform.h>

int platform_basefw_fw_config(uint32_t *data_offset, char *data)
{
*data_offset = 0;

return 0;
}

int platform_basefw_hw_config(uint32_t *data_offset, char *data)
{
*data_offset = 0;
Expand Down

0 comments on commit 7bd44a3

Please sign in to comment.