1 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) 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 */
38 /* keep FILEREAD/FILEWRITE as the last ones */
39 SOF_COMP_FILEREAD
= 10000, /**< host test based file IO */
40 SOF_COMP_FILEWRITE
= 10001, /**< host test based file IO */
43 /* XRUN action for component */
44 #define SOF_XRUN_STOP 1 /**< stop stream */
45 #define SOF_XRUN_UNDER_ZERO 2 /**< send 0s to sink */
46 #define SOF_XRUN_OVER_NULL 4 /**< send data to NULL */
48 /* create new generic component - SOF_IPC_TPLG_COMP_NEW */
50 struct sof_ipc_cmd_hdr hdr
;
52 enum sof_comp_type type
;
55 /* reserved for future use */
64 * SOF memory capabilities, add new ones at the end
66 #define SOF_MEM_CAPS_RAM (1 << 0)
67 #define SOF_MEM_CAPS_ROM (1 << 1)
68 #define SOF_MEM_CAPS_EXT (1 << 2) /**< external */
69 #define SOF_MEM_CAPS_LP (1 << 3) /**< low power */
70 #define SOF_MEM_CAPS_HP (1 << 4) /**< high performance */
71 #define SOF_MEM_CAPS_DMA (1 << 5) /**< DMA'able */
72 #define SOF_MEM_CAPS_CACHE (1 << 6) /**< cacheable */
73 #define SOF_MEM_CAPS_EXEC (1 << 7) /**< executable */
75 /* create new component buffer - SOF_IPC_TPLG_BUFFER_NEW */
76 struct sof_ipc_buffer
{
77 struct sof_ipc_comp comp
;
78 uint32_t size
; /**< buffer size in bytes */
79 uint32_t caps
; /**< SOF_MEM_CAPS_ */
82 /* generic component config data - must always be after struct sof_ipc_comp */
83 struct sof_ipc_comp_config
{
84 struct sof_ipc_cmd_hdr hdr
;
85 uint32_t periods_sink
; /**< 0 means variable */
86 uint32_t periods_source
; /**< 0 means variable */
87 uint32_t reserved1
; /**< reserved */
88 uint32_t frame_fmt
; /**< SOF_IPC_FRAME_ */
91 /* reserved for future use */
95 /* generic host component */
96 struct sof_ipc_comp_host
{
97 struct sof_ipc_comp comp
;
98 struct sof_ipc_comp_config config
;
99 uint32_t direction
; /**< SOF_IPC_STREAM_ */
100 uint32_t no_irq
; /**< don't send periodic IRQ to host/DSP */
101 uint32_t dmac_config
; /**< DMA engine specific */
104 /* generic DAI component */
105 struct sof_ipc_comp_dai
{
106 struct sof_ipc_comp comp
;
107 struct sof_ipc_comp_config config
;
108 uint32_t direction
; /**< SOF_IPC_STREAM_ */
109 uint32_t dai_index
; /**< index of this type dai */
110 uint32_t type
; /**< DAI type - SOF_DAI_ */
111 uint32_t reserved
; /**< reserved */
114 /* generic mixer component */
115 struct sof_ipc_comp_mixer
{
116 struct sof_ipc_comp comp
;
117 struct sof_ipc_comp_config config
;
120 /* volume ramping types */
121 enum sof_volume_ramp
{
122 SOF_VOLUME_LINEAR
= 0,
124 SOF_VOLUME_LINEAR_ZC
,
128 /* generic volume component */
129 struct sof_ipc_comp_volume
{
130 struct sof_ipc_comp comp
;
131 struct sof_ipc_comp_config config
;
135 uint32_t ramp
; /**< SOF_VOLUME_ */
136 uint32_t initial_ramp
; /**< ramp space in ms */
139 /* generic SRC component */
140 struct sof_ipc_comp_src
{
141 struct sof_ipc_comp comp
;
142 struct sof_ipc_comp_config config
;
143 /* either source or sink rate must be non zero */
144 uint32_t source_rate
; /**< source rate or 0 for variable */
145 uint32_t sink_rate
; /**< sink rate or 0 for variable */
146 uint32_t rate_mask
; /**< SOF_RATE_ supported rates */
149 /* generic MUX component */
150 struct sof_ipc_comp_mux
{
151 struct sof_ipc_comp comp
;
152 struct sof_ipc_comp_config config
;
155 /* generic tone generator component */
156 struct sof_ipc_comp_tone
{
157 struct sof_ipc_comp comp
;
158 struct sof_ipc_comp_config config
;
170 /** \brief Types of processing components */
171 enum sof_ipc_process_type
{
172 SOF_PROCESS_NONE
= 0, /**< None */
173 SOF_PROCESS_EQFIR
, /**< Intel FIR */
174 SOF_PROCESS_EQIIR
, /**< Intel IIR */
175 SOF_PROCESS_KEYWORD_DETECT
, /**< Keyword Detection */
176 SOF_PROCESS_KPB
, /**< KeyPhrase Buffer Manager */
177 SOF_PROCESS_CHAN_SELECTOR
, /**< Channel Selector */
180 /* generic "effect", "codec" or proprietary processing component */
181 struct sof_ipc_comp_process
{
182 struct sof_ipc_comp comp
;
183 struct sof_ipc_comp_config config
;
184 uint32_t size
; /**< size of bespoke data section in bytes */
185 uint32_t type
; /**< sof_ipc_process_type */
187 /* reserved for future use */
188 uint32_t reserved
[7];
190 unsigned char data
[0];
193 /* frees components, buffers and pipelines
194 * SOF_IPC_TPLG_COMP_FREE, SOF_IPC_TPLG_PIPE_FREE, SOF_IPC_TPLG_BUFFER_FREE
196 struct sof_ipc_free
{
197 struct sof_ipc_cmd_hdr hdr
;
201 struct sof_ipc_comp_reply
{
202 struct sof_ipc_reply rhdr
;
211 /** \brief Types of pipeline scheduling time domains */
212 enum sof_ipc_pipe_sched_time_domain
{
213 SOF_TIME_DOMAIN_DMA
= 0, /**< DMA interrupt */
214 SOF_TIME_DOMAIN_TIMER
, /**< Timer interrupt */
217 /* new pipeline - SOF_IPC_TPLG_PIPE_NEW */
218 struct sof_ipc_pipe_new
{
219 struct sof_ipc_cmd_hdr hdr
;
220 uint32_t comp_id
; /**< component id for pipeline */
221 uint32_t pipeline_id
; /**< pipeline id */
222 uint32_t sched_id
; /**< Scheduling component id */
223 uint32_t core
; /**< core we run on */
224 uint32_t period
; /**< execution period in us*/
225 uint32_t priority
; /**< priority level 0 (low) to 10 (max) */
226 uint32_t period_mips
; /**< worst case instruction count per period */
227 uint32_t frames_per_sched
;/**< output frames of pipeline, 0 is variable */
228 uint32_t xrun_limit_usecs
; /**< report xruns greater than limit */
229 uint32_t time_domain
; /**< scheduling time domain */
232 /* pipeline construction complete - SOF_IPC_TPLG_PIPE_COMPLETE */
233 struct sof_ipc_pipe_ready
{
234 struct sof_ipc_cmd_hdr hdr
;
238 struct sof_ipc_pipe_free
{
239 struct sof_ipc_cmd_hdr hdr
;
243 /* connect two components in pipeline - SOF_IPC_TPLG_COMP_CONNECT */
244 struct sof_ipc_pipe_comp_connect
{
245 struct sof_ipc_cmd_hdr hdr
;
250 /* external events */
251 enum sof_event_types
{
253 SOF_KEYWORD_DETECT_DAPM_EVENT
,