Derek Chen | b2b9d2e | 2014-11-10 12:40:05 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved. |
| 2 | * |
| 3 | * Redistribution and use in source and binary forms, with or without |
| 4 | * modification, are permitted provided that the following conditions are |
| 5 | * met: |
| 6 | * * Redistributions of source code must retain the above copyright |
| 7 | * notice, this list of conditions and the following disclaimer. |
| 8 | * * Redistributions in binary form must reproduce the above |
| 9 | * copyright notice, this list of conditions and the following |
| 10 | * disclaimer in the documentation and/or other materials provided |
| 11 | * with the distribution. |
| 12 | * * Neither the name of The Linux Foundation nor the names of its |
| 13 | * contributors may be used to endorse or promote products derived |
| 14 | * from this software without specific prior written permission. |
| 15 | * |
| 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED |
| 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS |
| 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
| 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
| 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
| 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | */ |
| 28 | |
| 29 | #ifndef AUDIO_HAL_PLUGIN_H |
| 30 | #define AUDIO_HAL_PLUGIN_H |
| 31 | |
| 32 | #if defined(__cplusplus) |
| 33 | extern "C" { |
| 34 | #endif |
| 35 | |
Derek Chen | 0b58031 | 2020-03-22 21:17:17 -0700 | [diff] [blame] | 36 | #include <system/audio.h> |
Derek Chen | b2b9d2e | 2014-11-10 12:40:05 -0800 | [diff] [blame] | 37 | |
| 38 | #define AUDIO_HAL_PLUGIN_EOK (0) |
| 39 | #define AUDIO_HAL_PLUGIN_EFAIL (-1) /**< Undefined error */ |
| 40 | #define AUDIO_HAL_PLUGIN_ENOMEM (-2) /**< Out of memory */ |
| 41 | #define AUDIO_HAL_PLUGIN_EINVAL (-3) /**< Invalid argument */ |
| 42 | #define AUDIO_HAL_PLUGIN_EBUSY (-4) /**< Plugin driver is busy */ |
| 43 | #define AUDIO_HAL_PLUGIN_ENODEV (-5) /**< No device */ |
| 44 | #define AUDIO_HAL_PLUGIN_EALREADY (-6) /**< Already done */ |
| 45 | |
| 46 | #define AUDIO_PARAMETER_KEY_EXT_HW_PLUGIN_MSG_TYPE "ext_hw_plugin_msg_type" |
| 47 | #define AUDIO_PARAMETER_KEY_EXT_HW_PLUGIN_UC "ext_hw_plugin_usecase" |
| 48 | #define AUDIO_PARAMETER_KEY_EXT_HW_PLUGIN_SND_DEVICE "ext_hw_plugin_snd_device" |
| 49 | #define AUDIO_PARAMETER_KEY_EXT_HW_PLUGIN_DIRECTION "ext_hw_plugin_direction" |
| 50 | #define AUDIO_PARAMETER_KEY_EXT_HW_PLUGIN_CMASK "ext_hw_plugin_channel_mask" |
| 51 | #define AUDIO_PARAMETER_KEY_EXT_HW_PLUGIN_GAIN "ext_hw_plugin_gain" |
| 52 | #define AUDIO_PARAMETER_KEY_EXT_HW_PLUGIN_MUTE_FLAG "ext_hw_plugin_mute_flag" |
| 53 | #define AUDIO_PARAMETER_KEY_EXT_HW_PLUGIN_FADE "ext_hw_plugin_fade" |
| 54 | #define AUDIO_PARAMETER_KEY_EXT_HW_PLUGIN_BALANCE "ext_hw_plugin_balance" |
| 55 | #define AUDIO_PARAMETER_KEY_EXT_HW_PLUGIN_BMT_FTYPE "ext_hw_plugin_bmt_filter_type" |
| 56 | #define AUDIO_PARAMETER_KEY_EXT_HW_PLUGIN_BMT_FLAG "ext_hw_plugin_bmt_flag" |
| 57 | #define AUDIO_PARAMETER_KEY_EXT_HW_PLUGIN_BMT_VAL "ext_hw_plugin_bmt_value" |
| 58 | #define AUDIO_PARAMETER_KEY_EXT_HW_PLUGIN_EQ_FLAG "ext_hw_plugin_eq_flag" |
| 59 | #define AUDIO_PARAMETER_KEY_EXT_HW_PLUGIN_EQ_ID "ext_hw_plugin_eq_id" |
| 60 | #define AUDIO_PARAMETER_KEY_EXT_HW_PLUGIN_EQ_NUM_BANDS "ext_hw_plugin_eq_num_bands" |
| 61 | #define AUDIO_PARAMETER_KEY_EXT_HW_PLUGIN_EQ_BAND_DATA "ext_hw_plugin_eq_band_data" |
| 62 | #define AUDIO_PARAMETER_KEY_EXT_HW_PLUGIN_TUNNEL_SIZE "ext_hw_plugin_tunnel_size" |
| 63 | #define AUDIO_PARAMETER_KEY_EXT_HW_PLUGIN_TUNNEL_DATA "ext_hw_plugin_tunnel_data" |
| 64 | #define AUDIO_PARAMETER_KEY_EXT_HW_PLUGIN_GETPARAM_RESULT "ext_hw_plugin_getparam_result" |
| 65 | #define AUDIO_PARAMETER_KEY_EXT_HW_PLUGIN_GETPARAM_DATA "ext_hw_plugin_getparam_data" |
| 66 | #define AUDIO_PARAMETER_KEY_EXT_HW_PLUGIN_TUNNEL_GET_SIZE "ext_hw_plugin_tunnel_get_size" |
| 67 | /** |
| 68 | * Type of audio hal plug-in messages |
| 69 | */ |
| 70 | typedef enum |
| 71 | { |
| 72 | AUDIO_HAL_PLUGIN_MSG_INVALID = 0, |
| 73 | AUDIO_HAL_PLUGIN_MSG_CODEC_ENABLE, /**< setup codec routing path */ |
| 74 | AUDIO_HAL_PLUGIN_MSG_CODEC_DISABLE, /**< tear down routing path */ |
| 75 | AUDIO_HAL_PLUGIN_MSG_CODEC_SET_PP_VOLUME, /**< set volume */ |
| 76 | AUDIO_HAL_PLUGIN_MSG_CODEC_SET_PP_MUTE, /**< mute/unmute control */ |
| 77 | AUDIO_HAL_PLUGIN_MSG_CODEC_SET_PP_FADE, /**< fade out control */ |
| 78 | AUDIO_HAL_PLUGIN_MSG_CODEC_SET_PP_BALANCE, /**< left/right balance control */ |
| 79 | AUDIO_HAL_PLUGIN_MSG_CODEC_SET_PP_BMT, /**< base/mid/treble control */ |
| 80 | AUDIO_HAL_PLUGIN_MSG_CODEC_SET_PP_EQ, /**< EQ control */ |
| 81 | AUDIO_HAL_PLUGIN_MSG_CODEC_TUNNEL_CMD, /**< pass through cmds */ |
| 82 | AUDIO_HAL_PLUGIN_MSG_CODEC_GET_PP_VOLUME, /**< get volume params */ |
| 83 | AUDIO_HAL_PLUGIN_MSG_CODEC_GET_PP_FADE, /**< get fade params */ |
| 84 | AUDIO_HAL_PLUGIN_MSG_CODEC_GET_PP_BALANCE, /**< get balance params */ |
| 85 | AUDIO_HAL_PLUGIN_MSG_CODEC_GET_PP_BMT, /**< get bmt params */ |
| 86 | AUDIO_HAL_PLUGIN_MSG_CODEC_GET_PP_EQ, /**< get EQ params */ |
| 87 | AUDIO_HAL_PLUGIN_MSG_CODEC_GET_PP_EQ_SUBBANDS, /**< get EQ subbands params */ |
| 88 | AUDIO_HAL_PLUGIN_MSG_CODEC_TUNNEL_GET_CMD, /**< pass through get cmds */ |
Tahir Dawson | 95d89aa | 2021-03-08 14:49:34 -0500 | [diff] [blame] | 89 | AUDIO_HAL_PLUGIN_MSG_SILENT_MODE, /**<set silent boot mode */ |
Tahir Dawson | caaf099 | 2021-03-11 13:31:23 -0500 | [diff] [blame] | 90 | AUDIO_HAL_PLUGIN_MSG_MIC_STATE, /**< enable or disable codec mic */ |
Derek Chen | b2b9d2e | 2014-11-10 12:40:05 -0800 | [diff] [blame] | 91 | AUDIO_HAL_PLUGIN_MSG_MAX |
| 92 | } audio_hal_plugin_msg_type_t; |
| 93 | |
| 94 | /** |
| 95 | * Type of audio hal plug-in use cases |
| 96 | */ |
| 97 | typedef enum |
| 98 | { |
| 99 | AUDIO_HAL_PLUGIN_USECASE_INVALID = -1, |
| 100 | AUDIO_HAL_PLUGIN_USECASE_DEFAULT_PLAYBACK = 0, |
| 101 | AUDIO_HAL_PLUGIN_USECASE_DEFAULT_CAPTURE, |
| 102 | AUDIO_HAL_PLUGIN_USECASE_DRIVER_SIDE_PLAYBACK, |
| 103 | AUDIO_HAL_PLUGIN_USECASE_HFP_VOICE_CALL, |
| 104 | AUDIO_HAL_PLUGIN_USECASE_CS_VOICE_CALL, |
| 105 | AUDIO_HAL_PLUGIN_USECASE_FM_TUNER, |
| 106 | AUDIO_HAL_PLUGIN_USECASE_ICC, |
| 107 | AUDIO_HAL_PLUGIN_USECASE_EC_CAPTURE, |
| 108 | AUDIO_HAL_PLUGIN_USECASE_EC_REF_CAPTURE, |
| 109 | AUDIO_HAL_PLUGIN_USECASE_ANC, |
| 110 | AUDIO_HAL_PLUGIN_USECASE_LINE_IN_PASSTHROUGH, |
| 111 | AUDIO_HAL_PLUGIN_USECASE_HDMI_IN_PASSTHROUGH, |
| 112 | AUDIO_HAL_PLUGIN_USECASE_PHONE_PLAYBACK, |
Timothy Sham | a103159 | 2020-03-29 17:34:57 -0400 | [diff] [blame] | 113 | AUDIO_HAL_PLUGIN_USECASE_VOICE_ACTIVATION, |
Derek Chen | b2b9d2e | 2014-11-10 12:40:05 -0800 | [diff] [blame] | 114 | AUDIO_HAL_PLUGIN_USECASE_MAX |
| 115 | } audio_hal_plugin_usecase_type_t; |
| 116 | |
| 117 | /** |
| 118 | * Type of audio hal plug-in direction used in set_param |
| 119 | */ |
| 120 | typedef enum |
| 121 | { |
| 122 | AUDIO_HAL_PLUGIN_DIRECTION_INVALID = -1, |
| 123 | AUDIO_HAL_PLUGIN_DIRECTION_PLAYBACK = 0, |
| 124 | AUDIO_HAL_PLUGIN_DIRECTION_CAPTURE, |
| 125 | AUDIO_HAL_PLUGIN_DIRECTION_MAX |
| 126 | } audio_hal_plugin_direction_type_t; |
| 127 | |
| 128 | /** |
| 129 | * Type of query status mask |
| 130 | */ |
| 131 | #define QUERY_VALUE_VALID (0x0) |
| 132 | #define QUERY_VALUE_NOT_SUPPORTED (0x1) |
| 133 | #define QUERY_VALUE_NOT_SET (0x2) |
| 134 | |
| 135 | /** |
| 136 | * Type of signed 32-bit bounded value used in get_param |
| 137 | */ |
| 138 | typedef struct audio_hal_plugin_bint32 |
| 139 | { |
| 140 | uint32_t query_status_mask; /**< status of returned actual value */ |
| 141 | int32_t value; /**< actual value */ |
| 142 | int32_t min; /**< minimum for value */ |
| 143 | int32_t max; /**< maximum for value */ |
| 144 | } audio_hal_plugin_bint32_t; |
| 145 | |
| 146 | /** |
| 147 | * Type of unsigned 32-bit bounded value used in get_param |
| 148 | */ |
| 149 | typedef struct audio_hal_plugin_buint32 |
| 150 | { |
| 151 | uint32_t query_status_mask; /**< status of returned actual value */ |
| 152 | uint32_t value; /**< actual value */ |
| 153 | uint32_t min; /**< minimum for value */ |
| 154 | uint32_t max; /**< maximum for value */ |
| 155 | } audio_hal_plugin_buint32_t; |
| 156 | |
| 157 | /** |
| 158 | * Payload of AUDIO_HAL_PLUGIN_MSG_CODEC_ENABLE message |
| 159 | */ |
| 160 | typedef struct audio_hal_plugin_codec_enable |
| 161 | { |
Derek Chen | 0b58031 | 2020-03-22 21:17:17 -0700 | [diff] [blame] | 162 | int snd_dev; /**< Requested endpoint device to be enabled. @enum: SND_DEVICE_XXX */ |
Derek Chen | b2b9d2e | 2014-11-10 12:40:05 -0800 | [diff] [blame] | 163 | audio_hal_plugin_usecase_type_t usecase; |
| 164 | /**< Requested use case. @enum: AUDIO_HAL_PLUGIN_USECASE_XXX */ |
| 165 | uint32_t sample_rate; /**< Requested sample rate for the endpoint device */ |
| 166 | uint32_t bit_width; /**< Requested bit width per sample for the endpoint device */ |
| 167 | uint32_t num_chs; /**< Requested number of channels for the endpoint device */ |
| 168 | } audio_hal_plugin_codec_enable_t; |
| 169 | |
| 170 | /** |
| 171 | * Payload of AUDIO_HAL_PLUGIN_MSG_CODEC_DISABLE message |
| 172 | */ |
| 173 | typedef struct audio_hal_plugin_codec_disable |
| 174 | { |
Derek Chen | 0b58031 | 2020-03-22 21:17:17 -0700 | [diff] [blame] | 175 | int snd_dev; /**< Requested the endpoint device to be disabled */ |
Derek Chen | b2b9d2e | 2014-11-10 12:40:05 -0800 | [diff] [blame] | 176 | audio_hal_plugin_usecase_type_t usecase; /**< Requested use case */ |
| 177 | } audio_hal_plugin_codec_disable_t; |
| 178 | |
| 179 | /** |
| 180 | * Payload of AUDIO_HAL_PLUGIN_MSG_CODEC_SET_PP_VOLUME message |
| 181 | */ |
| 182 | typedef struct audio_hal_plugin_codec_set_pp_vol |
| 183 | { |
Derek Chen | 0b58031 | 2020-03-22 21:17:17 -0700 | [diff] [blame] | 184 | int snd_dev; /**< The requested endpoint device */ |
Derek Chen | b2b9d2e | 2014-11-10 12:40:05 -0800 | [diff] [blame] | 185 | audio_hal_plugin_usecase_type_t usecase; /**< Requested use case */ |
| 186 | audio_channel_mask_t ch_mask; /**< Requested audio channel mask */ |
| 187 | uint32_t gain; /**< The requested volume setting. */ |
| 188 | } audio_hal_plugin_codec_set_pp_vol_t; |
| 189 | |
| 190 | /** |
| 191 | * Payload of AUDIO_HAL_PLUGIN_MSG_CODEC_SET_PP_MUTE message |
| 192 | */ |
| 193 | typedef struct audio_hal_plugin_codec_set_pp_mute |
| 194 | { |
Derek Chen | 0b58031 | 2020-03-22 21:17:17 -0700 | [diff] [blame] | 195 | int snd_dev; /**< The requested endpoint device */ |
Derek Chen | b2b9d2e | 2014-11-10 12:40:05 -0800 | [diff] [blame] | 196 | audio_hal_plugin_usecase_type_t usecase; /**< Requested use case */ |
| 197 | audio_channel_mask_t ch_mask; /**< Requested audio channel mask */ |
| 198 | bool flag; /**< Enable/Disable mute flag. 1: mute, 0: unmute */ |
| 199 | } audio_hal_plugin_codec_set_pp_mute_t; |
| 200 | |
| 201 | /** |
| 202 | * Payload of AUDIO_HAL_PLUGIN_MSG_CODEC_SET_PP_FADE message |
| 203 | */ |
| 204 | typedef struct audio_hal_plugin_codec_set_pp_fade |
| 205 | { |
Derek Chen | 0b58031 | 2020-03-22 21:17:17 -0700 | [diff] [blame] | 206 | int snd_dev; /**< The requested endpoint device */ |
Derek Chen | b2b9d2e | 2014-11-10 12:40:05 -0800 | [diff] [blame] | 207 | audio_hal_plugin_usecase_type_t usecase; /**< Requested use case */ |
| 208 | int32_t fade; /**< The requested fade configuration. */ |
| 209 | } audio_hal_plugin_codec_set_pp_fade_t; |
| 210 | |
| 211 | /** |
| 212 | * Payload of AUDIO_HAL_PLUGIN_MSG_CODEC_SET_PP_BALANCE message |
| 213 | */ |
| 214 | typedef struct audio_hal_plugin_codec_set_pp_balance |
| 215 | { |
Derek Chen | 0b58031 | 2020-03-22 21:17:17 -0700 | [diff] [blame] | 216 | int snd_dev; /**< The requested endpoint device */ |
Derek Chen | b2b9d2e | 2014-11-10 12:40:05 -0800 | [diff] [blame] | 217 | audio_hal_plugin_usecase_type_t usecase; /**< Requested use case */ |
| 218 | int32_t balance; /**< The requested balance configuration. */ |
| 219 | } audio_hal_plugin_codec_set_pp_balance_t; |
| 220 | |
| 221 | /** |
| 222 | * Payload of AUDIO_HAL_PLUGIN_MSG_CODEC_SET_PP_BMT message |
| 223 | */ |
| 224 | typedef enum |
| 225 | { |
| 226 | AUDIO_HAL_PLUGIN_CODEC_PP_FILTER_TYPE_INVALID = 0, |
| 227 | AUDIO_HAL_PLUGIN_CODEC_PP_FILTER_TYPE_BASS, |
| 228 | AUDIO_HAL_PLUGIN_CODEC_PP_FILTER_TYPE_MID, |
| 229 | AUDIO_HAL_PLUGIN_CODEC_PP_FILTER_TYPE_TREBLE, |
| 230 | AUDIO_HAL_PLUGIN_CODEC_PP_FILTER_TYPE_MAX |
| 231 | } audio_hal_plugin_codec_pp_filter_type_t; |
| 232 | |
| 233 | typedef struct audio_hal_plugin_codec_set_pp_bmt |
| 234 | { |
Derek Chen | 0b58031 | 2020-03-22 21:17:17 -0700 | [diff] [blame] | 235 | int snd_dev; /**< The requested endpoint device */ |
Derek Chen | b2b9d2e | 2014-11-10 12:40:05 -0800 | [diff] [blame] | 236 | audio_hal_plugin_usecase_type_t usecase; /**< Requested use case */ |
| 237 | audio_hal_plugin_codec_pp_filter_type_t filter_type; /**< Requested filter type */ |
| 238 | bool enable_flag; /**< Enable flag. 0 - Disable, 1 - Enable */ |
| 239 | int32_t value; /**< Requested value to be set */ |
| 240 | } audio_hal_plugin_codec_set_pp_bmt_t; |
| 241 | |
| 242 | /** |
| 243 | * Payload of AUDIO_HAL_PLUGIN_MSG_CODEC_SET_PP_EQ message |
| 244 | */ |
| 245 | typedef struct audio_hal_plugin_codec_pp_eq_subband |
| 246 | { |
| 247 | uint32_t band_idx; /**< Band index. Supported value: 0 to (num_bands - 1) */ |
| 248 | uint32_t center_freq; /**< Filter band center frequency in millihertz */ |
| 249 | int32_t band_level; /**< Filter band gain in millibels */ |
| 250 | } audio_hal_plugin_codec_pp_eq_subband_t; |
| 251 | |
| 252 | typedef struct audio_hal_plugin_codec_set_pp_eq |
| 253 | { |
Derek Chen | 0b58031 | 2020-03-22 21:17:17 -0700 | [diff] [blame] | 254 | int snd_dev; /**< The requested endpoint device */ |
Derek Chen | b2b9d2e | 2014-11-10 12:40:05 -0800 | [diff] [blame] | 255 | audio_hal_plugin_usecase_type_t usecase; /**< Requested use case */ |
| 256 | bool enable_flag; /**< Enable flag. 0 - Disable, 1 - Enable */ |
| 257 | int32_t preset_id; /**< Specify to use either pre-defined preset EQ or |
| 258 | user-customized equalizers: |
| 259 | -1 - custom equalizer speficied through 'bands' struct |
| 260 | 0 to N - pre-defined preset EQ index: ROCK/JAZZ/POP, etc */ |
| 261 | uint32_t num_bands; /**< Number of EQ subbands when a custom preset_id is selected */ |
| 262 | audio_hal_plugin_codec_pp_eq_subband_t *bands; /**< Equalizer sub-band struct list */ |
| 263 | } audio_hal_plugin_codec_set_pp_eq_t; |
| 264 | |
| 265 | /** |
| 266 | * Payload of AUDIO_HAL_PLUGIN_MSG_CODEC_GET_PP_VOLUME message |
| 267 | */ |
| 268 | typedef struct audio_hal_plugin_codec_get_pp_vol |
| 269 | { |
Derek Chen | 0b58031 | 2020-03-22 21:17:17 -0700 | [diff] [blame] | 270 | int snd_dev; /**< Requested endpoint device */ |
Derek Chen | b2b9d2e | 2014-11-10 12:40:05 -0800 | [diff] [blame] | 271 | audio_hal_plugin_usecase_type_t usecase; /**< Requested use case */ |
| 272 | audio_channel_mask_t ch_mask; /**< Requested audio channel mask */ |
| 273 | audio_hal_plugin_buint32_t ret_gain; /**< Returned volume range and value */ |
| 274 | } audio_hal_plugin_codec_get_pp_vol_t; |
| 275 | |
| 276 | /** |
| 277 | * Payload of AUDIO_HAL_PLUGIN_MSG_CODEC_GET_PP_FADE message |
| 278 | */ |
| 279 | typedef struct audio_hal_plugin_codec_get_pp_fade |
| 280 | { |
Derek Chen | 0b58031 | 2020-03-22 21:17:17 -0700 | [diff] [blame] | 281 | int snd_dev; /**< The requested endpoint device */ |
Derek Chen | b2b9d2e | 2014-11-10 12:40:05 -0800 | [diff] [blame] | 282 | audio_hal_plugin_usecase_type_t usecase; /**< Requested use case */ |
| 283 | audio_hal_plugin_bint32_t ret_fade; /**< Returned fade range and value. */ |
| 284 | } audio_hal_plugin_codec_get_pp_fade_t; |
| 285 | |
| 286 | /** |
| 287 | * Payload of AUDIO_HAL_PLUGIN_MSG_CODEC_GET_PP_BALANCE message |
| 288 | */ |
| 289 | typedef struct audio_hal_plugin_codec_get_pp_balance |
| 290 | { |
Derek Chen | 0b58031 | 2020-03-22 21:17:17 -0700 | [diff] [blame] | 291 | int snd_dev; /**< The requested endpoint device */ |
Derek Chen | b2b9d2e | 2014-11-10 12:40:05 -0800 | [diff] [blame] | 292 | audio_hal_plugin_usecase_type_t usecase; /**< Requested use case */ |
| 293 | audio_hal_plugin_bint32_t ret_balance; /**< Returned balance range and value. */ |
| 294 | } audio_hal_plugin_codec_get_pp_balance_t; |
| 295 | |
| 296 | /** |
| 297 | * Payload of AUDIO_HAL_PLUGIN_MSG_CODEC_GET_PP_BMT message |
| 298 | */ |
| 299 | typedef struct audio_hal_plugin_codec_get_pp_bmt |
| 300 | { |
Derek Chen | 0b58031 | 2020-03-22 21:17:17 -0700 | [diff] [blame] | 301 | int snd_dev; /**< The requested endpoint device */ |
Derek Chen | b2b9d2e | 2014-11-10 12:40:05 -0800 | [diff] [blame] | 302 | audio_hal_plugin_usecase_type_t usecase; /**< Requested use case */ |
| 303 | audio_hal_plugin_codec_pp_filter_type_t filter_type; /**< Requested filter type */ |
| 304 | audio_hal_plugin_bint32_t ret_value; /**< Returned range and value */ |
| 305 | } audio_hal_plugin_codec_get_pp_bmt_t; |
| 306 | |
| 307 | /** |
| 308 | * Payload of AUDIO_HAL_PLUGIN_MSG_CODEC_GET_PP_EQ message |
| 309 | */ |
| 310 | typedef struct audio_hal_plugin_codec_get_pp_eq |
| 311 | { |
Derek Chen | 0b58031 | 2020-03-22 21:17:17 -0700 | [diff] [blame] | 312 | int snd_dev; /**< The requested endpoint device */ |
Derek Chen | b2b9d2e | 2014-11-10 12:40:05 -0800 | [diff] [blame] | 313 | audio_hal_plugin_usecase_type_t usecase; /**< Requested use case */ |
| 314 | audio_hal_plugin_bint32_t ret_preset_id; /**< Returned preset id |
| 315 | -1 - custom equalizer speficied through 'bands' struct |
| 316 | 0 to N - pre-defined preset EQ index: ROCK/JAZZ/POP, etc */ |
| 317 | uint32_t ret_num_bands; /**< Returned number of EQ subbands supported |
| 318 | when a custom preset_id is selected */ |
| 319 | } audio_hal_plugin_codec_get_pp_eq_t; |
| 320 | |
| 321 | /** |
| 322 | * Eq_subband struct used in the following payload |
| 323 | */ |
| 324 | typedef struct audio_hal_plugin_pp_eq_subband_binfo |
| 325 | { |
| 326 | audio_hal_plugin_buint32_t ret_center_freq; /**< Returned band center frequency range |
| 327 | and value in millihertz */ |
| 328 | audio_hal_plugin_bint32_t ret_band_level; /**< Returned band gain range and value in millibels */ |
| 329 | } audio_hal_plugin_pp_eq_subband_binfo_t; |
| 330 | |
| 331 | /** |
| 332 | * Payload of AUDIO_HAL_PLUGIN_MSG_CODEC_GET_PP_EQ_SUBBANDS message |
| 333 | */ |
| 334 | typedef struct audio_hal_plugin_codec_get_pp_eq_subbands |
| 335 | { |
Derek Chen | 0b58031 | 2020-03-22 21:17:17 -0700 | [diff] [blame] | 336 | int snd_dev; /**< The requested endpoint device */ |
Derek Chen | b2b9d2e | 2014-11-10 12:40:05 -0800 | [diff] [blame] | 337 | audio_hal_plugin_usecase_type_t usecase; /**< Requested use case */ |
| 338 | uint32_t num_bands; /**< number of EQ subbands supported for custom eq |
| 339 | returned from get_pp_eq query */ |
| 340 | audio_hal_plugin_pp_eq_subband_binfo_t *ret_bands; /**< Returned subband info list */ |
| 341 | } audio_hal_plugin_codec_get_pp_eq_subbands_t; |
| 342 | |
| 343 | /** |
| 344 | * Payload of AUDIO_HAL_PLUGIN_MSG_CODEC_TUNNEL_GET_CMD message |
| 345 | */ |
| 346 | typedef struct audio_hal_plugin_codec_tunnel_get |
| 347 | { |
| 348 | int32_t *param_data; /**< Request param data from client */ |
| 349 | uint32_t param_size; /**< Request 32-bit data size from client */ |
| 350 | uint32_t size_to_get; /**< Expected 32-bit data size to get from cleint */ |
| 351 | int32_t *ret_data; /**< Returned data */ |
| 352 | uint32_t ret_size; /**< Returned 32-bit data size */ |
| 353 | } audio_hal_plugin_codec_tunnel_get_t; |
| 354 | |
| 355 | /** |
| 356 | * Initialize the audio hal plug-in module and underlying hw driver |
| 357 | * One time call at audio hal boot up time |
| 358 | */ |
| 359 | int32_t audio_hal_plugin_init (void); |
| 360 | |
| 361 | /** |
| 362 | * De-Initialize the audio hal plug-in module and underlying hw driver |
| 363 | * One time call when audio hal get unloaded from system |
| 364 | */ |
| 365 | int32_t audio_hal_plugin_deinit (void); |
| 366 | |
| 367 | /** |
| 368 | * Function to invoke the underlying HW driver realizing the functionality for a given use case. |
| 369 | */ |
| 370 | int32_t audio_hal_plugin_send_msg ( |
| 371 | audio_hal_plugin_msg_type_t msg, |
| 372 | void * payload, uint32_t payload_size); |
| 373 | |
| 374 | #if defined(__cplusplus) |
| 375 | } /* extern "C" */ |
| 376 | #endif |
| 377 | |
| 378 | #endif |