msm8x60-pcm.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * Copyright (C) 2008 Google, Inc.
  3. * Copyright (C) 2008 HTC Corporation
  4. * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
  5. *
  6. * This software is licensed under the terms of the GNU General Public
  7. * License version 2, as published by the Free Software Foundation, and
  8. * may be copied, distributed, and modified under those terms.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. *
  14. * See the GNU General Public License for more details.
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, you can find it at http://www.fsf.org.
  17. */
  18. #ifndef _MSM_PCM_H
  19. #define _MSM_PCM_H
  20. #include <sound/apr_audio.h>
  21. #include <sound/q6asm.h>
  22. #define MAX_PLAYBACK_SESSIONS 2
  23. #define MAX_CAPTURE_SESSIONS 1
  24. #define MAX_COPP 12
  25. extern int copy_count;
  26. struct buffer {
  27. void *data;
  28. unsigned size;
  29. unsigned used;
  30. unsigned addr;
  31. };
  32. struct buffer_rec {
  33. void *data;
  34. unsigned int size;
  35. unsigned int read;
  36. unsigned int addr;
  37. };
  38. struct audio_locks {
  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. };
  44. extern struct audio_locks the_locks;
  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. int copp_id;
  54. uint32_t samp_rate;
  55. uint32_t channel_mode;
  56. uint32_t dsp_cnt;
  57. uint32_t device_events; /* device events interested in */
  58. int abort; /* set when error, like sample rate mismatch */
  59. int enabled;
  60. int close_ack;
  61. int cmd_ack;
  62. atomic_t start;
  63. atomic_t out_count;
  64. atomic_t in_count;
  65. atomic_t out_needed;
  66. int periods;
  67. int mmap_flag;
  68. };
  69. struct pcm_session {
  70. unsigned short playback_session[MAX_PLAYBACK_SESSIONS][MAX_COPP];
  71. unsigned short capture_session[MAX_CAPTURE_SESSIONS][MAX_COPP];
  72. };
  73. /* platform data */
  74. extern struct snd_soc_platform_driver msm_soc_platform;
  75. extern struct pcm_session session_route;
  76. #endif /*_MSM_PCM_H*/