msm-pcm-q6-v2.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /* Copyright (C) 2008 Google, Inc.
  2. * Copyright (C) 2008 HTC Corporation
  3. * Copyright (c) 2012-2014, 2019 The Linux Foundation. All rights reserved.
  4. *
  5. * This software is licensed under the terms of the GNU General Public
  6. * License version 2, as published by the Free Software Foundation, and
  7. * may be copied, distributed, and modified under those terms.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. *
  13. * See the GNU General Public License for more details.
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, you can find it at http://www.fsf.org.
  16. */
  17. #ifndef _MSM_PCM_H
  18. #define _MSM_PCM_H
  19. #include <sound/apr_audio-v2.h>
  20. #include <sound/q6asm-v2.h>
  21. /* Support unconventional sample rates 12000, 24000 as well */
  22. #define USE_RATE \
  23. (SNDRV_PCM_RATE_8000_48000 | SNDRV_PCM_RATE_KNOT)
  24. extern int copy_count;
  25. struct buffer {
  26. void *data;
  27. unsigned size;
  28. unsigned used;
  29. unsigned addr;
  30. };
  31. struct buffer_rec {
  32. void *data;
  33. unsigned int size;
  34. unsigned int read;
  35. unsigned int addr;
  36. };
  37. struct audio_locks {
  38. spinlock_t event_lock;
  39. wait_queue_head_t read_wait;
  40. wait_queue_head_t write_wait;
  41. wait_queue_head_t eos_wait;
  42. wait_queue_head_t enable_wait;
  43. wait_queue_head_t flush_wait;
  44. };
  45. struct msm_audio {
  46. struct snd_pcm_substream *substream;
  47. unsigned int pcm_size;
  48. unsigned int pcm_count;
  49. unsigned int pcm_irq_pos; /* IRQ position */
  50. uint16_t source; /* Encoding source bit mask */
  51. struct audio_client *audio_client;
  52. uint16_t session_id;
  53. uint32_t samp_rate;
  54. uint32_t channel_mode;
  55. uint32_t dsp_cnt;
  56. int abort; /* set when error, like sample rate mismatch */
  57. bool reset_event;
  58. int enabled;
  59. int close_ack;
  60. int cmd_ack;
  61. /*
  62. * cmd_ack doesn't tell if paticular command has been sent so can't
  63. * determine if it needs to wait for completion.
  64. * Use cmd_pending instead when checking whether a command is been
  65. * sent or not.
  66. */
  67. unsigned long cmd_pending;
  68. atomic_t start;
  69. atomic_t stop;
  70. atomic_t out_count;
  71. atomic_t in_count;
  72. atomic_t out_needed;
  73. atomic_t eos;
  74. int out_head;
  75. int periods;
  76. int mmap_flag;
  77. atomic_t pending_buffer;
  78. bool set_channel_map;
  79. char channel_map[8];
  80. int cmd_interrupt;
  81. bool meta_data_mode;
  82. uint32_t volume;
  83. };
  84. struct output_meta_data_st {
  85. uint32_t meta_data_length;
  86. uint32_t frame_size;
  87. uint32_t timestamp_lsw;
  88. uint32_t timestamp_msw;
  89. uint32_t reserved[12];
  90. };
  91. struct msm_plat_data {
  92. int perf_mode;
  93. struct mutex lock;
  94. };
  95. #endif /*_MSM_PCM_H*/