1#ifndef __INTEL_SST_FW_IPC_H__
2#define __INTEL_SST_FW_IPC_H__
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33#define MAX_NUM_STREAMS_MRST 3
34#define MAX_NUM_STREAMS_MFLD 6
35#define MAX_NUM_STREAMS 6
36#define MAX_DBG_RW_BYTES 80
37#define MAX_NUM_SCATTER_BUFFERS 8
38#define MAX_LOOP_BACK_DWORDS 8
39
40#define SST_MAILBOX_SIZE 0x0400
41#define SST_MAILBOX_SEND 0x0000
42#define SST_MAILBOX_RCV 0x0804
43#define SST_TIME_STAMP 0x1800
44#define SST_RESERVED_OFFSET 0x1A00
45#define SST_CHEKPOINT_OFFSET 0x1C00
46#define REPLY_MSG 0x80
47
48
49
50
51
52#define IPC_IA_PREP_LIB_DNLD 0x01
53#define IPC_IA_LIB_DNLD_CMPLT 0x02
54
55#define IPC_IA_SET_PMIC_TYPE 0x03
56#define IPC_IA_GET_FW_VERSION 0x04
57#define IPC_IA_GET_FW_BUILD_INF 0x05
58#define IPC_IA_GET_FW_INFO 0x06
59#define IPC_IA_GET_FW_CTXT 0x07
60#define IPC_IA_SET_FW_CTXT 0x08
61
62
63#define IPC_IA_SET_CODEC_PARAMS 0x10
64#define IPC_IA_GET_CODEC_PARAMS 0x11
65#define IPC_IA_SET_PPP_PARAMS 0x12
66#define IPC_IA_GET_PPP_PARAMS 0x13
67#define IPC_IA_PLAY_FRAMES 0x14
68#define IPC_IA_CAPT_FRAMES 0x15
69#define IPC_IA_PLAY_VOICE 0x16
70#define IPC_IA_CAPT_VOICE 0x17
71#define IPC_IA_DECODE_FRAMES 0x18
72
73#define IPC_IA_ALG_PARAMS 0x1A
74#define IPC_IA_TUNING_PARAMS 0x1B
75
76
77#define IPC_IA_ALLOC_STREAM 0x20
78#define IPC_IA_FREE_STREAM 0x21
79#define IPC_IA_SET_STREAM_PARAMS 0x22
80#define IPC_IA_GET_STREAM_PARAMS 0x23
81#define IPC_IA_PAUSE_STREAM 0x24
82#define IPC_IA_RESUME_STREAM 0x25
83#define IPC_IA_DROP_STREAM 0x26
84#define IPC_IA_DRAIN_STREAM 0x27
85#define IPC_IA_TARGET_DEV_SELECT 0x28
86#define IPC_IA_CONTROL_ROUTING 0x29
87
88#define IPC_IA_SET_STREAM_VOL 0x2A
89#define IPC_IA_GET_STREAM_VOL 0x2B
90#define IPC_IA_SET_STREAM_MUTE 0x2C
91#define IPC_IA_GET_STREAM_MUTE 0x2D
92#define IPC_IA_ENABLE_RX_TIME_SLOT 0x2E
93
94#define IPC_IA_START_STREAM 0x30
95
96
97#define IPC_IA_DBG_MEM_READ 0x40
98#define IPC_IA_DBG_MEM_WRITE 0x41
99#define IPC_IA_DBG_LOOP_BACK 0x42
100
101
102#define IPC_IA_FW_INIT_CMPLT 0x81
103#define IPC_IA_LPE_GETTING_STALLED 0x82
104#define IPC_IA_LPE_UNSTALLED 0x83
105
106
107#define IPC_SST_GET_PLAY_FRAMES 0x90
108#define IPC_SST_GET_CAPT_FRAMES 0x91
109#define IPC_SST_BUF_UNDER_RUN 0x92
110#define IPC_SST_BUF_OVER_RUN 0x93
111#define IPC_SST_DRAIN_END 0x94
112#define IPC_SST_CHNGE_SSP_PARAMS 0x95
113#define IPC_SST_STREAM_PROCESS_FATAL_ERR 0x96
114#define IPC_SST_PERIOD_ELAPSED 0x97
115#define IPC_IA_TARGET_DEV_CHNGD 0x98
116
117#define IPC_SST_ERROR_EVENT 0x99
118
119#define IPC_SC_DDR_LINK_UP 0xC0
120#define IPC_SC_DDR_LINK_DOWN 0xC1
121#define IPC_SC_SET_LPECLK_REQ 0xC2
122#define IPC_SC_SSP_BIT_BANG 0xC3
123
124
125#define IPC_IA_MEM_ALLOC_FAIL 0xE0
126#define IPC_IA_PROC_ERR 0xE1
127
128
129
130
131#define IPC_IA_PRINT_STRING 0xF0
132
133
134
135
136
137
138
139
140enum ackData {
141 IPC_ACK_SUCCESS = 0,
142 IPC_ACK_FAILURE
143};
144
145
146enum sst_error_codes {
147
148
149 SST_SUCCESS = 0,
150 SST_ERR_INVALID_STREAM_ID = 1,
151 SST_ERR_INVALID_MSG_ID = 2,
152 SST_ERR_INVALID_STREAM_OP = 3,
153 SST_ERR_INVALID_PARAMS = 4,
154 SST_ERR_INVALID_CODEC = 5,
155 SST_ERR_INVALID_MEDIA_TYPE = 6,
156 SST_ERR_STREAM_ERR = 7,
157
158
159 SST_IPC_ERR_CALL_BACK_NOT_REGD = 8,
160 SST_IPC_ERR_STREAM_NOT_ALLOCATED = 9,
161 SST_IPC_ERR_STREAM_ALLOC_FAILED = 10,
162 SST_IPC_ERR_GET_STREAM_FAILED = 11,
163 SST_ERR_MOD_NOT_AVAIL = 12,
164 SST_ERR_MOD_DNLD_RQD = 13,
165 SST_ERR_STREAM_STOPPED = 14,
166 SST_ERR_STREAM_IN_USE = 15,
167
168
169 SST_CAP_ERR_INCMPLTE_CAPTURE_MSG = 16,
170 SST_CAP_ERR_CAPTURE_FAIL = 17,
171 SST_CAP_ERR_GET_DDR_NEW_SGLIST = 18,
172 SST_CAP_ERR_UNDER_RUN = 19,
173 SST_CAP_ERR_OVERFLOW = 20,
174
175
176 SST_PB_ERR_INCMPLTE_PLAY_MSG = 21,
177 SST_PB_ERR_PLAY_FAIL = 22,
178 SST_PB_ERR_GET_DDR_NEW_SGLIST = 23,
179
180
181 SST_LIB_ERR_LIB_DNLD_REQUIRED = 24,
182 SST_LIB_ERR_LIB_NOT_SUPPORTED = 25,
183
184
185 SST_SCC_ERR_PREP_DNLD_FAILED = 26,
186 SST_SCC_ERR_LIB_DNLD_RES_FAILED = 27,
187
188 SST_SCH_ERR_FAIL = 28,
189
190
191 SST_DMA_ERR_NO_CHNL_AVAILABLE = 29,
192 SST_DMA_ERR_INVALID_INPUT_PARAMS = 30,
193 SST_DMA_ERR_CHNL_ALREADY_SUSPENDED = 31,
194 SST_DMA_ERR_CHNL_ALREADY_STARTED = 32,
195 SST_DMA_ERR_CHNL_NOT_ENABLED = 33,
196 SST_DMA_ERR_TRANSFER_FAILED = 34,
197
198 SST_SSP_ERR_ALREADY_ENABLED = 35,
199 SST_SSP_ERR_ALREADY_DISABLED = 36,
200 SST_SSP_ERR_NOT_INITIALIZED = 37,
201 SST_SSP_ERR_SRAM_NO_DMA_DATA = 38,
202
203
204 SST_ERR_MOD_INIT_FAIL = 39,
205
206
207 SST_RDR_ERR_IO_DEV_SEL_NOT_ALLOWED = 40,
208 SST_RDR_ERR_ROUTE_ALREADY_STARTED = 41,
209 SST_RDR_ERR_IO_DEV_SEL_FAILED = 42,
210 SST_RDR_PREP_CODEC_DNLD_FAILED = 43,
211
212
213 SST_ERR_DBG_MEM_READ_FAIL = 44,
214 SST_ERR_DBG_MEM_WRITE_FAIL = 45,
215 SST_ERR_INSUFFICIENT_INPUT_SG_LIST = 46,
216 SST_ERR_INSUFFICIENT_OUTPUT_SG_LIST = 47,
217
218 SST_ERR_BUFFER_NOT_AVAILABLE = 48,
219 SST_ERR_BUFFER_NOT_ALLOCATED = 49,
220 SST_ERR_INVALID_REGION_TYPE = 50,
221 SST_ERR_NULL_PTR = 51,
222 SST_ERR_INVALID_BUFFER_SIZE = 52,
223 SST_ERR_INVALID_BUFFER_INDEX = 53,
224
225
226 SST_IIPC_QUEUE_FULL = 54,
227 SST_IIPC_ERR_MSG_SND_FAILED = 55,
228 SST_PB_ERR_UNDERRUN_OCCURED = 56,
229 SST_RDR_INSUFFICIENT_MIXER_BUFFER = 57,
230 SST_INVALID_TIME_SLOTS = 58,
231};
232
233enum dbg_mem_data_type {
234
235 DATA_TYPE_U32,
236 DATA_TYPE_U16,
237 DATA_TYPE_U8,
238};
239
240
241
242
243union ipc_header {
244 struct {
245 u32 msg_id:8;
246 u32 str_id:5;
247 u32 large:1;
248 u32 reserved:2;
249 u32 data:14;
250 u32 done:1;
251 u32 busy:1;
252 } part;
253 u32 full;
254} __attribute__ ((packed));
255
256
257struct sst_fw_build_info {
258 unsigned char date[16];
259 unsigned char time[16];
260} __attribute__ ((packed));
261
262struct ipc_header_fw_init {
263 struct snd_sst_fw_version fw_version;
264 struct sst_fw_build_info build_info;
265 u16 result;
266 u8 module_id;
267 u8 debug_info;
268} __attribute__ ((packed));
269
270
271struct sst_address_info {
272 u32 addr;
273 u32 size;
274} __attribute__ ((packed));
275
276
277struct snd_sst_tstamp {
278 u64 samples_processed;
279 u64 samples_rendered;
280 u64 bytes_processed;
281 u32 sampling_frequency;
282 u32 dma_base_address;
283 u16 dma_channel_no;
284 u16 reserved;
285};
286
287
288struct sst_frame_info {
289 u16 num_entries;
290 u16 rsrvd;
291 struct sst_address_info addr[MAX_NUM_SCATTER_BUFFERS];
292} __attribute__ ((packed));
293
294
295struct snd_sst_decode_info {
296 unsigned long long input_bytes_consumed;
297 unsigned long long output_bytes_produced;
298 struct sst_frame_info frames_in;
299 struct sst_frame_info frames_out;
300} __attribute__ ((packed));
301
302
303struct ipc_sst_ia_print_params {
304 u32 string_size;
305 u8 prt_string[160];
306} __attribute__ ((packed));
307
308
309struct snd_sst_voice_data {
310 u16 num_bytes;
311 u8 pcm_wd_size;
312 u8 reserved;
313 u8 voice_data_buf[0];
314} __attribute__ ((packed));
315
316
317struct ipc_sst_ia_dbg_mem_rw {
318 u16 num_bytes;
319 u16 data_type;
320 u32 address;
321 u8 rw_bytes[MAX_DBG_RW_BYTES];
322} __attribute__ ((packed));
323
324struct ipc_sst_ia_dbg_loop_back {
325 u16 num_dwords;
326 u16 increment_val;
327 u32 lpbk_dwords[MAX_LOOP_BACK_DWORDS];
328} __attribute__ ((packed));
329
330
331struct snd_sst_str_type {
332 u8 codec_type;
333 u8 str_type;
334 u8 operation;
335 u8 protected_str;
336 u8 time_slots;
337 u8 reserved;
338 u16 result;
339} __attribute__ ((packed));
340
341
342struct module_info {
343 u32 lib_version;
344 u32 lib_type;
345 u32 media_type;
346 u8 lib_name[12];
347 u32 lib_caps;
348 unsigned char b_date[16];
349 unsigned char b_time[16];
350} __attribute__ ((packed));
351
352
353struct lib_slot_info {
354 u8 slot_num;
355 u8 reserved1;
356 u16 reserved2;
357 u32 iram_size;
358 u32 dram_size;
359 u32 iram_offset;
360 u32 dram_offset;
361} __attribute__ ((packed));
362
363struct snd_sst_lib_download {
364 struct module_info lib_info;
365 struct lib_slot_info slot_info;
366 u32 mod_entry_pt;
367};
368
369struct snd_sst_lib_download_info {
370 struct snd_sst_lib_download dload_lib;
371 u16 result;
372 u8 pvt_id;
373 u8 reserved;
374};
375
376
377struct snd_sst_alloc_params {
378 struct snd_sst_str_type str_type;
379 struct snd_sst_stream_params stream_params;
380};
381
382struct snd_sst_fw_get_stream_params {
383 struct snd_sst_stream_params codec_params;
384 struct snd_sst_pmic_config pcm_params;
385};
386
387
388struct snd_sst_alloc_response {
389 struct snd_sst_str_type str_type;
390 struct snd_sst_lib_download lib_dnld;
391};
392
393
394struct snd_sst_drop_response {
395 u32 result;
396 u32 bytes;
397};
398
399
400struct snd_sst_control_routing {
401 u8 control;
402 u8 reserved[3];
403};
404
405
406struct ipc_post {
407 struct list_head node;
408 union ipc_header header;
409 char *mailbox_data;
410};
411
412struct snd_sst_ctxt_params {
413 u32 address;
414 u32 size;
415};
416#endif
417