wm8904.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * Platform data for WM8904
  4. *
  5. * Copyright 2009 Wolfson Microelectronics PLC.
  6. *
  7. * Author: Mark Brown <[email protected]>
  8. */
  9. #ifndef __MFD_WM8994_PDATA_H__
  10. #define __MFD_WM8994_PDATA_H__
  11. /* Used to enable configuration of a GPIO to all zeros */
  12. #define WM8904_GPIO_NO_CONFIG 0x8000
  13. /*
  14. * R6 (0x06) - Mic Bias Control 0
  15. */
  16. #define WM8904_MICDET_THR_MASK 0x0070 /* MICDET_THR - [6:4] */
  17. #define WM8904_MICDET_THR_SHIFT 4 /* MICDET_THR - [6:4] */
  18. #define WM8904_MICDET_THR_WIDTH 3 /* MICDET_THR - [6:4] */
  19. #define WM8904_MICSHORT_THR_MASK 0x000C /* MICSHORT_THR - [3:2] */
  20. #define WM8904_MICSHORT_THR_SHIFT 2 /* MICSHORT_THR - [3:2] */
  21. #define WM8904_MICSHORT_THR_WIDTH 2 /* MICSHORT_THR - [3:2] */
  22. #define WM8904_MICDET_ENA 0x0002 /* MICDET_ENA */
  23. #define WM8904_MICDET_ENA_MASK 0x0002 /* MICDET_ENA */
  24. #define WM8904_MICDET_ENA_SHIFT 1 /* MICDET_ENA */
  25. #define WM8904_MICDET_ENA_WIDTH 1 /* MICDET_ENA */
  26. #define WM8904_MICBIAS_ENA 0x0001 /* MICBIAS_ENA */
  27. #define WM8904_MICBIAS_ENA_MASK 0x0001 /* MICBIAS_ENA */
  28. #define WM8904_MICBIAS_ENA_SHIFT 0 /* MICBIAS_ENA */
  29. #define WM8904_MICBIAS_ENA_WIDTH 1 /* MICBIAS_ENA */
  30. /*
  31. * R7 (0x07) - Mic Bias Control 1
  32. */
  33. #define WM8904_MIC_DET_FILTER_ENA 0x8000 /* MIC_DET_FILTER_ENA */
  34. #define WM8904_MIC_DET_FILTER_ENA_MASK 0x8000 /* MIC_DET_FILTER_ENA */
  35. #define WM8904_MIC_DET_FILTER_ENA_SHIFT 15 /* MIC_DET_FILTER_ENA */
  36. #define WM8904_MIC_DET_FILTER_ENA_WIDTH 1 /* MIC_DET_FILTER_ENA */
  37. #define WM8904_MIC_SHORT_FILTER_ENA 0x4000 /* MIC_SHORT_FILTER_ENA */
  38. #define WM8904_MIC_SHORT_FILTER_ENA_MASK 0x4000 /* MIC_SHORT_FILTER_ENA */
  39. #define WM8904_MIC_SHORT_FILTER_ENA_SHIFT 14 /* MIC_SHORT_FILTER_ENA */
  40. #define WM8904_MIC_SHORT_FILTER_ENA_WIDTH 1 /* MIC_SHORT_FILTER_ENA */
  41. #define WM8904_MICBIAS_SEL_MASK 0x0007 /* MICBIAS_SEL - [2:0] */
  42. #define WM8904_MICBIAS_SEL_SHIFT 0 /* MICBIAS_SEL - [2:0] */
  43. #define WM8904_MICBIAS_SEL_WIDTH 3 /* MICBIAS_SEL - [2:0] */
  44. /*
  45. * R121 (0x79) - GPIO Control 1
  46. */
  47. #define WM8904_GPIO1_PU 0x0020 /* GPIO1_PU */
  48. #define WM8904_GPIO1_PU_MASK 0x0020 /* GPIO1_PU */
  49. #define WM8904_GPIO1_PU_SHIFT 5 /* GPIO1_PU */
  50. #define WM8904_GPIO1_PU_WIDTH 1 /* GPIO1_PU */
  51. #define WM8904_GPIO1_PD 0x0010 /* GPIO1_PD */
  52. #define WM8904_GPIO1_PD_MASK 0x0010 /* GPIO1_PD */
  53. #define WM8904_GPIO1_PD_SHIFT 4 /* GPIO1_PD */
  54. #define WM8904_GPIO1_PD_WIDTH 1 /* GPIO1_PD */
  55. #define WM8904_GPIO1_SEL_MASK 0x000F /* GPIO1_SEL - [3:0] */
  56. #define WM8904_GPIO1_SEL_SHIFT 0 /* GPIO1_SEL - [3:0] */
  57. #define WM8904_GPIO1_SEL_WIDTH 4 /* GPIO1_SEL - [3:0] */
  58. /*
  59. * R122 (0x7A) - GPIO Control 2
  60. */
  61. #define WM8904_GPIO2_PU 0x0020 /* GPIO2_PU */
  62. #define WM8904_GPIO2_PU_MASK 0x0020 /* GPIO2_PU */
  63. #define WM8904_GPIO2_PU_SHIFT 5 /* GPIO2_PU */
  64. #define WM8904_GPIO2_PU_WIDTH 1 /* GPIO2_PU */
  65. #define WM8904_GPIO2_PD 0x0010 /* GPIO2_PD */
  66. #define WM8904_GPIO2_PD_MASK 0x0010 /* GPIO2_PD */
  67. #define WM8904_GPIO2_PD_SHIFT 4 /* GPIO2_PD */
  68. #define WM8904_GPIO2_PD_WIDTH 1 /* GPIO2_PD */
  69. #define WM8904_GPIO2_SEL_MASK 0x000F /* GPIO2_SEL - [3:0] */
  70. #define WM8904_GPIO2_SEL_SHIFT 0 /* GPIO2_SEL - [3:0] */
  71. #define WM8904_GPIO2_SEL_WIDTH 4 /* GPIO2_SEL - [3:0] */
  72. /*
  73. * R123 (0x7B) - GPIO Control 3
  74. */
  75. #define WM8904_GPIO3_PU 0x0020 /* GPIO3_PU */
  76. #define WM8904_GPIO3_PU_MASK 0x0020 /* GPIO3_PU */
  77. #define WM8904_GPIO3_PU_SHIFT 5 /* GPIO3_PU */
  78. #define WM8904_GPIO3_PU_WIDTH 1 /* GPIO3_PU */
  79. #define WM8904_GPIO3_PD 0x0010 /* GPIO3_PD */
  80. #define WM8904_GPIO3_PD_MASK 0x0010 /* GPIO3_PD */
  81. #define WM8904_GPIO3_PD_SHIFT 4 /* GPIO3_PD */
  82. #define WM8904_GPIO3_PD_WIDTH 1 /* GPIO3_PD */
  83. #define WM8904_GPIO3_SEL_MASK 0x000F /* GPIO3_SEL - [3:0] */
  84. #define WM8904_GPIO3_SEL_SHIFT 0 /* GPIO3_SEL - [3:0] */
  85. #define WM8904_GPIO3_SEL_WIDTH 4 /* GPIO3_SEL - [3:0] */
  86. /*
  87. * R124 (0x7C) - GPIO Control 4
  88. */
  89. #define WM8904_GPI7_ENA 0x0200 /* GPI7_ENA */
  90. #define WM8904_GPI7_ENA_MASK 0x0200 /* GPI7_ENA */
  91. #define WM8904_GPI7_ENA_SHIFT 9 /* GPI7_ENA */
  92. #define WM8904_GPI7_ENA_WIDTH 1 /* GPI7_ENA */
  93. #define WM8904_GPI8_ENA 0x0100 /* GPI8_ENA */
  94. #define WM8904_GPI8_ENA_MASK 0x0100 /* GPI8_ENA */
  95. #define WM8904_GPI8_ENA_SHIFT 8 /* GPI8_ENA */
  96. #define WM8904_GPI8_ENA_WIDTH 1 /* GPI8_ENA */
  97. #define WM8904_GPIO_BCLK_MODE_ENA 0x0080 /* GPIO_BCLK_MODE_ENA */
  98. #define WM8904_GPIO_BCLK_MODE_ENA_MASK 0x0080 /* GPIO_BCLK_MODE_ENA */
  99. #define WM8904_GPIO_BCLK_MODE_ENA_SHIFT 7 /* GPIO_BCLK_MODE_ENA */
  100. #define WM8904_GPIO_BCLK_MODE_ENA_WIDTH 1 /* GPIO_BCLK_MODE_ENA */
  101. #define WM8904_GPIO_BCLK_SEL_MASK 0x000F /* GPIO_BCLK_SEL - [3:0] */
  102. #define WM8904_GPIO_BCLK_SEL_SHIFT 0 /* GPIO_BCLK_SEL - [3:0] */
  103. #define WM8904_GPIO_BCLK_SEL_WIDTH 4 /* GPIO_BCLK_SEL - [3:0] */
  104. #define WM8904_MIC_REGS 2
  105. #define WM8904_GPIO_REGS 4
  106. #define WM8904_DRC_REGS 4
  107. #define WM8904_EQ_REGS 24
  108. /**
  109. * DRC configurations are specified with a label and a set of register
  110. * values to write (the enable bits will be ignored). At runtime an
  111. * enumerated control will be presented for each DRC block allowing
  112. * the user to choose the configuration to use.
  113. *
  114. * Configurations may be generated by hand or by using the DRC control
  115. * panel provided by the WISCE - see http://www.wolfsonmicro.com/wisce/
  116. * for details.
  117. */
  118. struct wm8904_drc_cfg {
  119. const char *name;
  120. u16 regs[WM8904_DRC_REGS];
  121. };
  122. /**
  123. * ReTune Mobile configurations are specified with a label, sample
  124. * rate and set of values to write (the enable bits will be ignored).
  125. *
  126. * Configurations are expected to be generated using the ReTune Mobile
  127. * control panel in WISCE - see http://www.wolfsonmicro.com/wisce/
  128. */
  129. struct wm8904_retune_mobile_cfg {
  130. const char *name;
  131. unsigned int rate;
  132. u16 regs[WM8904_EQ_REGS];
  133. };
  134. struct wm8904_pdata {
  135. int num_drc_cfgs;
  136. struct wm8904_drc_cfg *drc_cfgs;
  137. int num_retune_mobile_cfgs;
  138. struct wm8904_retune_mobile_cfg *retune_mobile_cfgs;
  139. u32 gpio_cfg[WM8904_GPIO_REGS];
  140. u32 mic_cfg[WM8904_MIC_REGS];
  141. };
  142. #endif