pdata.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. /*
  2. * include/linux/mfd/wm8994/pdata.h -- Platform data for WM8994
  3. *
  4. * Copyright 2009 Wolfson Microelectronics PLC.
  5. *
  6. * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License as published by the
  10. * Free Software Foundation; either version 2 of the License, or (at your
  11. * option) any later version.
  12. *
  13. */
  14. #ifndef __MFD_WM8994_PDATA_H__
  15. #define __MFD_WM8994_PDATA_H__
  16. #define WM8994_NUM_LDO 2
  17. #define WM8994_NUM_GPIO 11
  18. struct wm8994_ldo_pdata {
  19. /** GPIOs to enable regulator, 0 or less if not available */
  20. int enable;
  21. const struct regulator_init_data *init_data;
  22. };
  23. #define WM8994_CONFIGURE_GPIO 0x10000
  24. #define WM8994_DRC_REGS 5
  25. #define WM8994_EQ_REGS 20
  26. #define WM8958_MBC_CUTOFF_REGS 20
  27. #define WM8958_MBC_COEFF_REGS 48
  28. #define WM8958_MBC_COMBINED_REGS 56
  29. #define WM8958_VSS_HPF_REGS 2
  30. #define WM8958_VSS_REGS 148
  31. #define WM8958_ENH_EQ_REGS 32
  32. /**
  33. * DRC configurations are specified with a label and a set of register
  34. * values to write (the enable bits will be ignored). At runtime an
  35. * enumerated control will be presented for each DRC block allowing
  36. * the user to choose the configration to use.
  37. *
  38. * Configurations may be generated by hand or by using the DRC control
  39. * panel provided by the WISCE - see http://www.wolfsonmicro.com/wisce/
  40. * for details.
  41. */
  42. struct wm8994_drc_cfg {
  43. const char *name;
  44. u16 regs[WM8994_DRC_REGS];
  45. };
  46. /**
  47. * ReTune Mobile configurations are specified with a label, sample
  48. * rate and set of values to write (the enable bits will be ignored).
  49. *
  50. * Configurations are expected to be generated using the ReTune Mobile
  51. * control panel in WISCE - see http://www.wolfsonmicro.com/wisce/
  52. */
  53. struct wm8994_retune_mobile_cfg {
  54. const char *name;
  55. unsigned int rate;
  56. u16 regs[WM8994_EQ_REGS];
  57. };
  58. /**
  59. * Multiband compressor configurations are specified with a label and
  60. * two sets of values to write. Configurations are expected to be
  61. * generated using the multiband compressor configuration panel in
  62. * WISCE - see http://www.wolfsonmicro.com/wisce/
  63. */
  64. struct wm8958_mbc_cfg {
  65. const char *name;
  66. u16 cutoff_regs[WM8958_MBC_CUTOFF_REGS];
  67. u16 coeff_regs[WM8958_MBC_COEFF_REGS];
  68. /* Coefficient layout when using MBC+VSS firmware */
  69. u16 combined_regs[WM8958_MBC_COMBINED_REGS];
  70. };
  71. /**
  72. * VSS HPF configurations are specified with a label and two values to
  73. * write. Configurations are expected to be generated using the
  74. * multiband compressor configuration panel in WISCE - see
  75. * http://www.wolfsonmicro.com/wisce/
  76. */
  77. struct wm8958_vss_hpf_cfg {
  78. const char *name;
  79. u16 regs[WM8958_VSS_HPF_REGS];
  80. };
  81. /**
  82. * VSS configurations are specified with a label and array of values
  83. * to write. Configurations are expected to be generated using the
  84. * multiband compressor configuration panel in WISCE - see
  85. * http://www.wolfsonmicro.com/wisce/
  86. */
  87. struct wm8958_vss_cfg {
  88. const char *name;
  89. u16 regs[WM8958_VSS_REGS];
  90. };
  91. /**
  92. * Enhanced EQ configurations are specified with a label and array of
  93. * values to write. Configurations are expected to be generated using
  94. * the multiband compressor configuration panel in WISCE - see
  95. * http://www.wolfsonmicro.com/wisce/
  96. */
  97. struct wm8958_enh_eq_cfg {
  98. const char *name;
  99. u16 regs[WM8958_ENH_EQ_REGS];
  100. };
  101. /**
  102. * Microphone detection rates, used to tune response rates and power
  103. * consumption for WM8958/WM1811 microphone detection.
  104. *
  105. * @sysclk: System clock rate to use this configuration for.
  106. * @idle: True if this configuration should use when no accessory is detected,
  107. * false otherwise.
  108. * @start: Value for MICD_BIAS_START_TIME register field (not shifted).
  109. * @rate: Value for MICD_RATE register field (not shifted).
  110. */
  111. struct wm8958_micd_rate {
  112. int sysclk;
  113. bool idle;
  114. int start;
  115. int rate;
  116. };
  117. struct wm8994_pdata {
  118. int gpio_base;
  119. /**
  120. * Default values for GPIOs if non-zero, WM8994_CONFIGURE_GPIO
  121. * can be used for all zero values.
  122. */
  123. int gpio_defaults[WM8994_NUM_GPIO];
  124. struct wm8994_ldo_pdata ldo[WM8994_NUM_LDO];
  125. int irq_base; /** Base IRQ number for WM8994, required for IRQs */
  126. unsigned long irq_flags; /** user irq flags */
  127. int num_drc_cfgs;
  128. struct wm8994_drc_cfg *drc_cfgs;
  129. int num_retune_mobile_cfgs;
  130. struct wm8994_retune_mobile_cfg *retune_mobile_cfgs;
  131. int num_mbc_cfgs;
  132. struct wm8958_mbc_cfg *mbc_cfgs;
  133. int num_vss_cfgs;
  134. struct wm8958_vss_cfg *vss_cfgs;
  135. int num_vss_hpf_cfgs;
  136. struct wm8958_vss_hpf_cfg *vss_hpf_cfgs;
  137. int num_enh_eq_cfgs;
  138. struct wm8958_enh_eq_cfg *enh_eq_cfgs;
  139. int num_micd_rates;
  140. struct wm8958_micd_rate *micd_rates;
  141. /* Power up delays to add after microphone bias power up (ms) */
  142. int micb1_delay;
  143. int micb2_delay;
  144. /* LINEOUT can be differential or single ended */
  145. unsigned int lineout1_diff:1;
  146. unsigned int lineout2_diff:1;
  147. /* Common mode feedback */
  148. unsigned int lineout1fb:1;
  149. unsigned int lineout2fb:1;
  150. /* IRQ for microphone detection if brought out directly as a
  151. * signal.
  152. */
  153. int micdet_irq;
  154. /* WM8994 microphone biases: 0=0.9*AVDD1 1=0.65*AVVD1 */
  155. unsigned int micbias1_lvl:1;
  156. unsigned int micbias2_lvl:1;
  157. /* WM8994 jack detect threashold levels, see datasheet for values */
  158. unsigned int jd_scthr:2;
  159. unsigned int jd_thr:2;
  160. /* Configure WM1811 jack detection for use with external capacitor */
  161. unsigned int jd_ext_cap:1;
  162. /* WM8958 microphone bias configuration */
  163. int micbias[2];
  164. /* WM8958 microphone detection ranges */
  165. u16 micd_lvl_sel;
  166. /* Disable the internal pull downs on the LDOs if they are
  167. * always driven (eg, connected to an always on supply or
  168. * GPIO that always drives an output. If they float power
  169. * consumption will rise.
  170. */
  171. bool ldo_ena_always_driven;
  172. /*
  173. * SPKMODE must be pulled internally by the device on this
  174. * system.
  175. */
  176. bool spkmode_pu;
  177. };
  178. #endif