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 enum lsm_vw_status {
20 	LSM_VOICE_WAKEUP_STATUS_RUNNING = 1,
21 	LSM_VOICE_WAKEUP_STATUS_DETECTED,
22 	LSM_VOICE_WAKEUP_STATUS_END_SPEECH,
23 	LSM_VOICE_WAKEUP_STATUS_REJECTED
24 };
25 
26 struct snd_lsm_sound_model {
27 	__u8 __user *data;
28 	__u32 data_size;
29 	enum lsm_detection_mode detection_mode;
30 	__u16 min_keyw_confidence;
31 	__u16 min_user_confidence;
32 	bool detect_failure;
33 };
34 
35 struct snd_lsm_sound_model_v2 {
36 	__u8 __user *data;
37 	__u8 *confidence_level;
38 	__u32 data_size;
39 	enum lsm_detection_mode detection_mode;
40 	__u8 num_confidence_levels;
41 	bool detect_failure;
42 };
43 
44 struct snd_lsm_session_data {
45 	enum lsm_app_id app_id;
46 };
47 
48 struct snd_lsm_event_status {
49 	__u16 status;
50 	__u16 payload_size;
51 	__u8 payload[0];
52 };
53 
54 struct snd_lsm_detection_params {
55 	__u8 *conf_level;
56 	enum lsm_detection_mode detect_mode;
57 	__u8 num_confidence_levels;
58 	bool detect_failure;
59 };
60 
61 #define SNDRV_LSM_REG_SND_MODEL	 _IOW('U', 0x00, struct snd_lsm_sound_model)
62 #define SNDRV_LSM_DEREG_SND_MODEL _IOW('U', 0x01, int)
63 #define SNDRV_LSM_EVENT_STATUS	_IOW('U', 0x02, struct snd_lsm_event_status)
64 #define SNDRV_LSM_ABORT_EVENT	_IOW('U', 0x03, int)
65 #define SNDRV_LSM_START		_IOW('U', 0x04, int)
66 #define SNDRV_LSM_STOP		_IOW('U', 0x05, int)
67 #define SNDRV_LSM_SET_SESSION_DATA _IOW('U', 0x06, struct snd_lsm_session_data)
68 #define SNDRV_LSM_REG_SND_MODEL_V2 _IOW('U', 0x07,\
69 					struct snd_lsm_sound_model_v2)
70 #define SNDRV_LSM_LAB_CONTROL	_IOW('U', 0x08, uint32_t)
71 #define SNDRV_LSM_STOP_LAB	_IO('U', 0x09)
72 #define SNDRV_LSM_SET_PARAMS	_IOW('U', 0x0A, \
73 					struct snd_lsm_detection_params)
74 
75 #endif
76