1 /**************************************************************************** 2 **************************************************************************** 3 *** 4 *** This header was automatically generated from a Linux kernel header 5 *** of the same name, to make information necessary for userspace to 6 *** call into the kernel available to libc. It contains only constants, 7 *** structures, and macros generated from the original header, and thus, 8 *** contains no copyrightable information. 9 *** 10 *** To edit the content of this header, modify the corresponding 11 *** source file (e.g. under external/kernel-headers/original/) then 12 *** run bionic/libc/kernel/tools/update_all.py 13 *** 14 *** Any manual change here will be lost the next time this script will 15 *** be run. You've been warned! 16 *** 17 **************************************************************************** 18 ****************************************************************************/ 19 #ifndef _LSM_PARAMS_H__ 20 #define _LSM_PARAMS_H__ 21 #define LSM_POLLING_ENABLE_SUPPORT 22 #define LSM_EVENT_TIMESTAMP_MODE_SUPPORT 23 #include <linux/types.h> 24 #include <sound/asound.h> 25 #define SNDRV_LSM_VERSION SNDRV_PROTOCOL_VERSION(0, 3, 1) 26 #define LSM_MAX_STAGES_PER_SESSION 2 27 #define LSM_STAGE_INDEX_FIRST 0 28 #define LSM_OUT_FORMAT_PCM (0) 29 #define LSM_OUT_FORMAT_ADPCM (1 << 0) 30 #define LSM_OUT_DATA_RAW (0) 31 #define LSM_OUT_DATA_PACKED (1) 32 #define LSM_OUT_DATA_EVENTS_DISABLED (0) 33 #define LSM_OUT_DATA_EVENTS_ENABLED (1) 34 #define LSM_OUT_TRANSFER_MODE_RT (0) 35 #define LSM_OUT_TRANSFER_MODE_FTRT (1) 36 #define LSM_ENDPOINT_DETECT_THRESHOLD (0) 37 #define LSM_OPERATION_MODE (1) 38 #define LSM_GAIN (2) 39 #define LSM_MIN_CONFIDENCE_LEVELS (3) 40 #define LSM_REG_SND_MODEL (4) 41 #define LSM_DEREG_SND_MODEL (5) 42 #define LSM_CUSTOM_PARAMS (6) 43 #define LSM_POLLING_ENABLE (7) 44 #define LSM_DET_EVENT_TYPE (8) 45 #define LSM_LAB_CONTROL (9) 46 #define LSM_GET_CUSTOM_PARAMS (10) 47 #define LSM_PARAMS_MAX (LSM_GET_CUSTOM_PARAMS + 1) 48 #define LSM_EVENT_NON_TIME_STAMP_MODE (0) 49 #define LSM_EVENT_TIME_STAMP_MODE (1) 50 #define LSM_DET_EVENT_TYPE_LEGACY (0) 51 #define LSM_DET_EVENT_TYPE_GENERIC (1) 52 #define LSM_INPUT_SAMPLE_RATE_16K 16000 53 #define LSM_INPUT_SAMPLE_RATE_48K 48000 54 #define LSM_INPUT_BIT_WIDTH_16 16 55 #define LSM_INPUT_BIT_WIDTH_24 24 56 #define LSM_INPUT_NUM_CHANNELS_MIN 1 57 #define LSM_INPUT_NUM_CHANNELS_MAX 9 58 enum lsm_app_id { 59 LSM_VOICE_WAKEUP_APP_ID = 1, 60 LSM_VOICE_WAKEUP_APP_ID_V2 = 2, 61 }; 62 enum lsm_detection_mode { 63 LSM_MODE_KEYWORD_ONLY_DETECTION = 1, 64 LSM_MODE_USER_KEYWORD_DETECTION 65 }; 66 enum lsm_vw_status { 67 LSM_VOICE_WAKEUP_STATUS_RUNNING = 1, 68 LSM_VOICE_WAKEUP_STATUS_DETECTED, 69 LSM_VOICE_WAKEUP_STATUS_END_SPEECH, 70 LSM_VOICE_WAKEUP_STATUS_REJECTED 71 }; 72 struct snd_lsm_ep_det_thres { 73 __u32 epd_begin; 74 __u32 epd_end; 75 }; 76 struct snd_lsm_detect_mode { 77 enum lsm_detection_mode mode; 78 bool detect_failure; 79 }; 80 struct snd_lsm_gain { 81 __u16 gain; 82 }; 83 struct snd_lsm_poll_enable { 84 bool poll_en; 85 }; 86 struct snd_lsm_det_event_type { 87 __u32 event_type; 88 __u32 mode; 89 }; 90 struct snd_lsm_sound_model_v2 { 91 __u8 * data; 92 __u8 * confidence_level; 93 __u32 data_size; 94 enum lsm_detection_mode detection_mode; 95 __u8 num_confidence_levels; 96 bool detect_failure; 97 }; 98 struct snd_lsm_session_data { 99 enum lsm_app_id app_id; 100 }; 101 struct snd_lsm_stage_info { 102 __u32 app_type; 103 __u32 lpi_enable; 104 }; 105 struct snd_lsm_session_data_v2 { 106 enum lsm_app_id app_id; 107 __u32 num_stages; 108 struct snd_lsm_stage_info stage_info[LSM_MAX_STAGES_PER_SESSION]; 109 }; 110 struct snd_lsm_lab_control { 111 __u32 enable; 112 }; 113 struct snd_lsm_event_status { 114 __u16 status; 115 __u16 payload_size; 116 __u8 payload[0]; 117 }; 118 struct snd_lsm_event_status_v3 { 119 __u32 timestamp_lsw; 120 __u32 timestamp_msw; 121 __u16 status; 122 __u16 payload_size; 123 __u8 payload[0]; 124 }; 125 struct snd_lsm_detection_params { 126 __u8 * conf_level; 127 enum lsm_detection_mode detect_mode; 128 __u8 num_confidence_levels; 129 bool detect_failure; 130 bool poll_enable; 131 }; 132 struct lsm_params_info { 133 __u32 module_id; 134 __u32 param_id; 135 __u32 param_size; 136 __u8 * param_data; 137 uint32_t param_type; 138 }; 139 struct lsm_params_info_v2 { 140 __u32 module_id; 141 __u32 param_id; 142 __u32 param_size; 143 __u8 * param_data; 144 uint32_t param_type; 145 __u16 instance_id; 146 __u16 stage_idx; 147 }; 148 struct snd_lsm_module_params { 149 __u8 * params; 150 __u32 num_params; 151 __u32 data_size; 152 }; 153 struct snd_lsm_output_format_cfg { 154 __u8 format; 155 __u8 packing; 156 __u8 events; 157 __u8 mode; 158 }; 159 struct snd_lsm_input_hw_params { 160 __u32 sample_rate; 161 __u16 bit_width; 162 __u16 num_channels; 163 } __attribute__((packed)); 164 struct lsm_params_get_info { 165 __u32 module_id; 166 __u16 instance_id; 167 __u16 reserved; 168 __u32 param_id; 169 __u32 param_size; 170 uint32_t param_type; 171 __u16 stage_idx; 172 __u8 payload[0]; 173 } __attribute__((packed)); 174 #define SNDRV_LSM_DEREG_SND_MODEL _IOW('U', 0x01, int) 175 #define SNDRV_LSM_EVENT_STATUS _IOW('U', 0x02, struct snd_lsm_event_status) 176 #define SNDRV_LSM_ABORT_EVENT _IOW('U', 0x03, int) 177 #define SNDRV_LSM_START _IOW('U', 0x04, int) 178 #define SNDRV_LSM_STOP _IOW('U', 0x05, int) 179 #define SNDRV_LSM_SET_SESSION_DATA _IOW('U', 0x06, struct snd_lsm_session_data) 180 #define SNDRV_LSM_REG_SND_MODEL_V2 _IOW('U', 0x07, struct snd_lsm_sound_model_v2) 181 #define SNDRV_LSM_LAB_CONTROL _IOW('U', 0x08, uint32_t) 182 #define SNDRV_LSM_STOP_LAB _IO('U', 0x09) 183 #define SNDRV_LSM_SET_PARAMS _IOW('U', 0x0A, struct snd_lsm_detection_params) 184 #define SNDRV_LSM_SET_MODULE_PARAMS _IOW('U', 0x0B, struct snd_lsm_module_params) 185 #define SNDRV_LSM_OUT_FORMAT_CFG _IOW('U', 0x0C, struct snd_lsm_output_format_cfg) 186 #define SNDRV_LSM_SET_PORT _IO('U', 0x0D) 187 #define SNDRV_LSM_SET_FWK_MODE_CONFIG _IOW('U', 0x0E, uint32_t) 188 #define SNDRV_LSM_EVENT_STATUS_V3 _IOW('U', 0x0F, struct snd_lsm_event_status_v3) 189 #define SNDRV_LSM_GENERIC_DET_EVENT _IOW('U', 0x10, struct snd_lsm_event_status) 190 #define SNDRV_LSM_SET_INPUT_HW_PARAMS _IOW('U', 0x11, struct snd_lsm_input_hw_params) 191 #define SNDRV_LSM_SET_SESSION_DATA_V2 _IOW('U', 0x12, struct snd_lsm_session_data_v2) 192 #define SNDRV_LSM_SET_MODULE_PARAMS_V2 _IOW('U', 0x13, struct snd_lsm_module_params) 193 #define SNDRV_LSM_GET_MODULE_PARAMS _IOWR('U', 0x14, struct lsm_params_get_info) 194 #endif 195