Rohit kumar | 5d860f4 | 2019-02-01 18:01:12 +0530 | [diff] [blame] | 1 | /* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved. |
Asish Bhattacharya | 8e2277f | 2017-07-20 18:31:55 +0530 | [diff] [blame] | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | */ |
| 12 | #ifndef __Q6_ADM_V2_H__ |
| 13 | #define __Q6_ADM_V2_H__ |
| 14 | |
| 15 | |
| 16 | #define ADM_PATH_PLAYBACK 0x1 |
| 17 | #define ADM_PATH_LIVE_REC 0x2 |
| 18 | #define ADM_PATH_NONLIVE_REC 0x3 |
| 19 | #define ADM_PATH_COMPRESSED_RX 0x5 |
| 20 | #define ADM_PATH_COMPRESSED_TX 0x6 |
Laxminath Kasam | 605b42f | 2017-08-01 22:02:15 +0530 | [diff] [blame] | 21 | #include <dsp/rtac.h> |
| 22 | #include <dsp/q6afe-v2.h> |
| 23 | #include <dsp/q6audio-v2.h> |
Asish Bhattacharya | 8e2277f | 2017-07-20 18:31:55 +0530 | [diff] [blame] | 24 | |
| 25 | #define MAX_MODULES_IN_TOPO 16 |
| 26 | #define ADM_GET_TOPO_MODULE_LIST_LENGTH\ |
| 27 | ((MAX_MODULES_IN_TOPO + 1) * sizeof(uint32_t)) |
| 28 | #define AUD_PROC_BLOCK_SIZE 4096 |
| 29 | #define AUD_VOL_BLOCK_SIZE 4096 |
Bhalchandra Gajare | face276 | 2018-05-10 14:16:49 -0700 | [diff] [blame] | 30 | #define AUD_PROC_PERSIST_BLOCK_SIZE (2 * 1024 * 1020) |
Asish Bhattacharya | 8e2277f | 2017-07-20 18:31:55 +0530 | [diff] [blame] | 31 | #define AUDIO_RX_CALIBRATION_SIZE (AUD_PROC_BLOCK_SIZE + \ |
| 32 | AUD_VOL_BLOCK_SIZE) |
Dhanalakshmi Siddani | 040e026 | 2018-11-26 23:01:26 +0530 | [diff] [blame] | 33 | #define SESSION_TYPE_RX 0 |
| 34 | #define SESSION_TYPE_TX 1 |
| 35 | |
Asish Bhattacharya | 8e2277f | 2017-07-20 18:31:55 +0530 | [diff] [blame] | 36 | enum { |
| 37 | ADM_CUSTOM_TOP_CAL = 0, |
| 38 | ADM_AUDPROC_CAL, |
Aditya Bavanari | 2a627ae | 2017-11-21 20:24:53 +0530 | [diff] [blame] | 39 | ADM_LSM_AUDPROC_CAL, |
Asish Bhattacharya | 8e2277f | 2017-07-20 18:31:55 +0530 | [diff] [blame] | 40 | ADM_AUDVOL_CAL, |
| 41 | ADM_RTAC_INFO_CAL, |
| 42 | ADM_RTAC_APR_CAL, |
| 43 | ADM_SRS_TRUMEDIA, |
| 44 | ADM_RTAC_AUDVOL_CAL, |
Bhalchandra Gajare | face276 | 2018-05-10 14:16:49 -0700 | [diff] [blame] | 45 | ADM_LSM_AUDPROC_PERSISTENT_CAL, |
Asish Bhattacharya | 8e2277f | 2017-07-20 18:31:55 +0530 | [diff] [blame] | 46 | ADM_MAX_CAL_TYPES |
| 47 | }; |
| 48 | |
| 49 | enum { |
| 50 | ADM_MEM_MAP_INDEX_SOURCE_TRACKING = ADM_MAX_CAL_TYPES, |
| 51 | ADM_MEM_MAP_INDEX_MAX |
| 52 | }; |
| 53 | |
| 54 | enum { |
| 55 | ADM_CLIENT_ID_DEFAULT = 0, |
| 56 | ADM_CLIENT_ID_SOURCE_TRACKING, |
| 57 | ADM_CLIENT_ID_MAX, |
| 58 | }; |
| 59 | |
| 60 | #define MAX_COPPS_PER_PORT 0x8 |
| 61 | #define ADM_MAX_CHANNELS 8 |
| 62 | |
| 63 | /* multiple copp per stream. */ |
| 64 | struct route_payload { |
| 65 | unsigned int copp_idx[MAX_COPPS_PER_PORT]; |
| 66 | unsigned int port_id[MAX_COPPS_PER_PORT]; |
| 67 | int app_type[MAX_COPPS_PER_PORT]; |
| 68 | int acdb_dev_id[MAX_COPPS_PER_PORT]; |
| 69 | int sample_rate[MAX_COPPS_PER_PORT]; |
| 70 | unsigned short num_copps; |
| 71 | unsigned int session_id; |
| 72 | }; |
| 73 | |
| 74 | struct default_chmixer_param_id_coeff { |
| 75 | uint32_t index; |
| 76 | uint16_t num_output_channels; |
| 77 | uint16_t num_input_channels; |
| 78 | }; |
| 79 | |
| 80 | struct msm_pcm_channel_mixer { |
| 81 | int output_channel; |
| 82 | int input_channels[ADM_MAX_CHANNELS]; |
| 83 | bool enable; |
| 84 | int rule; |
| 85 | int channel_weight[ADM_MAX_CHANNELS][ADM_MAX_CHANNELS]; |
| 86 | }; |
| 87 | |
| 88 | int srs_trumedia_open(int port_id, int copp_idx, __s32 srs_tech_id, |
| 89 | void *srs_params); |
| 90 | |
| 91 | int adm_dts_eagle_set(int port_id, int copp_idx, int param_id, |
| 92 | void *data, uint32_t size); |
| 93 | |
| 94 | int adm_dts_eagle_get(int port_id, int copp_idx, int param_id, |
| 95 | void *data, uint32_t size); |
| 96 | |
| 97 | void adm_copp_mfc_cfg(int port_id, int copp_idx, int dst_sample_rate); |
| 98 | |
| 99 | int adm_get_params(int port_id, int copp_idx, uint32_t module_id, |
| 100 | uint32_t param_id, uint32_t params_length, char *params); |
| 101 | |
| 102 | int adm_send_params_v5(int port_id, int copp_idx, char *params, |
| 103 | uint32_t params_length); |
| 104 | |
| 105 | int adm_dolby_dap_send_params(int port_id, int copp_idx, char *params, |
| 106 | uint32_t params_length); |
| 107 | |
| 108 | int adm_open(int port, int path, int rate, int mode, int topology, |
| 109 | int perf_mode, uint16_t bits_per_sample, |
Sachin Mohan Gadag | 3c3c581 | 2018-07-20 15:46:54 +0530 | [diff] [blame] | 110 | int app_type, int acdbdev_id, int session_type); |
Asish Bhattacharya | 8e2277f | 2017-07-20 18:31:55 +0530 | [diff] [blame] | 111 | |
| 112 | int adm_map_rtac_block(struct rtac_cal_block_data *cal_block); |
| 113 | |
| 114 | int adm_unmap_rtac_block(uint32_t *mem_map_handle); |
| 115 | |
| 116 | int adm_close(int port, int topology, int perf_mode); |
| 117 | |
| 118 | int adm_matrix_map(int path, struct route_payload payload_map, |
| 119 | int perf_mode, uint32_t passthr_mode); |
| 120 | |
| 121 | int adm_connect_afe_port(int mode, int session_id, int port_id); |
| 122 | |
| 123 | void adm_ec_ref_rx_id(int port_id); |
| 124 | |
| 125 | void adm_num_ec_ref_rx_chans(int num_chans); |
| 126 | |
| 127 | void adm_ec_ref_rx_bit_width(int bit_width); |
| 128 | |
| 129 | void adm_ec_ref_rx_sampling_rate(int sampling_rate); |
| 130 | |
| 131 | int adm_get_lowlatency_copp_id(int port_id); |
| 132 | |
| 133 | int adm_set_multi_ch_map(char *channel_map, int path); |
| 134 | |
| 135 | int adm_get_multi_ch_map(char *channel_map, int path); |
| 136 | |
Rohit kumar | 5d860f4 | 2019-02-01 18:01:12 +0530 | [diff] [blame] | 137 | void adm_set_port_multi_ch_map(char *channel_map, int port_id); |
| 138 | |
Asish Bhattacharya | 8e2277f | 2017-07-20 18:31:55 +0530 | [diff] [blame] | 139 | int adm_validate_and_get_port_index(int port_id); |
| 140 | |
| 141 | int adm_get_default_copp_idx(int port_id); |
| 142 | |
| 143 | int adm_get_topology_for_port_from_copp_id(int port_id, int copp_id); |
| 144 | |
| 145 | int adm_get_topology_for_port_copp_idx(int port_id, int copp_idx); |
| 146 | |
| 147 | int adm_get_indexes_from_copp_id(int copp_id, int *port_idx, int *copp_idx); |
| 148 | |
| 149 | int adm_set_stereo_to_custom_stereo(int port_id, int copp_idx, |
| 150 | unsigned int session_id, |
| 151 | char *params, uint32_t params_length); |
| 152 | |
| 153 | int adm_get_pp_topo_module_list(int port_id, int copp_idx, int32_t param_length, |
| 154 | char *params); |
| 155 | |
| 156 | int adm_set_volume(int port_id, int copp_idx, int volume); |
| 157 | |
| 158 | int adm_set_softvolume(int port_id, int copp_idx, |
| 159 | struct audproc_softvolume_params *softvol_param); |
| 160 | |
| 161 | int adm_set_mic_gain(int port_id, int copp_idx, int volume); |
| 162 | |
| 163 | int adm_send_set_multichannel_ec_primary_mic_ch(int port_id, int copp_idx, |
| 164 | int primary_mic_ch); |
| 165 | |
| 166 | int adm_param_enable(int port_id, int copp_idx, int module_id, int enable); |
| 167 | |
| 168 | int adm_send_calibration(int port_id, int copp_idx, int path, int perf_mode, |
| 169 | int cal_type, char *params, int size); |
| 170 | |
| 171 | int adm_set_wait_parameters(int port_id, int copp_idx); |
| 172 | |
| 173 | int adm_reset_wait_parameters(int port_id, int copp_idx); |
| 174 | |
| 175 | int adm_wait_timeout(int port_id, int copp_idx, int wait_time); |
| 176 | |
| 177 | int adm_store_cal_data(int port_id, int copp_idx, int path, int perf_mode, |
| 178 | int cal_type, char *params, int *size); |
| 179 | |
| 180 | int adm_send_compressed_device_mute(int port_id, int copp_idx, bool mute_on); |
| 181 | |
| 182 | int adm_send_compressed_device_latency(int port_id, int copp_idx, int latency); |
| 183 | int adm_set_sound_focus(int port_id, int copp_idx, |
| 184 | struct sound_focus_param soundFocusData); |
| 185 | int adm_get_sound_focus(int port_id, int copp_idx, |
| 186 | struct sound_focus_param *soundFocusData); |
| 187 | int adm_get_source_tracking(int port_id, int copp_idx, |
| 188 | struct source_tracking_param *sourceTrackingData); |
| 189 | int adm_swap_speaker_channels(int port_id, int copp_idx, int sample_rate, |
| 190 | bool spk_swap); |
| 191 | int adm_programable_channel_mixer(int port_id, int copp_idx, int session_id, |
| 192 | int session_type, |
| 193 | struct msm_pcm_channel_mixer *ch_mixer, |
Dhanalakshmi Siddani | 040e026 | 2018-11-26 23:01:26 +0530 | [diff] [blame] | 194 | int channel_index, bool use_default_chmap, |
| 195 | char *ch_map); |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 196 | void msm_dts_srs_acquire_lock(void); |
| 197 | void msm_dts_srs_release_lock(void); |
Asish Bhattacharya | 8e2277f | 2017-07-20 18:31:55 +0530 | [diff] [blame] | 198 | #endif /* __Q6_ADM_V2_H__ */ |