18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci#ifndef __SST_MFLD_DSP_H__ 38c2ecf20Sopenharmony_ci#define __SST_MFLD_DSP_H__ 48c2ecf20Sopenharmony_ci/* 58c2ecf20Sopenharmony_ci * sst_mfld_dsp.h - Intel SST Driver for audio engine 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * Copyright (C) 2008-14 Intel Corporation 88c2ecf20Sopenharmony_ci * Authors: Vinod Koul <vinod.koul@linux.intel.com> 98c2ecf20Sopenharmony_ci * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 108c2ecf20Sopenharmony_ci * 118c2ecf20Sopenharmony_ci * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 128c2ecf20Sopenharmony_ci */ 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci#define SST_MAX_BIN_BYTES 1024 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci#define MAX_DBG_RW_BYTES 80 178c2ecf20Sopenharmony_ci#define MAX_NUM_SCATTER_BUFFERS 8 188c2ecf20Sopenharmony_ci#define MAX_LOOP_BACK_DWORDS 8 198c2ecf20Sopenharmony_ci/* IPC base address and mailbox, timestamp offsets */ 208c2ecf20Sopenharmony_ci#define SST_MAILBOX_SIZE 0x0400 218c2ecf20Sopenharmony_ci#define SST_MAILBOX_SEND 0x0000 228c2ecf20Sopenharmony_ci#define SST_TIME_STAMP 0x1800 238c2ecf20Sopenharmony_ci#define SST_TIME_STAMP_MRFLD 0x800 248c2ecf20Sopenharmony_ci#define SST_RESERVED_OFFSET 0x1A00 258c2ecf20Sopenharmony_ci#define SST_SCU_LPE_MAILBOX 0x1000 268c2ecf20Sopenharmony_ci#define SST_LPE_SCU_MAILBOX 0x1400 278c2ecf20Sopenharmony_ci#define SST_SCU_LPE_LOG_BUF (SST_SCU_LPE_MAILBOX+16) 288c2ecf20Sopenharmony_ci#define PROCESS_MSG 0x80 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci/* Message ID's for IPC messages */ 318c2ecf20Sopenharmony_ci/* Bits B7: SST or IA/SC ; B6-B4: Msg Category; B3-B0: Msg Type */ 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci/* I2L Firmware/Codec Download msgs */ 348c2ecf20Sopenharmony_ci#define IPC_IA_PREP_LIB_DNLD 0x01 358c2ecf20Sopenharmony_ci#define IPC_IA_LIB_DNLD_CMPLT 0x02 368c2ecf20Sopenharmony_ci#define IPC_IA_GET_FW_VERSION 0x04 378c2ecf20Sopenharmony_ci#define IPC_IA_GET_FW_BUILD_INF 0x05 388c2ecf20Sopenharmony_ci#define IPC_IA_GET_FW_INFO 0x06 398c2ecf20Sopenharmony_ci#define IPC_IA_GET_FW_CTXT 0x07 408c2ecf20Sopenharmony_ci#define IPC_IA_SET_FW_CTXT 0x08 418c2ecf20Sopenharmony_ci#define IPC_IA_PREPARE_SHUTDOWN 0x31 428c2ecf20Sopenharmony_ci/* I2L Codec Config/control msgs */ 438c2ecf20Sopenharmony_ci#define IPC_PREP_D3 0x10 448c2ecf20Sopenharmony_ci#define IPC_IA_SET_CODEC_PARAMS 0x10 458c2ecf20Sopenharmony_ci#define IPC_IA_GET_CODEC_PARAMS 0x11 468c2ecf20Sopenharmony_ci#define IPC_IA_SET_PPP_PARAMS 0x12 478c2ecf20Sopenharmony_ci#define IPC_IA_GET_PPP_PARAMS 0x13 488c2ecf20Sopenharmony_ci#define IPC_SST_PERIOD_ELAPSED_MRFLD 0xA 498c2ecf20Sopenharmony_ci#define IPC_IA_ALG_PARAMS 0x1A 508c2ecf20Sopenharmony_ci#define IPC_IA_TUNING_PARAMS 0x1B 518c2ecf20Sopenharmony_ci#define IPC_IA_SET_RUNTIME_PARAMS 0x1C 528c2ecf20Sopenharmony_ci#define IPC_IA_SET_PARAMS 0x1 538c2ecf20Sopenharmony_ci#define IPC_IA_GET_PARAMS 0x2 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ci#define IPC_EFFECTS_CREATE 0xE 568c2ecf20Sopenharmony_ci#define IPC_EFFECTS_DESTROY 0xF 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ci/* I2L Stream config/control msgs */ 598c2ecf20Sopenharmony_ci#define IPC_IA_ALLOC_STREAM_MRFLD 0x2 608c2ecf20Sopenharmony_ci#define IPC_IA_ALLOC_STREAM 0x20 /* Allocate a stream ID */ 618c2ecf20Sopenharmony_ci#define IPC_IA_FREE_STREAM_MRFLD 0x03 628c2ecf20Sopenharmony_ci#define IPC_IA_FREE_STREAM 0x21 /* Free the stream ID */ 638c2ecf20Sopenharmony_ci#define IPC_IA_SET_STREAM_PARAMS 0x22 648c2ecf20Sopenharmony_ci#define IPC_IA_SET_STREAM_PARAMS_MRFLD 0x12 658c2ecf20Sopenharmony_ci#define IPC_IA_GET_STREAM_PARAMS 0x23 668c2ecf20Sopenharmony_ci#define IPC_IA_PAUSE_STREAM 0x24 678c2ecf20Sopenharmony_ci#define IPC_IA_PAUSE_STREAM_MRFLD 0x4 688c2ecf20Sopenharmony_ci#define IPC_IA_RESUME_STREAM 0x25 698c2ecf20Sopenharmony_ci#define IPC_IA_RESUME_STREAM_MRFLD 0x5 708c2ecf20Sopenharmony_ci#define IPC_IA_DROP_STREAM 0x26 718c2ecf20Sopenharmony_ci#define IPC_IA_DROP_STREAM_MRFLD 0x07 728c2ecf20Sopenharmony_ci#define IPC_IA_DRAIN_STREAM 0x27 /* Short msg with str_id */ 738c2ecf20Sopenharmony_ci#define IPC_IA_DRAIN_STREAM_MRFLD 0x8 748c2ecf20Sopenharmony_ci#define IPC_IA_CONTROL_ROUTING 0x29 758c2ecf20Sopenharmony_ci#define IPC_IA_VTSV_UPDATE_MODULES 0x20 768c2ecf20Sopenharmony_ci#define IPC_IA_VTSV_DETECTED 0x21 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_ci#define IPC_IA_START_STREAM_MRFLD 0X06 798c2ecf20Sopenharmony_ci#define IPC_IA_START_STREAM 0x30 /* Short msg with str_id */ 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_ci#define IPC_IA_SET_GAIN_MRFLD 0x21 828c2ecf20Sopenharmony_ci/* Debug msgs */ 838c2ecf20Sopenharmony_ci#define IPC_IA_DBG_MEM_READ 0x40 848c2ecf20Sopenharmony_ci#define IPC_IA_DBG_MEM_WRITE 0x41 858c2ecf20Sopenharmony_ci#define IPC_IA_DBG_LOOP_BACK 0x42 868c2ecf20Sopenharmony_ci#define IPC_IA_DBG_LOG_ENABLE 0x45 878c2ecf20Sopenharmony_ci#define IPC_IA_DBG_SET_PROBE_PARAMS 0x47 888c2ecf20Sopenharmony_ci 898c2ecf20Sopenharmony_ci/* L2I Firmware/Codec Download msgs */ 908c2ecf20Sopenharmony_ci#define IPC_IA_FW_INIT_CMPLT 0x81 918c2ecf20Sopenharmony_ci#define IPC_IA_FW_INIT_CMPLT_MRFLD 0x01 928c2ecf20Sopenharmony_ci#define IPC_IA_FW_ASYNC_ERR_MRFLD 0x11 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_ci/* L2I Codec Config/control msgs */ 958c2ecf20Sopenharmony_ci#define IPC_SST_FRAGMENT_ELPASED 0x90 /* Request IA more data */ 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ci#define IPC_SST_BUF_UNDER_RUN 0x92 /* PB Under run and stopped */ 988c2ecf20Sopenharmony_ci#define IPC_SST_BUF_OVER_RUN 0x93 /* CAP Under run and stopped */ 998c2ecf20Sopenharmony_ci#define IPC_SST_DRAIN_END 0x94 /* PB Drain complete and stopped */ 1008c2ecf20Sopenharmony_ci#define IPC_SST_CHNGE_SSP_PARAMS 0x95 /* PB SSP parameters changed */ 1018c2ecf20Sopenharmony_ci#define IPC_SST_STREAM_PROCESS_FATAL_ERR 0x96/* error in processing a stream */ 1028c2ecf20Sopenharmony_ci#define IPC_SST_PERIOD_ELAPSED 0x97 /* period elapsed */ 1038c2ecf20Sopenharmony_ci 1048c2ecf20Sopenharmony_ci#define IPC_SST_ERROR_EVENT 0x99 /* Buffer over run occurred */ 1058c2ecf20Sopenharmony_ci/* L2S messages */ 1068c2ecf20Sopenharmony_ci#define IPC_SC_DDR_LINK_UP 0xC0 1078c2ecf20Sopenharmony_ci#define IPC_SC_DDR_LINK_DOWN 0xC1 1088c2ecf20Sopenharmony_ci#define IPC_SC_SET_LPECLK_REQ 0xC2 1098c2ecf20Sopenharmony_ci#define IPC_SC_SSP_BIT_BANG 0xC3 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_ci/* L2I Error reporting msgs */ 1128c2ecf20Sopenharmony_ci#define IPC_IA_MEM_ALLOC_FAIL 0xE0 1138c2ecf20Sopenharmony_ci#define IPC_IA_PROC_ERR 0xE1 /* error in processing a 1148c2ecf20Sopenharmony_ci stream can be used by playback and 1158c2ecf20Sopenharmony_ci capture modules */ 1168c2ecf20Sopenharmony_ci 1178c2ecf20Sopenharmony_ci/* L2I Debug msgs */ 1188c2ecf20Sopenharmony_ci#define IPC_IA_PRINT_STRING 0xF0 1198c2ecf20Sopenharmony_ci 1208c2ecf20Sopenharmony_ci/* Buffer under-run */ 1218c2ecf20Sopenharmony_ci#define IPC_IA_BUF_UNDER_RUN_MRFLD 0x0B 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_ci/* Mrfld specific defines: 1248c2ecf20Sopenharmony_ci * For asynchronous messages(INIT_CMPLT, PERIOD_ELAPSED, ASYNC_ERROR) 1258c2ecf20Sopenharmony_ci * received from FW, the format is: 1268c2ecf20Sopenharmony_ci * - IPC High: pvt_id is set to zero. Always short message. 1278c2ecf20Sopenharmony_ci * - msg_id is in lower 16-bits of IPC low payload. 1288c2ecf20Sopenharmony_ci * - pipe_id is in higher 16-bits of IPC low payload for period_elapsed. 1298c2ecf20Sopenharmony_ci * - error id is in higher 16-bits of IPC low payload for async errors. 1308c2ecf20Sopenharmony_ci */ 1318c2ecf20Sopenharmony_ci#define SST_ASYNC_DRV_ID 0 1328c2ecf20Sopenharmony_ci 1338c2ecf20Sopenharmony_ci/* Command Response or Acknowledge message to any IPC message will have 1348c2ecf20Sopenharmony_ci * same message ID and stream ID information which is sent. 1358c2ecf20Sopenharmony_ci * There is no specific Ack message ID. The data field is used as response 1368c2ecf20Sopenharmony_ci * meaning. 1378c2ecf20Sopenharmony_ci */ 1388c2ecf20Sopenharmony_cienum ackData { 1398c2ecf20Sopenharmony_ci IPC_ACK_SUCCESS = 0, 1408c2ecf20Sopenharmony_ci IPC_ACK_FAILURE, 1418c2ecf20Sopenharmony_ci}; 1428c2ecf20Sopenharmony_ci 1438c2ecf20Sopenharmony_cienum ipc_ia_msg_id { 1448c2ecf20Sopenharmony_ci IPC_CMD = 1, /*!< Task Control message ID */ 1458c2ecf20Sopenharmony_ci IPC_SET_PARAMS = 2,/*!< Task Set param message ID */ 1468c2ecf20Sopenharmony_ci IPC_GET_PARAMS = 3, /*!< Task Get param message ID */ 1478c2ecf20Sopenharmony_ci IPC_INVALID = 0xFF, /*!<Task Get param message ID */ 1488c2ecf20Sopenharmony_ci}; 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_cienum sst_codec_types { 1518c2ecf20Sopenharmony_ci /* AUDIO/MUSIC CODEC Type Definitions */ 1528c2ecf20Sopenharmony_ci SST_CODEC_TYPE_UNKNOWN = 0, 1538c2ecf20Sopenharmony_ci SST_CODEC_TYPE_PCM, /* Pass through Audio codec */ 1548c2ecf20Sopenharmony_ci SST_CODEC_TYPE_MP3, 1558c2ecf20Sopenharmony_ci SST_CODEC_TYPE_MP24, 1568c2ecf20Sopenharmony_ci SST_CODEC_TYPE_AAC, 1578c2ecf20Sopenharmony_ci SST_CODEC_TYPE_AACP, 1588c2ecf20Sopenharmony_ci SST_CODEC_TYPE_eAACP, 1598c2ecf20Sopenharmony_ci}; 1608c2ecf20Sopenharmony_ci 1618c2ecf20Sopenharmony_cienum stream_type { 1628c2ecf20Sopenharmony_ci SST_STREAM_TYPE_NONE = 0, 1638c2ecf20Sopenharmony_ci SST_STREAM_TYPE_MUSIC = 1, 1648c2ecf20Sopenharmony_ci}; 1658c2ecf20Sopenharmony_ci 1668c2ecf20Sopenharmony_cienum sst_error_codes { 1678c2ecf20Sopenharmony_ci /* Error code,response to msgId: Description */ 1688c2ecf20Sopenharmony_ci /* Common error codes */ 1698c2ecf20Sopenharmony_ci SST_SUCCESS = 0, /* Success */ 1708c2ecf20Sopenharmony_ci SST_ERR_INVALID_STREAM_ID = 1, 1718c2ecf20Sopenharmony_ci SST_ERR_INVALID_MSG_ID = 2, 1728c2ecf20Sopenharmony_ci SST_ERR_INVALID_STREAM_OP = 3, 1738c2ecf20Sopenharmony_ci SST_ERR_INVALID_PARAMS = 4, 1748c2ecf20Sopenharmony_ci SST_ERR_INVALID_CODEC = 5, 1758c2ecf20Sopenharmony_ci SST_ERR_INVALID_MEDIA_TYPE = 6, 1768c2ecf20Sopenharmony_ci SST_ERR_STREAM_ERR = 7, 1778c2ecf20Sopenharmony_ci 1788c2ecf20Sopenharmony_ci SST_ERR_STREAM_IN_USE = 15, 1798c2ecf20Sopenharmony_ci}; 1808c2ecf20Sopenharmony_ci 1818c2ecf20Sopenharmony_cistruct ipc_dsp_hdr { 1828c2ecf20Sopenharmony_ci u16 mod_index_id:8; /*!< DSP Command ID specific to tasks */ 1838c2ecf20Sopenharmony_ci u16 pipe_id:8; /*!< instance of the module in the pipeline */ 1848c2ecf20Sopenharmony_ci u16 mod_id; /*!< Pipe_id */ 1858c2ecf20Sopenharmony_ci u16 cmd_id; /*!< Module ID = lpe_algo_types_t */ 1868c2ecf20Sopenharmony_ci u16 length; /*!< Length of the payload only */ 1878c2ecf20Sopenharmony_ci} __packed; 1888c2ecf20Sopenharmony_ci 1898c2ecf20Sopenharmony_ciunion ipc_header_high { 1908c2ecf20Sopenharmony_ci struct { 1918c2ecf20Sopenharmony_ci u32 msg_id:8; /* Message ID - Max 256 Message Types */ 1928c2ecf20Sopenharmony_ci u32 task_id:4; /* Task ID associated with this comand */ 1938c2ecf20Sopenharmony_ci u32 drv_id:4; /* Identifier for the driver to track*/ 1948c2ecf20Sopenharmony_ci u32 rsvd1:8; /* Reserved */ 1958c2ecf20Sopenharmony_ci u32 result:4; /* Reserved */ 1968c2ecf20Sopenharmony_ci u32 res_rqd:1; /* Response rqd */ 1978c2ecf20Sopenharmony_ci u32 large:1; /* Large Message if large = 1 */ 1988c2ecf20Sopenharmony_ci u32 done:1; /* bit 30 - Done bit */ 1998c2ecf20Sopenharmony_ci u32 busy:1; /* bit 31 - busy bit*/ 2008c2ecf20Sopenharmony_ci } part; 2018c2ecf20Sopenharmony_ci u32 full; 2028c2ecf20Sopenharmony_ci} __packed; 2038c2ecf20Sopenharmony_ci/* IPC header */ 2048c2ecf20Sopenharmony_ciunion ipc_header_mrfld { 2058c2ecf20Sopenharmony_ci struct { 2068c2ecf20Sopenharmony_ci u32 header_low_payload; 2078c2ecf20Sopenharmony_ci union ipc_header_high header_high; 2088c2ecf20Sopenharmony_ci } p; 2098c2ecf20Sopenharmony_ci u64 full; 2108c2ecf20Sopenharmony_ci} __packed; 2118c2ecf20Sopenharmony_ci/* CAUTION NOTE: All IPC message body must be multiple of 32 bits.*/ 2128c2ecf20Sopenharmony_ci 2138c2ecf20Sopenharmony_ci/* IPC Header */ 2148c2ecf20Sopenharmony_ciunion ipc_header { 2158c2ecf20Sopenharmony_ci struct { 2168c2ecf20Sopenharmony_ci u32 msg_id:8; /* Message ID - Max 256 Message Types */ 2178c2ecf20Sopenharmony_ci u32 str_id:5; 2188c2ecf20Sopenharmony_ci u32 large:1; /* Large Message if large = 1 */ 2198c2ecf20Sopenharmony_ci u32 reserved:2; /* Reserved for future use */ 2208c2ecf20Sopenharmony_ci u32 data:14; /* Ack/Info for msg, size of msg in Mailbox */ 2218c2ecf20Sopenharmony_ci u32 done:1; /* bit 30 */ 2228c2ecf20Sopenharmony_ci u32 busy:1; /* bit 31 */ 2238c2ecf20Sopenharmony_ci } part; 2248c2ecf20Sopenharmony_ci u32 full; 2258c2ecf20Sopenharmony_ci} __packed; 2268c2ecf20Sopenharmony_ci 2278c2ecf20Sopenharmony_ci/* Firmware build info */ 2288c2ecf20Sopenharmony_cistruct sst_fw_build_info { 2298c2ecf20Sopenharmony_ci unsigned char date[16]; /* Firmware build date */ 2308c2ecf20Sopenharmony_ci unsigned char time[16]; /* Firmware build time */ 2318c2ecf20Sopenharmony_ci} __packed; 2328c2ecf20Sopenharmony_ci 2338c2ecf20Sopenharmony_ci/* Firmware Version info */ 2348c2ecf20Sopenharmony_cistruct snd_sst_fw_version { 2358c2ecf20Sopenharmony_ci u8 build; /* build number*/ 2368c2ecf20Sopenharmony_ci u8 minor; /* minor number*/ 2378c2ecf20Sopenharmony_ci u8 major; /* major number*/ 2388c2ecf20Sopenharmony_ci u8 type; /* build type */ 2398c2ecf20Sopenharmony_ci}; 2408c2ecf20Sopenharmony_ci 2418c2ecf20Sopenharmony_cistruct ipc_header_fw_init { 2428c2ecf20Sopenharmony_ci struct snd_sst_fw_version fw_version;/* Firmware version details */ 2438c2ecf20Sopenharmony_ci struct sst_fw_build_info build_info; 2448c2ecf20Sopenharmony_ci u16 result; /* Fw init result */ 2458c2ecf20Sopenharmony_ci u8 module_id; /* Module ID in case of error */ 2468c2ecf20Sopenharmony_ci u8 debug_info; /* Debug info from Module ID in case of fail */ 2478c2ecf20Sopenharmony_ci} __packed; 2488c2ecf20Sopenharmony_ci 2498c2ecf20Sopenharmony_cistruct snd_sst_tstamp { 2508c2ecf20Sopenharmony_ci u64 ring_buffer_counter; /* PB/CP: Bytes copied from/to DDR. */ 2518c2ecf20Sopenharmony_ci u64 hardware_counter; /* PB/CP: Bytes DMAed to/from SSP. */ 2528c2ecf20Sopenharmony_ci u64 frames_decoded; 2538c2ecf20Sopenharmony_ci u64 bytes_decoded; 2548c2ecf20Sopenharmony_ci u64 bytes_copied; 2558c2ecf20Sopenharmony_ci u32 sampling_frequency; 2568c2ecf20Sopenharmony_ci u32 channel_peak[8]; 2578c2ecf20Sopenharmony_ci} __packed; 2588c2ecf20Sopenharmony_ci 2598c2ecf20Sopenharmony_ci/* Stream type params struture for Alloc stream */ 2608c2ecf20Sopenharmony_cistruct snd_sst_str_type { 2618c2ecf20Sopenharmony_ci u8 codec_type; /* Codec type */ 2628c2ecf20Sopenharmony_ci u8 str_type; /* 1 = voice 2 = music */ 2638c2ecf20Sopenharmony_ci u8 operation; /* Playback or Capture */ 2648c2ecf20Sopenharmony_ci u8 protected_str; /* 0=Non DRM, 1=DRM */ 2658c2ecf20Sopenharmony_ci u8 time_slots; 2668c2ecf20Sopenharmony_ci u8 reserved; /* Reserved */ 2678c2ecf20Sopenharmony_ci u16 result; /* Result used for acknowledgment */ 2688c2ecf20Sopenharmony_ci} __packed; 2698c2ecf20Sopenharmony_ci 2708c2ecf20Sopenharmony_ci/* Library info structure */ 2718c2ecf20Sopenharmony_cistruct module_info { 2728c2ecf20Sopenharmony_ci u32 lib_version; 2738c2ecf20Sopenharmony_ci u32 lib_type;/*TBD- KLOCKWORK u8 lib_type;*/ 2748c2ecf20Sopenharmony_ci u32 media_type; 2758c2ecf20Sopenharmony_ci u8 lib_name[12]; 2768c2ecf20Sopenharmony_ci u32 lib_caps; 2778c2ecf20Sopenharmony_ci unsigned char b_date[16]; /* Lib build date */ 2788c2ecf20Sopenharmony_ci unsigned char b_time[16]; /* Lib build time */ 2798c2ecf20Sopenharmony_ci} __packed; 2808c2ecf20Sopenharmony_ci 2818c2ecf20Sopenharmony_ci/* Library slot info */ 2828c2ecf20Sopenharmony_cistruct lib_slot_info { 2838c2ecf20Sopenharmony_ci u8 slot_num; /* 1 or 2 */ 2848c2ecf20Sopenharmony_ci u8 reserved1; 2858c2ecf20Sopenharmony_ci u16 reserved2; 2868c2ecf20Sopenharmony_ci u32 iram_size; /* slot size in IRAM */ 2878c2ecf20Sopenharmony_ci u32 dram_size; /* slot size in DRAM */ 2888c2ecf20Sopenharmony_ci u32 iram_offset; /* starting offset of slot in IRAM */ 2898c2ecf20Sopenharmony_ci u32 dram_offset; /* starting offset of slot in DRAM */ 2908c2ecf20Sopenharmony_ci} __packed; 2918c2ecf20Sopenharmony_ci 2928c2ecf20Sopenharmony_cistruct snd_ppp_mixer_params { 2938c2ecf20Sopenharmony_ci __u32 type; /*Type of the parameter */ 2948c2ecf20Sopenharmony_ci __u32 size; 2958c2ecf20Sopenharmony_ci __u32 input_stream_bitmap; /*Input stream Bit Map*/ 2968c2ecf20Sopenharmony_ci} __packed; 2978c2ecf20Sopenharmony_ci 2988c2ecf20Sopenharmony_cistruct snd_sst_lib_download { 2998c2ecf20Sopenharmony_ci struct module_info lib_info; /* library info type, capabilities etc */ 3008c2ecf20Sopenharmony_ci struct lib_slot_info slot_info; /* slot info to be downloaded */ 3018c2ecf20Sopenharmony_ci u32 mod_entry_pt; 3028c2ecf20Sopenharmony_ci}; 3038c2ecf20Sopenharmony_ci 3048c2ecf20Sopenharmony_cistruct snd_sst_lib_download_info { 3058c2ecf20Sopenharmony_ci struct snd_sst_lib_download dload_lib; 3068c2ecf20Sopenharmony_ci u16 result; /* Result used for acknowledgment */ 3078c2ecf20Sopenharmony_ci u8 pvt_id; /* Private ID */ 3088c2ecf20Sopenharmony_ci u8 reserved; /* for alignment */ 3098c2ecf20Sopenharmony_ci}; 3108c2ecf20Sopenharmony_cistruct snd_pcm_params { 3118c2ecf20Sopenharmony_ci u8 num_chan; /* 1=Mono, 2=Stereo */ 3128c2ecf20Sopenharmony_ci u8 pcm_wd_sz; /* 16/24 - bit*/ 3138c2ecf20Sopenharmony_ci u8 use_offload_path; /* 0-PCM using period elpased & ALSA interfaces 3148c2ecf20Sopenharmony_ci 1-PCM stream via compressed interface */ 3158c2ecf20Sopenharmony_ci u8 reserved2; 3168c2ecf20Sopenharmony_ci u32 sfreq; /* Sampling rate in Hz */ 3178c2ecf20Sopenharmony_ci u8 channel_map[8]; 3188c2ecf20Sopenharmony_ci} __packed; 3198c2ecf20Sopenharmony_ci 3208c2ecf20Sopenharmony_ci/* MP3 Music Parameters Message */ 3218c2ecf20Sopenharmony_cistruct snd_mp3_params { 3228c2ecf20Sopenharmony_ci u8 num_chan; /* 1=Mono, 2=Stereo */ 3238c2ecf20Sopenharmony_ci u8 pcm_wd_sz; /* 16/24 - bit*/ 3248c2ecf20Sopenharmony_ci u8 crc_check; /* crc_check - disable (0) or enable (1) */ 3258c2ecf20Sopenharmony_ci u8 reserved1; /* unused*/ 3268c2ecf20Sopenharmony_ci u16 reserved2; /* Unused */ 3278c2ecf20Sopenharmony_ci} __packed; 3288c2ecf20Sopenharmony_ci 3298c2ecf20Sopenharmony_ci#define AAC_BIT_STREAM_ADTS 0 3308c2ecf20Sopenharmony_ci#define AAC_BIT_STREAM_ADIF 1 3318c2ecf20Sopenharmony_ci#define AAC_BIT_STREAM_RAW 2 3328c2ecf20Sopenharmony_ci 3338c2ecf20Sopenharmony_ci/* AAC Music Parameters Message */ 3348c2ecf20Sopenharmony_cistruct snd_aac_params { 3358c2ecf20Sopenharmony_ci u8 num_chan; /* 1=Mono, 2=Stereo*/ 3368c2ecf20Sopenharmony_ci u8 pcm_wd_sz; /* 16/24 - bit*/ 3378c2ecf20Sopenharmony_ci u8 bdownsample; /*SBR downsampling 0 - disable 1 -enabled AAC+ only */ 3388c2ecf20Sopenharmony_ci u8 bs_format; /* input bit stream format adts=0, adif=1, raw=2 */ 3398c2ecf20Sopenharmony_ci u16 reser2; 3408c2ecf20Sopenharmony_ci u32 externalsr; /*sampling rate of basic AAC raw bit stream*/ 3418c2ecf20Sopenharmony_ci u8 sbr_signalling;/*disable/enable/set automode the SBR tool.AAC+*/ 3428c2ecf20Sopenharmony_ci u8 reser1; 3438c2ecf20Sopenharmony_ci u16 reser3; 3448c2ecf20Sopenharmony_ci} __packed; 3458c2ecf20Sopenharmony_ci 3468c2ecf20Sopenharmony_ci/* WMA Music Parameters Message */ 3478c2ecf20Sopenharmony_cistruct snd_wma_params { 3488c2ecf20Sopenharmony_ci u8 num_chan; /* 1=Mono, 2=Stereo */ 3498c2ecf20Sopenharmony_ci u8 pcm_wd_sz; /* 16/24 - bit*/ 3508c2ecf20Sopenharmony_ci u16 reserved1; 3518c2ecf20Sopenharmony_ci u32 brate; /* Use the hard coded value. */ 3528c2ecf20Sopenharmony_ci u32 sfreq; /* Sampling freq eg. 8000, 441000, 48000 */ 3538c2ecf20Sopenharmony_ci u32 channel_mask; /* Channel Mask */ 3548c2ecf20Sopenharmony_ci u16 format_tag; /* Format Tag */ 3558c2ecf20Sopenharmony_ci u16 block_align; /* packet size */ 3568c2ecf20Sopenharmony_ci u16 wma_encode_opt;/* Encoder option */ 3578c2ecf20Sopenharmony_ci u8 op_align; /* op align 0- 16 bit, 1- MSB, 2 LSB */ 3588c2ecf20Sopenharmony_ci u8 reserved; /* reserved */ 3598c2ecf20Sopenharmony_ci} __packed; 3608c2ecf20Sopenharmony_ci 3618c2ecf20Sopenharmony_ci/* Codec params struture */ 3628c2ecf20Sopenharmony_ciunion snd_sst_codec_params { 3638c2ecf20Sopenharmony_ci struct snd_pcm_params pcm_params; 3648c2ecf20Sopenharmony_ci struct snd_mp3_params mp3_params; 3658c2ecf20Sopenharmony_ci struct snd_aac_params aac_params; 3668c2ecf20Sopenharmony_ci struct snd_wma_params wma_params; 3678c2ecf20Sopenharmony_ci} __packed; 3688c2ecf20Sopenharmony_ci 3698c2ecf20Sopenharmony_ci/* Address and size info of a frame buffer */ 3708c2ecf20Sopenharmony_cistruct sst_address_info { 3718c2ecf20Sopenharmony_ci u32 addr; /* Address at IA */ 3728c2ecf20Sopenharmony_ci u32 size; /* Size of the buffer */ 3738c2ecf20Sopenharmony_ci}; 3748c2ecf20Sopenharmony_ci 3758c2ecf20Sopenharmony_cistruct snd_sst_alloc_params_ext { 3768c2ecf20Sopenharmony_ci __u16 sg_count; 3778c2ecf20Sopenharmony_ci __u16 reserved; 3788c2ecf20Sopenharmony_ci __u32 frag_size; /*Number of samples after which period elapsed 3798c2ecf20Sopenharmony_ci message is sent valid only if path = 0*/ 3808c2ecf20Sopenharmony_ci struct sst_address_info ring_buf_info[8]; 3818c2ecf20Sopenharmony_ci}; 3828c2ecf20Sopenharmony_ci 3838c2ecf20Sopenharmony_cistruct snd_sst_stream_params { 3848c2ecf20Sopenharmony_ci union snd_sst_codec_params uc; 3858c2ecf20Sopenharmony_ci} __packed; 3868c2ecf20Sopenharmony_ci 3878c2ecf20Sopenharmony_cistruct snd_sst_params { 3888c2ecf20Sopenharmony_ci u32 result; 3898c2ecf20Sopenharmony_ci u32 stream_id; 3908c2ecf20Sopenharmony_ci u8 codec; 3918c2ecf20Sopenharmony_ci u8 ops; 3928c2ecf20Sopenharmony_ci u8 stream_type; 3938c2ecf20Sopenharmony_ci u8 device_type; 3948c2ecf20Sopenharmony_ci u8 task; 3958c2ecf20Sopenharmony_ci struct snd_sst_stream_params sparams; 3968c2ecf20Sopenharmony_ci struct snd_sst_alloc_params_ext aparams; 3978c2ecf20Sopenharmony_ci}; 3988c2ecf20Sopenharmony_ci 3998c2ecf20Sopenharmony_cistruct snd_sst_alloc_mrfld { 4008c2ecf20Sopenharmony_ci u16 codec_type; 4018c2ecf20Sopenharmony_ci u8 operation; 4028c2ecf20Sopenharmony_ci u8 sg_count; 4038c2ecf20Sopenharmony_ci struct sst_address_info ring_buf_info[8]; 4048c2ecf20Sopenharmony_ci u32 frag_size; 4058c2ecf20Sopenharmony_ci u32 ts; 4068c2ecf20Sopenharmony_ci struct snd_sst_stream_params codec_params; 4078c2ecf20Sopenharmony_ci} __packed; 4088c2ecf20Sopenharmony_ci 4098c2ecf20Sopenharmony_ci/* Alloc stream params structure */ 4108c2ecf20Sopenharmony_cistruct snd_sst_alloc_params { 4118c2ecf20Sopenharmony_ci struct snd_sst_str_type str_type; 4128c2ecf20Sopenharmony_ci struct snd_sst_stream_params stream_params; 4138c2ecf20Sopenharmony_ci struct snd_sst_alloc_params_ext alloc_params; 4148c2ecf20Sopenharmony_ci} __packed; 4158c2ecf20Sopenharmony_ci 4168c2ecf20Sopenharmony_ci/* Alloc stream response message */ 4178c2ecf20Sopenharmony_cistruct snd_sst_alloc_response { 4188c2ecf20Sopenharmony_ci struct snd_sst_str_type str_type; /* Stream type for allocation */ 4198c2ecf20Sopenharmony_ci struct snd_sst_lib_download lib_dnld; /* Valid only for codec dnld */ 4208c2ecf20Sopenharmony_ci}; 4218c2ecf20Sopenharmony_ci 4228c2ecf20Sopenharmony_ci/* Drop response */ 4238c2ecf20Sopenharmony_cistruct snd_sst_drop_response { 4248c2ecf20Sopenharmony_ci u32 result; 4258c2ecf20Sopenharmony_ci u32 bytes; 4268c2ecf20Sopenharmony_ci}; 4278c2ecf20Sopenharmony_ci 4288c2ecf20Sopenharmony_cistruct snd_sst_async_msg { 4298c2ecf20Sopenharmony_ci u32 msg_id; /* Async msg id */ 4308c2ecf20Sopenharmony_ci u32 payload[0]; 4318c2ecf20Sopenharmony_ci}; 4328c2ecf20Sopenharmony_ci 4338c2ecf20Sopenharmony_cistruct snd_sst_async_err_msg { 4348c2ecf20Sopenharmony_ci u32 fw_resp; /* Firmware Result */ 4358c2ecf20Sopenharmony_ci u32 lib_resp; /*Library result */ 4368c2ecf20Sopenharmony_ci} __packed; 4378c2ecf20Sopenharmony_ci 4388c2ecf20Sopenharmony_cistruct snd_sst_vol { 4398c2ecf20Sopenharmony_ci u32 stream_id; 4408c2ecf20Sopenharmony_ci s32 volume; 4418c2ecf20Sopenharmony_ci u32 ramp_duration; 4428c2ecf20Sopenharmony_ci u32 ramp_type; /* Ramp type, default=0 */ 4438c2ecf20Sopenharmony_ci}; 4448c2ecf20Sopenharmony_ci 4458c2ecf20Sopenharmony_ci/* Gain library parameters for mrfld 4468c2ecf20Sopenharmony_ci * based on DSP command spec v0.82 4478c2ecf20Sopenharmony_ci */ 4488c2ecf20Sopenharmony_cistruct snd_sst_gain_v2 { 4498c2ecf20Sopenharmony_ci u16 gain_cell_num; /* num of gain cells to modify*/ 4508c2ecf20Sopenharmony_ci u8 cell_nbr_idx; /* instance index*/ 4518c2ecf20Sopenharmony_ci u8 cell_path_idx; /* pipe-id */ 4528c2ecf20Sopenharmony_ci u16 module_id; /*module id */ 4538c2ecf20Sopenharmony_ci u16 left_cell_gain; /* left gain value in dB*/ 4548c2ecf20Sopenharmony_ci u16 right_cell_gain; /* right gain value in dB*/ 4558c2ecf20Sopenharmony_ci u16 gain_time_const; /* gain time constant*/ 4568c2ecf20Sopenharmony_ci} __packed; 4578c2ecf20Sopenharmony_ci 4588c2ecf20Sopenharmony_cistruct snd_sst_mute { 4598c2ecf20Sopenharmony_ci u32 stream_id; 4608c2ecf20Sopenharmony_ci u32 mute; 4618c2ecf20Sopenharmony_ci}; 4628c2ecf20Sopenharmony_ci 4638c2ecf20Sopenharmony_cistruct snd_sst_runtime_params { 4648c2ecf20Sopenharmony_ci u8 type; 4658c2ecf20Sopenharmony_ci u8 str_id; 4668c2ecf20Sopenharmony_ci u8 size; 4678c2ecf20Sopenharmony_ci u8 rsvd; 4688c2ecf20Sopenharmony_ci void *addr; 4698c2ecf20Sopenharmony_ci} __packed; 4708c2ecf20Sopenharmony_ci 4718c2ecf20Sopenharmony_cienum stream_param_type { 4728c2ecf20Sopenharmony_ci SST_SET_TIME_SLOT = 0, 4738c2ecf20Sopenharmony_ci SST_SET_CHANNEL_INFO = 1, 4748c2ecf20Sopenharmony_ci OTHERS = 2, /*reserved for future params*/ 4758c2ecf20Sopenharmony_ci}; 4768c2ecf20Sopenharmony_ci 4778c2ecf20Sopenharmony_ci/* CSV Voice call routing structure */ 4788c2ecf20Sopenharmony_cistruct snd_sst_control_routing { 4798c2ecf20Sopenharmony_ci u8 control; /* 0=start, 1=Stop */ 4808c2ecf20Sopenharmony_ci u8 reserved[3]; /* Reserved- for 32 bit alignment */ 4818c2ecf20Sopenharmony_ci}; 4828c2ecf20Sopenharmony_ci 4838c2ecf20Sopenharmony_cistruct ipc_post { 4848c2ecf20Sopenharmony_ci struct list_head node; 4858c2ecf20Sopenharmony_ci union ipc_header header; /* driver specific */ 4868c2ecf20Sopenharmony_ci bool is_large; 4878c2ecf20Sopenharmony_ci bool is_process_reply; 4888c2ecf20Sopenharmony_ci union ipc_header_mrfld mrfld_header; 4898c2ecf20Sopenharmony_ci char *mailbox_data; 4908c2ecf20Sopenharmony_ci}; 4918c2ecf20Sopenharmony_ci 4928c2ecf20Sopenharmony_cistruct snd_sst_ctxt_params { 4938c2ecf20Sopenharmony_ci u32 address; /* Physical Address in DDR where the context is stored */ 4948c2ecf20Sopenharmony_ci u32 size; /* size of the context */ 4958c2ecf20Sopenharmony_ci}; 4968c2ecf20Sopenharmony_ci 4978c2ecf20Sopenharmony_cistruct snd_sst_lpe_log_params { 4988c2ecf20Sopenharmony_ci u8 dbg_type; 4998c2ecf20Sopenharmony_ci u8 module_id; 5008c2ecf20Sopenharmony_ci u8 log_level; 5018c2ecf20Sopenharmony_ci u8 reserved; 5028c2ecf20Sopenharmony_ci} __packed; 5038c2ecf20Sopenharmony_ci 5048c2ecf20Sopenharmony_cienum snd_sst_bytes_type { 5058c2ecf20Sopenharmony_ci SND_SST_BYTES_SET = 0x1, 5068c2ecf20Sopenharmony_ci SND_SST_BYTES_GET = 0x2, 5078c2ecf20Sopenharmony_ci}; 5088c2ecf20Sopenharmony_ci 5098c2ecf20Sopenharmony_cistruct snd_sst_bytes_v2 { 5108c2ecf20Sopenharmony_ci u8 type; 5118c2ecf20Sopenharmony_ci u8 ipc_msg; 5128c2ecf20Sopenharmony_ci u8 block; 5138c2ecf20Sopenharmony_ci u8 task_id; 5148c2ecf20Sopenharmony_ci u8 pipe_id; 5158c2ecf20Sopenharmony_ci u8 rsvd; 5168c2ecf20Sopenharmony_ci u16 len; 5178c2ecf20Sopenharmony_ci char bytes[0]; 5188c2ecf20Sopenharmony_ci}; 5198c2ecf20Sopenharmony_ci 5208c2ecf20Sopenharmony_ci#define MAX_VTSV_FILES 2 5218c2ecf20Sopenharmony_cistruct snd_sst_vtsv_info { 5228c2ecf20Sopenharmony_ci struct sst_address_info vfiles[MAX_VTSV_FILES]; 5238c2ecf20Sopenharmony_ci} __packed; 5248c2ecf20Sopenharmony_ci 5258c2ecf20Sopenharmony_ci#endif /* __SST_MFLD_DSP_H__ */ 526