OSDN Git Service

Merge android-4.4-p.194 (2b29211) into msm-4.4
[sagit-ice-cold/kernel_xiaomi_msm8998.git] / include / sound / q6adm-v2.h
1 /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
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
21 #include <linux/qdsp6v2/rtac.h>
22 #include <sound/q6afe-v2.h>
23 #include <sound/q6audio-v2.h>
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 ADM_GET_TOPO_MODULE_INSTANCE_LIST_LENGTH                               \
29         ((MAX_MODULES_IN_TOPO + 1) * 2 * sizeof(uint32_t))
30 #define AUD_PROC_BLOCK_SIZE     4096
31 #define AUD_VOL_BLOCK_SIZE      4096
32 #define AUDIO_RX_CALIBRATION_SIZE       (AUD_PROC_BLOCK_SIZE + \
33                                                 AUD_VOL_BLOCK_SIZE)
34 enum {
35         ADM_CUSTOM_TOP_CAL = 0,
36         ADM_AUDPROC_CAL,
37         ADM_AUDVOL_CAL,
38         ADM_RTAC_INFO_CAL,
39         ADM_RTAC_APR_CAL,
40         ADM_SRS_TRUMEDIA,
41         ADM_RTAC_AUDVOL_CAL,
42         ADM_MAX_CAL_TYPES
43 };
44
45 enum {
46         ADM_MEM_MAP_INDEX_SOURCE_TRACKING = ADM_MAX_CAL_TYPES,
47         ADM_MEM_MAP_INDEX_MAX
48 };
49
50 enum {
51         ADM_CLIENT_ID_DEFAULT = 0,
52         ADM_CLIENT_ID_SOURCE_TRACKING,
53         ADM_CLIENT_ID_MAX,
54 };
55
56 /* ENUM for adm_status & route_status */
57 enum adm_status_flags {
58         ADM_STATUS_CALIBRATION_REQUIRED = 0,
59         ADM_STATUS_LIMITER,
60         ADM_STATUS_MAX,
61 };
62
63 #define MAX_COPPS_PER_PORT 0x8
64 #define ADM_MAX_CHANNELS 32
65
66 /* multiple copp per stream. */
67 struct route_payload {
68         unsigned int copp_idx[MAX_COPPS_PER_PORT];
69         unsigned int port_id[MAX_COPPS_PER_PORT];
70         int app_type[MAX_COPPS_PER_PORT];
71         int acdb_dev_id[MAX_COPPS_PER_PORT];
72         int sample_rate[MAX_COPPS_PER_PORT];
73         unsigned long route_status[MAX_COPPS_PER_PORT];
74         unsigned short num_copps;
75         unsigned int session_id;
76 };
77
78 struct default_chmixer_param_id_coeff {
79         uint32_t index;
80         uint16_t num_output_channels;
81         uint16_t num_input_channels;
82 };
83
84 struct msm_pcm_channel_mixer {
85         int output_channel;
86         int input_channels[ADM_MAX_CHANNELS];
87         bool enable;
88         int rule;
89         int channel_weight[ADM_MAX_CHANNELS][ADM_MAX_CHANNELS];
90         int port_idx;
91         int input_channel;
92         uint16_t in_ch_map[ADM_MAX_CHANNELS];
93         uint16_t out_ch_map[ADM_MAX_CHANNELS];
94         int override_cfg;
95 };
96
97 int srs_trumedia_open(int port_id, int copp_idx, __s32 srs_tech_id,
98                       void *srs_params);
99
100 int adm_dts_eagle_set(int port_id, int copp_idx, int param_id,
101                       void *data, uint32_t size);
102
103 int adm_dts_eagle_get(int port_id, int copp_idx, int param_id,
104                       void *data, uint32_t size);
105
106 void adm_copp_mfc_cfg(int port_id, int copp_idx, int dst_sample_rate);
107
108 int adm_get_params(int port_id, int copp_idx, uint32_t module_id,
109                    uint32_t param_id, uint32_t params_length, char *params);
110
111 int adm_get_pp_params(int port_id, int copp_idx, uint32_t client_id,
112                       struct mem_mapping_hdr *mem_hdr,
113                       struct param_hdr_v3 *param_hdr, u8 *returned_param_data);
114
115 int adm_send_params_v5(int port_id, int copp_idx, char *params,
116                               uint32_t params_length);
117
118 int adm_dolby_dap_send_params(int port_id, int copp_idx, char *params,
119                               uint32_t params_length);
120
121 int adm_set_pp_params(int port_id, int copp_idx,
122                       struct mem_mapping_hdr *mem_hdr, u8 *param_data,
123                       u32 params_size);
124
125 int adm_pack_and_set_one_pp_param(int port_id, int copp_idx,
126                                   struct param_hdr_v3 param_hdr,
127                                   u8 *param_data);
128
129 int adm_open(int port, int path, int rate, int mode, int topology,
130                            int perf_mode, uint16_t bits_per_sample,
131                            int app_type, int acdbdev_id, u32 copp_token);
132
133 int adm_map_rtac_block(struct rtac_cal_block_data *cal_block);
134
135 int adm_unmap_rtac_block(uint32_t *mem_map_handle);
136
137 int adm_close(int port, int topology, int perf_mode);
138
139 int adm_matrix_map(int path, struct route_payload payload_map,
140                    int perf_mode, uint32_t passthr_mode);
141
142 int adm_connect_afe_port(int mode, int session_id, int port_id);
143
144 void adm_ec_ref_rx_id(int  port_id);
145
146 void adm_num_ec_ref_rx_chans(int num_chans);
147
148 void adm_ec_ref_rx_bit_width(int bit_width);
149
150 void adm_ec_ref_rx_sampling_rate(int sampling_rate);
151
152 int adm_get_lowlatency_copp_id(int port_id);
153
154 int adm_set_multi_ch_map(char *channel_map, int path);
155
156 int adm_get_multi_ch_map(char *channel_map, int path);
157
158 int adm_validate_and_get_port_index(int port_id);
159
160 int adm_get_default_copp_idx(int port_id);
161
162 int adm_get_topology_for_port_from_copp_id(int port_id, int copp_id);
163
164 int adm_get_topology_for_port_copp_idx(int port_id, int copp_idx);
165
166 int adm_get_indexes_from_copp_id(int copp_id, int *port_idx, int *copp_idx);
167
168 int adm_set_pspd_matrix_params(int port_id, int copp_idx,
169                                 unsigned int session_id,
170                                 char *params, uint32_t params_length,
171                                 int session_type);
172
173 int adm_set_downmix_params(int port_id, int copp_idx,
174                                 unsigned int session_id, char *params,
175                                 uint32_t params_length);
176
177 int adm_get_pp_topo_module_list(int port_id, int copp_idx, int32_t param_length,
178                                 char *params);
179
180 int adm_get_pp_topo_module_list_v2(int port_id, int copp_idx,
181                                    int32_t param_length,
182                                    int32_t *returned_params);
183
184 int adm_set_volume(int port_id, int copp_idx, int volume);
185
186 int adm_set_softvolume(int port_id, int copp_idx,
187                        struct audproc_softvolume_params *softvol_param);
188
189 int adm_set_mic_gain(int port_id, int copp_idx, int volume);
190
191 int adm_send_set_multichannel_ec_primary_mic_ch(int port_id, int copp_idx,
192                                 int primary_mic_ch);
193
194 int adm_param_enable(int port_id, int copp_idx, int module_id,  int enable);
195
196 int adm_param_enable_v2(int port_id, int copp_idx,
197                         struct module_instance_info mod_inst_info, int enable);
198
199 int adm_send_calibration(int port_id, int copp_idx, int path, int perf_mode,
200                          int cal_type, char *params, int size);
201
202 int adm_set_wait_parameters(int port_id, int copp_idx);
203
204 int adm_reset_wait_parameters(int port_id, int copp_idx);
205
206 int adm_wait_timeout(int port_id, int copp_idx, int wait_time);
207
208 int adm_store_cal_data(int port_id, int copp_idx, int path, int perf_mode,
209                        int cal_type, char *params, int *size);
210
211 int adm_send_compressed_device_mute(int port_id, int copp_idx, bool mute_on);
212
213 int adm_send_compressed_device_latency(int port_id, int copp_idx, int latency);
214 int adm_set_sound_focus(int port_id, int copp_idx,
215                         struct sound_focus_param soundFocusData);
216 int adm_get_sound_focus(int port_id, int copp_idx,
217                         struct sound_focus_param *soundFocusData);
218 int adm_get_source_tracking(int port_id, int copp_idx,
219                             struct source_tracking_param *sourceTrackingData);
220 int adm_swap_speaker_channels(int port_id, int copp_idx, int sample_rate,
221                                 bool spk_swap);
222 int adm_programable_channel_mixer(int port_id, int copp_idx, int session_id,
223                         int session_type,
224                         struct msm_pcm_channel_mixer *ch_mixer,
225                         int channel_index);
226 void adm_set_native_mode(int mode);
227 #endif /* __Q6_ADM_V2_H__ */