wm8994.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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 "wm_hubs.h"
  14. /* Sources for AIF1/2 SYSCLK - use with set_dai_sysclk() */
  15. #define WM8994_SYSCLK_MCLK1 1
  16. #define WM8994_SYSCLK_MCLK2 2
  17. #define WM8994_SYSCLK_FLL1 3
  18. #define WM8994_SYSCLK_FLL2 4
  19. /* OPCLK is also configured with set_dai_sysclk, specify division*10 as rate. */
  20. #define WM8994_SYSCLK_OPCLK 5
  21. #define WM8994_FLL1 1
  22. #define WM8994_FLL2 2
  23. #define WM8994_FLL_SRC_MCLK1 1
  24. #define WM8994_FLL_SRC_MCLK2 2
  25. #define WM8994_FLL_SRC_LRCLK 3
  26. #define WM8994_FLL_SRC_BCLK 4
  27. typedef void (*wm8958_micdet_cb)(u16 status, void *data);
  28. int wm8994_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
  29. int micbias, int det, int shrt);
  30. int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
  31. wm8958_micdet_cb cb, void *cb_data);
  32. int wm8958_aif_ev(struct snd_soc_dapm_widget *w,
  33. struct snd_kcontrol *kcontrol, int event);
  34. void wm8958_dsp2_init(struct snd_soc_codec *codec);
  35. struct wm8994_micdet {
  36. struct snd_soc_jack *jack;
  37. int det;
  38. int shrt;
  39. };
  40. /* codec private data */
  41. struct wm8994_fll_config {
  42. int src;
  43. int in;
  44. int out;
  45. };
  46. #define WM8994_NUM_DRC 3
  47. #define WM8994_NUM_EQ 3
  48. struct wm8994;
  49. struct wm8994_priv {
  50. struct wm_hubs_data hubs;
  51. struct wm8994 *wm8994;
  52. struct snd_soc_codec *codec;
  53. int sysclk[2];
  54. int sysclk_rate[2];
  55. int mclk[2];
  56. int aifclk[2];
  57. struct wm8994_fll_config fll[2], fll_suspend[2];
  58. struct completion fll_locked[2];
  59. bool fll_locked_irq;
  60. int vmid_refcount;
  61. int active_refcount;
  62. int dac_rates[2];
  63. int lrclk_shared[2];
  64. int mbc_ena[3];
  65. int hpf1_ena[3];
  66. int hpf2_ena[3];
  67. int vss_ena[3];
  68. int enh_eq_ena[3];
  69. /* Platform dependant DRC configuration */
  70. const char **drc_texts;
  71. int drc_cfg[WM8994_NUM_DRC];
  72. struct soc_enum drc_enum;
  73. /* Platform dependant ReTune mobile configuration */
  74. int num_retune_mobile_texts;
  75. const char **retune_mobile_texts;
  76. int retune_mobile_cfg[WM8994_NUM_EQ];
  77. struct soc_enum retune_mobile_enum;
  78. /* Platform dependant MBC configuration */
  79. int mbc_cfg;
  80. const char **mbc_texts;
  81. struct soc_enum mbc_enum;
  82. /* Platform dependant VSS configuration */
  83. int vss_cfg;
  84. const char **vss_texts;
  85. struct soc_enum vss_enum;
  86. /* Platform dependant VSS HPF configuration */
  87. int vss_hpf_cfg;
  88. const char **vss_hpf_texts;
  89. struct soc_enum vss_hpf_enum;
  90. /* Platform dependant enhanced EQ configuration */
  91. int enh_eq_cfg;
  92. const char **enh_eq_texts;
  93. struct soc_enum enh_eq_enum;
  94. struct mutex accdet_lock;
  95. struct wm8994_micdet micdet[2];
  96. bool mic_detecting;
  97. bool jack_mic;
  98. int btn_mask;
  99. bool jackdet;
  100. wm8958_micdet_cb jack_cb;
  101. void *jack_cb_data;
  102. int micdet_irq;
  103. int revision;
  104. struct wm8994_pdata *pdata;
  105. unsigned int aif1clk_enable:1;
  106. unsigned int aif2clk_enable:1;
  107. unsigned int aif1clk_disable:1;
  108. unsigned int aif2clk_disable:1;
  109. int dsp_active;
  110. const struct firmware *cur_fw;
  111. const struct firmware *mbc;
  112. const struct firmware *mbc_vss;
  113. const struct firmware *enh_eq;
  114. };
  115. #endif