Linux Audio

Check our new training course

Loading...
v6.2
  1/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
  2/*
  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.
  5 *
  6 * Copyright(c) 2022 Intel Corporation. All rights reserved.
  7 */
  8
  9#ifndef __INCLUDE_SOUND_SOF_IPC4_TOPOLOGY_H__
 10#define __INCLUDE_SOUND_SOF_IPC4_TOPOLOGY_H__
 11
 12#include <sound/sof/ipc4/header.h>
 13
 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)))
 17
 18#define SOF_IPC4_MODULE_LOAD_TYPE		GENMASK(3, 0)
 19#define SOF_IPC4_MODULE_AUTO_START		BIT(4)
 20/*
 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
 25 */
 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)
 
 
 
 
 29
 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
 39
 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)
 44
 45/* Node ID for SSP type DAI copiers */
 46#define SOF_IPC4_NODE_INDEX_INTEL_SSP(x) (((x) & 0xf) << 4)
 47
 48/* Node ID for DMIC type DAI copiers */
 49#define SOF_IPC4_NODE_INDEX_INTEL_DMIC(x) (((x) & 0x7) << 5)
 50
 51#define SOF_IPC4_GAIN_ALL_CHANNELS_MASK 0xffffffff
 52#define SOF_IPC4_VOL_ZERO_DB	0x7fffffff
 53
 54#define ALH_MAX_NUMBER_OF_GTW   16
 
 
 
 
 
 55
 56/*
 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.
 62 */
 63#define ALH_MULTI_GTW_BASE	0x50
 64/* A magic number from FW */
 65#define ALH_MULTI_GTW_COUNT	8
 66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 67/**
 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
 
 74 */
 75struct sof_ipc4_pipeline {
 76	uint32_t priority;
 77	uint32_t lp_mode;
 78	uint32_t mem_usage;
 
 79	int state;
 
 80	struct sof_ipc4_msg msg;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 81};
 82
 83/**
 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
 90 */
 91struct 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;
 95	u32 *dma_buffer_size;
 96	int audio_fmt_num;
 97};
 98
 99/**
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
105 */
106struct sof_copier_gateway_cfg {
107	uint32_t node_id;
108	uint32_t dma_buffer_size;
109	uint32_t config_length;
110	uint32_t config_data[];
111};
112
113/**
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
119 */
120struct 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;
125};
126
127/**
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
132 */
133struct sof_ipc4_gtw_attributes {
134	uint32_t lp_buffer_alloc : 1;
135	uint32_t alloc_from_reg_file : 1;
136	uint32_t rsvd : 30;
137};
138
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
144 */
145struct sof_ipc4_alh_multi_gtw_cfg {
146	uint32_t count;
147	struct {
148		uint32_t alh_id;
149		uint32_t channel_mask;
150	} mapping[ALH_MAX_NUMBER_OF_GTW];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151} __packed;
152
153/** struct sof_ipc4_alh_configuration_blob: ALH blob
154 * @gw_attr: Gateway attributes
155 * @alh_cfg: ALH configuration data
156 */
157struct sof_ipc4_alh_configuration_blob {
158	struct sof_ipc4_gtw_attributes gw_attr;
159	struct sof_ipc4_alh_multi_gtw_cfg alh_cfg;
160};
161
162/**
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
 
173 */
174struct sof_ipc4_copier {
175	struct sof_ipc4_copier_data data;
176	u32 *copier_config;
177	uint32_t ipc_config_size;
178	void *ipc_config_data;
179	struct sof_ipc4_available_audio_format available_fmt;
180	u32 frame_fmt;
181	struct sof_ipc4_msg msg;
182	struct sof_ipc4_gtw_attributes *gtw_attr;
183	u32 dai_type;
184	int dai_index;
 
185};
186
187/**
188 * struct sof_ipc4_ctrl_value_chan: generic channel mapped value data
189 * @channel: Channel ID
190 * @value: gain value
191 */
192struct sof_ipc4_ctrl_value_chan {
193	u32 channel;
194	u32 value;
195};
196
197/**
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
203 */
204struct sof_ipc4_control_data {
205	struct sof_ipc4_msg msg;
206	int index;
207
208	union {
209		struct sof_ipc4_ctrl_value_chan chanv[0];
210		struct sof_abi_hdr data[0];
211	};
212};
213
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
214/**
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
 
221 */
222struct sof_ipc4_gain_data {
223	uint32_t channels;
224	uint32_t init_val;
225	uint32_t curve_type;
226	uint32_t reserved;
227	uint32_t curve_duration;
228} __aligned(8);
 
229
230/**
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
236 */
237struct 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;
242};
243
244/**
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
249 */
250struct 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;
254};
255
256/**
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
262 */
263struct sof_ipc4_src {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
264	struct sof_ipc4_base_module_cfg base_config;
265	uint32_t sink_rate;
 
266	struct sof_ipc4_available_audio_format available_fmt;
 
 
267	struct sof_ipc4_msg msg;
 
 
268};
269
 
 
 
270#endif
v6.9.4
  1/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
  2/*
  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.
  5 *
  6 * Copyright(c) 2022 Intel Corporation. All rights reserved.
  7 */
  8
  9#ifndef __INCLUDE_SOUND_SOF_IPC4_TOPOLOGY_H__
 10#define __INCLUDE_SOUND_SOF_IPC4_TOPOLOGY_H__
 11
 12#include <sound/sof/ipc4/header.h>
 13
 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)))
 17
 18#define SOF_IPC4_MODULE_LOAD_TYPE		GENMASK(3, 0)
 19#define SOF_IPC4_MODULE_AUTO_START		BIT(4)
 20/*
 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
 25 */
 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)
 29#define SOF_IPC4_MODULE_INIT_CONFIG_MASK	GENMASK(11, 8)
 30
 31#define SOF_IPC4_MODULE_INIT_CONFIG_TYPE_BASE_CFG		0
 32#define SOF_IPC4_MODULE_INIT_CONFIG_TYPE_BASE_CFG_WITH_EXT	1
 33
 34#define SOF_IPC4_MODULE_INSTANCE_LIST_ITEM_SIZE 12
 35#define SOF_IPC4_PIPELINE_OBJECT_SIZE 448
 36#define SOF_IPC4_DATA_QUEUE_OBJECT_SIZE 128
 37#define SOF_IPC4_LL_TASK_OBJECT_SIZE 72
 38#define SOF_IPC4_DP_TASK_OBJECT_SIZE 104
 39#define SOF_IPC4_DP_TASK_LIST_SIZE (12 + 8)
 40#define SOF_IPC4_LL_TASK_LIST_ITEM_SIZE 12
 41#define SOF_IPC4_FW_MAX_PAGE_COUNT 20
 42#define SOF_IPC4_FW_MAX_QUEUE_COUNT 8
 43
 44/* Node index and mask applicable for host copier and ALH/HDA type DAI copiers */
 45#define SOF_IPC4_NODE_INDEX_MASK	0xFF
 46#define SOF_IPC4_NODE_INDEX(x)	((x) & SOF_IPC4_NODE_INDEX_MASK)
 47#define SOF_IPC4_NODE_TYPE(x)  ((x) << 8)
 48
 49/* Node ID for SSP type DAI copiers */
 50#define SOF_IPC4_NODE_INDEX_INTEL_SSP(x) (((x) & 0xf) << 4)
 51
 52/* Node ID for DMIC type DAI copiers */
 53#define SOF_IPC4_NODE_INDEX_INTEL_DMIC(x) ((x) & 0x7)
 54
 55#define SOF_IPC4_GAIN_ALL_CHANNELS_MASK 0xffffffff
 56#define SOF_IPC4_VOL_ZERO_DB	0x7fffffff
 57
 58#define SOF_IPC4_DMA_DEVICE_MAX_COUNT 16
 59
 60#define SOF_IPC4_INVALID_NODE_ID	0xffffffff
 61
 62/* FW requires minimum 2ms DMA buffer size */
 63#define SOF_IPC4_MIN_DMA_BUFFER_SIZE	2
 64
 65/*
 66 * The base of multi-gateways. Multi-gateways addressing starts from
 67 * ALH_MULTI_GTW_BASE and there are ALH_MULTI_GTW_COUNT multi-sources
 68 * and ALH_MULTI_GTW_COUNT multi-sinks available.
 69 * Addressing is continuous from ALH_MULTI_GTW_BASE to
 70 * ALH_MULTI_GTW_BASE + ALH_MULTI_GTW_COUNT - 1.
 71 */
 72#define ALH_MULTI_GTW_BASE	0x50
 73/* A magic number from FW */
 74#define ALH_MULTI_GTW_COUNT	8
 75
 76enum sof_ipc4_copier_module_config_params {
 77/*
 78 * Use LARGE_CONFIG_SET to initialize timestamp event. Ipc mailbox must
 79 * contain properly built CopierConfigTimestampInitData struct.
 80 */
 81	SOF_IPC4_COPIER_MODULE_CFG_PARAM_TIMESTAMP_INIT = 1,
 82/*
 83 * Use LARGE_CONFIG_SET to initialize copier sink. Ipc mailbox must contain
 84 * properly built CopierConfigSetSinkFormat struct.
 85 */
 86	SOF_IPC4_COPIER_MODULE_CFG_PARAM_SET_SINK_FORMAT,
 87/*
 88 * Use LARGE_CONFIG_SET to initialize and enable on Copier data segment
 89 * event. Ipc mailbox must contain properly built DataSegmentEnabled struct.
 90 */
 91	SOF_IPC4_COPIER_MODULE_CFG_PARAM_DATA_SEGMENT_ENABLED,
 92/*
 93 * Use LARGE_CONFIG_GET to retrieve Linear Link Position (LLP) value for non
 94 * HD-A gateways.
 95 */
 96	SOF_IPC4_COPIER_MODULE_CFG_PARAM_LLP_READING,
 97/*
 98 * Use LARGE_CONFIG_GET to retrieve Linear Link Position (LLP) value for non
 99 * HD-A gateways and corresponding total processed data
100 */
101	SOF_IPC4_COPIER_MODULE_CFG_PARAM_LLP_READING_EXTENDED,
102/*
103 * Use LARGE_CONFIG_SET to setup attenuation on output pins. Data is just uint32_t.
104 * note Config is only allowed when output pin is set up for 32bit and source
105 * is connected to Gateway
106 */
107	SOF_IPC4_COPIER_MODULE_CFG_ATTENUATION,
108};
109
110struct sof_ipc4_copier_config_set_sink_format {
111/* Id of sink */
112	u32 sink_id;
113/*
114 * Input format used by the source
115 * attention must be the same as present if already initialized.
116 */
117	struct sof_ipc4_audio_format source_fmt;
118/* Output format used by the sink */
119	struct sof_ipc4_audio_format sink_fmt;
120} __packed __aligned(4);
121
122/**
123 * struct sof_ipc4_pipeline - pipeline config data
124 * @priority: Priority of this pipeline
125 * @lp_mode: Low power mode
126 * @mem_usage: Memory usage
127 * @core_id: Target core for the pipeline
128 * @state: Pipeline state
129 * @use_chain_dma: flag to indicate if the firmware shall use chained DMA
130 * @msg: message structure for pipeline
131 * @skip_during_fe_trigger: skip triggering this pipeline during the FE DAI trigger
132 */
133struct sof_ipc4_pipeline {
134	uint32_t priority;
135	uint32_t lp_mode;
136	uint32_t mem_usage;
137	uint32_t core_id;
138	int state;
139	bool use_chain_dma;
140	struct sof_ipc4_msg msg;
141	bool skip_during_fe_trigger;
142};
143
144/**
145 * struct sof_ipc4_multi_pipeline_data - multi pipeline trigger IPC data
146 * @count: Number of pipelines to be triggered
147 * @pipeline_instance_ids: Flexible array of IDs of the pipelines to be triggered
148 */
149struct ipc4_pipeline_set_state_data {
150	u32 count;
151	DECLARE_FLEX_ARRAY(u32, pipeline_instance_ids);
152} __packed;
153
154/**
155 * struct sof_ipc4_pin_format - Module pin format
156 * @pin_index: pin index
157 * @buffer_size: buffer size in bytes
158 * @audio_fmt: audio format for the pin
159 *
160 * This structure can be used for both output or input pins and the pin_index is relative to the
161 * pin type i.e output/input pin
162 */
163struct sof_ipc4_pin_format {
164	u32 pin_index;
165	u32 buffer_size;
166	struct sof_ipc4_audio_format audio_fmt;
167};
168
169/**
170 * struct sof_ipc4_available_audio_format - Available audio formats
171 * @output_pin_fmts: Available output pin formats
172 * @input_pin_fmts: Available input pin formats
173 * @num_input_formats: Number of input pin formats
174 * @num_output_formats: Number of output pin formats
 
175 */
176struct sof_ipc4_available_audio_format {
177	struct sof_ipc4_pin_format *output_pin_fmts;
178	struct sof_ipc4_pin_format *input_pin_fmts;
179	u32 num_input_formats;
180	u32 num_output_formats;
 
181};
182
183/**
184 * struct sof_copier_gateway_cfg - IPC gateway configuration
185 * @node_id: ID of Gateway Node
186 * @dma_buffer_size: Preferred Gateway DMA buffer size (in bytes)
187 * @config_length: Length of gateway node configuration blob specified in #config_data
188 * config_data: Gateway node configuration blob
189 */
190struct sof_copier_gateway_cfg {
191	uint32_t node_id;
192	uint32_t dma_buffer_size;
193	uint32_t config_length;
194	uint32_t config_data[];
195};
196
197/**
198 * struct sof_ipc4_copier_data - IPC data for copier
199 * @base_config: Base configuration including input audio format
200 * @out_format: Output audio format
201 * @copier_feature_mask: Copier feature mask
202 * @gtw_cfg: Gateway configuration
203 */
204struct sof_ipc4_copier_data {
205	struct sof_ipc4_base_module_cfg base_config;
206	struct sof_ipc4_audio_format out_format;
207	uint32_t copier_feature_mask;
208	struct sof_copier_gateway_cfg gtw_cfg;
209};
210
211/**
212 * struct sof_ipc4_gtw_attributes: Gateway attributes
213 * @lp_buffer_alloc: Gateway data requested in low power memory
214 * @alloc_from_reg_file: Gateway data requested in register file memory
215 * @rsvd: reserved for future use
216 */
217struct sof_ipc4_gtw_attributes {
218	uint32_t lp_buffer_alloc : 1;
219	uint32_t alloc_from_reg_file : 1;
220	uint32_t rsvd : 30;
221};
222
223/**
224 * struct sof_ipc4_dma_device_stream_ch_map: abstract representation of
225 * channel mapping to DMAs
226 * @device: representation of hardware device address or FIFO
227 * @channel_mask: channels handled by @device. Channels are expected to be
228 * contiguous
229 */
230struct sof_ipc4_dma_device_stream_ch_map {
231	uint32_t device;
232	uint32_t channel_mask;
233};
234
235/**
236 * struct sof_ipc4_dma_stream_ch_map: DMA configuration data
237 * @device_count: Number valid items in mapping array
238 * @mapping: device address and channel mask
239 */
240struct sof_ipc4_dma_stream_ch_map {
241	uint32_t device_count;
242	struct sof_ipc4_dma_device_stream_ch_map mapping[SOF_IPC4_DMA_DEVICE_MAX_COUNT];
243} __packed;
244
245#define SOF_IPC4_DMA_METHOD_HDA   1
246#define SOF_IPC4_DMA_METHOD_GPDMA 2 /* defined for consistency but not used */
247
248/**
249 * struct sof_ipc4_dma_config: DMA configuration
250 * @dma_method: HDAudio or GPDMA
251 * @pre_allocated_by_host: 1 if host driver allocates DMA channels, 0 otherwise
252 * @dma_channel_id: for HDaudio defined as @stream_id - 1
253 * @stream_id: HDaudio stream tag
254 * @dma_stream_channel_map: array of device/channel mappings
255 * @dma_priv_config_size: currently not used
256 * @dma_priv_config: currently not used
257 */
258struct sof_ipc4_dma_config {
259	uint8_t dma_method;
260	uint8_t pre_allocated_by_host;
261	uint16_t rsvd;
262	uint32_t dma_channel_id;
263	uint32_t stream_id;
264	struct sof_ipc4_dma_stream_ch_map dma_stream_channel_map;
265	uint32_t dma_priv_config_size;
266	uint8_t dma_priv_config[];
267} __packed;
268
269#define SOF_IPC4_GTW_DMA_CONFIG_ID 0x1000
270
271/**
272 * struct sof_ipc4_dma_config: DMA configuration
273 * @type: set to SOF_IPC4_GTW_DMA_CONFIG_ID
274 * @length: sizeof(struct sof_ipc4_dma_config) + dma_config.dma_priv_config_size
275 * @dma_config: actual DMA configuration
276 */
277struct sof_ipc4_dma_config_tlv {
278	uint32_t type;
279	uint32_t length;
280	struct sof_ipc4_dma_config dma_config;
281} __packed;
282
283/** struct sof_ipc4_alh_configuration_blob: ALH blob
284 * @gw_attr: Gateway attributes
285 * @alh_cfg: ALH configuration data
286 */
287struct sof_ipc4_alh_configuration_blob {
288	struct sof_ipc4_gtw_attributes gw_attr;
289	struct sof_ipc4_dma_stream_ch_map alh_cfg;
290};
291
292/**
293 * struct sof_ipc4_copier - copier config data
294 * @data: IPC copier data
295 * @copier_config: Copier + blob
296 * @ipc_config_size: Size of copier_config
297 * @available_fmt: Available audio format
298 * @frame_fmt: frame format
299 * @msg: message structure for copier
300 * @gtw_attr: Gateway attributes for copier blob
301 * @dai_type: DAI type
302 * @dai_index: DAI index
303 * @dma_config_tlv: DMA configuration
304 */
305struct sof_ipc4_copier {
306	struct sof_ipc4_copier_data data;
307	u32 *copier_config;
308	uint32_t ipc_config_size;
309	void *ipc_config_data;
310	struct sof_ipc4_available_audio_format available_fmt;
311	u32 frame_fmt;
312	struct sof_ipc4_msg msg;
313	struct sof_ipc4_gtw_attributes *gtw_attr;
314	u32 dai_type;
315	int dai_index;
316	struct sof_ipc4_dma_config_tlv dma_config_tlv;
317};
318
319/**
320 * struct sof_ipc4_ctrl_value_chan: generic channel mapped value data
321 * @channel: Channel ID
322 * @value: Value associated with @channel
323 */
324struct sof_ipc4_ctrl_value_chan {
325	u32 channel;
326	u32 value;
327};
328
329/**
330 * struct sof_ipc4_control_data - IPC data for kcontrol IO
331 * @msg: message structure for kcontrol IO
332 * @index: pipeline ID
333 * @chanv: channel ID and value array used by volume type controls
334 * @data: data for binary kcontrols
335 */
336struct sof_ipc4_control_data {
337	struct sof_ipc4_msg msg;
338	int index;
339
340	union {
341		DECLARE_FLEX_ARRAY(struct sof_ipc4_ctrl_value_chan, chanv);
342		DECLARE_FLEX_ARRAY(struct sof_abi_hdr, data);
343	};
344};
345
346#define SOF_IPC4_SWITCH_CONTROL_PARAM_ID	200
347#define SOF_IPC4_ENUM_CONTROL_PARAM_ID		201
348
349/**
350 * struct sof_ipc4_control_msg_payload - IPC payload for kcontrol parameters
351 * @id: unique id of the control
352 * @num_elems: Number of elements in the chanv array
353 * @reserved: reserved for future use, must be set to 0
354 * @chanv: channel ID and value array
355 */
356struct sof_ipc4_control_msg_payload {
357	uint16_t id;
358	uint16_t num_elems;
359	uint32_t reserved[4];
360	DECLARE_FLEX_ARRAY(struct sof_ipc4_ctrl_value_chan, chanv);
361} __packed;
362
363/**
364 * struct sof_ipc4_gain_params - IPC gain parameters
365 * @channels: Channels
366 * @init_val: Initial value
367 * @curve_type: Curve type
368 * @reserved: reserved for future use
369 * @curve_duration_l: Curve duration low part
370 * @curve_duration_h: Curve duration high part
371 */
372struct sof_ipc4_gain_params {
373	uint32_t channels;
374	uint32_t init_val;
375	uint32_t curve_type;
376	uint32_t reserved;
377	uint32_t curve_duration_l;
378	uint32_t curve_duration_h;
379} __packed __aligned(4);
380
381/**
382 * struct sof_ipc4_gain_data - IPC gain init blob
383 * @base_config: IPC base config data
384 * @params: Initial parameters for the gain module
385 */
386struct sof_ipc4_gain_data {
387	struct sof_ipc4_base_module_cfg base_config;
388	struct sof_ipc4_gain_params params;
389} __packed __aligned(4);
390
391/**
392 * struct sof_ipc4_gain - gain config data
393 * @data: IPC gain blob
394 * @available_fmt: Available audio format
395 * @msg: message structure for gain
396 */
397struct sof_ipc4_gain {
 
398	struct sof_ipc4_gain_data data;
399	struct sof_ipc4_available_audio_format available_fmt;
400	struct sof_ipc4_msg msg;
401};
402
403/**
404 * struct sof_ipc4_mixer - mixer config data
405 * @base_config: IPC base config data
406 * @available_fmt: Available audio format
407 * @msg: IPC4 message struct containing header and data info
408 */
409struct sof_ipc4_mixer {
410	struct sof_ipc4_base_module_cfg base_config;
411	struct sof_ipc4_available_audio_format available_fmt;
412	struct sof_ipc4_msg msg;
413};
414
415/*
416 * struct sof_ipc4_src_data - IPC data for SRC
417 * @base_config: IPC base config data
418 * @sink_rate: Output rate for sink module
419 */
420struct sof_ipc4_src_data {
421	struct sof_ipc4_base_module_cfg base_config;
422	uint32_t sink_rate;
423} __packed __aligned(4);
424
425/**
426 * struct sof_ipc4_src - SRC config data
427 * @data: IPC base config data
428 * @available_fmt: Available audio format
429 * @msg: IPC4 message struct containing header and data info
430 */
431struct sof_ipc4_src {
432	struct sof_ipc4_src_data data;
433	struct sof_ipc4_available_audio_format available_fmt;
434	struct sof_ipc4_msg msg;
435};
436
437/**
438 * struct sof_ipc4_base_module_cfg_ext - base module config extension containing the pin format
439 * information for the module. Both @num_input_pin_fmts and @num_output_pin_fmts cannot be 0 for a
440 * module.
441 * @num_input_pin_fmts: number of input pin formats in the @pin_formats array
442 * @num_output_pin_fmts: number of output pin formats in the @pin_formats array
443 * @reserved: reserved for future use
444 * @pin_formats: flexible array consisting of @num_input_pin_fmts input pin format items followed
445 *		 by @num_output_pin_fmts output pin format items
446 */
447struct sof_ipc4_base_module_cfg_ext {
448	u16 num_input_pin_fmts;
449	u16 num_output_pin_fmts;
450	u8 reserved[12];
451	DECLARE_FLEX_ARRAY(struct sof_ipc4_pin_format, pin_formats);
452} __packed;
453
454/**
455 * struct sof_ipc4_process - process config data
456 * @base_config: IPC base config data
457 * @base_config_ext: Base config extension data for module init
458 * @output_format: Output audio format
459 * @available_fmt: Available audio format
460 * @ipc_config_data: Process module config data
461 * @ipc_config_size: Size of process module config data
462 * @msg: IPC4 message struct containing header and data info
463 * @base_config_ext_size: Size of the base config extension data in bytes
464 * @init_config: Module init config type (SOF_IPC4_MODULE_INIT_CONFIG_TYPE_*)
465 */
466struct sof_ipc4_process {
467	struct sof_ipc4_base_module_cfg base_config;
468	struct sof_ipc4_base_module_cfg_ext *base_config_ext;
469	struct sof_ipc4_audio_format output_format;
470	struct sof_ipc4_available_audio_format available_fmt;
471	void *ipc_config_data;
472	uint32_t ipc_config_size;
473	struct sof_ipc4_msg msg;
474	u32 base_config_ext_size;
475	u32 init_config;
476};
477
478bool sof_ipc4_copier_is_single_format(struct snd_sof_dev *sdev,
479				      struct sof_ipc4_pin_format *pin_fmts,
480				      u32 pin_fmts_size);
481#endif