wm8994.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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 "wm_hubs.h"
  13. /* Sources for AIF1/2 SYSCLK - use with set_dai_sysclk() */
  14. #define WM8994_SYSCLK_MCLK1 1
  15. #define WM8994_SYSCLK_MCLK2 2
  16. #define WM8994_SYSCLK_FLL1 3
  17. #define WM8994_SYSCLK_FLL2 4
  18. /* OPCLK is also configured with set_dai_sysclk, specify division*10 as rate. */
  19. #define WM8994_SYSCLK_OPCLK 5
  20. #define WM8994_FLL1 1
  21. #define WM8994_FLL2 2
  22. #define WM8994_FLL_SRC_MCLK1 1
  23. #define WM8994_FLL_SRC_MCLK2 2
  24. #define WM8994_FLL_SRC_LRCLK 3
  25. #define WM8994_FLL_SRC_BCLK 4
  26. typedef void (*wm8958_micdet_cb)(u16 status, void *data);
  27. int wm8994_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
  28. int micbias, int det, int shrt);
  29. int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
  30. wm8958_micdet_cb cb, void *cb_data);
  31. #define WM8994_CACHE_SIZE 1570
  32. struct wm8994_access_mask {
  33. unsigned short readable; /* Mask of readable bits */
  34. unsigned short writable; /* Mask of writable bits */
  35. };
  36. extern const struct wm8994_access_mask wm8994_access_masks[WM8994_CACHE_SIZE];
  37. extern const u16 wm8994_reg_defaults[WM8994_CACHE_SIZE];
  38. int wm8958_aif_ev(struct snd_soc_dapm_widget *w,
  39. struct snd_kcontrol *kcontrol, int event);
  40. void wm8958_dsp2_init(struct snd_soc_codec *codec);
  41. struct wm8994_micdet {
  42. struct snd_soc_jack *jack;
  43. int det;
  44. int shrt;
  45. };
  46. /* codec private data */
  47. struct wm8994_fll_config {
  48. int src;
  49. int in;
  50. int out;
  51. };
  52. #define WM8994_NUM_DRC 3
  53. #define WM8994_NUM_EQ 3
  54. struct wm8994_priv {
  55. struct wm_hubs_data hubs;
  56. enum snd_soc_control_type control_type;
  57. void *control_data;
  58. struct snd_soc_codec *codec;
  59. int sysclk[2];
  60. int sysclk_rate[2];
  61. int mclk[2];
  62. int aifclk[2];
  63. struct wm8994_fll_config fll[2], fll_suspend[2];
  64. int dac_rates[2];
  65. int lrclk_shared[2];
  66. int mbc_ena[3];
  67. /* Platform dependant DRC configuration */
  68. const char **drc_texts;
  69. int drc_cfg[WM8994_NUM_DRC];
  70. struct soc_enum drc_enum;
  71. /* Platform dependant ReTune mobile configuration */
  72. int num_retune_mobile_texts;
  73. const char **retune_mobile_texts;
  74. int retune_mobile_cfg[WM8994_NUM_EQ];
  75. struct soc_enum retune_mobile_enum;
  76. /* Platform dependant MBC configuration */
  77. int mbc_cfg;
  78. const char **mbc_texts;
  79. struct soc_enum mbc_enum;
  80. struct wm8994_micdet micdet[2];
  81. wm8958_micdet_cb jack_cb;
  82. void *jack_cb_data;
  83. int micdet_irq;
  84. int revision;
  85. struct wm8994_pdata *pdata;
  86. unsigned int aif1clk_enable:1;
  87. unsigned int aif2clk_enable:1;
  88. unsigned int aif1clk_disable:1;
  89. unsigned int aif2clk_disable:1;
  90. int dsp_active;
  91. const struct firmware *cur_fw;
  92. const struct firmware *mbc;
  93. };
  94. #endif