/arch/arm/mach-msm/include/mach/msm_qdsp6_audio.h

https://github.com/marc1706/cm-on-wince-htc · C Header · 110 lines · 71 code · 20 blank · 19 comment · 0 complexity · 6c1c8e219bcb602d7d03842c2ff85a69 MD5 · raw file

  1. /* arch/arm/mach-msm/include/mach/msm_qdsp6_audio.h
  2. *
  3. * Copyright (C) 2009 Google, Inc.
  4. * Author: Brian Swetland <swetland@google.com>
  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. See the
  13. * GNU General Public License for more details.
  14. *
  15. */
  16. #ifndef _MACH_MSM_QDSP6_Q6AUDIO_
  17. #define _MACH_MSM_QDSP6_Q6AUDIO_
  18. #define AUDIO_FLAG_READ 0
  19. #define AUDIO_FLAG_WRITE 1
  20. struct audio_buffer {
  21. dma_addr_t phys;
  22. void *data;
  23. uint32_t size;
  24. uint32_t used; /* 1 = CPU is waiting for DSP to consume this buf */
  25. };
  26. struct audio_client {
  27. struct audio_buffer buf[2];
  28. int cpu_buf; /* next buffer the CPU will touch */
  29. int dsp_buf; /* next buffer the DSP will touch */
  30. int running;
  31. int session;
  32. wait_queue_head_t wait;
  33. struct dal_client *client;
  34. int cb_status;
  35. uint32_t flags;
  36. };
  37. #define Q6_HW_HANDSET 0
  38. #define Q6_HW_HEADSET 1
  39. #define Q6_HW_SPEAKER 2
  40. #define Q6_HW_TTY 3
  41. #define Q6_HW_BT_SCO 4
  42. #define Q6_HW_BT_A2DP 5
  43. #define Q6_HW_COUNT 6
  44. struct q6_hw_info {
  45. int min_gain;
  46. int max_gain;
  47. };
  48. /* Obtain a 16bit signed, interleaved audio channel of the specified
  49. * rate (Hz) and channels (1 or 2), with two buffers of bufsz bytes.
  50. */
  51. struct audio_client *q6audio_open_pcm(uint32_t bufsz, uint32_t rate,
  52. uint32_t channels, uint32_t flags,
  53. uint32_t acdb_id);
  54. struct audio_client *q6voice_open(uint32_t flags, uint32_t acdb_id);
  55. struct audio_client *q6audio_open_mp3(uint32_t bufsz, uint32_t rate,
  56. uint32_t channels, uint32_t acdb_id);
  57. int q6audio_close(struct audio_client *ac);
  58. int q6voice_close(struct audio_client *ac);
  59. int q6audio_mp3_close(struct audio_client *ac);
  60. struct audio_client *q6fm_open(void);
  61. int q6fm_close(struct audio_client *ac);
  62. int q6audio_read(struct audio_client *ac, struct audio_buffer *ab);
  63. int q6audio_write(struct audio_client *ac, struct audio_buffer *ab);
  64. int q6audio_async(struct audio_client *ac);
  65. int q6audio_do_routing(uint32_t route, uint32_t acdb_id);
  66. int q6audio_set_tx_mute(int mute);
  67. int q6audio_reinit_acdb(char* filename);
  68. int q6audio_update_acdb(uint32_t id_src, uint32_t id_dst);
  69. int q6audio_set_rx_volume(int level);
  70. int q6audio_set_stream_volume(struct audio_client *ac, int vol);
  71. struct q6audio_analog_ops {
  72. void (*init)(void);
  73. void (*speaker_enable)(int en);
  74. void (*headset_enable)(int en);
  75. void (*receiver_enable)(int en);
  76. void (*bt_sco_enable)(int en);
  77. void (*int_mic_enable)(int en);
  78. void (*ext_mic_enable)(int en);
  79. int (*get_rx_vol)(uint8_t hw, int level);
  80. };
  81. #ifdef CONFIG_MSM_QDSP6
  82. void q6audio_register_analog_ops(struct q6audio_analog_ops *ops);
  83. void q6audio_set_acdb_file(char* filename);
  84. #else
  85. static inline void q6audio_register_analog_ops(struct q6audio_analog_ops *ops) {}
  86. static inline void q6audio_set_acdb_file(char* filename) {}
  87. #endif
  88. /* signal non-recoverable DSP error so we can log and/or panic */
  89. void q6audio_dsp_not_responding(void);
  90. #endif