1
2 #ifndef __SST_MFLD_DSP_H__
3 #define __SST_MFLD_DSP_H__
4
5
6
7
8
9
10
11
12
13
14 #define SST_MAX_BIN_BYTES 1024
15
16 #define MAX_DBG_RW_BYTES 80
17 #define MAX_NUM_SCATTER_BUFFERS 8
18 #define MAX_LOOP_BACK_DWORDS 8
19
20 #define SST_MAILBOX_SIZE 0x0400
21 #define SST_MAILBOX_SEND 0x0000
22 #define SST_TIME_STAMP 0x1800
23 #define SST_TIME_STAMP_MRFLD 0x800
24 #define SST_RESERVED_OFFSET 0x1A00
25 #define SST_SCU_LPE_MAILBOX 0x1000
26 #define SST_LPE_SCU_MAILBOX 0x1400
27 #define SST_SCU_LPE_LOG_BUF (SST_SCU_LPE_MAILBOX+16)
28 #define PROCESS_MSG 0x80
29
30
31
32
33
34 #define IPC_IA_PREP_LIB_DNLD 0x01
35 #define IPC_IA_LIB_DNLD_CMPLT 0x02
36 #define IPC_IA_GET_FW_VERSION 0x04
37 #define IPC_IA_GET_FW_BUILD_INF 0x05
38 #define IPC_IA_GET_FW_INFO 0x06
39 #define IPC_IA_GET_FW_CTXT 0x07
40 #define IPC_IA_SET_FW_CTXT 0x08
41 #define IPC_IA_PREPARE_SHUTDOWN 0x31
42
43 #define IPC_PREP_D3 0x10
44 #define IPC_IA_SET_CODEC_PARAMS 0x10
45 #define IPC_IA_GET_CODEC_PARAMS 0x11
46 #define IPC_IA_SET_PPP_PARAMS 0x12
47 #define IPC_IA_GET_PPP_PARAMS 0x13
48 #define IPC_SST_PERIOD_ELAPSED_MRFLD 0xA
49 #define IPC_IA_ALG_PARAMS 0x1A
50 #define IPC_IA_TUNING_PARAMS 0x1B
51 #define IPC_IA_SET_RUNTIME_PARAMS 0x1C
52 #define IPC_IA_SET_PARAMS 0x1
53 #define IPC_IA_GET_PARAMS 0x2
54
55 #define IPC_EFFECTS_CREATE 0xE
56 #define IPC_EFFECTS_DESTROY 0xF
57
58
59 #define IPC_IA_ALLOC_STREAM_MRFLD 0x2
60 #define IPC_IA_ALLOC_STREAM 0x20
61 #define IPC_IA_FREE_STREAM_MRFLD 0x03
62 #define IPC_IA_FREE_STREAM 0x21
63 #define IPC_IA_SET_STREAM_PARAMS 0x22
64 #define IPC_IA_SET_STREAM_PARAMS_MRFLD 0x12
65 #define IPC_IA_GET_STREAM_PARAMS 0x23
66 #define IPC_IA_PAUSE_STREAM 0x24
67 #define IPC_IA_PAUSE_STREAM_MRFLD 0x4
68 #define IPC_IA_RESUME_STREAM 0x25
69 #define IPC_IA_RESUME_STREAM_MRFLD 0x5
70 #define IPC_IA_DROP_STREAM 0x26
71 #define IPC_IA_DROP_STREAM_MRFLD 0x07
72 #define IPC_IA_DRAIN_STREAM 0x27
73 #define IPC_IA_DRAIN_STREAM_MRFLD 0x8
74 #define IPC_IA_CONTROL_ROUTING 0x29
75 #define IPC_IA_VTSV_UPDATE_MODULES 0x20
76 #define IPC_IA_VTSV_DETECTED 0x21
77
78 #define IPC_IA_START_STREAM_MRFLD 0X06
79 #define IPC_IA_START_STREAM 0x30
80
81 #define IPC_IA_SET_GAIN_MRFLD 0x21
82
83 #define IPC_IA_DBG_MEM_READ 0x40
84 #define IPC_IA_DBG_MEM_WRITE 0x41
85 #define IPC_IA_DBG_LOOP_BACK 0x42
86 #define IPC_IA_DBG_LOG_ENABLE 0x45
87 #define IPC_IA_DBG_SET_PROBE_PARAMS 0x47
88
89
90 #define IPC_IA_FW_INIT_CMPLT 0x81
91 #define IPC_IA_FW_INIT_CMPLT_MRFLD 0x01
92 #define IPC_IA_FW_ASYNC_ERR_MRFLD 0x11
93
94
95 #define IPC_SST_FRAGMENT_ELPASED 0x90
96
97 #define IPC_SST_BUF_UNDER_RUN 0x92
98 #define IPC_SST_BUF_OVER_RUN 0x93
99 #define IPC_SST_DRAIN_END 0x94
100 #define IPC_SST_CHNGE_SSP_PARAMS 0x95
101 #define IPC_SST_STREAM_PROCESS_FATAL_ERR 0x96
102 #define IPC_SST_PERIOD_ELAPSED 0x97
103
104 #define IPC_SST_ERROR_EVENT 0x99
105
106 #define IPC_SC_DDR_LINK_UP 0xC0
107 #define IPC_SC_DDR_LINK_DOWN 0xC1
108 #define IPC_SC_SET_LPECLK_REQ 0xC2
109 #define IPC_SC_SSP_BIT_BANG 0xC3
110
111
112 #define IPC_IA_MEM_ALLOC_FAIL 0xE0
113 #define IPC_IA_PROC_ERR 0xE1
114
115
116
117
118 #define IPC_IA_PRINT_STRING 0xF0
119
120
121 #define IPC_IA_BUF_UNDER_RUN_MRFLD 0x0B
122
123
124
125
126
127
128
129
130
131 #define SST_ASYNC_DRV_ID 0
132
133
134
135
136
137
138 enum ackData {
139 IPC_ACK_SUCCESS = 0,
140 IPC_ACK_FAILURE,
141 };
142
143 enum ipc_ia_msg_id {
144 IPC_CMD = 1,
145 IPC_SET_PARAMS = 2,
146 IPC_GET_PARAMS = 3,
147 IPC_INVALID = 0xFF,
148 };
149
150 enum sst_codec_types {
151
152 SST_CODEC_TYPE_UNKNOWN = 0,
153 SST_CODEC_TYPE_PCM,
154 SST_CODEC_TYPE_MP3,
155 SST_CODEC_TYPE_MP24,
156 SST_CODEC_TYPE_AAC,
157 SST_CODEC_TYPE_AACP,
158 SST_CODEC_TYPE_eAACP,
159 };
160
161 enum stream_type {
162 SST_STREAM_TYPE_NONE = 0,
163 SST_STREAM_TYPE_MUSIC = 1,
164 };
165
166 enum sst_error_codes {
167
168
169 SST_SUCCESS = 0,
170 SST_ERR_INVALID_STREAM_ID = 1,
171 SST_ERR_INVALID_MSG_ID = 2,
172 SST_ERR_INVALID_STREAM_OP = 3,
173 SST_ERR_INVALID_PARAMS = 4,
174 SST_ERR_INVALID_CODEC = 5,
175 SST_ERR_INVALID_MEDIA_TYPE = 6,
176 SST_ERR_STREAM_ERR = 7,
177
178 SST_ERR_STREAM_IN_USE = 15,
179 };
180
181 struct ipc_dsp_hdr {
182 u16 mod_index_id:8;
183 u16 pipe_id:8;
184 u16 mod_id;
185 u16 cmd_id;
186 u16 length;
187 } __packed;
188
189 union ipc_header_high {
190 struct {
191 u32 msg_id:8;
192 u32 task_id:4;
193 u32 drv_id:4;
194 u32 rsvd1:8;
195 u32 result:4;
196 u32 res_rqd:1;
197 u32 large:1;
198 u32 done:1;
199 u32 busy:1;
200 } part;
201 u32 full;
202 } __packed;
203
204 union ipc_header_mrfld {
205 struct {
206 u32 header_low_payload;
207 union ipc_header_high header_high;
208 } p;
209 u64 full;
210 } __packed;
211
212
213
214 union ipc_header {
215 struct {
216 u32 msg_id:8;
217 u32 str_id:5;
218 u32 large:1;
219 u32 reserved:2;
220 u32 data:14;
221 u32 done:1;
222 u32 busy:1;
223 } part;
224 u32 full;
225 } __packed;
226
227
228 struct sst_fw_build_info {
229 unsigned char date[16];
230 unsigned char time[16];
231 } __packed;
232
233
234 struct snd_sst_fw_version {
235 u8 build;
236 u8 minor;
237 u8 major;
238 u8 type;
239 };
240
241 struct ipc_header_fw_init {
242 struct snd_sst_fw_version fw_version;
243 struct sst_fw_build_info build_info;
244 u16 result;
245 u8 module_id;
246 u8 debug_info;
247 } __packed;
248
249 struct snd_sst_tstamp {
250 u64 ring_buffer_counter;
251 u64 hardware_counter;
252 u64 frames_decoded;
253 u64 bytes_decoded;
254 u64 bytes_copied;
255 u32 sampling_frequency;
256 u32 channel_peak[8];
257 } __packed;
258
259
260 struct snd_sst_str_type {
261 u8 codec_type;
262 u8 str_type;
263 u8 operation;
264 u8 protected_str;
265 u8 time_slots;
266 u8 reserved;
267 u16 result;
268 } __packed;
269
270
271 struct module_info {
272 u32 lib_version;
273 u32 lib_type;
274 u32 media_type;
275 u8 lib_name[12];
276 u32 lib_caps;
277 unsigned char b_date[16];
278 unsigned char b_time[16];
279 } __packed;
280
281
282 struct lib_slot_info {
283 u8 slot_num;
284 u8 reserved1;
285 u16 reserved2;
286 u32 iram_size;
287 u32 dram_size;
288 u32 iram_offset;
289 u32 dram_offset;
290 } __packed;
291
292 struct snd_ppp_mixer_params {
293 __u32 type;
294 __u32 size;
295 __u32 input_stream_bitmap;
296 } __packed;
297
298 struct snd_sst_lib_download {
299 struct module_info lib_info;
300 struct lib_slot_info slot_info;
301 u32 mod_entry_pt;
302 };
303
304 struct snd_sst_lib_download_info {
305 struct snd_sst_lib_download dload_lib;
306 u16 result;
307 u8 pvt_id;
308 u8 reserved;
309 };
310 struct snd_pcm_params {
311 u8 num_chan;
312 u8 pcm_wd_sz;
313 u8 use_offload_path;
314
315 u8 reserved2;
316 u32 sfreq;
317 u8 channel_map[8];
318 } __packed;
319
320
321 struct snd_mp3_params {
322 u8 num_chan;
323 u8 pcm_wd_sz;
324 u8 crc_check;
325 u8 reserved1;
326 u16 reserved2;
327 } __packed;
328
329 #define AAC_BIT_STREAM_ADTS 0
330 #define AAC_BIT_STREAM_ADIF 1
331 #define AAC_BIT_STREAM_RAW 2
332
333
334 struct snd_aac_params {
335 u8 num_chan;
336 u8 pcm_wd_sz;
337 u8 bdownsample;
338 u8 bs_format;
339 u16 reser2;
340 u32 externalsr;
341 u8 sbr_signalling;
342 u8 reser1;
343 u16 reser3;
344 } __packed;
345
346
347 struct snd_wma_params {
348 u8 num_chan;
349 u8 pcm_wd_sz;
350 u16 reserved1;
351 u32 brate;
352 u32 sfreq;
353 u32 channel_mask;
354 u16 format_tag;
355 u16 block_align;
356 u16 wma_encode_opt;
357 u8 op_align;
358 u8 reserved;
359 } __packed;
360
361
362 union snd_sst_codec_params {
363 struct snd_pcm_params pcm_params;
364 struct snd_mp3_params mp3_params;
365 struct snd_aac_params aac_params;
366 struct snd_wma_params wma_params;
367 } __packed;
368
369
370 struct sst_address_info {
371 u32 addr;
372 u32 size;
373 };
374
375 struct snd_sst_alloc_params_ext {
376 __u16 sg_count;
377 __u16 reserved;
378 __u32 frag_size;
379
380 struct sst_address_info ring_buf_info[8];
381 };
382
383 struct snd_sst_stream_params {
384 union snd_sst_codec_params uc;
385 } __packed;
386
387 struct snd_sst_params {
388 u32 result;
389 u32 stream_id;
390 u8 codec;
391 u8 ops;
392 u8 stream_type;
393 u8 device_type;
394 u8 task;
395 struct snd_sst_stream_params sparams;
396 struct snd_sst_alloc_params_ext aparams;
397 };
398
399 struct snd_sst_alloc_mrfld {
400 u16 codec_type;
401 u8 operation;
402 u8 sg_count;
403 struct sst_address_info ring_buf_info[8];
404 u32 frag_size;
405 u32 ts;
406 struct snd_sst_stream_params codec_params;
407 } __packed;
408
409
410 struct snd_sst_alloc_params {
411 struct snd_sst_str_type str_type;
412 struct snd_sst_stream_params stream_params;
413 struct snd_sst_alloc_params_ext alloc_params;
414 } __packed;
415
416
417 struct snd_sst_alloc_response {
418 struct snd_sst_str_type str_type;
419 struct snd_sst_lib_download lib_dnld;
420 };
421
422
423 struct snd_sst_drop_response {
424 u32 result;
425 u32 bytes;
426 };
427
428 struct snd_sst_async_msg {
429 u32 msg_id;
430 u32 payload[0];
431 };
432
433 struct snd_sst_async_err_msg {
434 u32 fw_resp;
435 u32 lib_resp;
436 } __packed;
437
438 struct snd_sst_vol {
439 u32 stream_id;
440 s32 volume;
441 u32 ramp_duration;
442 u32 ramp_type;
443 };
444
445
446
447
448 struct snd_sst_gain_v2 {
449 u16 gain_cell_num;
450 u8 cell_nbr_idx;
451 u8 cell_path_idx;
452 u16 module_id;
453 u16 left_cell_gain;
454 u16 right_cell_gain;
455 u16 gain_time_const;
456 } __packed;
457
458 struct snd_sst_mute {
459 u32 stream_id;
460 u32 mute;
461 };
462
463 struct snd_sst_runtime_params {
464 u8 type;
465 u8 str_id;
466 u8 size;
467 u8 rsvd;
468 void *addr;
469 } __packed;
470
471 enum stream_param_type {
472 SST_SET_TIME_SLOT = 0,
473 SST_SET_CHANNEL_INFO = 1,
474 OTHERS = 2,
475 };
476
477
478 struct snd_sst_control_routing {
479 u8 control;
480 u8 reserved[3];
481 };
482
483 struct ipc_post {
484 struct list_head node;
485 union ipc_header header;
486 bool is_large;
487 bool is_process_reply;
488 union ipc_header_mrfld mrfld_header;
489 char *mailbox_data;
490 };
491
492 struct snd_sst_ctxt_params {
493 u32 address;
494 u32 size;
495 };
496
497 struct snd_sst_lpe_log_params {
498 u8 dbg_type;
499 u8 module_id;
500 u8 log_level;
501 u8 reserved;
502 } __packed;
503
504 enum snd_sst_bytes_type {
505 SND_SST_BYTES_SET = 0x1,
506 SND_SST_BYTES_GET = 0x2,
507 };
508
509 struct snd_sst_bytes_v2 {
510 u8 type;
511 u8 ipc_msg;
512 u8 block;
513 u8 task_id;
514 u8 pipe_id;
515 u8 rsvd;
516 u16 len;
517 char bytes[0];
518 };
519
520 #define MAX_VTSV_FILES 2
521 struct snd_sst_vtsv_info {
522 struct sst_address_info vfiles[MAX_VTSV_FILES];
523 } __packed;
524
525 #endif