Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) #ifndef __Q6_ASM_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) #define __Q6_ASM_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) #include "q6dsp-common.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) #include <dt-bindings/sound/qcom,q6asm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) /* ASM client callback events */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #define CMD_PAUSE			0x0001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #define ASM_CLIENT_EVENT_CMD_PAUSE_DONE		0x1001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #define CMD_FLUSH				0x0002
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #define ASM_CLIENT_EVENT_CMD_FLUSH_DONE		0x1002
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #define CMD_EOS				0x0003
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #define ASM_CLIENT_EVENT_CMD_EOS_DONE		0x1003
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #define CMD_CLOSE				0x0004
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #define ASM_CLIENT_EVENT_CMD_CLOSE_DONE		0x1004
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #define CMD_OUT_FLUSH				0x0005
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #define ASM_CLIENT_EVENT_CMD_OUT_FLUSH_DONE	0x1005
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #define CMD_SUSPEND				0x0006
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #define ASM_CLIENT_EVENT_CMD_SUSPEND_DONE	0x1006
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #define ASM_CLIENT_EVENT_CMD_RUN_DONE		0x1008
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #define ASM_CLIENT_EVENT_DATA_WRITE_DONE	0x1009
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #define ASM_CLIENT_EVENT_DATA_READ_DONE		0x100a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #define ASM_WRITE_TOKEN_MASK			GENMASK(15, 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #define ASM_WRITE_TOKEN_LEN_MASK		GENMASK(31, 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #define ASM_WRITE_TOKEN_LEN_SHIFT		16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 	LEGACY_PCM_MODE = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 	LOW_LATENCY_PCM_MODE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 	ULTRA_LOW_LATENCY_PCM_MODE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 	ULL_POST_PROCESSING_PCM_MODE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) #define MAX_SESSIONS	8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) #define FORMAT_LINEAR_PCM   0x0000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) #define ASM_LAST_BUFFER_FLAG           BIT(30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) struct q6asm_flac_cfg {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39)         u32 sample_rate;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40)         u32 ext_sample_rate;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41)         u32 min_frame_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42)         u32 max_frame_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43)         u16 stream_info_present;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44)         u16 min_blk_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45)         u16 max_blk_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46)         u16 ch_cfg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47)         u16 sample_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48)         u16 md5_sum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) struct q6asm_wma_cfg {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	u32 fmtag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	u32 num_channels;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	u32 sample_rate;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	u32 bytes_per_sec;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	u32 block_align;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	u32 bits_per_sample;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	u32 channel_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	u32 enc_options;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	u32 adv_enc_options;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	u32 adv_enc_options2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) struct q6asm_alac_cfg {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	u32 frame_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	u8 compatible_version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	u8 bit_depth;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	u8 pb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	u8 mb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	u8 kb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	u8 num_channels;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	u16 max_run;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	u32 max_frame_bytes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	u32 avg_bit_rate;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	u32 sample_rate;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	u32 channel_layout_tag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) struct q6asm_ape_cfg {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	u16 compatible_version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	u16 compression_level;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	u32 format_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	u32 blocks_per_frame;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	u32 final_frame_blocks;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	u32 total_frames;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	u16 bits_per_sample;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	u16 num_channels;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	u32 sample_rate;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	u32 seek_table_present;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) typedef void (*q6asm_cb) (uint32_t opcode, uint32_t token,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 			  void *payload, void *priv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) struct audio_client;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) struct audio_client *q6asm_audio_client_alloc(struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 					      q6asm_cb cb, void *priv,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 					      int session_id, int perf_mode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) void q6asm_audio_client_free(struct audio_client *ac);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) int q6asm_write_async(struct audio_client *ac, uint32_t stream_id, uint32_t len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 		      uint32_t msw_ts, uint32_t lsw_ts, uint32_t flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) int q6asm_open_write(struct audio_client *ac, uint32_t stream_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 		     uint32_t format, u32 codec_profile,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 		     uint16_t bits_per_sample, bool is_gapless);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) int q6asm_open_read(struct audio_client *ac, uint32_t stream_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 		    uint32_t format, uint16_t bits_per_sample);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) int q6asm_enc_cfg_blk_pcm_format_support(struct audio_client *ac,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 					 uint32_t stream_id, uint32_t rate,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 					 uint32_t channels,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 					 uint16_t bits_per_sample);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) int q6asm_read(struct audio_client *ac, uint32_t stream_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) int q6asm_media_format_block_multi_ch_pcm(struct audio_client *ac,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 					  uint32_t stream_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 					  uint32_t rate, uint32_t channels,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 					  u8 channel_map[PCM_MAX_NUM_CHANNEL],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 					  uint16_t bits_per_sample);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) int q6asm_stream_media_format_block_flac(struct audio_client *ac,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 					 uint32_t stream_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 					 struct q6asm_flac_cfg *cfg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) int q6asm_stream_media_format_block_wma_v9(struct audio_client *ac,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 					   uint32_t stream_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 					   struct q6asm_wma_cfg *cfg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) int q6asm_stream_media_format_block_wma_v10(struct audio_client *ac,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 					    uint32_t stream_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 					    struct q6asm_wma_cfg *cfg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) int q6asm_stream_media_format_block_alac(struct audio_client *ac,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 					 uint32_t stream_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 					 struct q6asm_alac_cfg *cfg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) int q6asm_stream_media_format_block_ape(struct audio_client *ac,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 					uint32_t stream_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 					struct q6asm_ape_cfg *cfg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) int q6asm_run(struct audio_client *ac, uint32_t stream_id, uint32_t flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	      uint32_t msw_ts, uint32_t lsw_ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) int q6asm_run_nowait(struct audio_client *ac, uint32_t stream_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 		     uint32_t flags, uint32_t msw_ts, uint32_t lsw_ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) int q6asm_stream_remove_initial_silence(struct audio_client *ac,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 					uint32_t stream_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 					uint32_t initial_samples);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) int q6asm_stream_remove_trailing_silence(struct audio_client *ac,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 					 uint32_t stream_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 					 uint32_t trailing_samples);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) int q6asm_cmd(struct audio_client *ac, uint32_t stream_id,  int cmd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) int q6asm_cmd_nowait(struct audio_client *ac, uint32_t stream_id,  int cmd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) int q6asm_get_session_id(struct audio_client *ac);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) int q6asm_map_memory_regions(unsigned int dir,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 			     struct audio_client *ac,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 			     phys_addr_t phys,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 			     size_t bufsz, unsigned int bufcnt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) int q6asm_unmap_memory_regions(unsigned int dir, struct audio_client *ac);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) #endif /* __Q6_ASM_H__ */