xref: /openbmc/linux/sound/soc/intel/atom/sst-mfld-dsp.h (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
18e8e69d6SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
2b97169daSJie Yang #ifndef __SST_MFLD_DSP_H__
3b97169daSJie Yang #define __SST_MFLD_DSP_H__
4b97169daSJie Yang /*
5b97169daSJie Yang  *  sst_mfld_dsp.h - Intel SST Driver for audio engine
6b97169daSJie Yang  *
7b97169daSJie Yang  *  Copyright (C) 2008-14 Intel Corporation
8b97169daSJie Yang  *  Authors:	Vinod Koul <vinod.koul@linux.intel.com>
9b97169daSJie Yang  *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10b97169daSJie Yang  *
11b97169daSJie Yang  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12b97169daSJie Yang  */
13b97169daSJie Yang 
14b97169daSJie Yang #define SST_MAX_BIN_BYTES 1024
15b97169daSJie Yang 
16b97169daSJie Yang #define MAX_DBG_RW_BYTES 80
17b97169daSJie Yang #define MAX_NUM_SCATTER_BUFFERS 8
18b97169daSJie Yang #define MAX_LOOP_BACK_DWORDS 8
19b97169daSJie Yang /* IPC base address and mailbox, timestamp offsets */
20b97169daSJie Yang #define SST_MAILBOX_SIZE 0x0400
21b97169daSJie Yang #define SST_MAILBOX_SEND 0x0000
22b97169daSJie Yang #define SST_TIME_STAMP 0x1800
23b97169daSJie Yang #define SST_TIME_STAMP_MRFLD 0x800
24b97169daSJie Yang #define SST_RESERVED_OFFSET 0x1A00
25b97169daSJie Yang #define SST_SCU_LPE_MAILBOX 0x1000
26b97169daSJie Yang #define SST_LPE_SCU_MAILBOX 0x1400
27b97169daSJie Yang #define SST_SCU_LPE_LOG_BUF (SST_SCU_LPE_MAILBOX+16)
28b97169daSJie Yang #define PROCESS_MSG 0x80
29b97169daSJie Yang 
30b97169daSJie Yang /* Message ID's for IPC messages */
31b97169daSJie Yang /* Bits B7: SST or IA/SC ; B6-B4: Msg Category; B3-B0: Msg Type */
32b97169daSJie Yang 
33b97169daSJie Yang /* I2L Firmware/Codec Download msgs */
34b97169daSJie Yang #define IPC_IA_PREP_LIB_DNLD 0x01
35b97169daSJie Yang #define IPC_IA_LIB_DNLD_CMPLT 0x02
36b97169daSJie Yang #define IPC_IA_GET_FW_VERSION 0x04
37b97169daSJie Yang #define IPC_IA_GET_FW_BUILD_INF 0x05
38b97169daSJie Yang #define IPC_IA_GET_FW_INFO 0x06
39b97169daSJie Yang #define IPC_IA_GET_FW_CTXT 0x07
40b97169daSJie Yang #define IPC_IA_SET_FW_CTXT 0x08
41b97169daSJie Yang #define IPC_IA_PREPARE_SHUTDOWN 0x31
42b97169daSJie Yang /* I2L Codec Config/control msgs */
43b97169daSJie Yang #define IPC_PREP_D3 0x10
44b97169daSJie Yang #define IPC_IA_SET_CODEC_PARAMS 0x10
45b97169daSJie Yang #define IPC_IA_GET_CODEC_PARAMS 0x11
46b97169daSJie Yang #define IPC_IA_SET_PPP_PARAMS 0x12
47b97169daSJie Yang #define IPC_IA_GET_PPP_PARAMS 0x13
48b97169daSJie Yang #define IPC_SST_PERIOD_ELAPSED_MRFLD 0xA
49b97169daSJie Yang #define IPC_IA_ALG_PARAMS 0x1A
50b97169daSJie Yang #define IPC_IA_TUNING_PARAMS 0x1B
51b97169daSJie Yang #define IPC_IA_SET_RUNTIME_PARAMS 0x1C
52b97169daSJie Yang #define IPC_IA_SET_PARAMS 0x1
53b97169daSJie Yang #define IPC_IA_GET_PARAMS 0x2
54b97169daSJie Yang 
55b97169daSJie Yang #define IPC_EFFECTS_CREATE 0xE
56b97169daSJie Yang #define IPC_EFFECTS_DESTROY 0xF
57b97169daSJie Yang 
58b97169daSJie Yang /* I2L Stream config/control msgs */
59b97169daSJie Yang #define IPC_IA_ALLOC_STREAM_MRFLD 0x2
60b97169daSJie Yang #define IPC_IA_ALLOC_STREAM 0x20 /* Allocate a stream ID */
61b97169daSJie Yang #define IPC_IA_FREE_STREAM_MRFLD 0x03
62b97169daSJie Yang #define IPC_IA_FREE_STREAM 0x21 /* Free the stream ID */
63b97169daSJie Yang #define IPC_IA_SET_STREAM_PARAMS 0x22
64b97169daSJie Yang #define IPC_IA_SET_STREAM_PARAMS_MRFLD 0x12
65b97169daSJie Yang #define IPC_IA_GET_STREAM_PARAMS 0x23
66b97169daSJie Yang #define IPC_IA_PAUSE_STREAM 0x24
67b97169daSJie Yang #define IPC_IA_PAUSE_STREAM_MRFLD 0x4
68b97169daSJie Yang #define IPC_IA_RESUME_STREAM 0x25
69b97169daSJie Yang #define IPC_IA_RESUME_STREAM_MRFLD 0x5
70b97169daSJie Yang #define IPC_IA_DROP_STREAM 0x26
71b97169daSJie Yang #define IPC_IA_DROP_STREAM_MRFLD 0x07
72b97169daSJie Yang #define IPC_IA_DRAIN_STREAM 0x27 /* Short msg with str_id */
73b97169daSJie Yang #define IPC_IA_DRAIN_STREAM_MRFLD 0x8
74b97169daSJie Yang #define IPC_IA_CONTROL_ROUTING 0x29
75b97169daSJie Yang #define IPC_IA_VTSV_UPDATE_MODULES 0x20
76b97169daSJie Yang #define IPC_IA_VTSV_DETECTED 0x21
77b97169daSJie Yang 
78b97169daSJie Yang #define IPC_IA_START_STREAM_MRFLD 0X06
79b97169daSJie Yang #define IPC_IA_START_STREAM 0x30 /* Short msg with str_id */
80b97169daSJie Yang 
81b97169daSJie Yang #define IPC_IA_SET_GAIN_MRFLD 0x21
82b97169daSJie Yang /* Debug msgs */
83b97169daSJie Yang #define IPC_IA_DBG_MEM_READ 0x40
84b97169daSJie Yang #define IPC_IA_DBG_MEM_WRITE 0x41
85b97169daSJie Yang #define IPC_IA_DBG_LOOP_BACK 0x42
86b97169daSJie Yang #define IPC_IA_DBG_LOG_ENABLE 0x45
87b97169daSJie Yang #define IPC_IA_DBG_SET_PROBE_PARAMS 0x47
88b97169daSJie Yang 
89b97169daSJie Yang /* L2I Firmware/Codec Download msgs */
90b97169daSJie Yang #define IPC_IA_FW_INIT_CMPLT 0x81
91b97169daSJie Yang #define IPC_IA_FW_INIT_CMPLT_MRFLD 0x01
92b97169daSJie Yang #define IPC_IA_FW_ASYNC_ERR_MRFLD 0x11
93b97169daSJie Yang 
94b97169daSJie Yang /* L2I Codec Config/control msgs */
95b97169daSJie Yang #define IPC_SST_FRAGMENT_ELPASED 0x90 /* Request IA more data */
96b97169daSJie Yang 
97b97169daSJie Yang #define IPC_SST_BUF_UNDER_RUN 0x92 /* PB Under run and stopped */
98b97169daSJie Yang #define IPC_SST_BUF_OVER_RUN 0x93 /* CAP Under run and stopped */
99b97169daSJie Yang #define IPC_SST_DRAIN_END 0x94 /* PB Drain complete and stopped */
100b97169daSJie Yang #define IPC_SST_CHNGE_SSP_PARAMS 0x95 /* PB SSP parameters changed */
101b97169daSJie Yang #define IPC_SST_STREAM_PROCESS_FATAL_ERR 0x96/* error in processing a stream */
102b97169daSJie Yang #define IPC_SST_PERIOD_ELAPSED 0x97 /* period elapsed */
103b97169daSJie Yang 
104b97169daSJie Yang #define IPC_SST_ERROR_EVENT 0x99 /* Buffer over run occurred */
105b97169daSJie Yang /* L2S messages */
106b97169daSJie Yang #define IPC_SC_DDR_LINK_UP 0xC0
107b97169daSJie Yang #define IPC_SC_DDR_LINK_DOWN 0xC1
108b97169daSJie Yang #define IPC_SC_SET_LPECLK_REQ 0xC2
109b97169daSJie Yang #define IPC_SC_SSP_BIT_BANG 0xC3
110b97169daSJie Yang 
111b97169daSJie Yang /* L2I Error reporting msgs */
112b97169daSJie Yang #define IPC_IA_MEM_ALLOC_FAIL 0xE0
113b97169daSJie Yang #define IPC_IA_PROC_ERR 0xE1 /* error in processing a
114b97169daSJie Yang 					stream can be used by playback and
115b97169daSJie Yang 					capture modules */
116b97169daSJie Yang 
117b97169daSJie Yang /* L2I Debug msgs */
118b97169daSJie Yang #define IPC_IA_PRINT_STRING 0xF0
119b97169daSJie Yang 
120b97169daSJie Yang /* Buffer under-run */
121b97169daSJie Yang #define IPC_IA_BUF_UNDER_RUN_MRFLD 0x0B
122b97169daSJie Yang 
123b97169daSJie Yang /* Mrfld specific defines:
124b97169daSJie Yang  * For asynchronous messages(INIT_CMPLT, PERIOD_ELAPSED, ASYNC_ERROR)
125b97169daSJie Yang  * received from FW, the format is:
126b97169daSJie Yang  *  - IPC High: pvt_id is set to zero. Always short message.
127b97169daSJie Yang  *  - msg_id is in lower 16-bits of IPC low payload.
128b97169daSJie Yang  *  - pipe_id is in higher 16-bits of IPC low payload for period_elapsed.
129b97169daSJie Yang  *  - error id is in higher 16-bits of IPC low payload for async errors.
130b97169daSJie Yang  */
131b97169daSJie Yang #define SST_ASYNC_DRV_ID 0
132b97169daSJie Yang 
133b97169daSJie Yang /* Command Response or Acknowledge message to any IPC message will have
134b97169daSJie Yang  * same message ID and stream ID information which is sent.
135b97169daSJie Yang  * There is no specific Ack message ID. The data field is used as response
136b97169daSJie Yang  * meaning.
137b97169daSJie Yang  */
138b97169daSJie Yang enum ackData {
139b97169daSJie Yang 	IPC_ACK_SUCCESS = 0,
140b97169daSJie Yang 	IPC_ACK_FAILURE,
141b97169daSJie Yang };
142b97169daSJie Yang 
143b97169daSJie Yang enum ipc_ia_msg_id {
144b97169daSJie Yang 	IPC_CMD = 1,		/*!< Task Control message ID */
145b97169daSJie Yang 	IPC_SET_PARAMS = 2,/*!< Task Set param message ID */
146b97169daSJie Yang 	IPC_GET_PARAMS = 3,	/*!< Task Get param message ID */
147b97169daSJie Yang 	IPC_INVALID = 0xFF,	/*!<Task Get param message ID */
148b97169daSJie Yang };
149b97169daSJie Yang 
150b97169daSJie Yang enum sst_codec_types {
151b97169daSJie Yang 	/*  AUDIO/MUSIC	CODEC Type Definitions */
152b97169daSJie Yang 	SST_CODEC_TYPE_UNKNOWN = 0,
153b97169daSJie Yang 	SST_CODEC_TYPE_PCM,	/* Pass through Audio codec */
154b97169daSJie Yang 	SST_CODEC_TYPE_MP3,
155b97169daSJie Yang 	SST_CODEC_TYPE_MP24,
156b97169daSJie Yang 	SST_CODEC_TYPE_AAC,
157b97169daSJie Yang 	SST_CODEC_TYPE_AACP,
158b97169daSJie Yang 	SST_CODEC_TYPE_eAACP,
159b97169daSJie Yang };
160b97169daSJie Yang 
161b97169daSJie Yang enum stream_type {
162b97169daSJie Yang 	SST_STREAM_TYPE_NONE = 0,
163b97169daSJie Yang 	SST_STREAM_TYPE_MUSIC = 1,
164b97169daSJie Yang };
165b97169daSJie Yang 
166b97169daSJie Yang enum sst_error_codes {
167b97169daSJie Yang 	/* Error code,response to msgId: Description */
168b97169daSJie Yang 	/* Common error codes */
169b97169daSJie Yang 	SST_SUCCESS = 0,        /* Success */
170b97169daSJie Yang 	SST_ERR_INVALID_STREAM_ID = 1,
171b97169daSJie Yang 	SST_ERR_INVALID_MSG_ID = 2,
172b97169daSJie Yang 	SST_ERR_INVALID_STREAM_OP = 3,
173b97169daSJie Yang 	SST_ERR_INVALID_PARAMS = 4,
174b97169daSJie Yang 	SST_ERR_INVALID_CODEC = 5,
175b97169daSJie Yang 	SST_ERR_INVALID_MEDIA_TYPE = 6,
176b97169daSJie Yang 	SST_ERR_STREAM_ERR = 7,
177b97169daSJie Yang 
178b97169daSJie Yang 	SST_ERR_STREAM_IN_USE = 15,
179b97169daSJie Yang };
180b97169daSJie Yang 
181b97169daSJie Yang struct ipc_dsp_hdr {
182b97169daSJie Yang 	u16 mod_index_id:8;		/*!< DSP Command ID specific to tasks */
183b97169daSJie Yang 	u16 pipe_id:8;	/*!< instance of the module in the pipeline */
184b97169daSJie Yang 	u16 mod_id;		/*!< Pipe_id */
185b97169daSJie Yang 	u16 cmd_id;		/*!< Module ID = lpe_algo_types_t */
186b97169daSJie Yang 	u16 length;		/*!< Length of the payload only */
187b97169daSJie Yang } __packed;
188b97169daSJie Yang 
189b97169daSJie Yang union ipc_header_high {
190b97169daSJie Yang 	struct {
191b97169daSJie Yang 		u32  msg_id:8;	    /* Message ID - Max 256 Message Types */
192b97169daSJie Yang 		u32  task_id:4;	    /* Task ID associated with this comand */
193b97169daSJie Yang 		u32  drv_id:4;    /* Identifier for the driver to track*/
194b97169daSJie Yang 		u32  rsvd1:8;	    /* Reserved */
195b97169daSJie Yang 		u32  result:4;	    /* Reserved */
196b97169daSJie Yang 		u32  res_rqd:1;	    /* Response rqd */
197b97169daSJie Yang 		u32  large:1;	    /* Large Message if large = 1 */
198b97169daSJie Yang 		u32  done:1;	    /* bit 30 - Done bit */
199b97169daSJie Yang 		u32  busy:1;	    /* bit 31 - busy bit*/
200b97169daSJie Yang 	} part;
201b97169daSJie Yang 	u32 full;
202b97169daSJie Yang } __packed;
203b97169daSJie Yang /* IPC header */
204b97169daSJie Yang union ipc_header_mrfld {
205b97169daSJie Yang 	struct {
206b97169daSJie Yang 		u32 header_low_payload;
207b97169daSJie Yang 		union ipc_header_high header_high;
208b97169daSJie Yang 	} p;
209b97169daSJie Yang 	u64 full;
210b97169daSJie Yang } __packed;
211b97169daSJie Yang /* CAUTION NOTE: All IPC message body must be multiple of 32 bits.*/
212b97169daSJie Yang 
213b97169daSJie Yang /* IPC Header */
214b97169daSJie Yang union ipc_header {
215b97169daSJie Yang 	struct {
216b97169daSJie Yang 		u32  msg_id:8; /* Message ID - Max 256 Message Types */
217b97169daSJie Yang 		u32  str_id:5;
218b97169daSJie Yang 		u32  large:1;	/* Large Message if large = 1 */
219b97169daSJie Yang 		u32  reserved:2;	/* Reserved for future use */
220b97169daSJie Yang 		u32  data:14;	/* Ack/Info for msg, size of msg in Mailbox */
221b97169daSJie Yang 		u32  done:1; /* bit 30 */
222b97169daSJie Yang 		u32  busy:1; /* bit 31 */
223b97169daSJie Yang 	} part;
224b97169daSJie Yang 	u32 full;
225b97169daSJie Yang } __packed;
226b97169daSJie Yang 
227b97169daSJie Yang /* Firmware build info */
228b97169daSJie Yang struct sst_fw_build_info {
229b97169daSJie Yang 	unsigned char  date[16]; /* Firmware build date */
230b97169daSJie Yang 	unsigned char  time[16]; /* Firmware build time */
231b97169daSJie Yang } __packed;
232b97169daSJie Yang 
233b97169daSJie Yang /* Firmware Version info */
234b97169daSJie Yang struct snd_sst_fw_version {
235b97169daSJie Yang 	u8 build;	/* build number*/
236b97169daSJie Yang 	u8 minor;	/* minor number*/
237b97169daSJie Yang 	u8 major;	/* major number*/
238b97169daSJie Yang 	u8 type;	/* build type */
239b97169daSJie Yang };
240b97169daSJie Yang 
241b97169daSJie Yang struct ipc_header_fw_init {
242b97169daSJie Yang 	struct snd_sst_fw_version fw_version;/* Firmware version details */
243b97169daSJie Yang 	struct sst_fw_build_info build_info;
244b97169daSJie Yang 	u16 result;	/* Fw init result */
245b97169daSJie Yang 	u8 module_id; /* Module ID in case of error */
246b97169daSJie Yang 	u8 debug_info; /* Debug info from Module ID in case of fail */
247b97169daSJie Yang } __packed;
248b97169daSJie Yang 
249b97169daSJie Yang struct snd_sst_tstamp {
250b97169daSJie Yang 	u64 ring_buffer_counter;	/* PB/CP: Bytes copied from/to DDR. */
251b97169daSJie Yang 	u64 hardware_counter;	    /* PB/CP: Bytes DMAed to/from SSP. */
252b97169daSJie Yang 	u64 frames_decoded;
253b97169daSJie Yang 	u64 bytes_decoded;
254b97169daSJie Yang 	u64 bytes_copied;
255b97169daSJie Yang 	u32 sampling_frequency;
256b97169daSJie Yang 	u32 channel_peak[8];
257b97169daSJie Yang } __packed;
258b97169daSJie Yang 
259ebf721fbSBhaskar Chowdhury /* Stream type params structure for Alloc stream */
260b97169daSJie Yang struct snd_sst_str_type {
261b97169daSJie Yang 	u8 codec_type;		/* Codec type */
262b97169daSJie Yang 	u8 str_type;		/* 1 = voice 2 = music */
263b97169daSJie Yang 	u8 operation;		/* Playback or Capture */
264b97169daSJie Yang 	u8 protected_str;	/* 0=Non DRM, 1=DRM */
265b97169daSJie Yang 	u8 time_slots;
266b97169daSJie Yang 	u8 reserved;		/* Reserved */
267b97169daSJie Yang 	u16 result;		/* Result used for acknowledgment */
268b97169daSJie Yang } __packed;
269b97169daSJie Yang 
270b97169daSJie Yang /* Library info structure */
271b97169daSJie Yang struct module_info {
272b97169daSJie Yang 	u32 lib_version;
273b97169daSJie Yang 	u32 lib_type;/*TBD- KLOCKWORK u8 lib_type;*/
274b97169daSJie Yang 	u32 media_type;
275b97169daSJie Yang 	u8  lib_name[12];
276b97169daSJie Yang 	u32 lib_caps;
277b97169daSJie Yang 	unsigned char  b_date[16]; /* Lib build date */
278b97169daSJie Yang 	unsigned char  b_time[16]; /* Lib build time */
279b97169daSJie Yang } __packed;
280b97169daSJie Yang 
281b97169daSJie Yang /* Library slot info */
282b97169daSJie Yang struct lib_slot_info {
283b97169daSJie Yang 	u8  slot_num; /* 1 or 2 */
284b97169daSJie Yang 	u8  reserved1;
285b97169daSJie Yang 	u16 reserved2;
286b97169daSJie Yang 	u32 iram_size; /* slot size in IRAM */
287b97169daSJie Yang 	u32 dram_size; /* slot size in DRAM */
288b97169daSJie Yang 	u32 iram_offset; /* starting offset of slot in IRAM */
289b97169daSJie Yang 	u32 dram_offset; /* starting offset of slot in DRAM */
290b97169daSJie Yang } __packed;
291b97169daSJie Yang 
292b97169daSJie Yang struct snd_ppp_mixer_params {
293b97169daSJie Yang 	__u32			type; /*Type of the parameter */
294b97169daSJie Yang 	__u32			size;
295b97169daSJie Yang 	__u32			input_stream_bitmap; /*Input stream Bit Map*/
296b97169daSJie Yang } __packed;
297b97169daSJie Yang 
298b97169daSJie Yang struct snd_sst_lib_download {
299b97169daSJie Yang 	struct module_info lib_info; /* library info type, capabilities etc */
300b97169daSJie Yang 	struct lib_slot_info slot_info; /* slot info to be downloaded */
301b97169daSJie Yang 	u32 mod_entry_pt;
302b97169daSJie Yang };
303b97169daSJie Yang 
304b97169daSJie Yang struct snd_sst_lib_download_info {
305b97169daSJie Yang 	struct snd_sst_lib_download dload_lib;
306b97169daSJie Yang 	u16 result;	/* Result used for acknowledgment */
307b97169daSJie Yang 	u8 pvt_id; /* Private ID */
308b97169daSJie Yang 	u8 reserved;  /* for alignment */
309b97169daSJie Yang };
310b97169daSJie Yang struct snd_pcm_params {
311b97169daSJie Yang 	u8 num_chan;	/* 1=Mono, 2=Stereo */
312b97169daSJie Yang 	u8 pcm_wd_sz;	/* 16/24 - bit*/
313b97169daSJie Yang 	u8 use_offload_path;	/* 0-PCM using period elpased & ALSA interfaces
314b97169daSJie Yang 				   1-PCM stream via compressed interface  */
315b97169daSJie Yang 	u8 reserved2;
316b97169daSJie Yang 	u32 sfreq;    /* Sampling rate in Hz */
317b97169daSJie Yang 	u8 channel_map[8];
318b97169daSJie Yang } __packed;
319b97169daSJie Yang 
320b97169daSJie Yang /* MP3 Music Parameters Message */
321b97169daSJie Yang struct snd_mp3_params {
322b97169daSJie Yang 	u8  num_chan;	/* 1=Mono, 2=Stereo	*/
323b97169daSJie Yang 	u8  pcm_wd_sz; /* 16/24 - bit*/
324b97169daSJie Yang 	u8  crc_check; /* crc_check - disable (0) or enable (1) */
325b97169daSJie Yang 	u8  reserved1; /* unused*/
326b97169daSJie Yang 	u16 reserved2;	/* Unused */
327b97169daSJie Yang } __packed;
328b97169daSJie Yang 
329b97169daSJie Yang #define AAC_BIT_STREAM_ADTS		0
330b97169daSJie Yang #define AAC_BIT_STREAM_ADIF		1
331b97169daSJie Yang #define AAC_BIT_STREAM_RAW		2
332b97169daSJie Yang 
333b97169daSJie Yang /* AAC Music Parameters Message */
334b97169daSJie Yang struct snd_aac_params {
335b97169daSJie Yang 	u8 num_chan; /* 1=Mono, 2=Stereo*/
336b97169daSJie Yang 	u8 pcm_wd_sz; /* 16/24 - bit*/
337b97169daSJie Yang 	u8 bdownsample; /*SBR downsampling 0 - disable 1 -enabled AAC+ only */
338b97169daSJie Yang 	u8 bs_format; /* input bit stream format adts=0, adif=1, raw=2 */
339b97169daSJie Yang 	u16  reser2;
340b97169daSJie Yang 	u32 externalsr; /*sampling rate of basic AAC raw bit stream*/
341b97169daSJie Yang 	u8 sbr_signalling;/*disable/enable/set automode the SBR tool.AAC+*/
342b97169daSJie Yang 	u8 reser1;
343b97169daSJie Yang 	u16  reser3;
344b97169daSJie Yang } __packed;
345b97169daSJie Yang 
346b97169daSJie Yang /* WMA Music Parameters Message */
347b97169daSJie Yang struct snd_wma_params {
348b97169daSJie Yang 	u8  num_chan;	/* 1=Mono, 2=Stereo */
349b97169daSJie Yang 	u8  pcm_wd_sz;	/* 16/24 - bit*/
350b97169daSJie Yang 	u16 reserved1;
351b97169daSJie Yang 	u32 brate;	/* Use the hard coded value. */
352b97169daSJie Yang 	u32 sfreq;	/* Sampling freq eg. 8000, 441000, 48000 */
353b97169daSJie Yang 	u32 channel_mask;  /* Channel Mask */
354b97169daSJie Yang 	u16 format_tag;	/* Format Tag */
355b97169daSJie Yang 	u16 block_align;	/* packet size */
356b97169daSJie Yang 	u16 wma_encode_opt;/* Encoder option */
357b97169daSJie Yang 	u8 op_align;	/* op align 0- 16 bit, 1- MSB, 2 LSB */
358b97169daSJie Yang 	u8 reserved;	/* reserved */
359b97169daSJie Yang } __packed;
360b97169daSJie Yang 
36150cbf945SBhaskar Chowdhury /* Codec params structure */
362b97169daSJie Yang union  snd_sst_codec_params {
363b97169daSJie Yang 	struct snd_pcm_params pcm_params;
364b97169daSJie Yang 	struct snd_mp3_params mp3_params;
365b97169daSJie Yang 	struct snd_aac_params aac_params;
366b97169daSJie Yang 	struct snd_wma_params wma_params;
367b97169daSJie Yang } __packed;
368b97169daSJie Yang 
369b97169daSJie Yang /* Address and size info of a frame buffer */
370b97169daSJie Yang struct sst_address_info {
371b97169daSJie Yang 	u32 addr; /* Address at IA */
372b97169daSJie Yang 	u32 size; /* Size of the buffer */
373b97169daSJie Yang };
374b97169daSJie Yang 
375b97169daSJie Yang struct snd_sst_alloc_params_ext {
376b97169daSJie Yang 	__u16 sg_count;
377b97169daSJie Yang 	__u16 reserved;
378b97169daSJie Yang 	__u32 frag_size;	/*Number of samples after which period elapsed
379b97169daSJie Yang 				  message is sent valid only if path  = 0*/
380b97169daSJie Yang 	struct sst_address_info  ring_buf_info[8];
381b97169daSJie Yang };
382b97169daSJie Yang 
383b97169daSJie Yang struct snd_sst_stream_params {
384b97169daSJie Yang 	union snd_sst_codec_params uc;
385b97169daSJie Yang } __packed;
386b97169daSJie Yang 
387b97169daSJie Yang struct snd_sst_params {
388b97169daSJie Yang 	u32 result;
389b97169daSJie Yang 	u32 stream_id;
390b97169daSJie Yang 	u8 codec;
391b97169daSJie Yang 	u8 ops;
392b97169daSJie Yang 	u8 stream_type;
393b97169daSJie Yang 	u8 device_type;
394b97169daSJie Yang 	u8 task;
395b97169daSJie Yang 	struct snd_sst_stream_params sparams;
396b97169daSJie Yang 	struct snd_sst_alloc_params_ext aparams;
397b97169daSJie Yang };
398b97169daSJie Yang 
399b97169daSJie Yang struct snd_sst_alloc_mrfld {
400b97169daSJie Yang 	u16 codec_type;
401b97169daSJie Yang 	u8 operation;
402b97169daSJie Yang 	u8 sg_count;
403b97169daSJie Yang 	struct sst_address_info ring_buf_info[8];
404b97169daSJie Yang 	u32 frag_size;
405b97169daSJie Yang 	u32 ts;
406b97169daSJie Yang 	struct snd_sst_stream_params codec_params;
407b97169daSJie Yang } __packed;
408b97169daSJie Yang 
409b97169daSJie Yang /* Alloc stream params structure */
410b97169daSJie Yang struct snd_sst_alloc_params {
411b97169daSJie Yang 	struct snd_sst_str_type str_type;
412b97169daSJie Yang 	struct snd_sst_stream_params stream_params;
413b97169daSJie Yang 	struct snd_sst_alloc_params_ext alloc_params;
414b97169daSJie Yang } __packed;
415b97169daSJie Yang 
416b97169daSJie Yang /* Alloc stream response message */
417b97169daSJie Yang struct snd_sst_alloc_response {
418b97169daSJie Yang 	struct snd_sst_str_type str_type; /* Stream type for allocation */
419b97169daSJie Yang 	struct snd_sst_lib_download lib_dnld; /* Valid only for codec dnld */
420b97169daSJie Yang };
421b97169daSJie Yang 
422b97169daSJie Yang /* Drop response */
423b97169daSJie Yang struct snd_sst_drop_response {
424b97169daSJie Yang 	u32 result;
425b97169daSJie Yang 	u32 bytes;
426b97169daSJie Yang };
427b97169daSJie Yang 
428b97169daSJie Yang struct snd_sst_async_msg {
429b97169daSJie Yang 	u32 msg_id; /* Async msg id */
430*5224f790SGustavo A. R. Silva 	u32 payload[];
431b97169daSJie Yang };
432b97169daSJie Yang 
433b97169daSJie Yang struct snd_sst_async_err_msg {
434b97169daSJie Yang 	u32 fw_resp; /* Firmware Result */
435b97169daSJie Yang 	u32 lib_resp; /*Library result */
436b97169daSJie Yang } __packed;
437b97169daSJie Yang 
438b97169daSJie Yang struct snd_sst_vol {
439b97169daSJie Yang 	u32	stream_id;
440b97169daSJie Yang 	s32	volume;
441b97169daSJie Yang 	u32	ramp_duration;
442b97169daSJie Yang 	u32	ramp_type;		/* Ramp type, default=0 */
443b97169daSJie Yang };
444b97169daSJie Yang 
445b97169daSJie Yang /* Gain library parameters for mrfld
446b97169daSJie Yang  * based on DSP command spec v0.82
447b97169daSJie Yang  */
448b97169daSJie Yang struct snd_sst_gain_v2 {
449b97169daSJie Yang 	u16 gain_cell_num;  /* num of gain cells to modify*/
450b97169daSJie Yang 	u8 cell_nbr_idx; /* instance index*/
451b97169daSJie Yang 	u8 cell_path_idx; /* pipe-id */
452b97169daSJie Yang 	u16 module_id; /*module id */
453b97169daSJie Yang 	u16 left_cell_gain; /* left gain value in dB*/
454b97169daSJie Yang 	u16 right_cell_gain; /* right gain value in dB*/
455b97169daSJie Yang 	u16 gain_time_const; /* gain time constant*/
456b97169daSJie Yang } __packed;
457b97169daSJie Yang 
458b97169daSJie Yang struct snd_sst_mute {
459b97169daSJie Yang 	u32	stream_id;
460b97169daSJie Yang 	u32	mute;
461b97169daSJie Yang };
462b97169daSJie Yang 
463b97169daSJie Yang struct snd_sst_runtime_params {
464b97169daSJie Yang 	u8 type;
465b97169daSJie Yang 	u8 str_id;
466b97169daSJie Yang 	u8 size;
467b97169daSJie Yang 	u8 rsvd;
468b97169daSJie Yang 	void *addr;
469b97169daSJie Yang } __packed;
470b97169daSJie Yang 
471b97169daSJie Yang enum stream_param_type {
472b97169daSJie Yang 	SST_SET_TIME_SLOT = 0,
473b97169daSJie Yang 	SST_SET_CHANNEL_INFO = 1,
474b97169daSJie Yang 	OTHERS = 2, /*reserved for future params*/
475b97169daSJie Yang };
476b97169daSJie Yang 
477b97169daSJie Yang /* CSV Voice call routing structure */
478b97169daSJie Yang struct snd_sst_control_routing {
479b97169daSJie Yang 	u8 control; /* 0=start, 1=Stop */
480b97169daSJie Yang 	u8 reserved[3];	/* Reserved- for 32 bit alignment */
481b97169daSJie Yang };
482b97169daSJie Yang 
483b97169daSJie Yang struct ipc_post {
484b97169daSJie Yang 	struct list_head node;
485b97169daSJie Yang 	union ipc_header header; /* driver specific */
486b97169daSJie Yang 	bool is_large;
487b97169daSJie Yang 	bool is_process_reply;
488b97169daSJie Yang 	union ipc_header_mrfld mrfld_header;
489b97169daSJie Yang 	char *mailbox_data;
490b97169daSJie Yang };
491b97169daSJie Yang 
492b97169daSJie Yang struct snd_sst_ctxt_params {
493b97169daSJie Yang 	u32 address; /* Physical Address in DDR where the context is stored */
494b97169daSJie Yang 	u32 size; /* size of the context */
495b97169daSJie Yang };
496b97169daSJie Yang 
497b97169daSJie Yang struct snd_sst_lpe_log_params {
498b97169daSJie Yang 	u8 dbg_type;
499b97169daSJie Yang 	u8 module_id;
500b97169daSJie Yang 	u8 log_level;
501b97169daSJie Yang 	u8 reserved;
502b97169daSJie Yang } __packed;
503b97169daSJie Yang 
504b97169daSJie Yang enum snd_sst_bytes_type {
505b97169daSJie Yang 	SND_SST_BYTES_SET = 0x1,
506b97169daSJie Yang 	SND_SST_BYTES_GET = 0x2,
507b97169daSJie Yang };
508b97169daSJie Yang 
509b97169daSJie Yang struct snd_sst_bytes_v2 {
510b97169daSJie Yang 	u8 type;
511b97169daSJie Yang 	u8 ipc_msg;
512b97169daSJie Yang 	u8 block;
513b97169daSJie Yang 	u8 task_id;
514b97169daSJie Yang 	u8 pipe_id;
515b97169daSJie Yang 	u8 rsvd;
516b97169daSJie Yang 	u16 len;
517*5224f790SGustavo A. R. Silva 	char bytes[];
518b97169daSJie Yang };
519b97169daSJie Yang 
520b97169daSJie Yang #define MAX_VTSV_FILES 2
521b97169daSJie Yang struct snd_sst_vtsv_info {
522b97169daSJie Yang 	struct sst_address_info vfiles[MAX_VTSV_FILES];
523b97169daSJie Yang } __packed;
524b97169daSJie Yang 
525b97169daSJie Yang #endif /* __SST_MFLD_DSP_H__ */
526