0001
0002 #ifndef __SST_MFLD_DSP_H__
0003 #define __SST_MFLD_DSP_H__
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #define SST_MAX_BIN_BYTES 1024
0015
0016 #define MAX_DBG_RW_BYTES 80
0017 #define MAX_NUM_SCATTER_BUFFERS 8
0018 #define MAX_LOOP_BACK_DWORDS 8
0019
0020 #define SST_MAILBOX_SIZE 0x0400
0021 #define SST_MAILBOX_SEND 0x0000
0022 #define SST_TIME_STAMP 0x1800
0023 #define SST_TIME_STAMP_MRFLD 0x800
0024 #define SST_RESERVED_OFFSET 0x1A00
0025 #define SST_SCU_LPE_MAILBOX 0x1000
0026 #define SST_LPE_SCU_MAILBOX 0x1400
0027 #define SST_SCU_LPE_LOG_BUF (SST_SCU_LPE_MAILBOX+16)
0028 #define PROCESS_MSG 0x80
0029
0030
0031
0032
0033
0034 #define IPC_IA_PREP_LIB_DNLD 0x01
0035 #define IPC_IA_LIB_DNLD_CMPLT 0x02
0036 #define IPC_IA_GET_FW_VERSION 0x04
0037 #define IPC_IA_GET_FW_BUILD_INF 0x05
0038 #define IPC_IA_GET_FW_INFO 0x06
0039 #define IPC_IA_GET_FW_CTXT 0x07
0040 #define IPC_IA_SET_FW_CTXT 0x08
0041 #define IPC_IA_PREPARE_SHUTDOWN 0x31
0042
0043 #define IPC_PREP_D3 0x10
0044 #define IPC_IA_SET_CODEC_PARAMS 0x10
0045 #define IPC_IA_GET_CODEC_PARAMS 0x11
0046 #define IPC_IA_SET_PPP_PARAMS 0x12
0047 #define IPC_IA_GET_PPP_PARAMS 0x13
0048 #define IPC_SST_PERIOD_ELAPSED_MRFLD 0xA
0049 #define IPC_IA_ALG_PARAMS 0x1A
0050 #define IPC_IA_TUNING_PARAMS 0x1B
0051 #define IPC_IA_SET_RUNTIME_PARAMS 0x1C
0052 #define IPC_IA_SET_PARAMS 0x1
0053 #define IPC_IA_GET_PARAMS 0x2
0054
0055 #define IPC_EFFECTS_CREATE 0xE
0056 #define IPC_EFFECTS_DESTROY 0xF
0057
0058
0059 #define IPC_IA_ALLOC_STREAM_MRFLD 0x2
0060 #define IPC_IA_ALLOC_STREAM 0x20
0061 #define IPC_IA_FREE_STREAM_MRFLD 0x03
0062 #define IPC_IA_FREE_STREAM 0x21
0063 #define IPC_IA_SET_STREAM_PARAMS 0x22
0064 #define IPC_IA_SET_STREAM_PARAMS_MRFLD 0x12
0065 #define IPC_IA_GET_STREAM_PARAMS 0x23
0066 #define IPC_IA_PAUSE_STREAM 0x24
0067 #define IPC_IA_PAUSE_STREAM_MRFLD 0x4
0068 #define IPC_IA_RESUME_STREAM 0x25
0069 #define IPC_IA_RESUME_STREAM_MRFLD 0x5
0070 #define IPC_IA_DROP_STREAM 0x26
0071 #define IPC_IA_DROP_STREAM_MRFLD 0x07
0072 #define IPC_IA_DRAIN_STREAM 0x27
0073 #define IPC_IA_DRAIN_STREAM_MRFLD 0x8
0074 #define IPC_IA_CONTROL_ROUTING 0x29
0075 #define IPC_IA_VTSV_UPDATE_MODULES 0x20
0076 #define IPC_IA_VTSV_DETECTED 0x21
0077
0078 #define IPC_IA_START_STREAM_MRFLD 0X06
0079 #define IPC_IA_START_STREAM 0x30
0080
0081 #define IPC_IA_SET_GAIN_MRFLD 0x21
0082
0083 #define IPC_IA_DBG_MEM_READ 0x40
0084 #define IPC_IA_DBG_MEM_WRITE 0x41
0085 #define IPC_IA_DBG_LOOP_BACK 0x42
0086 #define IPC_IA_DBG_LOG_ENABLE 0x45
0087 #define IPC_IA_DBG_SET_PROBE_PARAMS 0x47
0088
0089
0090 #define IPC_IA_FW_INIT_CMPLT 0x81
0091 #define IPC_IA_FW_INIT_CMPLT_MRFLD 0x01
0092 #define IPC_IA_FW_ASYNC_ERR_MRFLD 0x11
0093
0094
0095 #define IPC_SST_FRAGMENT_ELPASED 0x90
0096
0097 #define IPC_SST_BUF_UNDER_RUN 0x92
0098 #define IPC_SST_BUF_OVER_RUN 0x93
0099 #define IPC_SST_DRAIN_END 0x94
0100 #define IPC_SST_CHNGE_SSP_PARAMS 0x95
0101 #define IPC_SST_STREAM_PROCESS_FATAL_ERR 0x96
0102 #define IPC_SST_PERIOD_ELAPSED 0x97
0103
0104 #define IPC_SST_ERROR_EVENT 0x99
0105
0106 #define IPC_SC_DDR_LINK_UP 0xC0
0107 #define IPC_SC_DDR_LINK_DOWN 0xC1
0108 #define IPC_SC_SET_LPECLK_REQ 0xC2
0109 #define IPC_SC_SSP_BIT_BANG 0xC3
0110
0111
0112 #define IPC_IA_MEM_ALLOC_FAIL 0xE0
0113 #define IPC_IA_PROC_ERR 0xE1
0114
0115
0116
0117
0118 #define IPC_IA_PRINT_STRING 0xF0
0119
0120
0121 #define IPC_IA_BUF_UNDER_RUN_MRFLD 0x0B
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131 #define SST_ASYNC_DRV_ID 0
0132
0133
0134
0135
0136
0137
0138 enum ackData {
0139 IPC_ACK_SUCCESS = 0,
0140 IPC_ACK_FAILURE,
0141 };
0142
0143 enum ipc_ia_msg_id {
0144 IPC_CMD = 1,
0145 IPC_SET_PARAMS = 2,
0146 IPC_GET_PARAMS = 3,
0147 IPC_INVALID = 0xFF,
0148 };
0149
0150 enum sst_codec_types {
0151
0152 SST_CODEC_TYPE_UNKNOWN = 0,
0153 SST_CODEC_TYPE_PCM,
0154 SST_CODEC_TYPE_MP3,
0155 SST_CODEC_TYPE_MP24,
0156 SST_CODEC_TYPE_AAC,
0157 SST_CODEC_TYPE_AACP,
0158 SST_CODEC_TYPE_eAACP,
0159 };
0160
0161 enum stream_type {
0162 SST_STREAM_TYPE_NONE = 0,
0163 SST_STREAM_TYPE_MUSIC = 1,
0164 };
0165
0166 enum sst_error_codes {
0167
0168
0169 SST_SUCCESS = 0,
0170 SST_ERR_INVALID_STREAM_ID = 1,
0171 SST_ERR_INVALID_MSG_ID = 2,
0172 SST_ERR_INVALID_STREAM_OP = 3,
0173 SST_ERR_INVALID_PARAMS = 4,
0174 SST_ERR_INVALID_CODEC = 5,
0175 SST_ERR_INVALID_MEDIA_TYPE = 6,
0176 SST_ERR_STREAM_ERR = 7,
0177
0178 SST_ERR_STREAM_IN_USE = 15,
0179 };
0180
0181 struct ipc_dsp_hdr {
0182 u16 mod_index_id:8;
0183 u16 pipe_id:8;
0184 u16 mod_id;
0185 u16 cmd_id;
0186 u16 length;
0187 } __packed;
0188
0189 union ipc_header_high {
0190 struct {
0191 u32 msg_id:8;
0192 u32 task_id:4;
0193 u32 drv_id:4;
0194 u32 rsvd1:8;
0195 u32 result:4;
0196 u32 res_rqd:1;
0197 u32 large:1;
0198 u32 done:1;
0199 u32 busy:1;
0200 } part;
0201 u32 full;
0202 } __packed;
0203
0204 union ipc_header_mrfld {
0205 struct {
0206 u32 header_low_payload;
0207 union ipc_header_high header_high;
0208 } p;
0209 u64 full;
0210 } __packed;
0211
0212
0213
0214 union ipc_header {
0215 struct {
0216 u32 msg_id:8;
0217 u32 str_id:5;
0218 u32 large:1;
0219 u32 reserved:2;
0220 u32 data:14;
0221 u32 done:1;
0222 u32 busy:1;
0223 } part;
0224 u32 full;
0225 } __packed;
0226
0227
0228 struct sst_fw_build_info {
0229 unsigned char date[16];
0230 unsigned char time[16];
0231 } __packed;
0232
0233
0234 struct snd_sst_fw_version {
0235 u8 build;
0236 u8 minor;
0237 u8 major;
0238 u8 type;
0239 };
0240
0241 struct ipc_header_fw_init {
0242 struct snd_sst_fw_version fw_version;
0243 struct sst_fw_build_info build_info;
0244 u16 result;
0245 u8 module_id;
0246 u8 debug_info;
0247 } __packed;
0248
0249 struct snd_sst_tstamp {
0250 u64 ring_buffer_counter;
0251 u64 hardware_counter;
0252 u64 frames_decoded;
0253 u64 bytes_decoded;
0254 u64 bytes_copied;
0255 u32 sampling_frequency;
0256 u32 channel_peak[8];
0257 } __packed;
0258
0259
0260 struct snd_sst_str_type {
0261 u8 codec_type;
0262 u8 str_type;
0263 u8 operation;
0264 u8 protected_str;
0265 u8 time_slots;
0266 u8 reserved;
0267 u16 result;
0268 } __packed;
0269
0270
0271 struct module_info {
0272 u32 lib_version;
0273 u32 lib_type;
0274 u32 media_type;
0275 u8 lib_name[12];
0276 u32 lib_caps;
0277 unsigned char b_date[16];
0278 unsigned char b_time[16];
0279 } __packed;
0280
0281
0282 struct lib_slot_info {
0283 u8 slot_num;
0284 u8 reserved1;
0285 u16 reserved2;
0286 u32 iram_size;
0287 u32 dram_size;
0288 u32 iram_offset;
0289 u32 dram_offset;
0290 } __packed;
0291
0292 struct snd_ppp_mixer_params {
0293 __u32 type;
0294 __u32 size;
0295 __u32 input_stream_bitmap;
0296 } __packed;
0297
0298 struct snd_sst_lib_download {
0299 struct module_info lib_info;
0300 struct lib_slot_info slot_info;
0301 u32 mod_entry_pt;
0302 };
0303
0304 struct snd_sst_lib_download_info {
0305 struct snd_sst_lib_download dload_lib;
0306 u16 result;
0307 u8 pvt_id;
0308 u8 reserved;
0309 };
0310 struct snd_pcm_params {
0311 u8 num_chan;
0312 u8 pcm_wd_sz;
0313 u8 use_offload_path;
0314
0315 u8 reserved2;
0316 u32 sfreq;
0317 u8 channel_map[8];
0318 } __packed;
0319
0320
0321 struct snd_mp3_params {
0322 u8 num_chan;
0323 u8 pcm_wd_sz;
0324 u8 crc_check;
0325 u8 reserved1;
0326 u16 reserved2;
0327 } __packed;
0328
0329 #define AAC_BIT_STREAM_ADTS 0
0330 #define AAC_BIT_STREAM_ADIF 1
0331 #define AAC_BIT_STREAM_RAW 2
0332
0333
0334 struct snd_aac_params {
0335 u8 num_chan;
0336 u8 pcm_wd_sz;
0337 u8 bdownsample;
0338 u8 bs_format;
0339 u16 reser2;
0340 u32 externalsr;
0341 u8 sbr_signalling;
0342 u8 reser1;
0343 u16 reser3;
0344 } __packed;
0345
0346
0347 struct snd_wma_params {
0348 u8 num_chan;
0349 u8 pcm_wd_sz;
0350 u16 reserved1;
0351 u32 brate;
0352 u32 sfreq;
0353 u32 channel_mask;
0354 u16 format_tag;
0355 u16 block_align;
0356 u16 wma_encode_opt;
0357 u8 op_align;
0358 u8 reserved;
0359 } __packed;
0360
0361
0362 union snd_sst_codec_params {
0363 struct snd_pcm_params pcm_params;
0364 struct snd_mp3_params mp3_params;
0365 struct snd_aac_params aac_params;
0366 struct snd_wma_params wma_params;
0367 } __packed;
0368
0369
0370 struct sst_address_info {
0371 u32 addr;
0372 u32 size;
0373 };
0374
0375 struct snd_sst_alloc_params_ext {
0376 __u16 sg_count;
0377 __u16 reserved;
0378 __u32 frag_size;
0379
0380 struct sst_address_info ring_buf_info[8];
0381 };
0382
0383 struct snd_sst_stream_params {
0384 union snd_sst_codec_params uc;
0385 } __packed;
0386
0387 struct snd_sst_params {
0388 u32 result;
0389 u32 stream_id;
0390 u8 codec;
0391 u8 ops;
0392 u8 stream_type;
0393 u8 device_type;
0394 u8 task;
0395 struct snd_sst_stream_params sparams;
0396 struct snd_sst_alloc_params_ext aparams;
0397 };
0398
0399 struct snd_sst_alloc_mrfld {
0400 u16 codec_type;
0401 u8 operation;
0402 u8 sg_count;
0403 struct sst_address_info ring_buf_info[8];
0404 u32 frag_size;
0405 u32 ts;
0406 struct snd_sst_stream_params codec_params;
0407 } __packed;
0408
0409
0410 struct snd_sst_alloc_params {
0411 struct snd_sst_str_type str_type;
0412 struct snd_sst_stream_params stream_params;
0413 struct snd_sst_alloc_params_ext alloc_params;
0414 } __packed;
0415
0416
0417 struct snd_sst_alloc_response {
0418 struct snd_sst_str_type str_type;
0419 struct snd_sst_lib_download lib_dnld;
0420 };
0421
0422
0423 struct snd_sst_drop_response {
0424 u32 result;
0425 u32 bytes;
0426 };
0427
0428 struct snd_sst_async_msg {
0429 u32 msg_id;
0430 u32 payload[];
0431 };
0432
0433 struct snd_sst_async_err_msg {
0434 u32 fw_resp;
0435 u32 lib_resp;
0436 } __packed;
0437
0438 struct snd_sst_vol {
0439 u32 stream_id;
0440 s32 volume;
0441 u32 ramp_duration;
0442 u32 ramp_type;
0443 };
0444
0445
0446
0447
0448 struct snd_sst_gain_v2 {
0449 u16 gain_cell_num;
0450 u8 cell_nbr_idx;
0451 u8 cell_path_idx;
0452 u16 module_id;
0453 u16 left_cell_gain;
0454 u16 right_cell_gain;
0455 u16 gain_time_const;
0456 } __packed;
0457
0458 struct snd_sst_mute {
0459 u32 stream_id;
0460 u32 mute;
0461 };
0462
0463 struct snd_sst_runtime_params {
0464 u8 type;
0465 u8 str_id;
0466 u8 size;
0467 u8 rsvd;
0468 void *addr;
0469 } __packed;
0470
0471 enum stream_param_type {
0472 SST_SET_TIME_SLOT = 0,
0473 SST_SET_CHANNEL_INFO = 1,
0474 OTHERS = 2,
0475 };
0476
0477
0478 struct snd_sst_control_routing {
0479 u8 control;
0480 u8 reserved[3];
0481 };
0482
0483 struct ipc_post {
0484 struct list_head node;
0485 union ipc_header header;
0486 bool is_large;
0487 bool is_process_reply;
0488 union ipc_header_mrfld mrfld_header;
0489 char *mailbox_data;
0490 };
0491
0492 struct snd_sst_ctxt_params {
0493 u32 address;
0494 u32 size;
0495 };
0496
0497 struct snd_sst_lpe_log_params {
0498 u8 dbg_type;
0499 u8 module_id;
0500 u8 log_level;
0501 u8 reserved;
0502 } __packed;
0503
0504 enum snd_sst_bytes_type {
0505 SND_SST_BYTES_SET = 0x1,
0506 SND_SST_BYTES_GET = 0x2,
0507 };
0508
0509 struct snd_sst_bytes_v2 {
0510 u8 type;
0511 u8 ipc_msg;
0512 u8 block;
0513 u8 task_id;
0514 u8 pipe_id;
0515 u8 rsvd;
0516 u16 len;
0517 char bytes[];
0518 };
0519
0520 #define MAX_VTSV_FILES 2
0521 struct snd_sst_vtsv_info {
0522 struct sst_address_info vfiles[MAX_VTSV_FILES];
0523 } __packed;
0524
0525 #endif