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