1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * snd_sst_tokens.h - Intel SST tokens definition
4 *
5 * Copyright (C) 2016 Intel Corp
6 * Author: Shreyas NC <shreyas.nc@intel.com>
7 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 * General Public License for more details.
17 */
18#ifndef __SND_SST_TOKENS_H__
19#define __SND_SST_TOKENS_H__
20
21/**
22 * %SKL_TKN_UUID:               Module UUID
23 *
24 * %SKL_TKN_U8_BLOCK_TYPE:      Type of the private data block.Can be:
25 *                              tuples, bytes, short and words
26 *
27 * %SKL_TKN_U8_IN_PIN_TYPE:     Input pin type,
28 *                              homogenous=0, heterogenous=1
29 *
30 * %SKL_TKN_U8_OUT_PIN_TYPE:    Output pin type,
31 *                              homogenous=0, heterogenous=1
32 * %SKL_TKN_U8_DYN_IN_PIN:      Configure Input pin dynamically
33 *                              if true
34 *
35 * %SKL_TKN_U8_DYN_OUT_PIN:     Configure Output pin dynamically
36 *                              if true
37 *
38 * %SKL_TKN_U8_IN_QUEUE_COUNT:  Store the number of Input pins
39 *
40 * %SKL_TKN_U8_OUT_QUEUE_COUNT: Store the number of Output pins
41 *
42 * %SKL_TKN_U8_TIME_SLOT:       TDM slot number
43 *
44 * %SKL_TKN_U8_CORE_ID:         Stores module affinity value.Can take
45 *                              the values:
46 *                              SKL_AFFINITY_CORE_0 = 0,
47 *                              SKL_AFFINITY_CORE_1,
48 *                              SKL_AFFINITY_CORE_MAX
49 *
50 * %SKL_TKN_U8_MOD_TYPE:        Module type value.
51 *
52 * %SKL_TKN_U8_CONN_TYPE:       Module connection type can be a FE,
53 *                              BE or NONE as defined :
54 *                              SKL_PIPE_CONN_TYPE_NONE = 0,
55 *                              SKL_PIPE_CONN_TYPE_FE = 1 (HOST_DMA)
56 *                              SKL_PIPE_CONN_TYPE_BE = 2 (LINK_DMA)
57 *
58 * %SKL_TKN_U8_DEV_TYPE:        Type of device to which the module is
59 *                              connected
60 *                              Can take the values:
61 *                              SKL_DEVICE_BT = 0x0,
62 *                              SKL_DEVICE_DMIC = 0x1,
63 *                              SKL_DEVICE_I2S = 0x2,
64 *                              SKL_DEVICE_SLIMBUS = 0x3,
65 *                              SKL_DEVICE_HDALINK = 0x4,
66 *                              SKL_DEVICE_HDAHOST = 0x5,
67 *                              SKL_DEVICE_NONE
68 *
69 * %SKL_TKN_U8_HW_CONN_TYPE:    Connection type of the HW to which the
70 *                              module is connected
71 *                              SKL_CONN_NONE = 0,
72 *                              SKL_CONN_SOURCE = 1,
73 *                              SKL_CONN_SINK = 2
74 *
75 * %SKL_TKN_U16_PIN_INST_ID:    Stores the pin instance id
76 *
77 * %SKL_TKN_U16_MOD_INST_ID:    Stores the mdule instance id
78 *
79 * %SKL_TKN_U32_MAX_MCPS:       Module max mcps value
80 *
81 * %SKL_TKN_U32_MEM_PAGES:      Module resource pages
82 *
83 * %SKL_TKN_U32_OBS:            Stores Output Buffer size
84 *
85 * %SKL_TKN_U32_IBS:            Stores input buffer size
86 *
87 * %SKL_TKN_U32_VBUS_ID:        Module VBUS_ID. PDM=0, SSP0=0,
88 *                              SSP1=1,SSP2=2,
89 *                              SSP3=3, SSP4=4,
90 *                              SSP5=5, SSP6=6,INVALID
91 *
92 * %SKL_TKN_U32_PARAMS_FIXUP:   Module Params fixup mask
93 * %SKL_TKN_U32_CONVERTER:      Module params converter mask
94 * %SKL_TKN_U32_PIPE_ID:        Stores the pipe id
95 *
96 * %SKL_TKN_U32_PIPE_CONN_TYPE: Type of the token to which the pipe is
97 *                              connected to. It can be
98 *                              SKL_PIPE_CONN_TYPE_NONE = 0,
99 *                              SKL_PIPE_CONN_TYPE_FE = 1 (HOST_DMA),
100 *                              SKL_PIPE_CONN_TYPE_BE = 2 (LINK_DMA),
101 *
102 * %SKL_TKN_U32_PIPE_PRIORITY:  Pipe priority value
103 * %SKL_TKN_U32_PIPE_MEM_PGS:   Pipe resource pages
104 *
105 * %SKL_TKN_U32_DIR_PIN_COUNT:  Value for the direction to set input/output
106 *                              formats and the pin count.
107 *                              The first 4 bits have the direction
108 *                              value and the next 4 have
109 *                              the pin count value.
110 *                              SKL_DIR_IN = 0, SKL_DIR_OUT = 1.
111 *                              The input and output formats
112 *                              share the same set of tokens
113 *                              with the distinction between input
114 *                              and output made by reading direction
115 *                              token.
116 *
117 * %SKL_TKN_U32_FMT_CH:         Supported channel count
118 *
119 * %SKL_TKN_U32_FMT_FREQ:       Supported frequency/sample rate
120 *
121 * %SKL_TKN_U32_FMT_BIT_DEPTH:  Supported container size
122 *
123 * %SKL_TKN_U32_FMT_SAMPLE_SIZE:Number of samples in the container
124 *
125 * %SKL_TKN_U32_FMT_CH_CONFIG:  Supported channel configurations for the
126 *                              input/output.
127 *
128 * %SKL_TKN_U32_FMT_INTERLEAVE: Interleaving style which can be per
129 *                              channel or per sample. The values can be :
130 *                              SKL_INTERLEAVING_PER_CHANNEL = 0,
131 *                              SKL_INTERLEAVING_PER_SAMPLE = 1,
132 *
133 * %SKL_TKN_U32_FMT_SAMPLE_TYPE:
134 *                              Specifies the sample type. Can take the
135 *                              values: SKL_SAMPLE_TYPE_INT_MSB = 0,
136 *                              SKL_SAMPLE_TYPE_INT_LSB = 1,
137 *                              SKL_SAMPLE_TYPE_INT_SIGNED = 2,
138 *                              SKL_SAMPLE_TYPE_INT_UNSIGNED = 3,
139 *                              SKL_SAMPLE_TYPE_FLOAT = 4
140 *
141 * %SKL_TKN_U32_CH_MAP:         Channel map values
142 * %SKL_TKN_U32_MOD_SET_PARAMS: It can take these values:
143 *                              SKL_PARAM_DEFAULT, SKL_PARAM_INIT,
144 *                              SKL_PARAM_SET, SKL_PARAM_BIND
145 *
146 * %SKL_TKN_U32_MOD_PARAM_ID:   ID of the module params
147 *
148 * %SKL_TKN_U32_CAPS_SET_PARAMS:
149 *                              Set params value
150 *
151 * %SKL_TKN_U32_CAPS_PARAMS_ID: Params ID
152 *
153 * %SKL_TKN_U32_CAPS_SIZE:      Caps size
154 *
155 * %SKL_TKN_U32_PROC_DOMAIN:    Specify processing domain
156 *
157 * %SKL_TKN_U32_LIB_COUNT:      Specifies the number of libraries
158 *
159 * %SKL_TKN_STR_LIB_NAME:       Specifies the library name
160 *
161 * %SKL_TKN_U32_PMODE:		Specifies the power mode for pipe
162 *
163 * %SKL_TKL_U32_D0I3_CAPS:	Specifies the D0i3 capability for module
164 *
165 * %SKL_TKN_U32_DMA_BUF_SIZE:	DMA buffer size in millisec
166 *
167 * %SKL_TKN_U32_PIPE_DIR:       Specifies pipe direction. Can be
168 *                              playback/capture.
169 *
170 * %SKL_TKN_U32_NUM_CONFIGS:    Number of pipe configs
171 *
172 * %SKL_TKN_U32_PATH_MEM_PGS:   Size of memory (in pages) required for pipeline
173 *                              and its data
174 *
175 * %SKL_TKN_U32_PIPE_CONFIG_ID: Config id for the modules in the pipe
176 *                              and PCM params supported by that pipe
177 *                              config. This is used as index to fill
178 *                              up the pipe config and module config
179 *                              structure.
180 *
181 * %SKL_TKN_U32_CFG_FREQ:
182 * %SKL_TKN_U8_CFG_CHAN:
183 * %SKL_TKN_U8_CFG_BPS:         PCM params (freq, channels, bits per sample)
184 *                              supported for each of the pipe configs.
185 *
186 * %SKL_TKN_CFG_MOD_RES_ID:     Module's resource index for each of the
187 *                              pipe config
188 *
189 * %SKL_TKN_CFG_MOD_FMT_ID:     Module's interface index for each of the
190 *                              pipe config
191 *
192 * %SKL_TKN_U8_NUM_MOD:         Number of modules in the manifest
193 *
194 * %SKL_TKN_MM_U8_MOD_IDX:      Current index of the module in the manifest
195 *
196 * %SKL_TKN_MM_U8_NUM_RES:      Number of resources for the module
197 *
198 * %SKL_TKN_MM_U8_NUM_INTF:     Number of interfaces for the module
199 *
200 * %SKL_TKN_MM_U32_RES_ID:      Resource index for the resource info to
201 *                              be filled into.
202 *                              A module can support multiple resource
203 *                              configuration and is represnted as a
204 *                              resource table. This index is used to
205 *                              fill information into appropriate index.
206 *
207 * %SKL_TKN_MM_U32_CPS:         DSP cycles per second
208 *
209 * %SKL_TKN_MM_U32_DMA_SIZE:    Allocated buffer size for gateway DMA
210 *
211 * %SKL_TKN_MM_U32_CPC:         DSP cycles allocated per frame
212 *
213 * %SKL_TKN_MM_U32_RES_PIN_ID:  Resource pin index in the module
214 *
215 * %SKL_TKN_MM_U32_INTF_PIN_ID: Interface index in the module
216 *
217 * %SKL_TKN_MM_U32_PIN_BUF:     Buffer size of the module pin
218 *
219 * %SKL_TKN_MM_U32_FMT_ID:      Format index for each of the interface/
220 *                              format information to be filled into.
221 *
222 * %SKL_TKN_MM_U32_NUM_IN_FMT:  Number of input formats
223 * %SKL_TKN_MM_U32_NUM_OUT_FMT: Number of output formats
224 *
225 * %SKL_TKN_U32_ASTATE_IDX:     Table Index for the A-State entry to be filled
226 *                              with kcps and clock source
227 *
228 * %SKL_TKN_U32_ASTATE_COUNT:   Number of valid entries in A-State table
229 *
230 * %SKL_TKN_U32_ASTATE_KCPS:    Specifies the core load threshold (in kilo
231 *                              cycles per second) below which DSP is clocked
232 *                              from source specified by clock source.
233 *
234 * %SKL_TKN_U32_ASTATE_CLK_SRC: Clock source for A-State entry
235 *
236 * module_id and loadable flags dont have tokens as these values will be
237 * read from the DSP FW manifest
238 *
239 * Tokens defined can be used either in the manifest or widget private data.
240 *
241 * SKL_TKN_MM is used as a suffix for all tokens that represent
242 * module data in the manifest.
243 */
244enum SKL_TKNS {
245	SKL_TKN_UUID = 1,
246	SKL_TKN_U8_NUM_BLOCKS,
247	SKL_TKN_U8_BLOCK_TYPE,
248	SKL_TKN_U8_IN_PIN_TYPE,
249	SKL_TKN_U8_OUT_PIN_TYPE,
250	SKL_TKN_U8_DYN_IN_PIN,
251	SKL_TKN_U8_DYN_OUT_PIN,
252	SKL_TKN_U8_IN_QUEUE_COUNT,
253	SKL_TKN_U8_OUT_QUEUE_COUNT,
254	SKL_TKN_U8_TIME_SLOT,
255	SKL_TKN_U8_CORE_ID,
256	SKL_TKN_U8_MOD_TYPE,
257	SKL_TKN_U8_CONN_TYPE,
258	SKL_TKN_U8_DEV_TYPE,
259	SKL_TKN_U8_HW_CONN_TYPE,
260	SKL_TKN_U16_MOD_INST_ID,
261	SKL_TKN_U16_BLOCK_SIZE,
262	SKL_TKN_U32_MAX_MCPS,
263	SKL_TKN_U32_MEM_PAGES,
264	SKL_TKN_U32_OBS,
265	SKL_TKN_U32_IBS,
266	SKL_TKN_U32_VBUS_ID,
267	SKL_TKN_U32_PARAMS_FIXUP,
268	SKL_TKN_U32_CONVERTER,
269	SKL_TKN_U32_PIPE_ID,
270	SKL_TKN_U32_PIPE_CONN_TYPE,
271	SKL_TKN_U32_PIPE_PRIORITY,
272	SKL_TKN_U32_PIPE_MEM_PGS,
273	SKL_TKN_U32_DIR_PIN_COUNT,
274	SKL_TKN_U32_FMT_CH,
275	SKL_TKN_U32_FMT_FREQ,
276	SKL_TKN_U32_FMT_BIT_DEPTH,
277	SKL_TKN_U32_FMT_SAMPLE_SIZE,
278	SKL_TKN_U32_FMT_CH_CONFIG,
279	SKL_TKN_U32_FMT_INTERLEAVE,
280	SKL_TKN_U32_FMT_SAMPLE_TYPE,
281	SKL_TKN_U32_FMT_CH_MAP,
282	SKL_TKN_U32_PIN_MOD_ID,
283	SKL_TKN_U32_PIN_INST_ID,
284	SKL_TKN_U32_MOD_SET_PARAMS,
285	SKL_TKN_U32_MOD_PARAM_ID,
286	SKL_TKN_U32_CAPS_SET_PARAMS,
287	SKL_TKN_U32_CAPS_PARAMS_ID,
288	SKL_TKN_U32_CAPS_SIZE,
289	SKL_TKN_U32_PROC_DOMAIN,
290	SKL_TKN_U32_LIB_COUNT,
291	SKL_TKN_STR_LIB_NAME,
292	SKL_TKN_U32_PMODE,
293	SKL_TKL_U32_D0I3_CAPS, /* Typo added at v4.10 */
294	SKL_TKN_U32_D0I3_CAPS = SKL_TKL_U32_D0I3_CAPS,
295	SKL_TKN_U32_DMA_BUF_SIZE,
296
297	SKL_TKN_U32_PIPE_DIRECTION,
298	SKL_TKN_U32_PIPE_CONFIG_ID,
299	SKL_TKN_U32_NUM_CONFIGS,
300	SKL_TKN_U32_PATH_MEM_PGS,
301
302	SKL_TKN_U32_CFG_FREQ,
303	SKL_TKN_U8_CFG_CHAN,
304	SKL_TKN_U8_CFG_BPS,
305	SKL_TKN_CFG_MOD_RES_ID,
306	SKL_TKN_CFG_MOD_FMT_ID,
307	SKL_TKN_U8_NUM_MOD,
308
309	SKL_TKN_MM_U8_MOD_IDX,
310	SKL_TKN_MM_U8_NUM_RES,
311	SKL_TKN_MM_U8_NUM_INTF,
312	SKL_TKN_MM_U32_RES_ID,
313	SKL_TKN_MM_U32_CPS,
314	SKL_TKN_MM_U32_DMA_SIZE,
315	SKL_TKN_MM_U32_CPC,
316	SKL_TKN_MM_U32_RES_PIN_ID,
317	SKL_TKN_MM_U32_INTF_PIN_ID,
318	SKL_TKN_MM_U32_PIN_BUF,
319	SKL_TKN_MM_U32_FMT_ID,
320	SKL_TKN_MM_U32_NUM_IN_FMT,
321	SKL_TKN_MM_U32_NUM_OUT_FMT,
322
323	SKL_TKN_U32_ASTATE_IDX,
324	SKL_TKN_U32_ASTATE_COUNT,
325	SKL_TKN_U32_ASTATE_KCPS,
326	SKL_TKN_U32_ASTATE_CLK_SRC,
327	SKL_TKN_MAX = SKL_TKN_U32_ASTATE_CLK_SRC,
328};
329
330#endif
331