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