1 #ifndef _UAPI_LSM_PARAMS_H__
2 #define _UAPI_LSM_PARAMS_H__
3 
4 #include <linux/types.h>
5 #include <sound/asound.h>
6 
7 #define SNDRV_LSM_VERSION SNDRV_PROTOCOL_VERSION(0, 1, 0)
8 
9 enum lsm_app_id {
10 	LSM_VOICE_WAKEUP_APP_ID = 1,
11 	LSM_VOICE_WAKEUP_APP_ID_V2 = 2,
12 };
13 
14 enum lsm_detection_mode {
15 	LSM_MODE_KEYWORD_ONLY_DETECTION = 1,
16 	LSM_MODE_USER_KEYWORD_DETECTION
17 };
18 
19 struct snd_lsm_sound_model {
20 	__u8 __user *data;
21 	__u32 data_size;
22 	enum lsm_detection_mode detection_mode;
23 	__u16 min_keyw_confidence;
24 	__u16 min_user_confidence;
25 	bool detect_failure;
26 };
27 
28 struct snd_lsm_sound_model_v2 {
29 	__u8 __user *data;
30 	__u8 *confidence_level;
31 	__u32 data_size;
32 	enum lsm_detection_mode detection_mode;
33 	__u8 num_confidence_levels;
34 	bool detect_failure;
35 };
36 
37 struct snd_lsm_session_data {
38 	enum lsm_app_id app_id;
39 };
40 
41 struct snd_lsm_event_status {
42 	__u16 status;
43 	__u16 payload_size;
44 	__u8 payload[0];
45 };
46 
47 #define SNDRV_LSM_REG_SND_MODEL	 _IOW('U', 0x00, struct snd_lsm_sound_model)
48 #define SNDRV_LSM_DEREG_SND_MODEL _IOW('U', 0x01, int)
49 #define SNDRV_LSM_EVENT_STATUS	_IOW('U', 0x02, struct snd_lsm_event_status)
50 #define SNDRV_LSM_ABORT_EVENT	_IOW('U', 0x03, int)
51 #define SNDRV_LSM_START		_IOW('U', 0x04, int)
52 #define SNDRV_LSM_STOP		_IOW('U', 0x05, int)
53 #define SNDRV_LSM_SET_SESSION_DATA _IOW('U', 0x06, struct snd_lsm_session_data)
54 #define SNDRV_LSM_REG_SND_MODEL_V2 _IOW('U', 0x07,\
55 					struct snd_lsm_sound_model_v2)
56 #endif
57