summaryrefslogtreecommitdiff
path: root/include/sound/q6adm-v2.h
blob: 4545f2cd3826df5ab4c758222c004af637973a87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */
#ifndef __Q6_ADM_V2_H__
#define __Q6_ADM_V2_H__


#define ADM_PATH_PLAYBACK 0x1
#define ADM_PATH_LIVE_REC 0x2
#define ADM_PATH_NONLIVE_REC 0x3
#define ADM_PATH_COMPRESSED_RX 0x5
#define ADM_PATH_COMPRESSED_TX 0x6
#include <linux/qdsp6v2/rtac.h>
#include <sound/q6afe-v2.h>
#include <sound/q6audio-v2.h>

#define MAX_MODULES_IN_TOPO 16
#define ADM_GET_TOPO_MODULE_LIST_LENGTH\
		((MAX_MODULES_IN_TOPO + 1) * sizeof(uint32_t))
#define ADM_GET_TOPO_MODULE_INSTANCE_LIST_LENGTH                               \
	((MAX_MODULES_IN_TOPO + 1) * 2 * sizeof(uint32_t))
#define AUD_PROC_BLOCK_SIZE	4096
#define AUD_VOL_BLOCK_SIZE	4096
#define AUDIO_RX_CALIBRATION_SIZE	(AUD_PROC_BLOCK_SIZE + \
						AUD_VOL_BLOCK_SIZE)
enum {
	ADM_CUSTOM_TOP_CAL = 0,
	ADM_AUDPROC_CAL,
	ADM_AUDVOL_CAL,
	ADM_RTAC_INFO_CAL,
	ADM_RTAC_APR_CAL,
	ADM_SRS_TRUMEDIA,
	ADM_RTAC_AUDVOL_CAL,
	ADM_MAX_CAL_TYPES
};

enum {
	ADM_MEM_MAP_INDEX_SOURCE_TRACKING = ADM_MAX_CAL_TYPES,
	ADM_MEM_MAP_INDEX_MAX
};

enum {
	ADM_CLIENT_ID_DEFAULT = 0,
	ADM_CLIENT_ID_SOURCE_TRACKING,
	ADM_CLIENT_ID_MAX,
};

/* ENUM for adm_status & route_status */
enum adm_status_flags {
	ADM_STATUS_CALIBRATION_REQUIRED = 0,
	ADM_STATUS_LIMITER,
	ADM_STATUS_MAX,
};

#define MAX_COPPS_PER_PORT 0x8
#define ADM_MAX_CHANNELS 32

/* multiple copp per stream. */
struct route_payload {
	unsigned int copp_idx[MAX_COPPS_PER_PORT];
	unsigned int port_id[MAX_COPPS_PER_PORT];
	int app_type[MAX_COPPS_PER_PORT];
	int acdb_dev_id[MAX_COPPS_PER_PORT];
	int sample_rate[MAX_COPPS_PER_PORT];
	unsigned long route_status[MAX_COPPS_PER_PORT];
	unsigned short num_copps;
	unsigned int session_id;
};

struct default_chmixer_param_id_coeff {
	uint32_t index;
	uint16_t num_output_channels;
	uint16_t num_input_channels;
};

struct msm_pcm_channel_mixer {
	int output_channel;
	int input_channels[ADM_MAX_CHANNELS];
	bool enable;
	int rule;
	int channel_weight[ADM_MAX_CHANNELS][ADM_MAX_CHANNELS];
	int port_idx;
	int input_channel;
	uint16_t in_ch_map[ADM_MAX_CHANNELS];
	uint16_t out_ch_map[ADM_MAX_CHANNELS];
	int override_cfg;
};

int srs_trumedia_open(int port_id, int copp_idx, __s32 srs_tech_id,
		      void *srs_params);

int adm_dts_eagle_set(int port_id, int copp_idx, int param_id,
		      void *data, uint32_t size);

int adm_dts_eagle_get(int port_id, int copp_idx, int param_id,
		      void *data, uint32_t size);

void adm_copp_mfc_cfg(int port_id, int copp_idx, int dst_sample_rate);

int adm_get_params(int port_id, int copp_idx, uint32_t module_id,
		   uint32_t param_id, uint32_t params_length, char *params);

int adm_get_pp_params(int port_id, int copp_idx, uint32_t client_id,
		      struct mem_mapping_hdr *mem_hdr,
		      struct param_hdr_v3 *param_hdr, u8 *returned_param_data);

int adm_send_params_v5(int port_id, int copp_idx, char *params,
			      uint32_t params_length);

int adm_dolby_dap_send_params(int port_id, int copp_idx, char *params,
			      uint32_t params_length);

int adm_set_pp_params(int port_id, int copp_idx,
		      struct mem_mapping_hdr *mem_hdr, u8 *param_data,
		      u32 params_size);

int adm_pack_and_set_one_pp_param(int port_id, int copp_idx,
				  struct param_hdr_v3 param_hdr,
				  u8 *param_data);

int adm_open(int port, int path, int rate, int mode, int topology,
			   int perf_mode, uint16_t bits_per_sample,
			   int app_type, int acdbdev_id);

int adm_map_rtac_block(struct rtac_cal_block_data *cal_block);

int adm_unmap_rtac_block(uint32_t *mem_map_handle);

int adm_close(int port, int topology, int perf_mode);

int adm_matrix_map(int path, struct route_payload payload_map,
		   int perf_mode, uint32_t passthr_mode);

int adm_connect_afe_port(int mode, int session_id, int port_id);

void adm_ec_ref_rx_id(int  port_id);

void adm_num_ec_ref_rx_chans(int num_chans);

void adm_ec_ref_rx_bit_width(int bit_width);

void adm_ec_ref_rx_sampling_rate(int sampling_rate);

int adm_get_lowlatency_copp_id(int port_id);

int adm_set_multi_ch_map(char *channel_map, int path);

int adm_get_multi_ch_map(char *channel_map, int path);

int adm_validate_and_get_port_index(int port_id);

int adm_get_default_copp_idx(int port_id);

int adm_get_topology_for_port_from_copp_id(int port_id, int copp_id);

int adm_get_topology_for_port_copp_idx(int port_id, int copp_idx);

int adm_get_indexes_from_copp_id(int copp_id, int *port_idx, int *copp_idx);

int adm_set_pspd_matrix_params(int port_id, int copp_idx,
				unsigned int session_id,
				char *params, uint32_t params_length,
				int session_type);

int adm_set_downmix_params(int port_id, int copp_idx,
				unsigned int session_id, char *params,
				uint32_t params_length);

int adm_get_pp_topo_module_list(int port_id, int copp_idx, int32_t param_length,
				char *params);

int adm_get_pp_topo_module_list_v2(int port_id, int copp_idx,
				   int32_t param_length,
				   int32_t *returned_params);

int adm_set_volume(int port_id, int copp_idx, int volume);

int adm_set_softvolume(int port_id, int copp_idx,
		       struct audproc_softvolume_params *softvol_param);

int adm_set_mic_gain(int port_id, int copp_idx, int volume);

int adm_send_set_multichannel_ec_primary_mic_ch(int port_id, int copp_idx,
				int primary_mic_ch);

int adm_param_enable(int port_id, int copp_idx, int module_id,  int enable);

int adm_param_enable_v2(int port_id, int copp_idx,
			struct module_instance_info mod_inst_info, int enable);

int adm_send_calibration(int port_id, int copp_idx, int path, int perf_mode,
			 int cal_type, char *params, int size);

int adm_set_wait_parameters(int port_id, int copp_idx);

int adm_reset_wait_parameters(int port_id, int copp_idx);

int adm_wait_timeout(int port_id, int copp_idx, int wait_time);

int adm_store_cal_data(int port_id, int copp_idx, int path, int perf_mode,
		       int cal_type, char *params, int *size);

int adm_send_compressed_device_mute(int port_id, int copp_idx, bool mute_on);

int adm_send_compressed_device_latency(int port_id, int copp_idx, int latency);
int adm_set_sound_focus(int port_id, int copp_idx,
			struct sound_focus_param soundFocusData);
int adm_get_sound_focus(int port_id, int copp_idx,
			struct sound_focus_param *soundFocusData);
int adm_get_source_tracking(int port_id, int copp_idx,
			    struct source_tracking_param *sourceTrackingData);
int adm_swap_speaker_channels(int port_id, int copp_idx, int sample_rate,
				bool spk_swap);
int adm_programable_channel_mixer(int port_id, int copp_idx, int session_id,
			int session_type,
			struct msm_pcm_channel_mixer *ch_mixer,
			int channel_index);
void adm_set_native_mode(int mode);
#endif /* __Q6_ADM_V2_H__ */