sdm660-common.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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_INTERFACE_MAX,
  49. };
  50. struct tdm_port {
  51. u32 mode;
  52. u32 channel;
  53. };
  54. enum {
  55. DIG_CDC,
  56. ANA_CDC,
  57. CODECS_MAX,
  58. };
  59. extern const struct snd_kcontrol_new msm_common_snd_controls[];
  60. extern bool codec_reg_done;
  61. struct sdm660_codec {
  62. void* (*get_afe_config_fn)(struct snd_soc_codec *codec,
  63. enum afe_config_type config_type);
  64. };
  65. enum {
  66. INT_SND_CARD,
  67. EXT_SND_CARD_TASHA,
  68. EXT_SND_CARD_TAVIL,
  69. };
  70. struct msm_snd_interrupt {
  71. void __iomem *mpm_wakeup;
  72. void __iomem *intr1_cfg_apps;
  73. void __iomem *lpi_gpio_intr_cfg;
  74. void __iomem *lpi_gpio_cfg;
  75. void __iomem *lpi_gpio_inout;
  76. };
  77. struct msm_asoc_mach_data {
  78. int us_euro_gpio; /* used by gpio driver API */
  79. int hph_en1_gpio;
  80. int hph_en0_gpio;
  81. struct device_node *us_euro_gpio_p; /* used by pinctrl API */
  82. struct device_node *hph_en1_gpio_p; /* used by pinctrl API */
  83. struct device_node *hph_en0_gpio_p; /* used by pinctrl API */
  84. struct device_node *pdm_gpio_p; /* used by pinctrl API */
  85. struct device_node *comp_gpio_p; /* used by pinctrl API */
  86. struct device_node *dmic_gpio_p; /* used by pinctrl API */
  87. struct device_node *ext_spk_gpio_p; /* used by pinctrl API */
  88. struct snd_soc_codec *codec;
  89. struct sdm660_codec sdm660_codec_fn;
  90. struct snd_info_entry *codec_root;
  91. int spk_ext_pa_gpio;
  92. int mclk_freq;
  93. bool native_clk_set;
  94. int lb_mode;
  95. int snd_card_val;
  96. u8 micbias1_cap_mode;
  97. u8 micbias2_cap_mode;
  98. atomic_t int_mclk0_rsc_ref;
  99. atomic_t int_mclk0_enabled;
  100. struct mutex cdc_int_mclk0_mutex;
  101. struct delayed_work disable_int_mclk0_work;
  102. struct afe_clk_set digital_cdc_core_clk;
  103. struct msm_snd_interrupt msm_snd_intr_lpi;
  104. };
  105. int msm_common_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
  106. struct snd_pcm_hw_params *params);
  107. int msm_aux_pcm_snd_startup(struct snd_pcm_substream *substream);
  108. void msm_aux_pcm_snd_shutdown(struct snd_pcm_substream *substream);
  109. int msm_mi2s_snd_startup(struct snd_pcm_substream *substream);
  110. void msm_mi2s_snd_shutdown(struct snd_pcm_substream *substream);
  111. int msm_common_snd_controls_size(void);
  112. void msm_set_codec_reg_done(bool done);
  113. #endif