1 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
3 * This file is provided under a dual BSD/GPLv2 license. When using or
4 * redistributing this file, you may do so under either license.
6 * Copyright(c) 2022 Intel Corporation. All rights reserved.
9 #ifndef __INCLUDE_SOUND_SOF_IPC4_TOPOLOGY_H__
10 #define __INCLUDE_SOUND_SOF_IPC4_TOPOLOGY_H__
12 #include <sound/sof/ipc4/header.h>
14 #define SOF_IPC4_FW_PAGE_SIZE BIT(12)
15 #define SOF_IPC4_FW_PAGE(x) ((((x) + BIT(12) - 1) & ~(BIT(12) - 1)) >> 12)
16 #define SOF_IPC4_FW_ROUNDUP(x) (((x) + BIT(6) - 1) & (~(BIT(6) - 1)))
18 #define SOF_IPC4_MODULE_LOAD_TYPE GENMASK(3, 0)
19 #define SOF_IPC4_MODULE_AUTO_START BIT(4)
21 * Two module schedule domains in fw :
22 * LL domain - Low latency domain
23 * DP domain - Data processing domain
24 * The LL setting should be equal to !DP setting
26 #define SOF_IPC4_MODULE_LL BIT(5)
27 #define SOF_IPC4_MODULE_DP BIT(6)
28 #define SOF_IPC4_MODULE_LIB_CODE BIT(7)
30 #define SOF_IPC4_MODULE_INSTANCE_LIST_ITEM_SIZE 12
31 #define SOF_IPC4_PIPELINE_OBJECT_SIZE 448
32 #define SOF_IPC4_DATA_QUEUE_OBJECT_SIZE 128
33 #define SOF_IPC4_LL_TASK_OBJECT_SIZE 72
34 #define SOF_IPC4_DP_TASK_OBJECT_SIZE 104
35 #define SOF_IPC4_DP_TASK_LIST_SIZE (12 + 8)
36 #define SOF_IPC4_LL_TASK_LIST_ITEM_SIZE 12
37 #define SOF_IPC4_FW_MAX_PAGE_COUNT 20
38 #define SOF_IPC4_FW_MAX_QUEUE_COUNT 8
40 /* Node index and mask applicable for host copier and ALH/HDA type DAI copiers */
41 #define SOF_IPC4_NODE_INDEX_MASK 0xFF
42 #define SOF_IPC4_NODE_INDEX(x) ((x) & SOF_IPC4_NODE_INDEX_MASK)
43 #define SOF_IPC4_NODE_TYPE(x) ((x) << 8)
45 /* Node ID for SSP type DAI copiers */
46 #define SOF_IPC4_NODE_INDEX_INTEL_SSP(x) (((x) & 0xf) << 4)
48 /* Node ID for DMIC type DAI copiers */
49 #define SOF_IPC4_NODE_INDEX_INTEL_DMIC(x) (((x) & 0x7) << 5)
51 #define SOF_IPC4_GAIN_ALL_CHANNELS_MASK 0xffffffff
52 #define SOF_IPC4_VOL_ZERO_DB 0x7fffffff
54 #define ALH_MAX_NUMBER_OF_GTW 16
57 * The base of multi-gateways. Multi-gateways addressing starts from
58 * ALH_MULTI_GTW_BASE and there are ALH_MULTI_GTW_COUNT multi-sources
59 * and ALH_MULTI_GTW_COUNT multi-sinks available.
60 * Addressing is continuous from ALH_MULTI_GTW_BASE to
61 * ALH_MULTI_GTW_BASE + ALH_MULTI_GTW_COUNT - 1.
63 #define ALH_MULTI_GTW_BASE 0x50
64 /* A magic number from FW */
65 #define ALH_MULTI_GTW_COUNT 8
68 * struct sof_ipc4_pipeline - pipeline config data
69 * @priority: Priority of this pipeline
70 * @lp_mode: Low power mode
71 * @mem_usage: Memory usage
72 * @state: Pipeline state
73 * @msg: message structure for pipeline
75 struct sof_ipc4_pipeline {
80 struct sof_ipc4_msg msg;
84 * struct sof_ipc4_available_audio_format - Available audio formats
85 * @base_config: Available base config
86 * @out_audio_fmt: Available output audio format
87 * @ref_audio_fmt: Reference audio format to match runtime audio format
88 * @dma_buffer_size: Available Gateway DMA buffer size (in bytes)
89 * @audio_fmt_num: Number of available audio formats
91 struct sof_ipc4_available_audio_format {
92 struct sof_ipc4_base_module_cfg *base_config;
93 struct sof_ipc4_audio_format *out_audio_fmt;
94 struct sof_ipc4_audio_format *ref_audio_fmt;
100 * struct sof_copier_gateway_cfg - IPC gateway configuration
101 * @node_id: ID of Gateway Node
102 * @dma_buffer_size: Preferred Gateway DMA buffer size (in bytes)
103 * @config_length: Length of gateway node configuration blob specified in #config_data
104 * config_data: Gateway node configuration blob
106 struct sof_copier_gateway_cfg {
108 uint32_t dma_buffer_size;
109 uint32_t config_length;
110 uint32_t config_data[];
114 * struct sof_ipc4_copier_data - IPC data for copier
115 * @base_config: Base configuration including input audio format
116 * @out_format: Output audio format
117 * @copier_feature_mask: Copier feature mask
118 * @gtw_cfg: Gateway configuration
120 struct sof_ipc4_copier_data {
121 struct sof_ipc4_base_module_cfg base_config;
122 struct sof_ipc4_audio_format out_format;
123 uint32_t copier_feature_mask;
124 struct sof_copier_gateway_cfg gtw_cfg;
128 * struct sof_ipc4_gtw_attributes: Gateway attributes
129 * @lp_buffer_alloc: Gateway data requested in low power memory
130 * @alloc_from_reg_file: Gateway data requested in register file memory
131 * @rsvd: reserved for future use
133 struct sof_ipc4_gtw_attributes {
134 uint32_t lp_buffer_alloc : 1;
135 uint32_t alloc_from_reg_file : 1;
139 /** struct sof_ipc4_alh_multi_gtw_cfg: ALH gateway cfg data
140 * @count: Number of streams (valid items in mapping array)
141 * @alh_id: ALH stream id of a single ALH stream aggregated
142 * @channel_mask: Channel mask
143 * @mapping: ALH streams
145 struct sof_ipc4_alh_multi_gtw_cfg {
149 uint32_t channel_mask;
150 } mapping[ALH_MAX_NUMBER_OF_GTW];
153 /** struct sof_ipc4_alh_configuration_blob: ALH blob
154 * @gw_attr: Gateway attributes
155 * @alh_cfg: ALH configuration data
157 struct sof_ipc4_alh_configuration_blob {
158 struct sof_ipc4_gtw_attributes gw_attr;
159 struct sof_ipc4_alh_multi_gtw_cfg alh_cfg;
163 * struct sof_ipc4_copier - copier config data
164 * @data: IPC copier data
165 * @copier_config: Copier + blob
166 * @ipc_config_size: Size of copier_config
167 * @available_fmt: Available audio format
168 * @frame_fmt: frame format
169 * @msg: message structure for copier
170 * @gtw_attr: Gateway attributes for copier blob
171 * @dai_type: DAI type
172 * @dai_index: DAI index
174 struct sof_ipc4_copier {
175 struct sof_ipc4_copier_data data;
177 uint32_t ipc_config_size;
178 void *ipc_config_data;
179 struct sof_ipc4_available_audio_format available_fmt;
181 struct sof_ipc4_msg msg;
182 struct sof_ipc4_gtw_attributes *gtw_attr;
188 * struct sof_ipc4_ctrl_value_chan: generic channel mapped value data
189 * @channel: Channel ID
192 struct sof_ipc4_ctrl_value_chan {
198 * struct sof_ipc4_control_data - IPC data for kcontrol IO
199 * @msg: message structure for kcontrol IO
200 * @index: pipeline ID
201 * @chanv: channel ID and value array used by volume type controls
202 * @data: data for binary kcontrols
204 struct sof_ipc4_control_data {
205 struct sof_ipc4_msg msg;
209 struct sof_ipc4_ctrl_value_chan chanv[0];
210 struct sof_abi_hdr data[0];
215 * struct sof_ipc4_gain_data - IPC gain blob
216 * @channels: Channels
217 * @init_val: Initial value
218 * @curve_type: Curve type
219 * @reserved: reserved for future use
220 * @curve_duration: Curve duration
222 struct sof_ipc4_gain_data {
227 uint32_t curve_duration;
231 * struct sof_ipc4_gain - gain config data
232 * @base_config: IPC base config data
233 * @data: IPC gain blob
234 * @available_fmt: Available audio format
235 * @msg: message structure for gain
237 struct sof_ipc4_gain {
238 struct sof_ipc4_base_module_cfg base_config;
239 struct sof_ipc4_gain_data data;
240 struct sof_ipc4_available_audio_format available_fmt;
241 struct sof_ipc4_msg msg;
245 * struct sof_ipc4_mixer - mixer config data
246 * @base_config: IPC base config data
247 * @available_fmt: Available audio format
248 * @msg: IPC4 message struct containing header and data info
250 struct sof_ipc4_mixer {
251 struct sof_ipc4_base_module_cfg base_config;
252 struct sof_ipc4_available_audio_format available_fmt;
253 struct sof_ipc4_msg msg;
257 * struct sof_ipc4_src SRC config data
258 * @base_config: IPC base config data
259 * @sink_rate: Output rate for sink module
260 * @available_fmt: Available audio format
261 * @msg: IPC4 message struct containing header and data info
263 struct sof_ipc4_src {
264 struct sof_ipc4_base_module_cfg base_config;
266 struct sof_ipc4_available_audio_format available_fmt;
267 struct sof_ipc4_msg msg;