linux/sound/soc/qcom/qdsp6/q6apm.h

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __Q6APM_H__
#define __Q6APM_H__
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/wait.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/of.h>
#include <linux/delay.h>
#include <sound/soc.h>
#include <linux/of_platform.h>
#include <linux/jiffies.h>
#include <linux/soc/qcom/apr.h>
#include "audioreach.h"

#define APM_PORT_MAX
#define APM_PORT_MAX_AUDIO_CHAN_CNT
#define PCM_CHANNEL_NULL
#define PCM_CHANNEL_FL
#define PCM_CHANNEL_FR
#define PCM_CHANNEL_FC
#define PCM_CHANNEL_LS
#define PCM_CHANNEL_RS
#define PCM_CHANNEL_LFE
#define PCM_CHANNEL_CS
#define PCM_CHANNEL_LB
#define PCM_CHANNEL_RB
#define PCM_CHANNELS

#define APM_TIMESTAMP_FLAG
#define FORMAT_LINEAR_PCM
/* APM client callback events */
#define APM_CMD_EOS
#define APM_CLIENT_EVENT_CMD_EOS_DONE
#define APM_CMD_CLOSE
#define APM_CLIENT_EVENT_CMD_CLOSE_DONE
#define APM_CLIENT_EVENT_CMD_RUN_DONE
#define APM_CLIENT_EVENT_DATA_WRITE_DONE
#define APM_CLIENT_EVENT_DATA_READ_DONE
#define APM_WRITE_TOKEN_MASK
#define APM_WRITE_TOKEN_LEN_MASK
#define APM_WRITE_TOKEN_LEN_SHIFT

#define APM_MAX_SESSIONS
#define APM_LAST_BUFFER_FLAG
#define NO_TIMESTAMP

struct q6apm {};

struct audio_buffer {};

struct audioreach_graph_data {};

struct audioreach_graph {};

q6apm_cb;
struct q6apm_graph {};

/* Graph Operations */
struct q6apm_graph *q6apm_graph_open(struct device *dev, q6apm_cb cb,
				     void *priv, int graph_id);
int q6apm_graph_close(struct q6apm_graph *graph);
int q6apm_graph_prepare(struct q6apm_graph *graph);
int q6apm_graph_start(struct q6apm_graph *graph);
int q6apm_graph_stop(struct q6apm_graph *graph);
int q6apm_graph_flush(struct q6apm_graph *graph);

/* Media Format */
int q6apm_graph_media_format_pcm(struct q6apm_graph *graph,
				 struct audioreach_module_config *cfg);

int q6apm_graph_media_format_shmem(struct q6apm_graph *graph,
				   struct audioreach_module_config *cfg);

/* read/write related */
int q6apm_read(struct q6apm_graph *graph);
int q6apm_write_async(struct q6apm_graph *graph, uint32_t len, uint32_t msw_ts,
		      uint32_t lsw_ts, uint32_t wflags);

/* Memory Map related */
int q6apm_map_memory_regions(struct q6apm_graph *graph,
			     unsigned int dir, phys_addr_t phys,
			     size_t period_sz, unsigned int periods);
int q6apm_unmap_memory_regions(struct q6apm_graph *graph,
			       unsigned int dir);
/* Helpers */
int q6apm_send_cmd_sync(struct q6apm *apm, struct gpr_pkt *pkt,
			uint32_t rsp_opcode);

/* Callback for graph specific */
struct audioreach_module *q6apm_find_module_by_mid(struct q6apm_graph *graph,
						    uint32_t mid);
int q6apm_graph_get_rx_shmem_module_iid(struct q6apm_graph *graph);

bool q6apm_is_adsp_ready(void);

int q6apm_enable_compress_module(struct device *dev, struct q6apm_graph *graph, bool en);
int q6apm_remove_initial_silence(struct device *dev, struct q6apm_graph *graph, uint32_t samples);
int q6apm_remove_trailing_silence(struct device *dev, struct q6apm_graph *graph, uint32_t samples);
int q6apm_set_real_module_id(struct device *dev, struct q6apm_graph *graph, uint32_t codec_id);
#endif /* __APM_GRAPH_ */