Sidipotu Ashok | 404f26d | 2017-10-10 22:27:51 +0530 | [diff] [blame] | 1 | /* |
Surendar Karka | 287348c | 2019-04-10 18:31:46 +0530 | [diff] [blame] | 2 | * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved. |
Sidipotu Ashok | 404f26d | 2017-10-10 22:27:51 +0530 | [diff] [blame] | 3 | * Not a Contribution. |
| 4 | * |
| 5 | * Copyright (C) 2011 The Android Open Source Project * |
| 6 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | * you may not use this file except in compliance with the License. |
| 8 | * You may obtain a copy of the License at |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, software |
| 13 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | * See the License for the specific language governing permissions and |
| 16 | * limitations under the License. |
| 17 | */ |
| 18 | |
| 19 | #include <sys/cdefs.h> |
| 20 | #include <stdint.h> |
Josh Kirsch | c03f31d | 2019-01-15 11:50:53 -0800 | [diff] [blame] | 21 | #include <system/audio.h> |
Sidipotu Ashok | 404f26d | 2017-10-10 22:27:51 +0530 | [diff] [blame] | 22 | |
| 23 | #ifndef QTI_AUDIO_HAL_DEFS_H |
| 24 | #define QTI_AUDIO_HAL_DEFS_H |
| 25 | |
| 26 | __BEGIN_DECLS |
| 27 | |
| 28 | /**************************************/ |
| 29 | |
| 30 | /** |
| 31 | * standard audio parameters that the HAL may need to handle |
| 32 | */ |
| 33 | |
| 34 | /** |
| 35 | * audio device parameters |
| 36 | */ |
| 37 | |
| 38 | /* BT SCO Noise Reduction + Echo Cancellation parameters */ |
| 39 | #define QAHW_PARAMETER_KEY_BT_NREC "bt_headset_nrec" |
| 40 | #define QAHW_PARAMETER_VALUE_ON "on" |
| 41 | #define QAHW_PARAMETER_VALUE_OFF "off" |
| 42 | |
| 43 | /* TTY mode selection */ |
| 44 | #define QAHW_PARAMETER_KEY_TTY_MODE "tty_mode" |
| 45 | #define QAHW_PARAMETER_VALUE_TTY_OFF "tty_off" |
| 46 | #define QAHW_PARAMETER_VALUE_TTY_VCO "tty_vco" |
| 47 | #define QAHW_PARAMETER_VALUE_TTY_HCO "tty_hco" |
| 48 | #define QAHW_PARAMETER_VALUE_TTY_FULL "tty_full" |
| 49 | |
| 50 | /* Hearing Aid Compatibility - Telecoil (HAC-T) mode on/off |
| 51 | Strings must be in sync with CallFeaturesSetting.java */ |
| 52 | #define QAHW_PARAMETER_KEY_HAC "HACSetting" |
| 53 | #define QAHW_PARAMETER_VALUE_HAC_ON "ON" |
| 54 | #define QAHW_PARAMETER_VALUE_HAC_OFF "OFF" |
| 55 | |
| 56 | /* A2DP sink address set by framework */ |
| 57 | #define QAHW_PARAMETER_A2DP_SINK_ADDRESS "a2dp_sink_address" |
| 58 | |
| 59 | /* A2DP source address set by framework */ |
| 60 | #define QAHW_PARAMETER_A2DP_SOURCE_ADDRESS "a2dp_source_address" |
| 61 | |
| 62 | /* Screen state */ |
| 63 | #define QAHW_PARAMETER_KEY_SCREEN_STATE "screen_state" |
| 64 | |
| 65 | /* Bluetooth SCO wideband */ |
| 66 | #define QAHW_PARAMETER_KEY_BT_SCO_WB "bt_wbs" |
| 67 | |
| 68 | /* Get a new HW synchronization source identifier. |
| 69 | * Return a valid source (positive integer) or AUDIO_HW_SYNC_INVALID if an error occurs |
| 70 | * or no HW sync is available. */ |
| 71 | #define QAHW_PARAMETER_HW_AV_SYNC "hw_av_sync" |
| 72 | |
| 73 | /** |
| 74 | * audio stream parameters |
| 75 | */ |
| 76 | |
| 77 | #define QAHW_PARAMETER_STREAM_ROUTING "routing" /* audio_devices_t */ |
| 78 | #define QAHW_PARAMETER_STREAM_FORMAT "format" /* audio_format_t */ |
| 79 | #define QAHW_PARAMETER_STREAM_CHANNELS "channels" /* audio_channel_mask_t */ |
| 80 | #define QAHW_PARAMETER_STREAM_FRAME_COUNT "frame_count" /* size_t */ |
| 81 | #define QAHW_PARAMETER_STREAM_INPUT_SOURCE "input_source" /* audio_source_t */ |
| 82 | #define QAHW_PARAMETER_STREAM_SAMPLING_RATE "sampling_rate" /* uint32_t */ |
| 83 | |
| 84 | #define QAHW_PARAMETER_DEVICE_CONNECT "connect" /* audio_devices_t */ |
| 85 | #define QAHW_PARAMETER_DEVICE_DISCONNECT "disconnect" /* audio_devices_t */ |
| 86 | |
| 87 | /* Query supported formats. The response is a '|' separated list of strings from |
| 88 | * audio_format_t enum e.g: "sup_formats=AUDIO_FORMAT_PCM_16_BIT" */ |
| 89 | #define QAHW_PARAMETER_STREAM_SUP_FORMATS "sup_formats" |
| 90 | |
| 91 | /* Query supported channel masks. The response is a '|' separated list of |
| 92 | * strings from audio_channel_mask_t enum |
| 93 | * e.g: "sup_channels=AUDIO_CHANNEL_OUT_STEREO|AUDIO_CHANNEL_OUT_MONO" */ |
| 94 | #define QAHW_PARAMETER_STREAM_SUP_CHANNELS "sup_channels" |
| 95 | |
| 96 | /* Query supported sampling rates. The response is a '|' separated list of |
| 97 | * integer values e.g: "sup_sampling_rates=44100|48000" */ |
| 98 | #define QAHW_PARAMETER_STREAM_SUP_SAMPLING_RATES "sup_sampling_rates" |
| 99 | |
| 100 | /* Set the HW synchronization source for an output stream. */ |
| 101 | #define QAHW_PARAMETER_STREAM_HW_AV_SYNC "hw_av_sync" |
| 102 | |
| 103 | /* Enable mono audio playback if 1, else should be 0. */ |
| 104 | #define QAHW_PARAMETER_MONO_OUTPUT "mono_output" |
| 105 | |
| 106 | /** |
| 107 | * audio codec parameters |
| 108 | */ |
| 109 | |
| 110 | #define QAHW_OFFLOAD_CODEC_PARAMS "music_offload_codec_param" |
| 111 | #define QAHW_OFFLOAD_CODEC_BIT_PER_SAMPLE "music_offload_bit_per_sample" |
| 112 | #define QAHW_OFFLOAD_CODEC_BIT_RATE "music_offload_bit_rate" |
| 113 | #define QAHW_OFFLOAD_CODEC_AVG_BIT_RATE "music_offload_avg_bit_rate" |
| 114 | #define QAHW_OFFLOAD_CODEC_ID "music_offload_codec_id" |
| 115 | #define QAHW_OFFLOAD_CODEC_BLOCK_ALIGN "music_offload_block_align" |
| 116 | #define QAHW_OFFLOAD_CODEC_SAMPLE_RATE "music_offload_sample_rate" |
| 117 | #define QAHW_OFFLOAD_CODEC_ENCODE_OPTION "music_offload_encode_option" |
| 118 | #define QAHW_OFFLOAD_CODEC_NUM_CHANNEL "music_offload_num_channels" |
| 119 | #define QAHW_OFFLOAD_CODEC_DOWN_SAMPLING "music_offload_down_sampling" |
| 120 | #define QAHW_OFFLOAD_CODEC_DELAY_SAMPLES "delay_samples" |
| 121 | #define QAHW_OFFLOAD_CODEC_PADDING_SAMPLES "padding_samples" |
| 122 | |
| 123 | /** |
| 124 | * extended audio codec parameters |
| 125 | */ |
| 126 | |
| 127 | #define QAHW_OFFLOAD_CODEC_WMA_FORMAT_TAG "music_offload_wma_format_tag" |
| 128 | #define QAHW_OFFLOAD_CODEC_WMA_BLOCK_ALIGN "music_offload_wma_block_align" |
| 129 | #define QAHW_OFFLOAD_CODEC_WMA_BIT_PER_SAMPLE "music_offload_wma_bit_per_sample" |
| 130 | #define QAHW_OFFLOAD_CODEC_WMA_CHANNEL_MASK "music_offload_wma_channel_mask" |
| 131 | #define QAHW_OFFLOAD_CODEC_WMA_ENCODE_OPTION "music_offload_wma_encode_option" |
| 132 | #define QAHW_OFFLOAD_CODEC_WMA_ENCODE_OPTION1 "music_offload_wma_encode_option1" |
| 133 | #define QAHW_OFFLOAD_CODEC_WMA_ENCODE_OPTION2 "music_offload_wma_encode_option2" |
| 134 | |
| 135 | #define QAHW_OFFLOAD_CODEC_FLAC_MIN_BLK_SIZE "music_offload_flac_min_blk_size" |
| 136 | #define QAHW_OFFLOAD_CODEC_FLAC_MAX_BLK_SIZE "music_offload_flac_max_blk_size" |
| 137 | #define QAHW_OFFLOAD_CODEC_FLAC_MIN_FRAME_SIZE "music_offload_flac_min_frame_size" |
| 138 | #define QAHW_OFFLOAD_CODEC_FLAC_MAX_FRAME_SIZE "music_offload_flac_max_frame_size" |
| 139 | |
| 140 | #define QAHW_OFFLOAD_CODEC_ALAC_FRAME_LENGTH "music_offload_alac_frame_length" |
| 141 | #define QAHW_OFFLOAD_CODEC_ALAC_COMPATIBLE_VERSION "music_offload_alac_compatible_version" |
| 142 | #define QAHW_OFFLOAD_CODEC_ALAC_BIT_DEPTH "music_offload_alac_bit_depth" |
| 143 | #define QAHW_OFFLOAD_CODEC_ALAC_PB "music_offload_alac_pb" |
| 144 | #define QAHW_OFFLOAD_CODEC_ALAC_MB "music_offload_alac_mb" |
| 145 | #define QAHW_OFFLOAD_CODEC_ALAC_KB "music_offload_alac_kb" |
| 146 | #define QAHW_OFFLOAD_CODEC_ALAC_NUM_CHANNELS "music_offload_alac_num_channels" |
| 147 | #define QAHW_OFFLOAD_CODEC_ALAC_MAX_RUN "music_offload_alac_max_run" |
| 148 | #define QAHW_OFFLOAD_CODEC_ALAC_MAX_FRAME_BYTES "music_offload_alac_max_frame_bytes" |
| 149 | #define QAHW_OFFLOAD_CODEC_ALAC_AVG_BIT_RATE "music_offload_alac_avg_bit_rate" |
| 150 | #define QAHW_OFFLOAD_CODEC_ALAC_SAMPLING_RATE "music_offload_alac_sampling_rate" |
| 151 | #define QAHW_OFFLOAD_CODEC_ALAC_CHANNEL_LAYOUT_TAG "music_offload_alac_channel_layout_tag" |
| 152 | |
| 153 | #define QAHW_OFFLOAD_CODEC_APE_COMPATIBLE_VERSION "music_offload_ape_compatible_version" |
| 154 | #define QAHW_OFFLOAD_CODEC_APE_COMPRESSION_LEVEL "music_offload_ape_compression_level" |
| 155 | #define QAHW_OFFLOAD_CODEC_APE_FORMAT_FLAGS "music_offload_ape_format_flags" |
| 156 | #define QAHW_OFFLOAD_CODEC_APE_BLOCKS_PER_FRAME "music_offload_ape_blocks_per_frame" |
| 157 | #define QAHW_OFFLOAD_CODEC_APE_FINAL_FRAME_BLOCKS "music_offload_ape_final_frame_blocks" |
| 158 | #define QAHW_OFFLOAD_CODEC_APE_TOTAL_FRAMES "music_offload_ape_total_frames" |
| 159 | #define QAHW_OFFLOAD_CODEC_APE_BITS_PER_SAMPLE "music_offload_ape_bits_per_sample" |
| 160 | #define QAHW_OFFLOAD_CODEC_APE_NUM_CHANNELS "music_offload_ape_num_channels" |
| 161 | #define QAHW_OFFLOAD_CODEC_APE_SAMPLE_RATE "music_offload_ape_sample_rate" |
| 162 | #define QAHW_OFFLOAD_CODEC_APE_SEEK_TABLE_PRESENT "music_offload_seek_table_present" |
| 163 | |
| 164 | #define QAHW_OFFLOAD_CODEC_VORBIS_BITSTREAM_FMT "music_offload_vorbis_bitstream_fmt" |
| 165 | |
| 166 | /* Set or Query stream profile type */ |
| 167 | #define QAHW_PARAMETER_STREAM_PROFILE "audio_stream_profile" |
| 168 | |
| 169 | /* audio input flags for compress and timestamp mode. |
| 170 | * check other input flags defined in audio.h for conflicts |
| 171 | */ |
| 172 | #define QAHW_INPUT_FLAG_TIMESTAMP 0x80000000 |
| 173 | #define QAHW_INPUT_FLAG_COMPRESS 0x40000000 |
Ralf Herz | aec8026 | 2018-07-03 07:08:49 +0200 | [diff] [blame] | 174 | #define QAHW_INPUT_FLAG_PASSTHROUGH 0x20000000 |
Josh Kirsch | c03f31d | 2019-01-15 11:50:53 -0800 | [diff] [blame] | 175 | #define QAHW_OUTPUT_FLAG_INCALL_MUSIC 0x80000000 |
| 176 | #define QAHW_AUDIO_FLAG_HPCM_TX 0x00020000 |
| 177 | #define QAHW_AUDIO_FLAG_HPCM_RX 0x00040000 |
Sidipotu Ashok | 404f26d | 2017-10-10 22:27:51 +0530 | [diff] [blame] | 178 | |
| 179 | /* Query fm volume */ |
| 180 | #define QAHW_PARAMETER_KEY_FM_VOLUME "fm_volume" |
| 181 | |
| 182 | /* Query if a2dp is supported */ |
| 183 | #define QAHW_PARAMETER_KEY_HANDLE_A2DP_DEVICE "isA2dpDeviceSupported" |
| 184 | |
| 185 | #define MAX_OUT_CHANNELS 8 |
| 186 | #define MAX_INP_CHANNELS 8 |
| 187 | |
| 188 | #define QAHW_PCM_CHANNEL_FL 1 /* Front left channel. */ |
| 189 | #define QAHW_PCM_CHANNEL_FR 2 /* Front right channel. */ |
| 190 | #define QAHW_PCM_CHANNEL_FC 3 /* Front center channel. */ |
| 191 | #define QAHW_PCM_CHANNEL_LS 4 /* Left surround channel. */ |
| 192 | #define QAHW_PCM_CHANNEL_RS 5 /* Right surround channel. */ |
| 193 | #define QAHW_PCM_CHANNEL_LFE 6 /* Low frequency effect channel. */ |
| 194 | #define QAHW_PCM_CHANNEL_CS 7 /* Center surround channel; Rear center channel. */ |
| 195 | #define QAHW_PCM_CHANNEL_LB 8 /* Left back channel; Rear left channel. */ |
| 196 | #define QAHW_PCM_CHANNEL_RB 9 /* Right back channel; Rear right channel. */ |
| 197 | #define QAHW_PCM_CHANNEL_TS 10 /* Top surround channel. */ |
| 198 | #define QAHW_PCM_CHANNEL_CVH 11 /* Center vertical height channel. */ |
| 199 | #define QAHW_PCM_CHANNEL_MS 12 /* Mono surround channel. */ |
| 200 | #define QAHW_PCM_CHANNEL_FLC 13 /* Front left of center. */ |
| 201 | #define QAHW_PCM_CHANNEL_FRC 14 /* Front right of center. */ |
| 202 | #define QAHW_PCM_CHANNEL_RLC 15 /* Rear left of center. */ |
| 203 | #define QAHW_PCM_CHANNEL_RRC 16 /* Rear right of center. */ |
Manish Dewangan | 4affcfe | 2018-09-10 13:45:57 +0530 | [diff] [blame] | 204 | #define QAHW_PCM_CHANNEL_LFE2 17 /* Secondary low frequency effect channel. */ |
| 205 | #define QAHW_PCM_CHANNEL_SL 18 /* Side left channel. */ |
| 206 | #define QAHW_PCM_CHANNEL_SR 19 /* Side right channel. */ |
| 207 | #define QAHW_PCM_CHANNEL_TFL 20 /* Top front left channel. */ |
| 208 | #define QAHW_PCM_CHANNEL_LVH QAHW_PCM_CHANNEL_TFL /* Left vertical height channel.*/ |
| 209 | #define QAHW_PCM_CHANNEL_TFR 21 /* Top front right channel. */ |
| 210 | #define QAHW_PCM_CHANNEL_RVH QAHW_PCM_CHANNEL_TFR /* Right vertical height channel.*/ |
| 211 | #define QAHW_PCM_CHANNEL_TC 22 /* Top center channel. */ |
| 212 | #define QAHW_PCM_CHANNEL_TBL 23 /* Top back left channel. */ |
| 213 | #define QAHW_PCM_CHANNEL_TBR 24 /* Top back right channel. */ |
| 214 | #define QAHW_PCM_CHANNEL_TSL 25 /* Top side left channel. */ |
| 215 | #define QAHW_PCM_CHANNEL_TSR 26 /* Top side right channel. */ |
| 216 | #define QAHW_PCM_CHANNEL_TBC 27 /* Top back center channel. */ |
| 217 | #define QAHW_PCM_CHANNEL_BFC 28 /* Bottom front center channel. */ |
| 218 | #define QAHW_PCM_CHANNEL_BFL 29 /* Bottom front left channel. */ |
| 219 | #define QAHW_PCM_CHANNEL_BFR 30 /* Bottom front right channel. */ |
| 220 | #define QAHW_PCM_CHANNEL_LW 31 /* Left wide channel. */ |
| 221 | #define QAHW_PCM_CHANNEL_RW 32 /* Right wide channel. */ |
| 222 | #define QAHW_PCM_CHANNEL_RSD 34 /* Right side direct channel. */ |
Sidipotu Ashok | 404f26d | 2017-10-10 22:27:51 +0530 | [diff] [blame] | 223 | |
Ramu Gottipati | e4b74e7 | 2019-07-31 12:35:34 +0530 | [diff] [blame] | 224 | #define QAHW_AUDIO_DEVICE_OUT_SPEAKER2 0x10000000 |
| 225 | #define QAHW_AUDIO_DEVICE_OUT_SPEAKER3 0x20000000 |
| 226 | |
Sidipotu Ashok | 404f26d | 2017-10-10 22:27:51 +0530 | [diff] [blame] | 227 | /* type of asynchronous write callback events. Mutually exclusive */ |
| 228 | typedef enum { |
| 229 | QAHW_STREAM_CBK_EVENT_WRITE_READY, /* non blocking write completed */ |
| 230 | QAHW_STREAM_CBK_EVENT_DRAIN_READY, /* drain completed */ |
| 231 | QAHW_STREAM_CBK_EVENT_ERROR, /* stream hit some error */ |
| 232 | |
| 233 | QAHW_STREAM_CBK_EVENT_ADSP = 0x100 /* callback event from ADSP PP, |
| 234 | * corresponding payload will be |
| 235 | * sent as is to the client |
| 236 | */ |
| 237 | } qahw_stream_callback_event_t; |
| 238 | |
| 239 | typedef int qahw_stream_callback_t(qahw_stream_callback_event_t event, |
| 240 | void *param, |
| 241 | void *cookie); |
| 242 | |
| 243 | /* type of drain requested to audio_stream_out->drain(). Mutually exclusive */ |
| 244 | typedef enum { |
| 245 | QAHW_DRAIN_ALL, /* drain() returns when all data has been played */ |
| 246 | QAHW_DRAIN_EARLY_NOTIFY /* drain() returns a short time before all data |
| 247 | from the current track has been played to |
| 248 | give time for gapless track switch */ |
| 249 | } qahw_drain_type_t; |
| 250 | |
| 251 | /* meta data flags */ |
| 252 | /*TBD: Extend this based on stb requirement*/ |
| 253 | typedef enum { |
| 254 | QAHW_META_DATA_FLAGS_NONE = 0, |
| 255 | } qahw_meta_data_flags_t; |
| 256 | |
| 257 | typedef struct { |
| 258 | const void *buffer; /* write buffer pointer */ |
| 259 | size_t bytes; /* size of buffer */ |
| 260 | size_t offset; /* offset in buffer from where valid byte starts */ |
| 261 | int64_t *timestamp; /* timestmap */ |
| 262 | qahw_meta_data_flags_t flags; /* meta data flags */ |
| 263 | uint32_t reserved[64]; /*reserved for future */ |
| 264 | } qahw_out_buffer_t; |
| 265 | |
| 266 | typedef struct { |
| 267 | void *buffer; /* read buffer pointer */ |
| 268 | size_t bytes; /* size of buffer */ |
| 269 | size_t offset; /* offset in buffer from where valid byte starts */ |
| 270 | int64_t *timestamp; /* timestmap */ |
| 271 | uint32_t reserved[64]; /*reserved for future */ |
| 272 | } qahw_in_buffer_t; |
| 273 | |
Josh Kirsch | c03f31d | 2019-01-15 11:50:53 -0800 | [diff] [blame] | 274 | typedef struct { |
| 275 | void *buffer; /* write buffer pointer */ |
| 276 | size_t size; /* size of buffer */ |
| 277 | size_t offset; /* offset in buffer from where valid byte starts */ |
| 278 | int64_t *timestamp; /* timestmap */ |
| 279 | qahw_meta_data_flags_t flags; /* meta data flags */ |
| 280 | } qahw_buffer_t; |
| 281 | |
Sidipotu Ashok | 404f26d | 2017-10-10 22:27:51 +0530 | [diff] [blame] | 282 | #define MAX_SECTORS 8 |
| 283 | |
| 284 | struct qahw_source_tracking_param { |
| 285 | uint8_t vad[MAX_SECTORS]; |
| 286 | uint16_t doa_speech; |
| 287 | uint16_t doa_noise[3]; |
| 288 | uint8_t polar_activity[360]; |
| 289 | }; |
| 290 | |
| 291 | struct qahw_sound_focus_param { |
| 292 | uint16_t start_angle[MAX_SECTORS]; |
| 293 | uint8_t enable[MAX_SECTORS]; |
| 294 | uint16_t gain_step; |
| 295 | }; |
| 296 | |
| 297 | struct aptx_dec_bt_addr { |
| 298 | uint32_t nap; |
| 299 | uint32_t uap; |
| 300 | uint32_t lap; |
| 301 | }; |
| 302 | |
| 303 | struct qahw_aptx_dec_param { |
| 304 | struct aptx_dec_bt_addr bt_addr; |
| 305 | }; |
| 306 | |
| 307 | struct qahw_avt_device_drift_param { |
| 308 | /* Flag to indicate if resync is required on the client side for |
| 309 | * drift correction. Flag is set to TRUE for the first get_param response |
| 310 | * after device interface starts. This flag value can be used by client |
| 311 | * to identify if device interface restart has happened and if any |
| 312 | * re-sync is required at their end for drift correction. |
| 313 | */ |
| 314 | uint32_t resync_flag; |
| 315 | /* Accumulated drift value in microseconds. |
| 316 | * Positive drift value indicates AV timer is running faster than device. |
| 317 | * Negative drift value indicates AV timer is running slower than device. |
| 318 | */ |
| 319 | int32_t avt_device_drift_value; |
| 320 | /* 64-bit absolute timestamp of reference */ |
| 321 | uint64_t ref_timer_abs_ts; |
| 322 | }; |
| 323 | |
| 324 | /*use these for setting infine window.i.e free run mode */ |
| 325 | #define QAHW_MAX_RENDER_START_WINDOW 0x8000000000000000 |
| 326 | #define QAHW_MAX_RENDER_END_WINDOW 0x7FFFFFFFFFFFFFFF |
| 327 | |
| 328 | struct qahw_out_render_window_param { |
| 329 | uint64_t render_ws; /* render window start value microseconds*/ |
| 330 | uint64_t render_we; /* render window end value microseconds*/ |
| 331 | }; |
| 332 | |
| 333 | struct qahw_out_start_delay_param { |
| 334 | uint64_t start_delay; /* session start delay in microseconds*/ |
| 335 | }; |
| 336 | |
| 337 | struct qahw_out_enable_drift_correction { |
| 338 | bool enable; /* enable drift correction*/ |
| 339 | }; |
| 340 | |
| 341 | struct qahw_out_correct_drift { |
| 342 | /* |
| 343 | * adjust time in microseconds, a positive value |
| 344 | * to advance the clock or a negative value to |
| 345 | * delay the clock. |
| 346 | */ |
| 347 | int64_t adjust_time; |
| 348 | }; |
| 349 | |
Surendar Karka | 287348c | 2019-04-10 18:31:46 +0530 | [diff] [blame] | 350 | struct qahw_out_presentation_position_param { |
| 351 | struct timespec timestamp; |
| 352 | uint64_t frames; |
| 353 | int32_t clock_id; |
| 354 | }; |
| 355 | |
Sidipotu Ashok | 404f26d | 2017-10-10 22:27:51 +0530 | [diff] [blame] | 356 | #define QAHW_MAX_ADSP_STREAM_CMD_PAYLOAD_LEN 512 |
| 357 | |
| 358 | typedef enum { |
| 359 | QAHW_STREAM_PP_EVENT = 0, |
| 360 | QAHW_STREAM_ENCDEC_EVENT = 1, |
| 361 | } qahw_event_id; |
| 362 | |
| 363 | /* payload format for HAL parameter |
| 364 | * QAHW_PARAM_ADSP_STREAM_CMD |
| 365 | */ |
| 366 | struct qahw_adsp_event { |
| 367 | qahw_event_id event_type; /* type of the event */ |
| 368 | uint32_t payload_length; /* length in bytes of the payload */ |
| 369 | void *payload; /* the actual payload */ |
| 370 | }; |
| 371 | |
| 372 | struct qahw_out_channel_map_param { |
| 373 | uint8_t channels; /* Input Channels */ |
| 374 | uint8_t channel_map[AUDIO_CHANNEL_COUNT_MAX]; /* Input Channel Map */ |
| 375 | }; |
| 376 | |
| 377 | struct qahw_device_cfg_param { |
| 378 | uint32_t sample_rate; |
| 379 | uint32_t channels; |
| 380 | uint32_t bit_width; |
| 381 | audio_format_t format; |
| 382 | audio_devices_t device; |
| 383 | uint8_t channel_map[AUDIO_CHANNEL_COUNT_MAX]; |
| 384 | uint16_t channel_allocation; |
| 385 | }; |
| 386 | |
| 387 | typedef struct qahw_mix_matrix_params { |
| 388 | uint16_t num_output_channels; |
| 389 | uint16_t num_input_channels; |
| 390 | uint8_t has_output_channel_map; |
| 391 | uint32_t output_channel_map[AUDIO_CHANNEL_COUNT_MAX]; |
| 392 | uint8_t has_input_channel_map; |
| 393 | uint32_t input_channel_map[AUDIO_CHANNEL_COUNT_MAX]; |
| 394 | uint8_t has_mixer_coeffs; |
| 395 | float mixer_coeffs[AUDIO_CHANNEL_COUNT_MAX][AUDIO_CHANNEL_COUNT_MAX]; |
| 396 | } qahw_mix_matrix_params_t; |
| 397 | |
Surendar karka | 3056979 | 2018-05-08 12:02:21 +0530 | [diff] [blame] | 398 | #define QAHW_LICENCE_STR_MAX_LENGTH (64) |
| 399 | #define QAHW_PRODUCT_STR_MAX_LENGTH (64) |
| 400 | typedef struct qahw_license_params { |
| 401 | char product[QAHW_PRODUCT_STR_MAX_LENGTH + 1]; |
| 402 | int key; |
| 403 | char license[QAHW_LICENCE_STR_MAX_LENGTH + 1]; |
| 404 | } qahw_license_params_t; |
| 405 | |
Josh Kirsch | c03f31d | 2019-01-15 11:50:53 -0800 | [diff] [blame] | 406 | typedef struct qahw_dtmf_gen_params { |
| 407 | bool enable; |
| 408 | uint16_t low_freq; |
| 409 | uint16_t high_freq; |
| 410 | uint16_t gain; |
| 411 | } qahw_dtmf_gen_params_t; |
| 412 | |
| 413 | enum { |
| 414 | QAHW_TTY_MODE_OFF, |
| 415 | QAHW_TTY_MODE_FULL, |
| 416 | QAHW_TTY_MODE_VCO, |
| 417 | QAHW_TTY_MODE_HCO, |
| 418 | QAHW_TTY_MODE_MAX, |
| 419 | }; |
| 420 | |
| 421 | typedef struct qahw_tty_params { |
| 422 | uint32_t mode; |
| 423 | } qahw_tty_params_t; |
| 424 | |
| 425 | typedef enum { |
| 426 | QAHW_HPCM_TAP_POINT_RX = 1, |
| 427 | QAHW_HPCM_TAP_POINT_TX = 2, |
| 428 | QAHW_HPCM_TAP_POINT_RX_TX = 3, |
| 429 | } qahw_hpcm_tap_point; |
| 430 | |
| 431 | typedef enum { |
| 432 | QAHW_HPCM_DIRECTION_OUT, |
| 433 | QAHW_HPCM_DIRECTION_IN, |
| 434 | QAHW_HPCM_DIRECTION_OUT_IN, |
| 435 | } qahw_hpcm_direction; |
| 436 | |
| 437 | typedef struct qahw_hpcm_params { |
| 438 | qahw_hpcm_tap_point tap_point; |
| 439 | qahw_hpcm_direction direction; |
| 440 | } qahw_hpcm_params_t; |
| 441 | |
Sidipotu Ashok | 404f26d | 2017-10-10 22:27:51 +0530 | [diff] [blame] | 442 | typedef union { |
| 443 | struct qahw_source_tracking_param st_params; |
| 444 | struct qahw_sound_focus_param sf_params; |
| 445 | struct qahw_aptx_dec_param aptx_params; |
| 446 | struct qahw_avt_device_drift_param drift_params; |
| 447 | struct qahw_out_render_window_param render_window_params; |
| 448 | struct qahw_out_start_delay_param start_delay; |
| 449 | struct qahw_out_enable_drift_correction drift_enable_param; |
| 450 | struct qahw_out_correct_drift drift_correction_param; |
| 451 | struct qahw_adsp_event adsp_event_params; |
| 452 | struct qahw_out_channel_map_param channel_map_params; |
| 453 | struct qahw_device_cfg_param device_cfg_params; |
| 454 | struct qahw_mix_matrix_params mix_matrix_params; |
Surendar karka | 3056979 | 2018-05-08 12:02:21 +0530 | [diff] [blame] | 455 | struct qahw_license_params license_params; |
Surendar Karka | 287348c | 2019-04-10 18:31:46 +0530 | [diff] [blame] | 456 | struct qahw_out_presentation_position_param pos_param; |
Josh Kirsch | c03f31d | 2019-01-15 11:50:53 -0800 | [diff] [blame] | 457 | struct qahw_dtmf_gen_params dtmf_gen_params; |
| 458 | struct qahw_tty_params tty_mode_params; |
| 459 | struct qahw_hpcm_params hpcm_params; |
Sidipotu Ashok | 404f26d | 2017-10-10 22:27:51 +0530 | [diff] [blame] | 460 | } qahw_param_payload; |
| 461 | |
| 462 | typedef enum { |
| 463 | QAHW_PARAM_SOURCE_TRACK, |
| 464 | QAHW_PARAM_SOUND_FOCUS, |
| 465 | QAHW_PARAM_APTX_DEC, |
| 466 | QAHW_PARAM_AVT_DEVICE_DRIFT, /* PARAM to query AV timer vs device drift */ |
| 467 | QAHW_PARAM_OUT_RENDER_WINDOW, /* PARAM to set render window */ |
| 468 | QAHW_PARAM_OUT_START_DELAY, /* PARAM to set session start delay*/ |
| 469 | /* enable adsp drift correction this must be called before out_write */ |
| 470 | QAHW_PARAM_OUT_ENABLE_DRIFT_CORRECTION, |
| 471 | /* param to set drift value to be adjusted by dsp */ |
| 472 | QAHW_PARAM_OUT_CORRECT_DRIFT, |
| 473 | QAHW_PARAM_ADSP_STREAM_CMD, |
| 474 | QAHW_PARAM_OUT_CHANNEL_MAP, /* PARAM to set i/p channel map */ |
| 475 | QAHW_PARAM_DEVICE_CONFIG, /* PARAM to set device config */ |
| 476 | QAHW_PARAM_OUT_MIX_MATRIX_PARAMS, |
| 477 | QAHW_PARAM_CH_MIX_MATRIX_PARAMS, |
Surendar karka | 3056979 | 2018-05-08 12:02:21 +0530 | [diff] [blame] | 478 | QAHW_PARAM_LICENSE_PARAMS, |
Surendar Karka | 287348c | 2019-04-10 18:31:46 +0530 | [diff] [blame] | 479 | QAHW_PARAM_OUT_PRESENTATION_POSITION, |
Josh Kirsch | c03f31d | 2019-01-15 11:50:53 -0800 | [diff] [blame] | 480 | QAHW_PARAM_DTMF_GEN, |
| 481 | QAHW_PARAM_TTY_MODE, |
| 482 | QAHW_PARAM_HPCM, |
Sidipotu Ashok | 404f26d | 2017-10-10 22:27:51 +0530 | [diff] [blame] | 483 | } qahw_param_id; |
| 484 | |
Trinath Thammishetty | 580f1de | 2018-09-28 12:43:24 +0530 | [diff] [blame] | 485 | typedef union { |
| 486 | struct qahw_out_render_window_param render_window_params; |
| 487 | } qahw_loopback_param_payload; |
| 488 | |
| 489 | typedef enum { |
| 490 | QAHW_PARAM_LOOPBACK_RENDER_WINDOW /* PARAM to set render window */ |
| 491 | } qahw_loopback_param_id; |
| 492 | |
Josh Kirsch | c03f31d | 2019-01-15 11:50:53 -0800 | [diff] [blame] | 493 | /** stream direction enumeration */ |
| 494 | typedef enum { |
| 495 | QAHW_STREAM_INPUT, |
| 496 | QAHW_STREAM_OUTPUT, |
| 497 | QAHW_STREAM_INPUT_OUTPUT, |
| 498 | } qahw_stream_direction; |
| 499 | |
| 500 | /** stream types */ |
| 501 | typedef enum { |
| 502 | QAHW_STREAM_TYPE_INVALID, |
| 503 | QAHW_AUDIO_PLAYBACK_LOW_LATENCY, /**< low latency, higher power*/ |
| 504 | QAHW_AUDIO_PLAYBACK_DEEP_BUFFER, /**< low power, higher latency*/ |
| 505 | QAHW_AUDIO_PLAYBACK_COMPRESSED, /**< compresssed audio*/ |
| 506 | QAHW_AUDIO_PLAYBACK_VOIP, /**< pcm voip audio*/ |
| 507 | QAHW_AUDIO_PLAYBACK_VOICE_CALL_MUSIC, /**< pcm voip audio*/ |
| 508 | |
| 509 | QAHW_AUDIO_CAPTURE_LOW_LATENCY, /**< low latency, higher power*/ |
| 510 | QAHW_AUDIO_CAPTURE_DEEP_BUFFER, /**< low power, higher latency*/ |
| 511 | QAHW_AUDIO_CAPTURE_COMPRESSED, /**< compresssed audio*/ |
| 512 | QAHW_AUDIO_CAPTURE_RAW, /**< pcm no post processing*/ |
| 513 | QAHW_AUDIO_CAPTURE_VOIP, /**< pcm voip audio*/ |
| 514 | QAHW_AUDIO_CAPTURE_VOICE_ACTIVATION, /**< voice activation*/ |
| 515 | QAHW_AUDIO_CAPTURE_VOICE_CALL_RX, /**< incall record, downlink */ |
| 516 | QAHW_AUDIO_CAPTURE_VOICE_CALL_TX, /**< incall record, uplink */ |
| 517 | QAHW_AUDIO_CAPTURE_VOICE_CALL_RX_TX, /**< incall record, uplink & Downlink */ |
| 518 | |
| 519 | QAHW_VOICE_CALL, /**< voice call */ |
| 520 | |
| 521 | QAHW_AUDIO_TRANSCODE, /**< audio transcode */ |
| 522 | QAHW_AUDIO_HOST_PCM_TX, |
| 523 | QAHW_AUDIO_HOST_PCM_RX, |
| 524 | QAHW_AUDIO_HOST_PCM_TX_RX, |
| 525 | QAHW_AUDIO_STREAM_TYPE_MAX, |
| 526 | } qahw_audio_stream_type; |
| 527 | |
| 528 | typedef uint32_t qahw_device_t; |
| 529 | |
| 530 | /**< Key value pair to identify the topology of a usecase from default */ |
| 531 | struct qahw_modifier_kv { |
| 532 | uint32_t key; |
| 533 | uint32_t value; |
| 534 | }; |
| 535 | |
| 536 | struct qahw_shared_attributes{ |
| 537 | audio_config_t config; |
| 538 | }; |
| 539 | struct qahw_voice_attributes{ |
| 540 | audio_config_t config; |
| 541 | const char *vsid; |
| 542 | }; |
| 543 | |
| 544 | struct qahw_audio_attributes{ |
| 545 | audio_config_t config; |
| 546 | }; |
| 547 | |
| 548 | typedef union { |
| 549 | struct qahw_shared_attributes shared; |
| 550 | struct qahw_voice_attributes voice; |
| 551 | struct qahw_audio_attributes audio; |
| 552 | } qahw_stream_attributes_config; |
| 553 | |
| 554 | struct qahw_stream_attributes { |
| 555 | qahw_audio_stream_type type; |
| 556 | qahw_stream_direction direction; |
| 557 | qahw_stream_attributes_config attr; |
| 558 | }; |
| 559 | |
| 560 | typedef enum { |
| 561 | QAHW_CHANNEL_L = 0, /*left channel*/ |
| 562 | QAHW_CHANNEL_R = 1, /*right channel*/ |
| 563 | QAHW_CHANNELS_MAX = 2, /*max number of supported streams*/ |
| 564 | } qahw_channel_map; |
| 565 | |
| 566 | struct qahw_channel_vol { |
| 567 | qahw_channel_map channel; |
| 568 | float vol; |
| 569 | }; |
| 570 | |
| 571 | struct qahw_volume_data { |
| 572 | uint32_t num_of_channels; |
| 573 | struct qahw_channel_vol *vol_pair; |
| 574 | }; |
| 575 | |
| 576 | struct qahw_mute_data { |
| 577 | bool enable; |
| 578 | qahw_stream_direction direction; |
| 579 | }; |
| 580 | |
Sidipotu Ashok | 404f26d | 2017-10-10 22:27:51 +0530 | [diff] [blame] | 581 | __END_DECLS |
| 582 | |
| 583 | #endif // QTI_AUDIO_HAL_DEFS_H |
| 584 | |