wm8994.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /*
  2. * wm8994.h -- WM8994 Soc Audio driver
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. */
  8. #ifndef _WM8994_H
  9. #define _WM8994_H
  10. #include <sound/soc.h>
  11. #include <linux/firmware.h>
  12. #include <linux/completion.h>
  13. #include <linux/workqueue.h>
  14. #include "wm_hubs.h"
  15. /* Sources for AIF1/2 SYSCLK - use with set_dai_sysclk() */
  16. #define WM8994_SYSCLK_MCLK1 1
  17. #define WM8994_SYSCLK_MCLK2 2
  18. #define WM8994_SYSCLK_FLL1 3
  19. #define WM8994_SYSCLK_FLL2 4
  20. /* OPCLK is also configured with set_dai_sysclk, specify division*10 as rate. */
  21. #define WM8994_SYSCLK_OPCLK 5
  22. #define WM8994_FLL1 1
  23. #define WM8994_FLL2 2
  24. #define WM8994_FLL_SRC_MCLK1 1
  25. #define WM8994_FLL_SRC_MCLK2 2
  26. #define WM8994_FLL_SRC_LRCLK 3
  27. #define WM8994_FLL_SRC_BCLK 4
  28. #define WM8994_FLL_SRC_INTERNAL 5
  29. enum wm8994_vmid_mode {
  30. WM8994_VMID_NORMAL,
  31. WM8994_VMID_FORCE,
  32. };
  33. typedef void (*wm1811_micdet_cb)(void *data);
  34. typedef void (*wm1811_mic_id_cb)(void *data, u16 status);
  35. int wm8994_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
  36. int micbias);
  37. int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
  38. wm1811_micdet_cb cb, void *det_cb_data,
  39. wm1811_mic_id_cb id_cb, void *id_cb_data);
  40. int wm8994_vmid_mode(struct snd_soc_codec *codec, enum wm8994_vmid_mode mode);
  41. int wm8958_aif_ev(struct snd_soc_dapm_widget *w,
  42. struct snd_kcontrol *kcontrol, int event);
  43. void wm8958_dsp2_init(struct snd_soc_codec *codec);
  44. struct wm8994_micdet {
  45. struct snd_soc_jack *jack;
  46. bool detecting;
  47. };
  48. /* codec private data */
  49. struct wm8994_fll_config {
  50. int src;
  51. int in;
  52. int out;
  53. };
  54. #define WM8994_NUM_DRC 3
  55. #define WM8994_NUM_EQ 3
  56. struct wm8994;
  57. struct wm8994_priv {
  58. struct wm_hubs_data hubs;
  59. struct wm8994 *wm8994;
  60. int sysclk[2];
  61. int sysclk_rate[2];
  62. int mclk[2];
  63. int aifclk[2];
  64. int channels[2];
  65. struct wm8994_fll_config fll[2], fll_suspend[2];
  66. struct completion fll_locked[2];
  67. bool fll_locked_irq;
  68. bool fll_byp;
  69. bool clk_has_run;
  70. int vmid_refcount;
  71. int active_refcount;
  72. enum wm8994_vmid_mode vmid_mode;
  73. int dac_rates[2];
  74. int lrclk_shared[2];
  75. int mbc_ena[3];
  76. int hpf1_ena[3];
  77. int hpf2_ena[3];
  78. int vss_ena[3];
  79. int enh_eq_ena[3];
  80. /* Platform dependant DRC configuration */
  81. const char **drc_texts;
  82. int drc_cfg[WM8994_NUM_DRC];
  83. struct soc_enum drc_enum;
  84. /* Platform dependant ReTune mobile configuration */
  85. int num_retune_mobile_texts;
  86. const char **retune_mobile_texts;
  87. int retune_mobile_cfg[WM8994_NUM_EQ];
  88. struct soc_enum retune_mobile_enum;
  89. /* Platform dependant MBC configuration */
  90. int mbc_cfg;
  91. const char **mbc_texts;
  92. struct soc_enum mbc_enum;
  93. /* Platform dependant VSS configuration */
  94. int vss_cfg;
  95. const char **vss_texts;
  96. struct soc_enum vss_enum;
  97. /* Platform dependant VSS HPF configuration */
  98. int vss_hpf_cfg;
  99. const char **vss_hpf_texts;
  100. struct soc_enum vss_hpf_enum;
  101. /* Platform dependant enhanced EQ configuration */
  102. int enh_eq_cfg;
  103. const char **enh_eq_texts;
  104. struct soc_enum enh_eq_enum;
  105. struct mutex accdet_lock;
  106. struct wm8994_micdet micdet[2];
  107. struct delayed_work mic_work;
  108. bool mic_detecting;
  109. bool jack_mic;
  110. int btn_mask;
  111. bool jackdet;
  112. int jackdet_mode;
  113. struct delayed_work jackdet_bootstrap;
  114. int micdet_irq;
  115. wm1811_micdet_cb micd_cb;
  116. void *micd_cb_data;
  117. wm1811_mic_id_cb mic_id_cb;
  118. void *mic_id_cb_data;
  119. int revision;
  120. unsigned int aif1clk_enable:1;
  121. unsigned int aif2clk_enable:1;
  122. unsigned int aif1clk_disable:1;
  123. unsigned int aif2clk_disable:1;
  124. int dsp_active;
  125. const struct firmware *cur_fw;
  126. const struct firmware *mbc;
  127. const struct firmware *mbc_vss;
  128. const struct firmware *enh_eq;
  129. };
  130. #endif