sdm660-common.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. */
  12. #ifndef __MSM_COMMON
  13. #define __MSM_COMMON
  14. #include <sound/soc.h>
  15. #include <dsp/q6afe-v2.h>
  16. #include "codecs/wcd-mbhc-v2.h"
  17. #define SAMPLING_RATE_8KHZ 8000
  18. #define SAMPLING_RATE_11P025KHZ 11025
  19. #define SAMPLING_RATE_16KHZ 16000
  20. #define SAMPLING_RATE_22P05KHZ 22050
  21. #define SAMPLING_RATE_32KHZ 32000
  22. #define SAMPLING_RATE_44P1KHZ 44100
  23. #define SAMPLING_RATE_48KHZ 48000
  24. #define SAMPLING_RATE_88P2KHZ 88200
  25. #define SAMPLING_RATE_96KHZ 96000
  26. #define SAMPLING_RATE_176P4KHZ 176400
  27. #define SAMPLING_RATE_192KHZ 192000
  28. #define SAMPLING_RATE_352P8KHZ 352800
  29. #define SAMPLING_RATE_384KHZ 384000
  30. #define TDM_CHANNEL_MAX 8
  31. #define TDM_SLOT_OFFSET_MAX 8
  32. enum {
  33. TDM_0 = 0,
  34. TDM_1,
  35. TDM_2,
  36. TDM_3,
  37. TDM_4,
  38. TDM_5,
  39. TDM_6,
  40. TDM_7,
  41. TDM_PORT_MAX,
  42. };
  43. enum {
  44. TDM_PRI = 0,
  45. TDM_SEC,
  46. TDM_TERT,
  47. TDM_QUAT,
  48. TDM_QUIN,
  49. TDM_INTERFACE_MAX,
  50. };
  51. struct tdm_port {
  52. u32 mode;
  53. u32 channel;
  54. };
  55. enum {
  56. PRIM_MI2S = 0,
  57. SEC_MI2S,
  58. TERT_MI2S,
  59. QUAT_MI2S,
  60. QUIN_MI2S,
  61. MI2S_MAX,
  62. };
  63. enum {
  64. DIG_CDC,
  65. ANA_CDC,
  66. CODECS_MAX,
  67. };
  68. extern const struct snd_kcontrol_new msm_common_snd_controls[];
  69. extern bool codec_reg_done;
  70. struct sdm660_codec {
  71. void* (*get_afe_config_fn)(struct snd_soc_codec *codec,
  72. enum afe_config_type config_type);
  73. };
  74. enum {
  75. INT_SND_CARD,
  76. EXT_SND_CARD_TASHA,
  77. EXT_SND_CARD_TAVIL,
  78. };
  79. struct msm_asoc_mach_data {
  80. int us_euro_gpio; /* used by gpio driver API */
  81. int hph_en1_gpio;
  82. int hph_en0_gpio;
  83. struct device_node *us_euro_gpio_p; /* used by pinctrl API */
  84. struct device_node *hph_en1_gpio_p; /* used by pinctrl API */
  85. struct device_node *hph_en0_gpio_p; /* used by pinctrl API */
  86. struct device_node *pdm_gpio_p; /* used by pinctrl API */
  87. struct device_node *comp_gpio_p; /* used by pinctrl API */
  88. struct device_node *dmic_gpio_p; /* used by pinctrl API */
  89. struct device_node *ext_spk_gpio_p; /* used by pinctrl API */
  90. struct device_node *mi2s_gpio_p[MI2S_MAX]; /* used by pinctrl API */
  91. struct snd_soc_codec *codec;
  92. struct sdm660_codec sdm660_codec_fn;
  93. struct snd_info_entry *codec_root;
  94. int spk_ext_pa_gpio;
  95. int mclk_freq;
  96. bool native_clk_set;
  97. int lb_mode;
  98. int snd_card_val;
  99. u8 micbias1_cap_mode;
  100. u8 micbias2_cap_mode;
  101. atomic_t int_mclk0_rsc_ref;
  102. atomic_t int_mclk0_enabled;
  103. struct mutex cdc_int_mclk0_mutex;
  104. struct delayed_work disable_int_mclk0_work;
  105. struct afe_clk_set digital_cdc_core_clk;
  106. };
  107. int msm_common_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
  108. struct snd_pcm_hw_params *params);
  109. int msm_aux_pcm_snd_startup(struct snd_pcm_substream *substream);
  110. void msm_aux_pcm_snd_shutdown(struct snd_pcm_substream *substream);
  111. int msm_mi2s_snd_startup(struct snd_pcm_substream *substream);
  112. void msm_mi2s_snd_shutdown(struct snd_pcm_substream *substream);
  113. int msm_common_snd_controls_size(void);
  114. void msm_set_codec_reg_done(bool done);
  115. #endif