1 /* SPDX-License-Identifier: (GPL-2.0 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) 2018 Intel Corporation. All rights reserved.
9 #ifndef __INCLUDE_SOUND_SOF_TOPOLOGY_H__
10 #define __INCLUDE_SOUND_SOF_TOPOLOGY_H__
12 #include <sound/sof/header.h>
18 /* types of component */
23 SOF_COMP_SG_HOST
, /**< scatter gather variant */
24 SOF_COMP_SG_DAI
, /**< scatter gather variant */
35 SOF_COMP_KEYWORD_DETECT
,
36 SOF_COMP_KPB
, /* A key phrase buffer component */
37 SOF_COMP_SELECTOR
, /**< channel selector component */
39 SOF_COMP_ASRC
, /**< Asynchronous sample rate converter */
40 /* keep FILEREAD/FILEWRITE as the last ones */
41 SOF_COMP_FILEREAD
= 10000, /**< host test based file IO */
42 SOF_COMP_FILEWRITE
= 10001, /**< host test based file IO */
45 /* XRUN action for component */
46 #define SOF_XRUN_STOP 1 /**< stop stream */
47 #define SOF_XRUN_UNDER_ZERO 2 /**< send 0s to sink */
48 #define SOF_XRUN_OVER_NULL 4 /**< send data to NULL */
50 /* create new generic component - SOF_IPC_TPLG_COMP_NEW */
52 struct sof_ipc_cmd_hdr hdr
;
54 enum sof_comp_type type
;
58 /* reserved for future use */
67 * SOF memory capabilities, add new ones at the end
69 #define SOF_MEM_CAPS_RAM (1 << 0)
70 #define SOF_MEM_CAPS_ROM (1 << 1)
71 #define SOF_MEM_CAPS_EXT (1 << 2) /**< external */
72 #define SOF_MEM_CAPS_LP (1 << 3) /**< low power */
73 #define SOF_MEM_CAPS_HP (1 << 4) /**< high performance */
74 #define SOF_MEM_CAPS_DMA (1 << 5) /**< DMA'able */
75 #define SOF_MEM_CAPS_CACHE (1 << 6) /**< cacheable */
76 #define SOF_MEM_CAPS_EXEC (1 << 7) /**< executable */
78 /* create new component buffer - SOF_IPC_TPLG_BUFFER_NEW */
79 struct sof_ipc_buffer
{
80 struct sof_ipc_comp comp
;
81 uint32_t size
; /**< buffer size in bytes */
82 uint32_t caps
; /**< SOF_MEM_CAPS_ */
85 /* generic component config data - must always be after struct sof_ipc_comp */
86 struct sof_ipc_comp_config
{
87 struct sof_ipc_cmd_hdr hdr
;
88 uint32_t periods_sink
; /**< 0 means variable */
89 uint32_t periods_source
;/**< 0 means variable */
90 uint32_t reserved1
; /**< reserved */
91 uint32_t frame_fmt
; /**< SOF_IPC_FRAME_ */
94 /* reserved for future use */
98 /* generic host component */
99 struct sof_ipc_comp_host
{
100 struct sof_ipc_comp comp
;
101 struct sof_ipc_comp_config config
;
102 uint32_t direction
; /**< SOF_IPC_STREAM_ */
103 uint32_t no_irq
; /**< don't send periodic IRQ to host/DSP */
104 uint32_t dmac_config
; /**< DMA engine specific */
107 /* generic DAI component */
108 struct sof_ipc_comp_dai
{
109 struct sof_ipc_comp comp
;
110 struct sof_ipc_comp_config config
;
111 uint32_t direction
; /**< SOF_IPC_STREAM_ */
112 uint32_t dai_index
; /**< index of this type dai */
113 uint32_t type
; /**< DAI type - SOF_DAI_ */
114 uint32_t reserved
; /**< reserved */
117 /* generic mixer component */
118 struct sof_ipc_comp_mixer
{
119 struct sof_ipc_comp comp
;
120 struct sof_ipc_comp_config config
;
123 /* volume ramping types */
124 enum sof_volume_ramp
{
125 SOF_VOLUME_LINEAR
= 0,
127 SOF_VOLUME_LINEAR_ZC
,
131 /* generic volume component */
132 struct sof_ipc_comp_volume
{
133 struct sof_ipc_comp comp
;
134 struct sof_ipc_comp_config config
;
138 uint32_t ramp
; /**< SOF_VOLUME_ */
139 uint32_t initial_ramp
; /**< ramp space in ms */
142 /* generic SRC component */
143 struct sof_ipc_comp_src
{
144 struct sof_ipc_comp comp
;
145 struct sof_ipc_comp_config config
;
146 /* either source or sink rate must be non zero */
147 uint32_t source_rate
; /**< source rate or 0 for variable */
148 uint32_t sink_rate
; /**< sink rate or 0 for variable */
149 uint32_t rate_mask
; /**< SOF_RATE_ supported rates */
152 /* generic ASRC component */
153 struct sof_ipc_comp_asrc
{
154 struct sof_ipc_comp comp
;
155 struct sof_ipc_comp_config config
;
156 /* either source or sink rate must be non zero */
157 uint32_t source_rate
; /**< Define fixed source rate or */
158 /**< use 0 to indicate need to get */
159 /**< the rate from stream */
160 uint32_t sink_rate
; /**< Define fixed sink rate or */
161 /**< use 0 to indicate need to get */
162 /**< the rate from stream */
163 uint32_t asynchronous_mode
; /**< synchronous 0, asynchronous 1 */
164 /**< When 1 the ASRC tracks and */
165 /**< compensates for drift. */
166 uint32_t operation_mode
; /**< push 0, pull 1, In push mode the */
167 /**< ASRC consumes a defined number */
168 /**< of frames at input, with varying */
169 /**< number of frames at output. */
170 /**< In pull mode the ASRC outputs */
171 /**< a defined number of frames while */
172 /**< number of input frames varies. */
174 /* reserved for future use */
175 uint32_t reserved
[4];
176 } __attribute__((packed
));
178 /* generic MUX component */
179 struct sof_ipc_comp_mux
{
180 struct sof_ipc_comp comp
;
181 struct sof_ipc_comp_config config
;
184 /* generic tone generator component */
185 struct sof_ipc_comp_tone
{
186 struct sof_ipc_comp comp
;
187 struct sof_ipc_comp_config config
;
199 /** \brief Types of processing components */
200 enum sof_ipc_process_type
{
201 SOF_PROCESS_NONE
= 0, /**< None */
202 SOF_PROCESS_EQFIR
, /**< Intel FIR */
203 SOF_PROCESS_EQIIR
, /**< Intel IIR */
204 SOF_PROCESS_KEYWORD_DETECT
, /**< Keyword Detection */
205 SOF_PROCESS_KPB
, /**< KeyPhrase Buffer Manager */
206 SOF_PROCESS_CHAN_SELECTOR
, /**< Channel Selector */
211 /* generic "effect", "codec" or proprietary processing component */
212 struct sof_ipc_comp_process
{
213 struct sof_ipc_comp comp
;
214 struct sof_ipc_comp_config config
;
215 uint32_t size
; /**< size of bespoke data section in bytes */
216 uint32_t type
; /**< sof_ipc_process_type */
218 /* reserved for future use */
219 uint32_t reserved
[7];
221 unsigned char data
[0];
224 /* frees components, buffers and pipelines
225 * SOF_IPC_TPLG_COMP_FREE, SOF_IPC_TPLG_PIPE_FREE, SOF_IPC_TPLG_BUFFER_FREE
227 struct sof_ipc_free
{
228 struct sof_ipc_cmd_hdr hdr
;
232 struct sof_ipc_comp_reply
{
233 struct sof_ipc_reply rhdr
;
242 /** \brief Types of pipeline scheduling time domains */
243 enum sof_ipc_pipe_sched_time_domain
{
244 SOF_TIME_DOMAIN_DMA
= 0, /**< DMA interrupt */
245 SOF_TIME_DOMAIN_TIMER
, /**< Timer interrupt */
248 /* new pipeline - SOF_IPC_TPLG_PIPE_NEW */
249 struct sof_ipc_pipe_new
{
250 struct sof_ipc_cmd_hdr hdr
;
251 uint32_t comp_id
; /**< component id for pipeline */
252 uint32_t pipeline_id
; /**< pipeline id */
253 uint32_t sched_id
; /**< Scheduling component id */
254 uint32_t core
; /**< core we run on */
255 uint32_t period
; /**< execution period in us*/
256 uint32_t priority
; /**< priority level 0 (low) to 10 (max) */
257 uint32_t period_mips
; /**< worst case instruction count per period */
258 uint32_t frames_per_sched
;/**< output frames of pipeline, 0 is variable */
259 uint32_t xrun_limit_usecs
; /**< report xruns greater than limit */
260 uint32_t time_domain
; /**< scheduling time domain */
263 /* pipeline construction complete - SOF_IPC_TPLG_PIPE_COMPLETE */
264 struct sof_ipc_pipe_ready
{
265 struct sof_ipc_cmd_hdr hdr
;
269 struct sof_ipc_pipe_free
{
270 struct sof_ipc_cmd_hdr hdr
;
274 /* connect two components in pipeline - SOF_IPC_TPLG_COMP_CONNECT */
275 struct sof_ipc_pipe_comp_connect
{
276 struct sof_ipc_cmd_hdr hdr
;
281 /* external events */
282 enum sof_event_types
{
284 SOF_KEYWORD_DETECT_DAPM_EVENT
,