blob: 87389b42c032c1508ada232bd8db50dce8a241d4 [file] [log] [blame]
Sidipotu Ashok404f26d2017-10-10 22:27:51 +05301/*
Surendar Karka287348c2019-04-10 18:31:46 +05302 * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
Sidipotu Ashok404f26d2017-10-10 22:27:51 +05303 * 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 Kirschc03f31d2019-01-15 11:50:53 -080021#include <system/audio.h>
Sidipotu Ashok404f26d2017-10-10 22:27:51 +053022
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 Herzaec80262018-07-03 07:08:49 +0200174#define QAHW_INPUT_FLAG_PASSTHROUGH 0x20000000
Josh Kirschc03f31d2019-01-15 11:50:53 -0800175#define QAHW_OUTPUT_FLAG_INCALL_MUSIC 0x80000000
176#define QAHW_AUDIO_FLAG_HPCM_TX 0x00020000
177#define QAHW_AUDIO_FLAG_HPCM_RX 0x00040000
Sidipotu Ashok404f26d2017-10-10 22:27:51 +0530178
Zun Qiao9a2c1bc2021-08-11 08:33:36 +0530179/* audio output flag for timestamp mode */
180#define QAHW_OUTPUT_FLAG_TIMESTAMP 0x20000000
181
Sidipotu Ashok404f26d2017-10-10 22:27:51 +0530182/* Query fm volume */
183#define QAHW_PARAMETER_KEY_FM_VOLUME "fm_volume"
184
185/* Query if a2dp is supported */
186#define QAHW_PARAMETER_KEY_HANDLE_A2DP_DEVICE "isA2dpDeviceSupported"
187
188#define MAX_OUT_CHANNELS 8
189#define MAX_INP_CHANNELS 8
190
191#define QAHW_PCM_CHANNEL_FL 1 /* Front left channel. */
192#define QAHW_PCM_CHANNEL_FR 2 /* Front right channel. */
193#define QAHW_PCM_CHANNEL_FC 3 /* Front center channel. */
194#define QAHW_PCM_CHANNEL_LS 4 /* Left surround channel. */
195#define QAHW_PCM_CHANNEL_RS 5 /* Right surround channel. */
196#define QAHW_PCM_CHANNEL_LFE 6 /* Low frequency effect channel. */
197#define QAHW_PCM_CHANNEL_CS 7 /* Center surround channel; Rear center channel. */
198#define QAHW_PCM_CHANNEL_LB 8 /* Left back channel; Rear left channel. */
199#define QAHW_PCM_CHANNEL_RB 9 /* Right back channel; Rear right channel. */
200#define QAHW_PCM_CHANNEL_TS 10 /* Top surround channel. */
201#define QAHW_PCM_CHANNEL_CVH 11 /* Center vertical height channel. */
202#define QAHW_PCM_CHANNEL_MS 12 /* Mono surround channel. */
203#define QAHW_PCM_CHANNEL_FLC 13 /* Front left of center. */
204#define QAHW_PCM_CHANNEL_FRC 14 /* Front right of center. */
205#define QAHW_PCM_CHANNEL_RLC 15 /* Rear left of center. */
206#define QAHW_PCM_CHANNEL_RRC 16 /* Rear right of center. */
Manish Dewangan4affcfe2018-09-10 13:45:57 +0530207#define QAHW_PCM_CHANNEL_LFE2 17 /* Secondary low frequency effect channel. */
208#define QAHW_PCM_CHANNEL_SL 18 /* Side left channel. */
209#define QAHW_PCM_CHANNEL_SR 19 /* Side right channel. */
210#define QAHW_PCM_CHANNEL_TFL 20 /* Top front left channel. */
211#define QAHW_PCM_CHANNEL_LVH QAHW_PCM_CHANNEL_TFL /* Left vertical height channel.*/
212#define QAHW_PCM_CHANNEL_TFR 21 /* Top front right channel. */
213#define QAHW_PCM_CHANNEL_RVH QAHW_PCM_CHANNEL_TFR /* Right vertical height channel.*/
214#define QAHW_PCM_CHANNEL_TC 22 /* Top center channel. */
215#define QAHW_PCM_CHANNEL_TBL 23 /* Top back left channel. */
216#define QAHW_PCM_CHANNEL_TBR 24 /* Top back right channel. */
217#define QAHW_PCM_CHANNEL_TSL 25 /* Top side left channel. */
218#define QAHW_PCM_CHANNEL_TSR 26 /* Top side right channel. */
219#define QAHW_PCM_CHANNEL_TBC 27 /* Top back center channel. */
220#define QAHW_PCM_CHANNEL_BFC 28 /* Bottom front center channel. */
221#define QAHW_PCM_CHANNEL_BFL 29 /* Bottom front left channel. */
222#define QAHW_PCM_CHANNEL_BFR 30 /* Bottom front right channel. */
223#define QAHW_PCM_CHANNEL_LW 31 /* Left wide channel. */
224#define QAHW_PCM_CHANNEL_RW 32 /* Right wide channel. */
225#define QAHW_PCM_CHANNEL_RSD 34 /* Right side direct channel. */
Sidipotu Ashok404f26d2017-10-10 22:27:51 +0530226
Ramu Gottipatie4b74e72019-07-31 12:35:34 +0530227#define QAHW_AUDIO_DEVICE_OUT_SPEAKER2 0x10000000
228#define QAHW_AUDIO_DEVICE_OUT_SPEAKER3 0x20000000
Zun Qiao9a2c1bc2021-08-11 08:33:36 +0530229#define QAHW_AUDIO_DEVICE_OUT_OPTICAL 0x40000
230
Avinash Chandrad7296d42021-08-04 15:07:47 +0530231#define QAHW_AUDIO_DEVICE_IN_SPEAKER_MIC2 0x10000000
232#define QAHW_AUDIO_DEVICE_IN_SPEAKER_MIC3 0x20000000
233
Zun Qiao9a2c1bc2021-08-11 08:33:36 +0530234#define QAHW_PCM_CUSTOM_CHANNEL_MAP_12 59
235#define QAHW_PCM_CUSTOM_CHANNEL_MAP_13 60
236#define QAHW_PCM_CUSTOM_CHANNEL_MAP_14 61
237#define QAHW_PCM_CUSTOM_CHANNEL_MAP_15 62
238#define QAHW_PCM_CUSTOM_CHANNEL_MAP_16 63
Ramu Gottipatie4b74e72019-07-31 12:35:34 +0530239
Zun Qiao698f8272021-09-27 09:14:00 +0530240/* Adapt update_device_list API */
241#define QAHW_UPDATE_DEVICE_LIST_ENABLED
242
Sidipotu Ashok404f26d2017-10-10 22:27:51 +0530243/* type of asynchronous write callback events. Mutually exclusive */
244typedef enum {
245 QAHW_STREAM_CBK_EVENT_WRITE_READY, /* non blocking write completed */
246 QAHW_STREAM_CBK_EVENT_DRAIN_READY, /* drain completed */
247 QAHW_STREAM_CBK_EVENT_ERROR, /* stream hit some error */
248
249 QAHW_STREAM_CBK_EVENT_ADSP = 0x100 /* callback event from ADSP PP,
250 * corresponding payload will be
251 * sent as is to the client
252 */
253} qahw_stream_callback_event_t;
254
255typedef int qahw_stream_callback_t(qahw_stream_callback_event_t event,
256 void *param,
257 void *cookie);
258
Zun Qiao9a2c1bc2021-08-11 08:33:36 +0530259struct qahw_stream_callback_param {
260 qahw_stream_callback_t *cb; /* callback function */
261 void *cookie; /* callback context */
262};
263
Sidipotu Ashok404f26d2017-10-10 22:27:51 +0530264/* type of drain requested to audio_stream_out->drain(). Mutually exclusive */
265typedef enum {
266 QAHW_DRAIN_ALL, /* drain() returns when all data has been played */
267 QAHW_DRAIN_EARLY_NOTIFY /* drain() returns a short time before all data
268 from the current track has been played to
269 give time for gapless track switch */
270} qahw_drain_type_t;
271
272/* meta data flags */
273/*TBD: Extend this based on stb requirement*/
274typedef enum {
275 QAHW_META_DATA_FLAGS_NONE = 0,
Zun Qiao9a2c1bc2021-08-11 08:33:36 +0530276 QAHW_META_DATA_FLAGS_TIMESTAMP_VALID,
277 QAHW_META_DATA_FLAGS_TIMESTAMP_CONTINUE,
Sidipotu Ashok404f26d2017-10-10 22:27:51 +0530278} qahw_meta_data_flags_t;
279
280typedef struct {
281 const void *buffer; /* write buffer pointer */
282 size_t bytes; /* size of buffer */
283 size_t offset; /* offset in buffer from where valid byte starts */
284 int64_t *timestamp; /* timestmap */
285 qahw_meta_data_flags_t flags; /* meta data flags */
286 uint32_t reserved[64]; /*reserved for future */
287} qahw_out_buffer_t;
288
289typedef struct {
290 void *buffer; /* read buffer pointer */
291 size_t bytes; /* size of buffer */
292 size_t offset; /* offset in buffer from where valid byte starts */
293 int64_t *timestamp; /* timestmap */
294 uint32_t reserved[64]; /*reserved for future */
295} qahw_in_buffer_t;
296
Josh Kirschc03f31d2019-01-15 11:50:53 -0800297typedef struct {
298 void *buffer; /* write buffer pointer */
299 size_t size; /* size of buffer */
300 size_t offset; /* offset in buffer from where valid byte starts */
301 int64_t *timestamp; /* timestmap */
302 qahw_meta_data_flags_t flags; /* meta data flags */
303} qahw_buffer_t;
304
Sidipotu Ashok404f26d2017-10-10 22:27:51 +0530305#define MAX_SECTORS 8
306
307struct qahw_source_tracking_param {
308 uint8_t vad[MAX_SECTORS];
309 uint16_t doa_speech;
310 uint16_t doa_noise[3];
311 uint8_t polar_activity[360];
312};
313
314struct qahw_sound_focus_param {
315 uint16_t start_angle[MAX_SECTORS];
316 uint8_t enable[MAX_SECTORS];
317 uint16_t gain_step;
318};
319
320struct aptx_dec_bt_addr {
321 uint32_t nap;
322 uint32_t uap;
323 uint32_t lap;
324};
325
326struct qahw_aptx_dec_param {
327 struct aptx_dec_bt_addr bt_addr;
328};
329
330struct qahw_avt_device_drift_param {
331 /* Flag to indicate if resync is required on the client side for
332 * drift correction. Flag is set to TRUE for the first get_param response
333 * after device interface starts. This flag value can be used by client
334 * to identify if device interface restart has happened and if any
335 * re-sync is required at their end for drift correction.
336 */
337 uint32_t resync_flag;
338 /* Accumulated drift value in microseconds.
339 * Positive drift value indicates AV timer is running faster than device.
340 * Negative drift value indicates AV timer is running slower than device.
341 */
342 int32_t avt_device_drift_value;
343 /* 64-bit absolute timestamp of reference */
344 uint64_t ref_timer_abs_ts;
345};
346
347/*use these for setting infine window.i.e free run mode */
348#define QAHW_MAX_RENDER_START_WINDOW 0x8000000000000000
349#define QAHW_MAX_RENDER_END_WINDOW 0x7FFFFFFFFFFFFFFF
350
351struct qahw_out_render_window_param {
352 uint64_t render_ws; /* render window start value microseconds*/
353 uint64_t render_we; /* render window end value microseconds*/
354};
355
356struct qahw_out_start_delay_param {
357 uint64_t start_delay; /* session start delay in microseconds*/
358};
359
360struct qahw_out_enable_drift_correction {
361 bool enable; /* enable drift correction*/
362};
363
364struct qahw_out_correct_drift {
365 /*
366 * adjust time in microseconds, a positive value
367 * to advance the clock or a negative value to
368 * delay the clock.
369 */
370 int64_t adjust_time;
371};
372
Surendar Karka287348c2019-04-10 18:31:46 +0530373struct qahw_out_presentation_position_param {
374 struct timespec timestamp;
375 uint64_t frames;
376 int32_t clock_id;
377};
378
Sidipotu Ashok404f26d2017-10-10 22:27:51 +0530379#define QAHW_MAX_ADSP_STREAM_CMD_PAYLOAD_LEN 512
380
381typedef enum {
382 QAHW_STREAM_PP_EVENT = 0,
383 QAHW_STREAM_ENCDEC_EVENT = 1,
Zun Qiao9a2c1bc2021-08-11 08:33:36 +0530384 QAHW_STREAM_IEC_61937_FMT_UPDATE_EVENT = 2,
Sidipotu Ashok404f26d2017-10-10 22:27:51 +0530385} qahw_event_id;
386
387/* payload format for HAL parameter
388 * QAHW_PARAM_ADSP_STREAM_CMD
389 */
390struct qahw_adsp_event {
391 qahw_event_id event_type; /* type of the event */
392 uint32_t payload_length; /* length in bytes of the payload */
393 void *payload; /* the actual payload */
394};
395
Zun Qiao9a2c1bc2021-08-11 08:33:36 +0530396struct qahw_in_channel_map_param {
397 uint8_t channels; /* Input Channels */
398 uint8_t channel_map[AUDIO_CHANNEL_COUNT_MAX]; /* Input Channel Map */
399};
400
Sidipotu Ashok404f26d2017-10-10 22:27:51 +0530401struct qahw_out_channel_map_param {
402 uint8_t channels; /* Input Channels */
403 uint8_t channel_map[AUDIO_CHANNEL_COUNT_MAX]; /* Input Channel Map */
404};
405
406struct qahw_device_cfg_param {
407 uint32_t sample_rate;
408 uint32_t channels;
409 uint32_t bit_width;
410 audio_format_t format;
411 audio_devices_t device;
412 uint8_t channel_map[AUDIO_CHANNEL_COUNT_MAX];
413 uint16_t channel_allocation;
414};
415
416typedef struct qahw_mix_matrix_params {
417 uint16_t num_output_channels;
418 uint16_t num_input_channels;
419 uint8_t has_output_channel_map;
420 uint32_t output_channel_map[AUDIO_CHANNEL_COUNT_MAX];
421 uint8_t has_input_channel_map;
422 uint32_t input_channel_map[AUDIO_CHANNEL_COUNT_MAX];
423 uint8_t has_mixer_coeffs;
424 float mixer_coeffs[AUDIO_CHANNEL_COUNT_MAX][AUDIO_CHANNEL_COUNT_MAX];
425} qahw_mix_matrix_params_t;
426
Surendar karka30569792018-05-08 12:02:21 +0530427#define QAHW_LICENCE_STR_MAX_LENGTH (64)
428#define QAHW_PRODUCT_STR_MAX_LENGTH (64)
429typedef struct qahw_license_params {
430 char product[QAHW_PRODUCT_STR_MAX_LENGTH + 1];
431 int key;
432 char license[QAHW_LICENCE_STR_MAX_LENGTH + 1];
433} qahw_license_params_t;
434
Josh Kirschc03f31d2019-01-15 11:50:53 -0800435typedef struct qahw_dtmf_gen_params {
436 bool enable;
437 uint16_t low_freq;
438 uint16_t high_freq;
439 uint16_t gain;
440} qahw_dtmf_gen_params_t;
441
442enum {
443 QAHW_TTY_MODE_OFF,
444 QAHW_TTY_MODE_FULL,
445 QAHW_TTY_MODE_VCO,
446 QAHW_TTY_MODE_HCO,
447 QAHW_TTY_MODE_MAX,
448};
449
450typedef struct qahw_tty_params {
451 uint32_t mode;
452} qahw_tty_params_t;
453
454typedef enum {
455 QAHW_HPCM_TAP_POINT_RX = 1,
456 QAHW_HPCM_TAP_POINT_TX = 2,
457 QAHW_HPCM_TAP_POINT_RX_TX = 3,
458} qahw_hpcm_tap_point;
459
460typedef enum {
461 QAHW_HPCM_DIRECTION_OUT,
462 QAHW_HPCM_DIRECTION_IN,
463 QAHW_HPCM_DIRECTION_OUT_IN,
464} qahw_hpcm_direction;
465
466typedef struct qahw_hpcm_params {
467 qahw_hpcm_tap_point tap_point;
468 qahw_hpcm_direction direction;
469} qahw_hpcm_params_t;
470
Zun Qiao9a2c1bc2021-08-11 08:33:36 +0530471struct qahw_in_ttp_offset_param {
472 uint64_t ttp_offset; /* TTP value is derived from ttp offset*/
473};
474
475struct qahw_out_channel_status_info {
476 /* Channel status is 192 bits each for CH A and CH B*/
477 char channel_status[48];
478};
479
480struct qahw_device_channel_bit_mask {
481 audio_devices_t device;
482 /* Channel status bit mask is 192 bits each for CH A and CH B*/
483 char bit_mask[48];
484};
485
Sidipotu Ashok404f26d2017-10-10 22:27:51 +0530486typedef union {
487 struct qahw_source_tracking_param st_params;
488 struct qahw_sound_focus_param sf_params;
489 struct qahw_aptx_dec_param aptx_params;
490 struct qahw_avt_device_drift_param drift_params;
491 struct qahw_out_render_window_param render_window_params;
492 struct qahw_out_start_delay_param start_delay;
493 struct qahw_out_enable_drift_correction drift_enable_param;
494 struct qahw_out_correct_drift drift_correction_param;
495 struct qahw_adsp_event adsp_event_params;
Zun Qiao9a2c1bc2021-08-11 08:33:36 +0530496 struct qahw_in_channel_map_param in_channel_map_params;
Sidipotu Ashok404f26d2017-10-10 22:27:51 +0530497 struct qahw_out_channel_map_param channel_map_params;
498 struct qahw_device_cfg_param device_cfg_params;
499 struct qahw_mix_matrix_params mix_matrix_params;
Surendar karka30569792018-05-08 12:02:21 +0530500 struct qahw_license_params license_params;
Surendar Karka287348c2019-04-10 18:31:46 +0530501 struct qahw_out_presentation_position_param pos_param;
Josh Kirschc03f31d2019-01-15 11:50:53 -0800502 struct qahw_dtmf_gen_params dtmf_gen_params;
503 struct qahw_tty_params tty_mode_params;
504 struct qahw_hpcm_params hpcm_params;
Zun Qiao9a2c1bc2021-08-11 08:33:36 +0530505 struct qahw_in_ttp_offset_param ttp_offset;
506 struct qahw_out_channel_status_info ch_status_info;
507 struct qahw_device_channel_bit_mask ch_bit_mask;
Sidipotu Ashok404f26d2017-10-10 22:27:51 +0530508} qahw_param_payload;
509
510typedef enum {
511 QAHW_PARAM_SOURCE_TRACK,
512 QAHW_PARAM_SOUND_FOCUS,
513 QAHW_PARAM_APTX_DEC,
514 QAHW_PARAM_AVT_DEVICE_DRIFT, /* PARAM to query AV timer vs device drift */
515 QAHW_PARAM_OUT_RENDER_WINDOW, /* PARAM to set render window */
516 QAHW_PARAM_OUT_START_DELAY, /* PARAM to set session start delay*/
517 /* enable adsp drift correction this must be called before out_write */
518 QAHW_PARAM_OUT_ENABLE_DRIFT_CORRECTION,
519 /* param to set drift value to be adjusted by dsp */
520 QAHW_PARAM_OUT_CORRECT_DRIFT,
521 QAHW_PARAM_ADSP_STREAM_CMD,
522 QAHW_PARAM_OUT_CHANNEL_MAP, /* PARAM to set i/p channel map */
523 QAHW_PARAM_DEVICE_CONFIG, /* PARAM to set device config */
524 QAHW_PARAM_OUT_MIX_MATRIX_PARAMS,
525 QAHW_PARAM_CH_MIX_MATRIX_PARAMS,
Surendar karka30569792018-05-08 12:02:21 +0530526 QAHW_PARAM_LICENSE_PARAMS,
Surendar Karka287348c2019-04-10 18:31:46 +0530527 QAHW_PARAM_OUT_PRESENTATION_POSITION,
Josh Kirschc03f31d2019-01-15 11:50:53 -0800528 QAHW_PARAM_DTMF_GEN,
529 QAHW_PARAM_TTY_MODE,
530 QAHW_PARAM_HPCM,
Zun Qiao9a2c1bc2021-08-11 08:33:36 +0530531 QAHW_PARAM_IN_TTP_OFFSET,
532 QAHW_PARAM_IN_CHANNEL_MAP, /* PARAM to set i/p channel map */
533 QAHW_PARAM_CHANNEL_STATUS_INFO,
534 QAHW_PARAM_CHANNEL_BIT_MASK,
Sidipotu Ashok404f26d2017-10-10 22:27:51 +0530535} qahw_param_id;
536
Trinath Thammishetty580f1de2018-09-28 12:43:24 +0530537typedef union {
538 struct qahw_out_render_window_param render_window_params;
Zun Qiao9a2c1bc2021-08-11 08:33:36 +0530539 struct qahw_stream_callback_param stream_callback_params;
Trinath Thammishetty580f1de2018-09-28 12:43:24 +0530540} qahw_loopback_param_payload;
541
542typedef enum {
Zun Qiao9a2c1bc2021-08-11 08:33:36 +0530543 QAHW_PARAM_LOOPBACK_RENDER_WINDOW, /* PARAM to set render window */
544 QAHW_PARAM_LOOPBACK_SET_CALLBACK
Trinath Thammishetty580f1de2018-09-28 12:43:24 +0530545} qahw_loopback_param_id;
546
Zun Qiao9a2c1bc2021-08-11 08:33:36 +0530547typedef struct {
548 uint32_t num_sources;
549 audio_input_flags_t flags;
550 struct audio_port_config *source_config;
551} qahw_source_port_config_t;
552
553typedef struct {
554 uint32_t num_sinks;
555 audio_output_flags_t flags;
556 struct audio_port_config *sink_config;
557} qahw_sink_port_config_t;
558
Josh Kirschc03f31d2019-01-15 11:50:53 -0800559/** stream direction enumeration */
560typedef enum {
561 QAHW_STREAM_INPUT,
562 QAHW_STREAM_OUTPUT,
563 QAHW_STREAM_INPUT_OUTPUT,
564} qahw_stream_direction;
565
566/** stream types */
567typedef enum {
568 QAHW_STREAM_TYPE_INVALID,
569 QAHW_AUDIO_PLAYBACK_LOW_LATENCY, /**< low latency, higher power*/
570 QAHW_AUDIO_PLAYBACK_DEEP_BUFFER, /**< low power, higher latency*/
571 QAHW_AUDIO_PLAYBACK_COMPRESSED, /**< compresssed audio*/
572 QAHW_AUDIO_PLAYBACK_VOIP, /**< pcm voip audio*/
573 QAHW_AUDIO_PLAYBACK_VOICE_CALL_MUSIC, /**< pcm voip audio*/
574
575 QAHW_AUDIO_CAPTURE_LOW_LATENCY, /**< low latency, higher power*/
576 QAHW_AUDIO_CAPTURE_DEEP_BUFFER, /**< low power, higher latency*/
577 QAHW_AUDIO_CAPTURE_COMPRESSED, /**< compresssed audio*/
578 QAHW_AUDIO_CAPTURE_RAW, /**< pcm no post processing*/
579 QAHW_AUDIO_CAPTURE_VOIP, /**< pcm voip audio*/
580 QAHW_AUDIO_CAPTURE_VOICE_ACTIVATION, /**< voice activation*/
581 QAHW_AUDIO_CAPTURE_VOICE_CALL_RX, /**< incall record, downlink */
582 QAHW_AUDIO_CAPTURE_VOICE_CALL_TX, /**< incall record, uplink */
583 QAHW_AUDIO_CAPTURE_VOICE_CALL_RX_TX, /**< incall record, uplink & Downlink */
584
585 QAHW_VOICE_CALL, /**< voice call */
586
587 QAHW_AUDIO_TRANSCODE, /**< audio transcode */
588 QAHW_AUDIO_HOST_PCM_TX,
589 QAHW_AUDIO_HOST_PCM_RX,
590 QAHW_AUDIO_HOST_PCM_TX_RX,
591 QAHW_AUDIO_STREAM_TYPE_MAX,
592} qahw_audio_stream_type;
593
594typedef uint32_t qahw_device_t;
595
596/**< Key value pair to identify the topology of a usecase from default */
597struct qahw_modifier_kv {
598 uint32_t key;
599 uint32_t value;
600};
601
602struct qahw_shared_attributes{
603 audio_config_t config;
604};
605struct qahw_voice_attributes{
606 audio_config_t config;
607 const char *vsid;
608};
609
610struct qahw_audio_attributes{
611 audio_config_t config;
612};
613
614typedef union {
615 struct qahw_shared_attributes shared;
616 struct qahw_voice_attributes voice;
617 struct qahw_audio_attributes audio;
618} qahw_stream_attributes_config;
619
620struct qahw_stream_attributes {
621 qahw_audio_stream_type type;
622 qahw_stream_direction direction;
623 qahw_stream_attributes_config attr;
624};
625
626typedef enum {
627 QAHW_CHANNEL_L = 0, /*left channel*/
628 QAHW_CHANNEL_R = 1, /*right channel*/
629 QAHW_CHANNELS_MAX = 2, /*max number of supported streams*/
630} qahw_channel_map;
631
632struct qahw_channel_vol {
633 qahw_channel_map channel;
634 float vol;
635};
636
637struct qahw_volume_data {
638 uint32_t num_of_channels;
639 struct qahw_channel_vol *vol_pair;
640};
641
642struct qahw_mute_data {
643 bool enable;
644 qahw_stream_direction direction;
645};
646
Sidipotu Ashok404f26d2017-10-10 22:27:51 +0530647__END_DECLS
648
649#endif // QTI_AUDIO_HAL_DEFS_H
650