Skip to content

Commit e70bee7

Browse files
committed
base_fw: Extend fw_config with information about the host buffer size
The host buffer default or minimum size can be platform dependent and it is not know by the host. It is in sole discretion of the firmware and the hardware where it is running and can be changed by recompiling the firmware. Add new tlv item to fw_config with ID 33 and store the host DMA default period size, which is the indication of the default, minimum size of the host buffer in ms. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
1 parent 46e12d7 commit e70bee7

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/audio/base_fw.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,25 @@ DECLARE_TR_CTX(basefw_comp_tr, SOF_UUID(basefw_uuid), LOG_LEVEL_INFO);
4444
static struct ipc4_system_time_info global_system_time_info;
4545
static uint64_t global_cycle_delta;
4646

47+
__cold static uint32_t get_host_buffer_size(void)
48+
{
49+
struct sof_dma *dma_host;
50+
uint32_t periods;
51+
52+
dma_host = sof_dma_get(SOF_DMA_DIR_HMEM_TO_LMEM, 0, SOF_DMA_DEV_HOST,
53+
SOF_DMA_ACCESS_SHARED);
54+
if (!dma_host) {
55+
LOG_WRN("Failed to get host DMA channel");
56+
return 0;
57+
}
58+
59+
periods = dma_host->plat_data.period_count;
60+
61+
sof_dma_put(dma_host);
62+
63+
return periods;
64+
}
65+
4766
__cold static int basefw_config(uint32_t *data_offset, char *data)
4867
{
4968
uint16_t version[4] = {SOF_MAJOR, SOF_MINOR, SOF_MICRO, SOF_BUILD};
@@ -124,6 +143,11 @@ __cold static int basefw_config(uint32_t *data_offset, char *data)
124143

125144
tuple = tlv_next(tuple);
126145

146+
tlv_value_uint32_set(tuple, IPC4_FW_MIN_HOST_BUFFER_PERIODS,
147+
get_host_buffer_size());
148+
149+
tuple = tlv_next(tuple);
150+
127151
/* add platform specific tuples */
128152
basefw_vendor_fw_config(&plat_data_offset, (char *)tuple);
129153

src/include/ipc4/base_fw.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,8 @@ enum ipc4_fw_config_params {
373373
IPC4_DMI_FORCE_L1_EXIT = 28,
374374
/* FW context save on D3 entry */
375375
IPC4_FW_CONTEXT_SAVE = 29,
376+
/* Minimum size of host buffer in ms */
377+
IPC4_FW_MIN_HOST_BUFFER_PERIODS = 33,
376378
/* Total number of FW config parameters */
377379
IPC4_FW_CFG_PARAMS_COUNT,
378380
/* Max config parameter id */

0 commit comments

Comments
 (0)