#ifndef __AUDIOREACH_H__
#define __AUDIOREACH_H__
#include <linux/types.h>
#include <linux/soc/qcom/apr.h>
#include <sound/soc.h>
struct q6apm;
struct q6apm_graph;
#define MODULE_ID_WR_SHARED_MEM_EP …
#define MODULE_ID_RD_SHARED_MEM_EP …
#define MODULE_ID_GAIN …
#define MODULE_ID_PCM_CNV …
#define MODULE_ID_PCM_ENC …
#define MODULE_ID_PCM_DEC …
#define MODULE_ID_PLACEHOLDER_ENCODER …
#define MODULE_ID_PLACEHOLDER_DECODER …
#define MODULE_ID_SAL …
#define MODULE_ID_MFC …
#define MODULE_ID_CODEC_DMA_SINK …
#define MODULE_ID_CODEC_DMA_SOURCE …
#define MODULE_ID_I2S_SINK …
#define MODULE_ID_I2S_SOURCE …
#define MODULE_ID_DATA_LOGGING …
#define MODULE_ID_AAC_DEC …
#define MODULE_ID_FLAC_DEC …
#define MODULE_ID_MP3_DECODE …
#define MODULE_ID_GAPLESS …
#define MODULE_ID_DISPLAY_PORT_SINK …
#define APM_CMD_GET_SPF_STATE …
#define APM_CMD_RSP_GET_SPF_STATE …
#define APM_MODULE_INSTANCE_ID …
#define PRM_MODULE_INSTANCE_ID …
#define AMDB_MODULE_INSTANCE_ID …
#define VCPM_MODULE_INSTANCE_ID …
#define AR_MODULE_INSTANCE_ID_START …
#define AR_MODULE_INSTANCE_ID_END …
#define AR_MODULE_DYNAMIC_INSTANCE_ID_START …
#define AR_MODULE_DYNAMIC_INSTANCE_ID_END …
#define AR_CONT_INSTANCE_ID_START …
#define AR_CONT_INSTANCE_ID_END …
#define AR_SG_INSTANCE_ID_START …
#define APM_CMD_GRAPH_OPEN …
#define APM_CMD_GRAPH_PREPARE …
#define APM_CMD_GRAPH_START …
#define APM_CMD_GRAPH_STOP …
#define APM_CMD_GRAPH_CLOSE …
#define APM_CMD_GRAPH_FLUSH …
#define APM_CMD_SET_CFG …
#define APM_CMD_GET_CFG …
#define APM_CMD_SHARED_MEM_MAP_REGIONS …
#define APM_CMD_SHARED_MEM_UNMAP_REGIONS …
#define APM_CMD_RSP_SHARED_MEM_MAP_REGIONS …
#define APM_CMD_RSP_GET_CFG …
#define APM_CMD_CLOSE_ALL …
#define APM_CMD_REGISTER_SHARED_CFG …
#define APM_MEMORY_MAP_SHMEM8_4K_POOL …
struct apm_cmd_shared_mem_map_regions { … } __packed;
struct apm_shared_map_region_payload { … } __packed;
struct apm_cmd_shared_mem_unmap_regions { … } __packed;
struct apm_cmd_rsp_shared_mem_map_regions { … } __packed;
#define APM_PARAM_ID_SUB_GRAPH_LIST …
#define APM_PARAM_ID_MODULE_LIST …
struct apm_param_id_modules_list { … } __packed;
#define APM_PARAM_ID_MODULE_PROP …
struct apm_param_id_module_prop { … } __packed;
struct apm_module_prop_cfg { … } __packed;
#define APM_PARAM_ID_MODULE_CONN …
struct apm_param_id_module_conn { … } __packed;
struct apm_module_conn_obj { … } __packed;
#define APM_PARAM_ID_GAIN …
struct param_id_gain_cfg { … } __packed;
#define PARAM_ID_PCM_OUTPUT_FORMAT_CFG …
struct param_id_pcm_output_format_cfg { … } __packed;
struct payload_pcm_output_format_cfg { … } __packed;
#define PARAM_ID_ENC_BITRATE …
struct param_id_enc_bitrate_param { … } __packed;
#define DATA_FORMAT_FIXED_POINT …
#define DATA_FORMAT_GENERIC_COMPRESSED …
#define DATA_FORMAT_RAW_COMPRESSED …
#define PCM_LSB_ALIGNED …
#define PCM_MSB_ALIGNED …
#define PCM_LITTLE_ENDIAN …
#define PCM_BIT_ENDIAN …
#define MEDIA_FMT_ID_PCM …
#define MEDIA_FMT_ID_MP3 …
#define SAMPLE_RATE_48K …
#define BIT_WIDTH_16 …
#define APM_PARAM_ID_PROP_PORT_INFO …
struct apm_modules_prop_info { … } __packed;
#define DATA_CMD_WR_SH_MEM_EP_DATA_BUFFER …
#define WR_SH_MEM_EP_TIMESTAMP_VALID_FLAG …
#define WR_SH_MEM_EP_LAST_BUFFER_FLAG …
#define WR_SH_MEM_EP_TS_CONTINUE_FLAG …
#define WR_SH_MEM_EP_EOF_FLAG …
struct apm_data_cmd_wr_sh_mem_ep_data_buffer { … } __packed;
#define DATA_CMD_WR_SH_MEM_EP_DATA_BUFFER_V2 …
struct apm_data_cmd_wr_sh_mem_ep_data_buffer_v2 { … } __packed;
#define DATA_CMD_RSP_WR_SH_MEM_EP_DATA_BUFFER_DONE …
struct data_cmd_rsp_wr_sh_mem_ep_data_buffer_done { … } __packed;
#define DATA_CMD_RSP_WR_SH_MEM_EP_DATA_BUFFER_DONE_V2 …
struct data_cmd_rsp_wr_sh_mem_ep_data_buffer_done_v2 { … } __packed;
#define PARAM_ID_MEDIA_FORMAT …
#define DATA_CMD_WR_SH_MEM_EP_MEDIA_FORMAT …
struct apm_media_format { … } __packed;
#define MEDIA_FMT_ID_FLAC …
struct payload_media_fmt_flac_t { … } __packed;
#define MEDIA_FMT_ID_AAC …
struct payload_media_fmt_aac_t { … } __packed;
#define DATA_CMD_WR_SH_MEM_EP_EOS …
#define WR_SH_MEM_EP_EOS_POLICY_LAST …
#define WR_SH_MEM_EP_EOS_POLICY_EACH …
struct data_cmd_wr_sh_mem_ep_eos { … } __packed;
#define DATA_CMD_RD_SH_MEM_EP_DATA_BUFFER …
struct data_cmd_rd_sh_mem_ep_data_buffer { … } __packed;
#define DATA_CMD_RSP_RD_SH_MEM_EP_DATA_BUFFER …
struct data_cmd_rsp_rd_sh_mem_ep_data_buffer_done { … } __packed;
#define DATA_CMD_RD_SH_MEM_EP_DATA_BUFFER_V2 …
struct data_cmd_rd_sh_mem_ep_data_buffer_v2 { … } __packed;
#define DATA_CMD_RSP_RD_SH_MEM_EP_DATA_BUFFER_V2 …
struct data_cmd_rsp_rd_sh_mem_ep_data_buffer_done_v2 { … } __packed;
#define PARAM_ID_RD_SH_MEM_CFG …
struct param_id_rd_sh_mem_cfg { … } __packed;
#define DATA_CMD_WR_SH_MEM_EP_EOS_RENDERED …
struct data_cmd_wr_sh_mem_ep_eos_rendered { … } __packed;
#define MODULE_ID_WR_SHARED_MEM_EP …
struct apm_cmd_header { … } __packed;
#define APM_CMD_HDR_SIZE …
struct apm_module_param_data { … } __packed;
#define APM_MODULE_PARAM_DATA_SIZE …
struct apm_module_param_shared_data { … } __packed;
struct apm_prop_data { … } __packed;
#define APM_PARAM_ID_SUB_GRAPH_CONFIG …
struct apm_param_id_sub_graph_cfg { … } __packed;
struct apm_sub_graph_cfg { … } __packed;
#define APM_SUB_GRAPH_PROP_ID_PERF_MODE …
struct apm_sg_prop_id_perf_mode { … } __packed;
#define APM_SG_PROP_ID_PERF_MODE_SIZE …
#define APM_SUB_GRAPH_PROP_ID_DIRECTION …
struct apm_sg_prop_id_direction { … } __packed;
#define APM_SG_PROP_ID_DIR_SIZE …
#define APM_SUB_GRAPH_PROP_ID_SCENARIO_ID …
#define APM_SUB_GRAPH_SID_AUDIO_PLAYBACK …
#define APM_SUB_GRAPH_SID_AUDIO_RECORD …
#define APM_SUB_GRAPH_SID_AUDIO_VOICE_CALL …
struct apm_sg_prop_id_scenario_id { … } __packed;
#define APM_SG_PROP_ID_SID_SIZE …
#define APM_PARAM_ID_CONTAINER_CONFIG …
struct apm_param_id_container_cfg { … } __packed;
struct apm_container_cfg { … } __packed;
struct apm_cont_capability { … } __packed;
#define APM_CONTAINER_PROP_ID_CAPABILITY_LIST …
#define APM_CONTAINER_PROP_ID_CAPABILITY_SIZE …
#define APM_PROP_ID_INVALID …
#define APM_CONTAINER_CAP_ID_PP …
#define APM_CONTAINER_CAP_ID_PP …
struct apm_cont_prop_id_cap_list { … } __packed;
#define APM_CONTAINER_PROP_ID_GRAPH_POS …
struct apm_cont_prop_id_graph_pos { … } __packed;
#define APM_CONTAINER_PROP_ID_STACK_SIZE …
struct apm_cont_prop_id_stack_size { … } __packed;
#define APM_CONTAINER_PROP_ID_PROC_DOMAIN …
struct apm_cont_prop_id_domain { … } __packed;
#define CONFIG_I2S_WS_SRC_EXTERNAL …
#define CONFIG_I2S_WS_SRC_INTERNAL …
#define PARAM_ID_I2S_INTF_CFG …
struct param_id_i2s_intf_cfg { … } __packed;
#define I2S_INTF_TYPE_PRIMARY …
#define I2S_INTF_TYPE_SECOINDARY …
#define I2S_INTF_TYPE_TERTINARY …
#define I2S_INTF_TYPE_QUATERNARY …
#define I2S_INTF_TYPE_QUINARY …
#define I2S_SD0 …
#define I2S_SD1 …
#define I2S_SD2 …
#define I2S_SD3 …
#define PORT_ID_I2S_INPUT …
#define PORT_ID_I2S_OUPUT …
#define I2S_STACK_SIZE …
#define PARAM_ID_DISPLAY_PORT_INTF_CFG …
struct param_id_display_port_intf_cfg { … } __packed;
#define PARAM_ID_HW_EP_MF_CFG …
struct param_id_hw_ep_mf { … } __packed;
#define PARAM_ID_HW_EP_FRAME_SIZE_FACTOR …
struct param_id_fram_size_factor { … } __packed;
#define APM_CONTAINER_PROP_ID_PARENT_CONTAINER_ID …
struct apm_cont_prop_id_parent_container { … } __packed;
#define APM_CONTAINER_PROP_ID_HEAP_ID …
#define APM_CONT_HEAP_DEFAULT …
#define APM_CONT_HEAP_LOW_POWER …
struct apm_cont_prop_id_headp_id { … } __packed;
struct apm_modules_list { … } __packed;
struct apm_module_obj { … } __packed;
#define APM_MODULE_PROP_ID_PORT_INFO …
#define APM_MODULE_PROP_ID_PORT_INFO_SZ …
struct apm_module_prop_id_port_info { … } __packed;
#define DATA_LOGGING_MAX_INPUT_PORTS …
#define DATA_LOGGING_MAX_OUTPUT_PORTS …
#define DATA_LOGGING_STACK_SIZE …
#define PARAM_ID_DATA_LOGGING_CONFIG …
struct data_logging_config { … } __packed;
#define PARAM_ID_SAL_OUTPUT_CFG …
struct param_id_sal_output_config { … } __packed;
#define PARAM_ID_SAL_LIMITER_ENABLE …
struct param_id_sal_limiter_enable { … } __packed;
#define PARAM_ID_MFC_OUTPUT_MEDIA_FORMAT …
#define PARAM_ID_EARLY_EOS_DELAY …
#define EARLY_EOS_DELAY_MS …
struct param_id_mfc_media_format { … } __packed;
struct param_id_gapless_early_eos_delay_t { … } __packed;
struct media_format { … } __packed;
struct payload_media_fmt_pcm { … } __packed;
#define PARAM_ID_MODULE_ENABLE …
struct param_id_module_enable { … } __packed;
#define PARAM_ID_CODEC_DMA_INTF_CFG …
struct param_id_codec_dma_intf_cfg { … } __packed;
struct audio_hw_clk_cfg { … } __packed;
struct audio_hw_clk_rel_cfg { … } __packed;
#define PARAM_ID_HW_EP_POWER_MODE_CFG …
#define AR_HW_EP_POWER_MODE_0 …
#define AR_HW_EP_POWER_MODE_1 …
#define AR_HW_EP_POWER_MODE_2 …
struct param_id_hw_ep_power_mode_cfg { … } __packed;
#define PARAM_ID_HW_EP_DMA_DATA_ALIGN …
#define AR_HW_EP_DMA_DATA_ALIGN_MSB …
#define AR_HW_EP_DMA_DATA_ALIGN_LSB …
#define AR_PCM_MAX_NUM_CHANNEL …
struct param_id_hw_ep_dma_data_align { … } __packed;
#define PARAM_ID_VOL_CTRL_MASTER_GAIN …
#define VOL_CTRL_DEFAULT_GAIN …
struct param_id_vol_ctrl_master_gain { … } __packed;
#define PARAM_ID_REMOVE_INITIAL_SILENCE …
#define PARAM_ID_REMOVE_TRAILING_SILENCE …
#define PARAM_ID_REAL_MODULE_ID …
struct param_id_placeholder_real_module_id { … } __packed;
struct audioreach_connection { … };
struct audioreach_graph_info { … };
struct audioreach_sub_graph { … };
struct audioreach_container { … };
#define AR_MAX_MOD_LINKS …
struct audioreach_module { … };
struct audioreach_module_config { … };
void *audioreach_alloc_apm_cmd_pkt(int pkt_size, uint32_t opcode, uint32_t
token);
void audioreach_set_default_channel_mapping(u8 *ch_map, int num_channels);
void *audioreach_alloc_cmd_pkt(int payload_size, uint32_t opcode,
uint32_t token, uint32_t src_port,
uint32_t dest_port);
void *audioreach_alloc_apm_pkt(int pkt_size, uint32_t opcode, uint32_t token,
uint32_t src_port);
void *audioreach_alloc_pkt(int payload_size, uint32_t opcode,
uint32_t token, uint32_t src_port,
uint32_t dest_port);
void *audioreach_alloc_graph_pkt(struct q6apm *apm, struct audioreach_graph_info
*info);
int audioreach_tplg_init(struct snd_soc_component *component);
void audioreach_graph_free_buf(struct q6apm_graph *graph);
int audioreach_map_memory_regions(struct q6apm_graph *graph,
unsigned int dir, size_t period_sz,
unsigned int periods,
bool is_contiguous);
int audioreach_send_cmd_sync(struct device *dev, gpr_device_t *gdev, struct gpr_ibasic_rsp_result_t *result,
struct mutex *cmd_lock, gpr_port_t *port, wait_queue_head_t *cmd_wait,
struct gpr_pkt *pkt, uint32_t rsp_opcode);
int audioreach_graph_send_cmd_sync(struct q6apm_graph *graph, struct gpr_pkt *pkt,
uint32_t rsp_opcode);
int audioreach_set_media_format(struct q6apm_graph *graph,
struct audioreach_module *module,
struct audioreach_module_config *cfg);
int audioreach_shared_memory_send_eos(struct q6apm_graph *graph);
int audioreach_gain_set_vol_ctrl(struct q6apm *apm,
struct audioreach_module *module, int vol);
int audioreach_send_u32_param(struct q6apm_graph *graph, struct audioreach_module *module,
uint32_t param_id, uint32_t param_val);
int audioreach_compr_set_param(struct q6apm_graph *graph, struct audioreach_module_config *mcfg);
#endif