q6adm-v2.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef __Q6_ADM_V2_H__
  6. #define __Q6_ADM_V2_H__
  7. #define ADM_PATH_PLAYBACK 0x1
  8. #define ADM_PATH_LIVE_REC 0x2
  9. #define ADM_PATH_NONLIVE_REC 0x3
  10. #define ADM_PATH_COMPRESSED_RX 0x5
  11. #define ADM_PATH_COMPRESSED_TX 0x6
  12. #include <dsp/rtac.h>
  13. #include <dsp/q6afe-v2.h>
  14. #include <dsp/q6audio-v2.h>
  15. #define MAX_MODULES_IN_TOPO 16
  16. #define ADM_GET_TOPO_MODULE_LIST_LENGTH\
  17. ((MAX_MODULES_IN_TOPO + 1) * sizeof(uint32_t))
  18. #define ADM_GET_TOPO_MODULE_INSTANCE_LIST_LENGTH \
  19. ((MAX_MODULES_IN_TOPO + 1) * 2 * sizeof(uint32_t))
  20. #define AUD_PROC_BLOCK_SIZE 4096
  21. #define AUD_VOL_BLOCK_SIZE 4096
  22. #define AUD_PROC_PERSIST_BLOCK_SIZE (2 * 1024 * 1020)
  23. #define AUDIO_RX_CALIBRATION_SIZE (AUD_PROC_BLOCK_SIZE + \
  24. AUD_VOL_BLOCK_SIZE)
  25. enum {
  26. ADM_CUSTOM_TOP_CAL = 0,
  27. ADM_AUDPROC_CAL,
  28. ADM_LSM_AUDPROC_CAL,
  29. ADM_AUDVOL_CAL,
  30. ADM_RTAC_INFO_CAL,
  31. ADM_RTAC_APR_CAL,
  32. ADM_SRS_TRUMEDIA,
  33. ADM_RTAC_AUDVOL_CAL,
  34. ADM_LSM_AUDPROC_PERSISTENT_CAL,
  35. ADM_MAX_CAL_TYPES
  36. };
  37. enum {
  38. ADM_MEM_MAP_INDEX_SOURCE_TRACKING = ADM_MAX_CAL_TYPES,
  39. ADM_MEM_MAP_INDEX_MAX
  40. };
  41. enum {
  42. ADM_CLIENT_ID_DEFAULT = 0,
  43. ADM_CLIENT_ID_SOURCE_TRACKING,
  44. ADM_CLIENT_ID_MAX,
  45. };
  46. #define MAX_COPPS_PER_PORT 0x8
  47. #define ADM_MAX_CHANNELS 32
  48. #define ADSP_ADM_API_VERSION_V3 3
  49. /* multiple copp per stream. */
  50. struct route_payload {
  51. unsigned int copp_idx[MAX_COPPS_PER_PORT];
  52. unsigned int port_id[MAX_COPPS_PER_PORT];
  53. int app_type[MAX_COPPS_PER_PORT];
  54. int acdb_dev_id[MAX_COPPS_PER_PORT];
  55. int sample_rate[MAX_COPPS_PER_PORT];
  56. unsigned short num_copps;
  57. unsigned int session_id;
  58. };
  59. struct default_chmixer_param_id_coeff {
  60. uint32_t index;
  61. uint16_t num_output_channels;
  62. uint16_t num_input_channels;
  63. };
  64. struct msm_pcm_channel_mixer {
  65. int output_channel;
  66. int input_channels[ADM_MAX_CHANNELS];
  67. bool enable;
  68. int rule;
  69. int channel_weight[ADM_MAX_CHANNELS][ADM_MAX_CHANNELS];
  70. int port_idx;
  71. int input_channel;
  72. uint16_t in_ch_map[ADM_MAX_CHANNELS];
  73. uint16_t out_ch_map[ADM_MAX_CHANNELS];
  74. bool override_in_ch_map;
  75. bool override_out_ch_map;
  76. };
  77. int srs_trumedia_open(int port_id, int copp_idx, __s32 srs_tech_id,
  78. void *srs_params);
  79. int adm_dts_eagle_set(int port_id, int copp_idx, int param_id,
  80. void *data, uint32_t size);
  81. int adm_dts_eagle_get(int port_id, int copp_idx, int param_id,
  82. void *data, uint32_t size);
  83. void adm_copp_mfc_cfg(int port_id, int copp_idx, int dst_sample_rate);
  84. int adm_get_pp_params(int port_id, int copp_idx, uint32_t client_id,
  85. struct mem_mapping_hdr *mem_hdr,
  86. struct param_hdr_v3 *param_hdr, u8 *returned_param_data);
  87. int adm_send_params_v5(int port_id, int copp_idx, char *params,
  88. uint32_t params_length);
  89. int adm_set_pp_params(int port_id, int copp_idx,
  90. struct mem_mapping_hdr *mem_hdr, u8 *param_data,
  91. u32 params_size);
  92. int adm_pack_and_set_one_pp_param(int port_id, int copp_idx,
  93. struct param_hdr_v3 param_hdr,
  94. u8 *param_data);
  95. int adm_open(int port, int path, int rate, int mode, int topology,
  96. int perf_mode, uint16_t bits_per_sample,
  97. int app_type, int acdbdev_id, int session_type);
  98. int adm_map_rtac_block(struct rtac_cal_block_data *cal_block);
  99. int adm_unmap_rtac_block(uint32_t *mem_map_handle);
  100. int adm_close(int port, int topology, int perf_mode);
  101. int adm_matrix_map(int path, struct route_payload payload_map,
  102. int perf_mode, uint32_t passthr_mode);
  103. int adm_connect_afe_port(int mode, int session_id, int port_id);
  104. void adm_ec_ref_rx_id(int port_id);
  105. void adm_num_ec_ref_rx_chans(int num_chans);
  106. void adm_num_ec_ref_rx_chans_downmixed(int num_chans);
  107. int adm_ec_ref_chmixer_weights(int out_channel_idx,
  108. uint16_t *weights, int count);
  109. void adm_ec_ref_rx_bit_width(int bit_width);
  110. void adm_ec_ref_rx_sampling_rate(int sampling_rate);
  111. int adm_get_lowlatency_copp_id(int port_id);
  112. int adm_set_multi_ch_map(char *channel_map, int path);
  113. int adm_get_multi_ch_map(char *channel_map, int path);
  114. int adm_validate_and_get_port_index(int port_id);
  115. int adm_get_default_copp_idx(int port_id);
  116. int adm_get_topology_for_port_from_copp_id(int port_id, int copp_id);
  117. int adm_get_topology_for_port_copp_idx(int port_id, int copp_idx);
  118. int adm_get_indexes_from_copp_id(int copp_id, int *port_idx, int *copp_idx);
  119. int adm_set_stereo_to_custom_stereo(int port_id, int copp_idx,
  120. unsigned int session_id,
  121. char *params, uint32_t params_length);
  122. int adm_get_pp_topo_module_list(int port_id, int copp_idx, int32_t param_length,
  123. char *params);
  124. int adm_get_pp_topo_module_list_v2(int port_id, int copp_idx,
  125. int32_t param_length,
  126. int32_t *returned_params);
  127. int adm_set_volume(int port_id, int copp_idx, int volume);
  128. int adm_set_softvolume(int port_id, int copp_idx,
  129. struct audproc_softvolume_params *softvol_param);
  130. int adm_set_mic_gain(int port_id, int copp_idx, int volume);
  131. int adm_send_set_multichannel_ec_primary_mic_ch(int port_id, int copp_idx,
  132. int primary_mic_ch);
  133. int adm_param_enable(int port_id, int copp_idx, int module_id, int enable);
  134. int adm_param_enable_v2(int port_id, int copp_idx,
  135. struct module_instance_info mod_inst_info, int enable);
  136. int adm_send_calibration(int port_id, int copp_idx, int path, int perf_mode,
  137. int cal_type, char *params, int size);
  138. int adm_set_wait_parameters(int port_id, int copp_idx);
  139. int adm_reset_wait_parameters(int port_id, int copp_idx);
  140. int adm_wait_timeout(int port_id, int copp_idx, int wait_time);
  141. int adm_store_cal_data(int port_id, int copp_idx, int path, int perf_mode,
  142. int cal_type, char *params, int *size);
  143. int adm_send_compressed_device_mute(int port_id, int copp_idx, bool mute_on);
  144. int adm_send_compressed_device_latency(int port_id, int copp_idx, int latency);
  145. int adm_set_sound_focus(int port_id, int copp_idx,
  146. struct sound_focus_param soundFocusData);
  147. int adm_get_sound_focus(int port_id, int copp_idx,
  148. struct sound_focus_param *soundFocusData);
  149. int adm_get_source_tracking(int port_id, int copp_idx,
  150. struct source_tracking_param *sourceTrackingData);
  151. int adm_get_doa_tracking_mon(int port_id, int copp_idx,
  152. struct doa_tracking_mon_param *doa_tracking_data);
  153. int adm_set_custom_chmix_cfg(int port_id, int copp_idx,
  154. unsigned int session_id, char *params,
  155. uint32_t params_length, int direction,
  156. int stream_type);
  157. int adm_swap_speaker_channels(int port_id, int copp_idx, int sample_rate,
  158. bool spk_swap);
  159. int adm_programable_channel_mixer(int port_id, int copp_idx, int session_id,
  160. int session_type,
  161. struct msm_pcm_channel_mixer *ch_mixer,
  162. int channel_index);
  163. void msm_dts_srs_acquire_lock(void);
  164. void msm_dts_srs_release_lock(void);
  165. void adm_set_native_mode(int mode);
  166. #endif /* __Q6_ADM_V2_H__ */