-
Notifications
You must be signed in to change notification settings - Fork 0
/
SoundTriggerPropIntf.h
175 lines (152 loc) · 6.38 KB
/
SoundTriggerPropIntf.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
/* SoundTriggerPropIntf.h
*
* Interface for sound trigger related communication
* across modules.
*
* Copyright (c) 2014, 2016-2020, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SOUND_TRIGGER_PROP_INTF_H
#define SOUND_TRIGGER_PROP_INTF_H
#include <hardware/sound_trigger.h>
#include "audio_extn.h"
#define MAKE_HAL_VERSION(maj, min) ((((maj) & 0xff) << 8) | ((min) & 0xff))
#define MAJOR_VERSION(ver) (((ver) & 0xff00) >> 8)
#define MINOR_VERSION(ver) ((ver) & 0x00ff)
/* Interface version used for compatibility with AHAL */
#define STHAL_PROP_API_VERSION_1_0 MAKE_HAL_VERSION(1, 0)
#define STHAL_PROP_API_VERSION_1_1 MAKE_HAL_VERSION(1, 1)
#define STHAL_PROP_API_CURRENT_VERSION STHAL_PROP_API_VERSION_1_1
#define ST_EVENT_CONFIG_MAX_STR_VALUE 32
enum audio_event_type {
AUDIO_EVENT_CAPTURE_DEVICE_INACTIVE,
AUDIO_EVENT_CAPTURE_DEVICE_ACTIVE,
AUDIO_EVENT_PLAYBACK_STREAM_INACTIVE,
AUDIO_EVENT_PLAYBACK_STREAM_ACTIVE,
AUDIO_EVENT_STOP_LAB,
AUDIO_EVENT_SSR,
AUDIO_EVENT_NUM_ST_SESSIONS,
AUDIO_EVENT_READ_SAMPLES,
AUDIO_EVENT_DEVICE_CONNECT,
AUDIO_EVENT_DEVICE_DISCONNECT,
AUDIO_EVENT_SVA_EXEC_MODE,
AUDIO_EVENT_SVA_EXEC_MODE_STATUS,
AUDIO_EVENT_CAPTURE_STREAM_INACTIVE,
AUDIO_EVENT_CAPTURE_STREAM_ACTIVE,
AUDIO_EVENT_BATTERY_STATUS_CHANGED,
AUDIO_EVENT_GET_PARAM,
AUDIO_EVENT_UPDATE_ECHO_REF,
AUDIO_EVENT_SCREEN_STATUS_CHANGED
};
typedef enum audio_event_type audio_event_type_t;
typedef enum {
USECASE_TYPE_PCM_PLAYBACK,
USECASE_TYPE_PCM_CAPTURE,
USECASE_TYPE_VOICE_CALL,
USECASE_TYPE_VOIP_CALL,
} audio_stream_usecase_type_t;
enum ssr_event_status {
SND_CARD_STATUS_OFFLINE,
SND_CARD_STATUS_ONLINE,
CPE_STATUS_OFFLINE,
CPE_STATUS_ONLINE,
SLPI_STATUS_OFFLINE,
SLPI_STATUS_ONLINE
};
struct audio_read_samples_info {
struct sound_trigger_session_info *ses_info;
void *buf;
size_t num_bytes;
};
struct audio_hal_usecase {
audio_stream_usecase_type_t type;
};
struct sound_trigger_device_info {
int device;
};
struct sound_trigger_get_param_data {
char *param;
int sm_handle;
struct str_parms *reply;
};
struct audio_event_info {
union {
enum ssr_event_status status;
int value;
struct sound_trigger_session_info ses_info;
struct audio_read_samples_info aud_info;
char str_value[ST_EVENT_CONFIG_MAX_STR_VALUE];
struct audio_hal_usecase usecase;
bool audio_ec_ref_enabled;
struct sound_trigger_get_param_data st_get_param_data;
} u;
struct sound_trigger_device_info device_info;
};
typedef struct audio_event_info audio_event_info_t;
struct sthw_extn_fptrs {
int (*set_parameters)(const struct sound_trigger_hw_device *dev,
sound_model_handle_t sound_model_handle,
const char *kv_pairs);
size_t (*get_buffer_size)(const struct sound_trigger_hw_device *dev,
sound_model_handle_t sound_model_handle);
int (*read_buffer)(const struct sound_trigger_hw_device *dev,
sound_model_handle_t sound_model_handle,
unsigned char *buf,
size_t bytes);
int (*stop_buffering)(const struct sound_trigger_hw_device *dev,
sound_model_handle_t sound_model_handle);
int (*get_param_data)(const struct sound_trigger_hw_device *dev,
sound_model_handle_t sound_model_handle,
const char *param,
void *payload,
size_t payload_size,
size_t *param_data_size);
};
typedef struct sthw_extn_fptrs sthw_extn_fptrs_t;
/* STHAL callback which is called by AHAL */
typedef int (*sound_trigger_hw_call_back_t)(enum audio_event_type,
struct audio_event_info*);
/* STHAL version queried by AHAL */
typedef int (*sound_trigger_hw_get_version_t)();
/* STHAL extn interface functionality called by qti wrapper */
typedef void (*sthw_extn_get_fptrs_t)(sthw_extn_fptrs_t *fptrs);
/* AHAL callback which is called by STHAL */
typedef void (*audio_hw_call_back_t)(sound_trigger_event_type_t event,
sound_trigger_event_info_t* config);
/* AHAL function which is called by STHAL */
typedef int (*audio_hw_acdb_init_t)(int snd_card_num);
/* AHAL function which is called by STHAL */
typedef int (*audio_hw_acdb_init_v2_t)(struct mixer *mixer);
/* AHAL extn util function which is called by STHAL */
typedef int (*audio_hw_get_snd_card_num_t)();
/* AHAL extn util function which is called by STHAL */
typedef int (*audio_hw_open_snd_mixer_t)(struct mixer **mixer);
/* AHAL extn util function which is called by STHAL */
typedef void (*audio_hw_close_snd_mixer_t)(struct mixer *mixer);
/* AHAL extn util function which is called by STHAL */
typedef int (*audio_extn_hidl_init)();
#endif /* SOUND_TRIGGER_PROP_INTF_H */