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_PARAMS_MAX (LSM_LAB_CONTROL + 1) 47 #define LSM_EVENT_NON_TIME_STAMP_MODE (0) 48 #define LSM_EVENT_TIME_STAMP_MODE (1) 49 #define LSM_DET_EVENT_TYPE_LEGACY (0) 50 #define LSM_DET_EVENT_TYPE_GENERIC (1) 51 #define LSM_INPUT_SAMPLE_RATE_16K 16000 52 #define LSM_INPUT_SAMPLE_RATE_48K 48000 53 #define LSM_INPUT_BIT_WIDTH_16 16 54 #define LSM_INPUT_BIT_WIDTH_24 24 55 #define LSM_INPUT_NUM_CHANNELS_MIN 1 56 #define LSM_INPUT_NUM_CHANNELS_MAX 9 57 enum lsm_app_id { 58 LSM_VOICE_WAKEUP_APP_ID = 1, 59 LSM_VOICE_WAKEUP_APP_ID_V2 = 2, 60 }; 61 enum lsm_detection_mode { 62 LSM_MODE_KEYWORD_ONLY_DETECTION = 1, 63 LSM_MODE_USER_KEYWORD_DETECTION 64 }; 65 enum lsm_vw_status { 66 LSM_VOICE_WAKEUP_STATUS_RUNNING = 1, 67 LSM_VOICE_WAKEUP_STATUS_DETECTED, 68 LSM_VOICE_WAKEUP_STATUS_END_SPEECH, 69 LSM_VOICE_WAKEUP_STATUS_REJECTED 70 }; 71 struct snd_lsm_ep_det_thres { 72 __u32 epd_begin; 73 __u32 epd_end; 74 }; 75 struct snd_lsm_detect_mode { 76 enum lsm_detection_mode mode; 77 bool detect_failure; 78 }; 79 struct snd_lsm_gain { 80 __u16 gain; 81 }; 82 struct snd_lsm_poll_enable { 83 bool poll_en; 84 }; 85 struct snd_lsm_det_event_type { 86 __u32 event_type; 87 __u32 mode; 88 }; 89 struct snd_lsm_sound_model_v2 { 90 __u8 * data; 91 __u8 * confidence_level; 92 __u32 data_size; 93 enum lsm_detection_mode detection_mode; 94 __u8 num_confidence_levels; 95 bool detect_failure; 96 }; 97 struct snd_lsm_session_data { 98 enum lsm_app_id app_id; 99 }; 100 struct snd_lsm_stage_info { 101 __u32 app_type; 102 __u32 lpi_enable; 103 }; 104 struct snd_lsm_session_data_v2 { 105 enum lsm_app_id app_id; 106 __u32 num_stages; 107 struct snd_lsm_stage_info stage_info[LSM_MAX_STAGES_PER_SESSION]; 108 }; 109 struct snd_lsm_lab_control { 110 __u32 enable; 111 }; 112 struct snd_lsm_event_status { 113 __u16 status; 114 __u16 payload_size; 115 __u8 payload[0]; 116 }; 117 struct snd_lsm_event_status_v3 { 118 __u32 timestamp_lsw; 119 __u32 timestamp_msw; 120 __u16 status; 121 __u16 payload_size; 122 __u8 payload[0]; 123 }; 124 struct snd_lsm_detection_params { 125 __u8 * conf_level; 126 enum lsm_detection_mode detect_mode; 127 __u8 num_confidence_levels; 128 bool detect_failure; 129 bool poll_enable; 130 }; 131 struct lsm_params_info { 132 __u32 module_id; 133 __u32 param_id; 134 __u32 param_size; 135 __u8 * param_data; 136 uint32_t param_type; 137 }; 138 struct lsm_params_info_v2 { 139 __u32 module_id; 140 __u32 param_id; 141 __u32 param_size; 142 __u8 * param_data; 143 uint32_t param_type; 144 __u16 instance_id; 145 __u16 stage_idx; 146 }; 147 struct snd_lsm_module_params { 148 __u8 * params; 149 __u32 num_params; 150 __u32 data_size; 151 }; 152 struct snd_lsm_output_format_cfg { 153 __u8 format; 154 __u8 packing; 155 __u8 events; 156 __u8 mode; 157 }; 158 struct snd_lsm_input_hw_params { 159 __u32 sample_rate; 160 __u16 bit_width; 161 __u16 num_channels; 162 } __attribute__((packed)); 163 #define SNDRV_LSM_DEREG_SND_MODEL _IOW('U', 0x01, int) 164 #define SNDRV_LSM_EVENT_STATUS _IOW('U', 0x02, struct snd_lsm_event_status) 165 #define SNDRV_LSM_ABORT_EVENT _IOW('U', 0x03, int) 166 #define SNDRV_LSM_START _IOW('U', 0x04, int) 167 #define SNDRV_LSM_STOP _IOW('U', 0x05, int) 168 #define SNDRV_LSM_SET_SESSION_DATA _IOW('U', 0x06, struct snd_lsm_session_data) 169 #define SNDRV_LSM_REG_SND_MODEL_V2 _IOW('U', 0x07, struct snd_lsm_sound_model_v2) 170 #define SNDRV_LSM_LAB_CONTROL _IOW('U', 0x08, uint32_t) 171 #define SNDRV_LSM_STOP_LAB _IO('U', 0x09) 172 #define SNDRV_LSM_SET_PARAMS _IOW('U', 0x0A, struct snd_lsm_detection_params) 173 #define SNDRV_LSM_SET_MODULE_PARAMS _IOW('U', 0x0B, struct snd_lsm_module_params) 174 #define SNDRV_LSM_OUT_FORMAT_CFG _IOW('U', 0x0C, struct snd_lsm_output_format_cfg) 175 #define SNDRV_LSM_SET_PORT _IO('U', 0x0D) 176 #define SNDRV_LSM_SET_FWK_MODE_CONFIG _IOW('U', 0x0E, uint32_t) 177 #define SNDRV_LSM_EVENT_STATUS_V3 _IOW('U', 0x0F, struct snd_lsm_event_status_v3) 178 #define SNDRV_LSM_GENERIC_DET_EVENT _IOW('U', 0x10, struct snd_lsm_event_status) 179 #define SNDRV_LSM_SET_INPUT_HW_PARAMS _IOW('U', 0x11, struct snd_lsm_input_hw_params) 180 #define SNDRV_LSM_SET_SESSION_DATA_V2 _IOW('U', 0x12, struct snd_lsm_session_data_v2) 181 #define SNDRV_LSM_SET_MODULE_PARAMS_V2 _IOW('U', 0x13, struct snd_lsm_module_params) 182 #endif 183