xref: /openbmc/linux/sound/soc/qcom/qdsp6/q6asm.h (revision 93f5715e)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __Q6_ASM_H__
3 #define __Q6_ASM_H__
4 #include "q6dsp-common.h"
5 #include <dt-bindings/sound/qcom,q6asm.h>
6 
7 /* ASM client callback events */
8 #define CMD_PAUSE			0x0001
9 #define ASM_CLIENT_EVENT_CMD_PAUSE_DONE		0x1001
10 #define CMD_FLUSH				0x0002
11 #define ASM_CLIENT_EVENT_CMD_FLUSH_DONE		0x1002
12 #define CMD_EOS				0x0003
13 #define ASM_CLIENT_EVENT_CMD_EOS_DONE		0x1003
14 #define CMD_CLOSE				0x0004
15 #define ASM_CLIENT_EVENT_CMD_CLOSE_DONE		0x1004
16 #define CMD_OUT_FLUSH				0x0005
17 #define ASM_CLIENT_EVENT_CMD_OUT_FLUSH_DONE	0x1005
18 #define CMD_SUSPEND				0x0006
19 #define ASM_CLIENT_EVENT_CMD_SUSPEND_DONE	0x1006
20 #define ASM_CLIENT_EVENT_CMD_RUN_DONE		0x1008
21 #define ASM_CLIENT_EVENT_DATA_WRITE_DONE	0x1009
22 #define ASM_CLIENT_EVENT_DATA_READ_DONE		0x100a
23 
24 enum {
25 	LEGACY_PCM_MODE = 0,
26 	LOW_LATENCY_PCM_MODE,
27 	ULTRA_LOW_LATENCY_PCM_MODE,
28 	ULL_POST_PROCESSING_PCM_MODE,
29 };
30 
31 #define MAX_SESSIONS	8
32 #define NO_TIMESTAMP    0xFF00
33 #define FORMAT_LINEAR_PCM   0x0000
34 
35 typedef void (*q6asm_cb) (uint32_t opcode, uint32_t token,
36 			  void *payload, void *priv);
37 struct audio_client;
38 struct audio_client *q6asm_audio_client_alloc(struct device *dev,
39 					      q6asm_cb cb, void *priv,
40 					      int session_id, int perf_mode);
41 void q6asm_audio_client_free(struct audio_client *ac);
42 int q6asm_write_async(struct audio_client *ac, uint32_t len, uint32_t msw_ts,
43 		       uint32_t lsw_ts, uint32_t flags);
44 int q6asm_open_write(struct audio_client *ac, uint32_t format,
45 		     uint16_t bits_per_sample);
46 
47 int q6asm_open_read(struct audio_client *ac, uint32_t format,
48 		     uint16_t bits_per_sample);
49 int q6asm_enc_cfg_blk_pcm_format_support(struct audio_client *ac,
50 		uint32_t rate, uint32_t channels, uint16_t bits_per_sample);
51 int q6asm_read(struct audio_client *ac);
52 
53 int q6asm_media_format_block_multi_ch_pcm(struct audio_client *ac,
54 					  uint32_t rate, uint32_t channels,
55 					  u8 channel_map[PCM_MAX_NUM_CHANNEL],
56 					  uint16_t bits_per_sample);
57 int q6asm_run(struct audio_client *ac, uint32_t flags, uint32_t msw_ts,
58 	      uint32_t lsw_ts);
59 int q6asm_run_nowait(struct audio_client *ac, uint32_t flags, uint32_t msw_ts,
60 		     uint32_t lsw_ts);
61 int q6asm_cmd(struct audio_client *ac, int cmd);
62 int q6asm_cmd_nowait(struct audio_client *ac, int cmd);
63 int q6asm_get_session_id(struct audio_client *ac);
64 int q6asm_map_memory_regions(unsigned int dir,
65 			     struct audio_client *ac,
66 			     phys_addr_t phys,
67 			     size_t bufsz, unsigned int bufcnt);
68 int q6asm_unmap_memory_regions(unsigned int dir, struct audio_client *ac);
69 #endif /* __Q6_ASM_H__ */
70