xref: /openbmc/linux/sound/soc/intel/avs/messages.h (revision 65b96377)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright(c) 2021-2022 Intel Corporation. All rights reserved.
4  *
5  * Authors: Cezary Rojewski <cezary.rojewski@intel.com>
6  *          Amadeusz Slawinski <amadeuszx.slawinski@linux.intel.com>
7  */
8 
9 #ifndef __SOUND_SOC_INTEL_AVS_MSGS_H
10 #define __SOUND_SOC_INTEL_AVS_MSGS_H
11 
12 struct avs_dev;
13 
14 #define AVS_MAILBOX_SIZE 4096
15 
16 enum avs_msg_target {
17 	AVS_FW_GEN_MSG = 0,
18 	AVS_MOD_MSG = 1
19 };
20 
21 enum avs_msg_direction {
22 	AVS_MSG_REQUEST = 0,
23 	AVS_MSG_REPLY = 1
24 };
25 
26 enum avs_global_msg_type {
27 	AVS_GLB_ROM_CONTROL = 1,
28 	AVS_GLB_LOAD_MULTIPLE_MODULES = 15,
29 	AVS_GLB_UNLOAD_MULTIPLE_MODULES = 16,
30 	AVS_GLB_CREATE_PIPELINE = 17,
31 	AVS_GLB_DELETE_PIPELINE = 18,
32 	AVS_GLB_SET_PIPELINE_STATE = 19,
33 	AVS_GLB_GET_PIPELINE_STATE = 20,
34 	AVS_GLB_LOAD_LIBRARY = 24,
35 	AVS_GLB_NOTIFICATION = 27,
36 };
37 
38 union avs_global_msg {
39 	u64 val;
40 	struct {
41 		union {
42 			u32 primary;
43 			struct {
44 				u32 rsvd:24;
45 				u32 global_msg_type:5;
46 				u32 msg_direction:1;
47 				u32 msg_target:1;
48 			};
49 			/* set boot config */
50 			struct {
51 				u32 rom_ctrl_msg_type:9;
52 				u32 dma_id:5;
53 				u32 purge_request:1;
54 			} boot_cfg;
55 			/* module loading */
56 			struct {
57 				u32 mod_cnt:8;
58 			} load_multi_mods;
59 			/* pipeline management */
60 			struct {
61 				u32 ppl_mem_size:11;
62 				u32 ppl_priority:5;
63 				u32 instance_id:8;
64 			} create_ppl;
65 			struct {
66 				u32 rsvd:16;
67 				u32 instance_id:8;
68 			} ppl; /* generic ppl request */
69 			struct {
70 				u32 state:16;
71 				u32 ppl_id:8;
72 			} set_ppl_state;
73 			struct {
74 				u32 ppl_id:8;
75 			} get_ppl_state;
76 			/* library loading */
77 			struct {
78 				u32 dma_id:5;
79 				u32 rsvd:11;
80 				u32 lib_id:4;
81 			} load_lib;
82 		};
83 		union {
84 			u32 val;
85 			/* pipeline management */
86 			struct {
87 				u32 lp:1; /* low power flag */
88 				u32 rsvd:3;
89 				u32 attributes:16; /* additional scheduling flags */
90 			} create_ppl;
91 		} ext;
92 	};
93 } __packed;
94 
95 struct avs_tlv {
96 	u32 type;
97 	u32 length;
98 	u32 value[];
99 } __packed;
100 
101 enum avs_module_msg_type {
102 	AVS_MOD_INIT_INSTANCE = 0,
103 	AVS_MOD_LARGE_CONFIG_GET = 3,
104 	AVS_MOD_LARGE_CONFIG_SET = 4,
105 	AVS_MOD_BIND = 5,
106 	AVS_MOD_UNBIND = 6,
107 	AVS_MOD_SET_DX = 7,
108 	AVS_MOD_SET_D0IX = 8,
109 	AVS_MOD_DELETE_INSTANCE = 11,
110 };
111 
112 union avs_module_msg {
113 	u64 val;
114 	struct {
115 		union {
116 			u32 primary;
117 			struct {
118 				u32 module_id:16;
119 				u32 instance_id:8;
120 				u32 module_msg_type:5;
121 				u32 msg_direction:1;
122 				u32 msg_target:1;
123 			};
124 		};
125 		union {
126 			u32 val;
127 			struct {
128 				u32 param_block_size:16;
129 				u32 ppl_instance_id:8;
130 				u32 core_id:4;
131 				u32 proc_domain:1;
132 			} init_instance;
133 			struct {
134 				u32 data_off_size:20;
135 				u32 large_param_id:8;
136 				u32 final_block:1;
137 				u32 init_block:1;
138 			} large_config;
139 			struct {
140 				u32 dst_module_id:16;
141 				u32 dst_instance_id:8;
142 				u32 dst_queue:3;
143 				u32 src_queue:3;
144 			} bind_unbind;
145 			struct {
146 				u32 wake:1;
147 				u32 streaming:1;
148 			} set_d0ix;
149 		} ext;
150 	};
151 } __packed;
152 
153 union avs_reply_msg {
154 	u64 val;
155 	struct {
156 		union {
157 			u32 primary;
158 			struct {
159 				u32 status:24;
160 				u32 global_msg_type:5;
161 				u32 msg_direction:1;
162 				u32 msg_target:1;
163 			};
164 		};
165 		union {
166 			u32 val;
167 			/* module loading */
168 			struct {
169 				u32 err_mod_id:16;
170 			} load_multi_mods;
171 			/* pipeline management */
172 			struct {
173 				u32 state:5;
174 			} get_ppl_state;
175 			/* module management */
176 			struct {
177 				u32 data_off_size:20;
178 				u32 large_param_id:8;
179 				u32 final_block:1;
180 				u32 init_block:1;
181 			} large_config;
182 		} ext;
183 	};
184 } __packed;
185 
186 enum avs_notify_msg_type {
187 	AVS_NOTIFY_PHRASE_DETECTED = 4,
188 	AVS_NOTIFY_RESOURCE_EVENT = 5,
189 	AVS_NOTIFY_FW_READY = 8,
190 	AVS_NOTIFY_MODULE_EVENT = 12,
191 };
192 
193 union avs_notify_msg {
194 	u64 val;
195 	struct {
196 		union {
197 			u32 primary;
198 			struct {
199 				u32 rsvd:16;
200 				u32 notify_msg_type:8;
201 				u32 global_msg_type:5;
202 				u32 msg_direction:1;
203 				u32 msg_target:1;
204 			};
205 		};
206 		union {
207 			u32 val;
208 		} ext;
209 	};
210 } __packed;
211 
212 #define AVS_MSG(hdr) { .val = hdr }
213 
214 #define AVS_GLOBAL_REQUEST(msg_type)		\
215 {						\
216 	.global_msg_type = AVS_GLB_##msg_type,	\
217 	.msg_direction = AVS_MSG_REQUEST,	\
218 	.msg_target = AVS_FW_GEN_MSG,		\
219 }
220 
221 #define AVS_MODULE_REQUEST(msg_type)		\
222 {						\
223 	.module_msg_type = AVS_MOD_##msg_type,	\
224 	.msg_direction = AVS_MSG_REQUEST,	\
225 	.msg_target = AVS_MOD_MSG,		\
226 }
227 
228 #define AVS_NOTIFICATION(msg_type)		\
229 {						\
230 	.notify_msg_type = AVS_NOTIFY_##msg_type,\
231 	.global_msg_type = AVS_GLB_NOTIFICATION,\
232 	.msg_direction = AVS_MSG_REPLY,		\
233 	.msg_target = AVS_FW_GEN_MSG,		\
234 }
235 
236 #define avs_msg_is_reply(hdr) \
237 ({ \
238 	union avs_reply_msg __msg = AVS_MSG(hdr); \
239 	__msg.msg_direction == AVS_MSG_REPLY && \
240 	__msg.global_msg_type != AVS_GLB_NOTIFICATION; \
241 })
242 
243 /* Notification types */
244 
245 struct avs_notify_voice_data {
246 	u16 kpd_score;
247 	u16 reserved;
248 } __packed;
249 
250 struct avs_notify_res_data {
251 	u32 resource_type;
252 	u32 resource_id;
253 	u32 event_type;
254 	u32 reserved;
255 	u32 data[6];
256 } __packed;
257 
258 struct avs_notify_mod_data {
259 	u32 module_instance_id;
260 	u32 event_id;
261 	u32 data_size;
262 	u32 data[];
263 } __packed;
264 
265 /* ROM messages */
266 enum avs_rom_control_msg_type {
267 	AVS_ROM_SET_BOOT_CONFIG = 0,
268 };
269 
270 int avs_ipc_set_boot_config(struct avs_dev *adev, u32 dma_id, u32 purge);
271 
272 /* Code loading messages */
273 int avs_ipc_load_modules(struct avs_dev *adev, u16 *mod_ids, u32 num_mod_ids);
274 int avs_ipc_unload_modules(struct avs_dev *adev, u16 *mod_ids, u32 num_mod_ids);
275 int avs_ipc_load_library(struct avs_dev *adev, u32 dma_id, u32 lib_id);
276 
277 /* Pipeline management messages */
278 enum avs_pipeline_state {
279 	AVS_PPL_STATE_INVALID,
280 	AVS_PPL_STATE_UNINITIALIZED,
281 	AVS_PPL_STATE_RESET,
282 	AVS_PPL_STATE_PAUSED,
283 	AVS_PPL_STATE_RUNNING,
284 };
285 
286 int avs_ipc_create_pipeline(struct avs_dev *adev, u16 req_size, u8 priority,
287 			    u8 instance_id, bool lp, u16 attributes);
288 int avs_ipc_delete_pipeline(struct avs_dev *adev, u8 instance_id);
289 int avs_ipc_set_pipeline_state(struct avs_dev *adev, u8 instance_id,
290 			       enum avs_pipeline_state state);
291 int avs_ipc_get_pipeline_state(struct avs_dev *adev, u8 instance_id,
292 			       enum avs_pipeline_state *state);
293 
294 /* Module management messages */
295 int avs_ipc_init_instance(struct avs_dev *adev, u16 module_id, u8 instance_id,
296 			  u8 ppl_id, u8 core_id, u8 domain,
297 			  void *param, u32 param_size);
298 int avs_ipc_delete_instance(struct avs_dev *adev, u16 module_id, u8 instance_id);
299 int avs_ipc_bind(struct avs_dev *adev, u16 module_id, u8 instance_id,
300 		 u16 dst_module_id, u8 dst_instance_id,
301 		 u8 dst_queue, u8 src_queue);
302 int avs_ipc_unbind(struct avs_dev *adev, u16 module_id, u8 instance_id,
303 		   u16 dst_module_id, u8 dst_instance_id,
304 		   u8 dst_queue, u8 src_queue);
305 int avs_ipc_set_large_config(struct avs_dev *adev, u16 module_id,
306 			     u8 instance_id, u8 param_id,
307 			     u8 *request, size_t request_size);
308 int avs_ipc_get_large_config(struct avs_dev *adev, u16 module_id, u8 instance_id,
309 			     u8 param_id, u8 *request_data, size_t request_size,
310 			     u8 **reply_data, size_t *reply_size);
311 
312 /* DSP cores and domains power management messages */
313 struct avs_dxstate_info {
314 	u32 core_mask;	/* which cores are subject for power transition */
315 	u32 dx_mask;	/* bit[n]=1 core n goes to D0, bit[n]=0 it goes to D3 */
316 } __packed;
317 
318 int avs_ipc_set_dx(struct avs_dev *adev, u32 core_mask, bool powerup);
319 int avs_ipc_set_d0ix(struct avs_dev *adev, bool enable_pg, bool streaming);
320 
321 /* Base-firmware runtime parameters */
322 
323 #define AVS_BASEFW_MOD_ID	0
324 #define AVS_BASEFW_INST_ID	0
325 
326 enum avs_basefw_runtime_param {
327 	AVS_BASEFW_FIRMWARE_CONFIG = 7,
328 	AVS_BASEFW_HARDWARE_CONFIG = 8,
329 	AVS_BASEFW_MODULES_INFO = 9,
330 	AVS_BASEFW_LIBRARIES_INFO = 16,
331 };
332 
333 struct avs_fw_version {
334 	u16 major;
335 	u16 minor;
336 	u16 hotfix;
337 	u16 build;
338 };
339 
340 enum avs_fw_cfg_params {
341 	AVS_FW_CFG_FW_VERSION = 0,
342 	AVS_FW_CFG_MEMORY_RECLAIMED,
343 	AVS_FW_CFG_SLOW_CLOCK_FREQ_HZ,
344 	AVS_FW_CFG_FAST_CLOCK_FREQ_HZ,
345 	AVS_FW_CFG_DMA_BUFFER_CONFIG,
346 	AVS_FW_CFG_ALH_SUPPORT_LEVEL,
347 	AVS_FW_CFG_IPC_DL_MAILBOX_BYTES,
348 	AVS_FW_CFG_IPC_UL_MAILBOX_BYTES,
349 	AVS_FW_CFG_TRACE_LOG_BYTES,
350 	AVS_FW_CFG_MAX_PPL_COUNT,
351 	AVS_FW_CFG_MAX_ASTATE_COUNT,
352 	AVS_FW_CFG_MAX_MODULE_PIN_COUNT,
353 	AVS_FW_CFG_MODULES_COUNT,
354 	AVS_FW_CFG_MAX_MOD_INST_COUNT,
355 	AVS_FW_CFG_MAX_LL_TASKS_PER_PRI_COUNT,
356 	AVS_FW_CFG_LL_PRI_COUNT,
357 	AVS_FW_CFG_MAX_DP_TASKS_COUNT,
358 	AVS_FW_CFG_MAX_LIBS_COUNT,
359 	AVS_FW_CFG_SCHEDULER_CONFIG,
360 	AVS_FW_CFG_XTAL_FREQ_HZ,
361 	AVS_FW_CFG_CLOCKS_CONFIG,
362 	AVS_FW_CFG_RESERVED,
363 	AVS_FW_CFG_POWER_GATING_POLICY,
364 	AVS_FW_CFG_ASSERT_MODE,
365 };
366 
367 struct avs_fw_cfg {
368 	struct avs_fw_version fw_version;
369 	u32 memory_reclaimed;
370 	u32 slow_clock_freq_hz;
371 	u32 fast_clock_freq_hz;
372 	u32 alh_support;
373 	u32 ipc_dl_mailbox_bytes;
374 	u32 ipc_ul_mailbox_bytes;
375 	u32 trace_log_bytes;
376 	u32 max_ppl_count;
377 	u32 max_astate_count;
378 	u32 max_module_pin_count;
379 	u32 modules_count;
380 	u32 max_mod_inst_count;
381 	u32 max_ll_tasks_per_pri_count;
382 	u32 ll_pri_count;
383 	u32 max_dp_tasks_count;
384 	u32 max_libs_count;
385 	u32 xtal_freq_hz;
386 	u32 power_gating_policy;
387 };
388 
389 int avs_ipc_get_fw_config(struct avs_dev *adev, struct avs_fw_cfg *cfg);
390 
391 enum avs_hw_cfg_params {
392 	AVS_HW_CFG_AVS_VER,
393 	AVS_HW_CFG_DSP_CORES,
394 	AVS_HW_CFG_MEM_PAGE_BYTES,
395 	AVS_HW_CFG_TOTAL_PHYS_MEM_PAGES,
396 	AVS_HW_CFG_I2S_CAPS,
397 	AVS_HW_CFG_GPDMA_CAPS,
398 	AVS_HW_CFG_GATEWAY_COUNT,
399 	AVS_HW_CFG_HP_EBB_COUNT,
400 	AVS_HW_CFG_LP_EBB_COUNT,
401 	AVS_HW_CFG_EBB_SIZE_BYTES,
402 };
403 
404 enum avs_iface_version {
405 	AVS_AVS_VER_1_5 = 0x10005,
406 	AVS_AVS_VER_1_8 = 0x10008,
407 };
408 
409 enum avs_i2s_version {
410 	AVS_I2S_VER_15_SKYLAKE   = 0x00000,
411 	AVS_I2S_VER_15_BROXTON   = 0x10000,
412 	AVS_I2S_VER_15_BROXTON_P = 0x20000,
413 	AVS_I2S_VER_18_KBL_CNL   = 0x30000,
414 };
415 
416 struct avs_i2s_caps {
417 	u32 i2s_version;
418 	u32 ctrl_count;
419 	u32 *ctrl_base_addr;
420 };
421 
422 struct avs_hw_cfg {
423 	u32 avs_version;
424 	u32 dsp_cores;
425 	u32 mem_page_bytes;
426 	u32 total_phys_mem_pages;
427 	struct avs_i2s_caps i2s_caps;
428 	u32 gateway_count;
429 	u32 hp_ebb_count;
430 	u32 lp_ebb_count;
431 	u32 ebb_size_bytes;
432 };
433 
434 int avs_ipc_get_hw_config(struct avs_dev *adev, struct avs_hw_cfg *cfg);
435 
436 #define AVS_MODULE_LOAD_TYPE_BUILTIN	0
437 #define AVS_MODULE_LOAD_TYPE_LOADABLE	1
438 #define AVS_MODULE_STATE_LOADED		BIT(0)
439 
440 struct avs_module_type {
441 	u32 load_type:4;
442 	u32 auto_start:1;
443 	u32 domain_ll:1;
444 	u32 domain_dp:1;
445 	u32 lib_code:1;
446 	u32 rsvd:24;
447 } __packed;
448 
449 union avs_segment_flags {
450 	u32 ul;
451 	struct {
452 		u32 contents:1;
453 		u32 alloc:1;
454 		u32 load:1;
455 		u32 readonly:1;
456 		u32 code:1;
457 		u32 data:1;
458 		u32 rsvd_1:2;
459 		u32 type:4;
460 		u32 rsvd_2:4;
461 		u32 length:16;
462 	};
463 } __packed;
464 
465 struct avs_segment_desc {
466 	union avs_segment_flags flags;
467 	u32 v_base_addr;
468 	u32 file_offset;
469 } __packed;
470 
471 struct avs_module_entry {
472 	u16 module_id;
473 	u16 state_flags;
474 	u8 name[8];
475 	guid_t uuid;
476 	struct avs_module_type type;
477 	u8 hash[32];
478 	u32 entry_point;
479 	u16 cfg_offset;
480 	u16 cfg_count;
481 	u32 affinity_mask;
482 	u16 instance_max_count;
483 	u16 instance_bss_size;
484 	struct avs_segment_desc segments[3];
485 } __packed;
486 
487 struct avs_mods_info {
488 	u32 count;
489 	struct avs_module_entry entries[];
490 } __packed;
491 
492 static inline bool avs_module_entry_is_loaded(struct avs_module_entry *mentry)
493 {
494 	return mentry->type.load_type == AVS_MODULE_LOAD_TYPE_BUILTIN ||
495 	       mentry->state_flags & AVS_MODULE_STATE_LOADED;
496 }
497 
498 int avs_ipc_get_modules_info(struct avs_dev *adev, struct avs_mods_info **info);
499 
500 /* Module configuration */
501 
502 #define AVS_MIXIN_MOD_UUID \
503 	GUID_INIT(0x39656EB2, 0x3B71, 0x4049, 0x8D, 0x3F, 0xF9, 0x2C, 0xD5, 0xC4, 0x3C, 0x09)
504 
505 #define AVS_MIXOUT_MOD_UUID \
506 	GUID_INIT(0x3C56505A, 0x24D7, 0x418F, 0xBD, 0xDC, 0xC1, 0xF5, 0xA3, 0xAC, 0x2A, 0xE0)
507 
508 #define AVS_COPIER_MOD_UUID \
509 	GUID_INIT(0x9BA00C83, 0xCA12, 0x4A83, 0x94, 0x3C, 0x1F, 0xA2, 0xE8, 0x2F, 0x9D, 0xDA)
510 
511 #define AVS_KPBUFF_MOD_UUID \
512 	GUID_INIT(0xA8A0CB32, 0x4A77, 0x4DB1, 0x85, 0xC7, 0x53, 0xD7, 0xEE, 0x07, 0xBC, 0xE6)
513 
514 #define AVS_MICSEL_MOD_UUID \
515 	GUID_INIT(0x32FE92C1, 0x1E17, 0x4FC2, 0x97, 0x58, 0xC7, 0xF3, 0x54, 0x2E, 0x98, 0x0A)
516 
517 #define AVS_MUX_MOD_UUID \
518 	GUID_INIT(0x64CE6E35, 0x857A, 0x4878, 0xAC, 0xE8, 0xE2, 0xA2, 0xF4, 0x2e, 0x30, 0x69)
519 
520 #define AVS_UPDWMIX_MOD_UUID \
521 	GUID_INIT(0x42F8060C, 0x832F, 0x4DBF, 0xB2, 0x47, 0x51, 0xE9, 0x61, 0x99, 0x7b, 0x35)
522 
523 #define AVS_SRCINTC_MOD_UUID \
524 	GUID_INIT(0xE61BB28D, 0x149A, 0x4C1F, 0xB7, 0x09, 0x46, 0x82, 0x3E, 0xF5, 0xF5, 0xAE)
525 
526 #define AVS_PROBE_MOD_UUID \
527 	GUID_INIT(0x7CAD0808, 0xAB10, 0xCD23, 0xEF, 0x45, 0x12, 0xAB, 0x34, 0xCD, 0x56, 0xEF)
528 
529 #define AVS_AEC_MOD_UUID \
530 	GUID_INIT(0x46CB87FB, 0xD2C9, 0x4970, 0x96, 0xD2, 0x6D, 0x7E, 0x61, 0x4B, 0xB6, 0x05)
531 
532 #define AVS_ASRC_MOD_UUID \
533 	GUID_INIT(0x66B4402D, 0xB468, 0x42F2, 0x81, 0xA7, 0xB3, 0x71, 0x21, 0x86, 0x3D, 0xD4)
534 
535 #define AVS_INTELWOV_MOD_UUID \
536 	GUID_INIT(0xEC774FA9, 0x28D3, 0x424A, 0x90, 0xE4, 0x69, 0xF9, 0x84, 0xF1, 0xEE, 0xB7)
537 
538 /* channel map */
539 enum avs_channel_index {
540 	AVS_CHANNEL_LEFT = 0,
541 	AVS_CHANNEL_RIGHT = 1,
542 	AVS_CHANNEL_CENTER = 2,
543 	AVS_CHANNEL_LEFT_SURROUND = 3,
544 	AVS_CHANNEL_CENTER_SURROUND = 3,
545 	AVS_CHANNEL_RIGHT_SURROUND = 4,
546 	AVS_CHANNEL_LFE = 7,
547 	AVS_CHANNEL_INVALID = 0xF,
548 };
549 
550 enum avs_channel_config {
551 	AVS_CHANNEL_CONFIG_MONO = 0,
552 	AVS_CHANNEL_CONFIG_STEREO = 1,
553 	AVS_CHANNEL_CONFIG_2_1 = 2,
554 	AVS_CHANNEL_CONFIG_3_0 = 3,
555 	AVS_CHANNEL_CONFIG_3_1 = 4,
556 	AVS_CHANNEL_CONFIG_QUATRO = 5,
557 	AVS_CHANNEL_CONFIG_4_0 = 6,
558 	AVS_CHANNEL_CONFIG_5_0 = 7,
559 	AVS_CHANNEL_CONFIG_5_1 = 8,
560 	AVS_CHANNEL_CONFIG_DUAL_MONO = 9,
561 	AVS_CHANNEL_CONFIG_I2S_DUAL_STEREO_0 = 10,
562 	AVS_CHANNEL_CONFIG_I2S_DUAL_STEREO_1 = 11,
563 	AVS_CHANNEL_CONFIG_4_CHANNEL = 12,
564 	AVS_CHANNEL_CONFIG_INVALID
565 };
566 
567 enum avs_interleaving {
568 	AVS_INTERLEAVING_PER_CHANNEL = 0,
569 	AVS_INTERLEAVING_PER_SAMPLE = 1,
570 };
571 
572 enum avs_sample_type {
573 	AVS_SAMPLE_TYPE_INT_MSB = 0,
574 	AVS_SAMPLE_TYPE_INT_LSB = 1,
575 	AVS_SAMPLE_TYPE_INT_SIGNED = 2,
576 	AVS_SAMPLE_TYPE_INT_UNSIGNED = 3,
577 	AVS_SAMPLE_TYPE_FLOAT = 4,
578 };
579 
580 #define AVS_CHANNELS_MAX	8
581 #define AVS_ALL_CHANNELS_MASK	UINT_MAX
582 
583 struct avs_audio_format {
584 	u32 sampling_freq;
585 	u32 bit_depth;
586 	u32 channel_map;
587 	u32 channel_config;
588 	u32 interleaving;
589 	u32 num_channels:8;
590 	u32 valid_bit_depth:8;
591 	u32 sample_type:8;
592 	u32 reserved:8;
593 } __packed;
594 
595 struct avs_modcfg_base {
596 	u32 cpc;
597 	u32 ibs;
598 	u32 obs;
599 	u32 is_pages;
600 	struct avs_audio_format audio_fmt;
601 } __packed;
602 
603 struct avs_pin_format {
604 	u32 pin_index;
605 	u32 iobs;
606 	struct avs_audio_format audio_fmt;
607 } __packed;
608 
609 struct avs_modcfg_ext {
610 	struct avs_modcfg_base base;
611 	u16 num_input_pins;
612 	u16 num_output_pins;
613 	u8 reserved[12];
614 	/* input pin formats followed by output ones */
615 	struct avs_pin_format pin_fmts[];
616 } __packed;
617 
618 enum avs_dma_type {
619 	AVS_DMA_HDA_HOST_OUTPUT = 0,
620 	AVS_DMA_HDA_HOST_INPUT = 1,
621 	AVS_DMA_HDA_LINK_OUTPUT = 8,
622 	AVS_DMA_HDA_LINK_INPUT = 9,
623 	AVS_DMA_DMIC_LINK_INPUT = 11,
624 	AVS_DMA_I2S_LINK_OUTPUT = 12,
625 	AVS_DMA_I2S_LINK_INPUT = 13,
626 };
627 
628 union avs_virtual_index {
629 	u8 val;
630 	struct {
631 		u8 time_slot:4;
632 		u8 instance:4;
633 	} i2s;
634 	struct {
635 		u8 queue_id:3;
636 		u8 time_slot:2;
637 		u8 instance:3;
638 	} dmic;
639 } __packed;
640 
641 union avs_connector_node_id {
642 	u32 val;
643 	struct {
644 		u32 vindex:8;
645 		u32 dma_type:5;
646 		u32 rsvd:19;
647 	};
648 } __packed;
649 
650 #define INVALID_PIPELINE_ID	0xFF
651 #define INVALID_NODE_ID \
652 	((union avs_connector_node_id) { UINT_MAX })
653 
654 union avs_gtw_attributes {
655 	u32 val;
656 	struct {
657 		u32 lp_buffer_alloc:1;
658 		u32 rsvd:31;
659 	};
660 } __packed;
661 
662 struct avs_copier_gtw_cfg {
663 	union avs_connector_node_id node_id;
664 	u32 dma_buffer_size;
665 	u32 config_length;
666 	struct {
667 		union avs_gtw_attributes attrs;
668 		u32 blob[];
669 	} config;
670 } __packed;
671 
672 struct avs_copier_cfg {
673 	struct avs_modcfg_base base;
674 	struct avs_audio_format out_fmt;
675 	u32 feature_mask;
676 	struct avs_copier_gtw_cfg gtw_cfg;
677 } __packed;
678 
679 struct avs_micsel_cfg {
680 	struct avs_modcfg_base base;
681 	struct avs_audio_format out_fmt;
682 } __packed;
683 
684 struct avs_mux_cfg {
685 	struct avs_modcfg_base base;
686 	struct avs_audio_format ref_fmt;
687 	struct avs_audio_format out_fmt;
688 } __packed;
689 
690 struct avs_updown_mixer_cfg {
691 	struct avs_modcfg_base base;
692 	u32 out_channel_config;
693 	u32 coefficients_select;
694 	s32 coefficients[AVS_CHANNELS_MAX];
695 	u32 channel_map;
696 } __packed;
697 
698 struct avs_src_cfg {
699 	struct avs_modcfg_base base;
700 	u32 out_freq;
701 } __packed;
702 
703 struct avs_probe_gtw_cfg {
704 	union avs_connector_node_id node_id;
705 	u32 dma_buffer_size;
706 } __packed;
707 
708 struct avs_probe_cfg {
709 	struct avs_modcfg_base base;
710 	struct avs_probe_gtw_cfg gtw_cfg;
711 } __packed;
712 
713 struct avs_aec_cfg {
714 	struct avs_modcfg_base base;
715 	struct avs_audio_format ref_fmt;
716 	struct avs_audio_format out_fmt;
717 	u32 cpc_lp_mode;
718 } __packed;
719 
720 struct avs_asrc_cfg {
721 	struct avs_modcfg_base base;
722 	u32 out_freq;
723 	u32 rsvd0:1;
724 	u32 mode:1;
725 	u32 rsvd2:2;
726 	u32 disable_jitter_buffer:1;
727 	u32 rsvd3:27;
728 } __packed;
729 
730 struct avs_wov_cfg {
731 	struct avs_modcfg_base base;
732 	u32 cpc_lp_mode;
733 } __packed;
734 
735 /* Module runtime parameters */
736 
737 enum avs_copier_runtime_param {
738 	AVS_COPIER_SET_SINK_FORMAT = 2,
739 };
740 
741 struct avs_copier_sink_format {
742 	u32 sink_id;
743 	struct avs_audio_format src_fmt;
744 	struct avs_audio_format sink_fmt;
745 } __packed;
746 
747 int avs_ipc_copier_set_sink_format(struct avs_dev *adev, u16 module_id,
748 				   u8 instance_id, u32 sink_id,
749 				   const struct avs_audio_format *src_fmt,
750 				   const struct avs_audio_format *sink_fmt);
751 
752 #endif /* __SOUND_SOC_INTEL_AVS_MSGS_H */
753