q6asm.h 2.5 KB

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