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
;
57 /* reserved for future use */
66 * SOF memory capabilities, add new ones at the end
68 #define SOF_MEM_CAPS_RAM (1 << 0)
69 #define SOF_MEM_CAPS_ROM (1 << 1)
70 #define SOF_MEM_CAPS_EXT (1 << 2) /**< external */
71 #define SOF_MEM_CAPS_LP (1 << 3) /**< low power */
72 #define SOF_MEM_CAPS_HP (1 << 4) /**< high performance */
73 #define SOF_MEM_CAPS_DMA (1 << 5) /**< DMA'able */
74 #define SOF_MEM_CAPS_CACHE (1 << 6) /**< cacheable */
75 #define SOF_MEM_CAPS_EXEC (1 << 7) /**< executable */
77 /* create new component buffer - SOF_IPC_TPLG_BUFFER_NEW */
78 struct sof_ipc_buffer
{
79 struct sof_ipc_comp comp
;
80 uint32_t size
; /**< buffer size in bytes */
81 uint32_t caps
; /**< SOF_MEM_CAPS_ */
84 /* generic component config data - must always be after struct sof_ipc_comp */
85 struct sof_ipc_comp_config
{
86 struct sof_ipc_cmd_hdr hdr
;
87 uint32_t periods_sink
; /**< 0 means variable */
88 uint32_t periods_source
;/**< 0 means variable */
89 uint32_t reserved1
; /**< reserved */
90 uint32_t frame_fmt
; /**< SOF_IPC_FRAME_ */
93 /* reserved for future use */
97 /* generic host component */
98 struct sof_ipc_comp_host
{
99 struct sof_ipc_comp comp
;
100 struct sof_ipc_comp_config config
;
101 uint32_t direction
; /**< SOF_IPC_STREAM_ */
102 uint32_t no_irq
; /**< don't send periodic IRQ to host/DSP */
103 uint32_t dmac_config
; /**< DMA engine specific */
106 /* generic DAI component */
107 struct sof_ipc_comp_dai
{
108 struct sof_ipc_comp comp
;
109 struct sof_ipc_comp_config config
;
110 uint32_t direction
; /**< SOF_IPC_STREAM_ */
111 uint32_t dai_index
; /**< index of this type dai */
112 uint32_t type
; /**< DAI type - SOF_DAI_ */
113 uint32_t reserved
; /**< reserved */
116 /* generic mixer component */
117 struct sof_ipc_comp_mixer
{
118 struct sof_ipc_comp comp
;
119 struct sof_ipc_comp_config config
;
122 /* volume ramping types */
123 enum sof_volume_ramp
{
124 SOF_VOLUME_LINEAR
= 0,
126 SOF_VOLUME_LINEAR_ZC
,
130 /* generic volume component */
131 struct sof_ipc_comp_volume
{
132 struct sof_ipc_comp comp
;
133 struct sof_ipc_comp_config config
;
137 uint32_t ramp
; /**< SOF_VOLUME_ */
138 uint32_t initial_ramp
; /**< ramp space in ms */
141 /* generic SRC component */
142 struct sof_ipc_comp_src
{
143 struct sof_ipc_comp comp
;
144 struct sof_ipc_comp_config config
;
145 /* either source or sink rate must be non zero */
146 uint32_t source_rate
; /**< source rate or 0 for variable */
147 uint32_t sink_rate
; /**< sink rate or 0 for variable */
148 uint32_t rate_mask
; /**< SOF_RATE_ supported rates */
151 /* generic ASRC component */
152 struct sof_ipc_comp_asrc
{
153 struct sof_ipc_comp comp
;
154 struct sof_ipc_comp_config config
;
155 /* either source or sink rate must be non zero */
156 uint32_t source_rate
; /**< Define fixed source rate or */
157 /**< use 0 to indicate need to get */
158 /**< the rate from stream */
159 uint32_t sink_rate
; /**< Define fixed sink rate or */
160 /**< use 0 to indicate need to get */
161 /**< the rate from stream */
162 uint32_t asynchronous_mode
; /**< synchronous 0, asynchronous 1 */
163 /**< When 1 the ASRC tracks and */
164 /**< compensates for drift. */
165 uint32_t operation_mode
; /**< push 0, pull 1, In push mode the */
166 /**< ASRC consumes a defined number */
167 /**< of frames at input, with varying */
168 /**< number of frames at output. */
169 /**< In pull mode the ASRC outputs */
170 /**< a defined number of frames while */
171 /**< number of input frames varies. */
173 /* reserved for future use */
174 uint32_t reserved
[4];
175 } __attribute__((packed
));
177 /* generic MUX component */
178 struct sof_ipc_comp_mux
{
179 struct sof_ipc_comp comp
;
180 struct sof_ipc_comp_config config
;
183 /* generic tone generator component */
184 struct sof_ipc_comp_tone
{
185 struct sof_ipc_comp comp
;
186 struct sof_ipc_comp_config config
;
198 /** \brief Types of processing components */
199 enum sof_ipc_process_type
{
200 SOF_PROCESS_NONE
= 0, /**< None */
201 SOF_PROCESS_EQFIR
, /**< Intel FIR */
202 SOF_PROCESS_EQIIR
, /**< Intel IIR */
203 SOF_PROCESS_KEYWORD_DETECT
, /**< Keyword Detection */
204 SOF_PROCESS_KPB
, /**< KeyPhrase Buffer Manager */
205 SOF_PROCESS_CHAN_SELECTOR
, /**< Channel Selector */
210 /* generic "effect", "codec" or proprietary processing component */
211 struct sof_ipc_comp_process
{
212 struct sof_ipc_comp comp
;
213 struct sof_ipc_comp_config config
;
214 uint32_t size
; /**< size of bespoke data section in bytes */
215 uint32_t type
; /**< sof_ipc_process_type */
217 /* reserved for future use */
218 uint32_t reserved
[7];
220 unsigned char data
[0];
223 /* frees components, buffers and pipelines
224 * SOF_IPC_TPLG_COMP_FREE, SOF_IPC_TPLG_PIPE_FREE, SOF_IPC_TPLG_BUFFER_FREE
226 struct sof_ipc_free
{
227 struct sof_ipc_cmd_hdr hdr
;
231 struct sof_ipc_comp_reply
{
232 struct sof_ipc_reply rhdr
;
241 /** \brief Types of pipeline scheduling time domains */
242 enum sof_ipc_pipe_sched_time_domain
{
243 SOF_TIME_DOMAIN_DMA
= 0, /**< DMA interrupt */
244 SOF_TIME_DOMAIN_TIMER
, /**< Timer interrupt */
247 /* new pipeline - SOF_IPC_TPLG_PIPE_NEW */
248 struct sof_ipc_pipe_new
{
249 struct sof_ipc_cmd_hdr hdr
;
250 uint32_t comp_id
; /**< component id for pipeline */
251 uint32_t pipeline_id
; /**< pipeline id */
252 uint32_t sched_id
; /**< Scheduling component id */
253 uint32_t core
; /**< core we run on */
254 uint32_t period
; /**< execution period in us*/
255 uint32_t priority
; /**< priority level 0 (low) to 10 (max) */
256 uint32_t period_mips
; /**< worst case instruction count per period */
257 uint32_t frames_per_sched
;/**< output frames of pipeline, 0 is variable */
258 uint32_t xrun_limit_usecs
; /**< report xruns greater than limit */
259 uint32_t time_domain
; /**< scheduling time domain */
262 /* pipeline construction complete - SOF_IPC_TPLG_PIPE_COMPLETE */
263 struct sof_ipc_pipe_ready
{
264 struct sof_ipc_cmd_hdr hdr
;
268 struct sof_ipc_pipe_free
{
269 struct sof_ipc_cmd_hdr hdr
;
273 /* connect two components in pipeline - SOF_IPC_TPLG_COMP_CONNECT */
274 struct sof_ipc_pipe_comp_connect
{
275 struct sof_ipc_cmd_hdr hdr
;
280 /* external events */
281 enum sof_event_types
{
283 SOF_KEYWORD_DETECT_DAPM_EVENT
,