pdata.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  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. #define WM8994_NUM_AIF 3
  19. struct wm8994_ldo_pdata {
  20. /** GPIOs to enable regulator, 0 or less if not available */
  21. int enable;
  22. const struct regulator_init_data *init_data;
  23. };
  24. #define WM8994_CONFIGURE_GPIO 0x10000
  25. #define WM8994_DRC_REGS 5
  26. #define WM8994_EQ_REGS 20
  27. #define WM8958_MBC_CUTOFF_REGS 20
  28. #define WM8958_MBC_COEFF_REGS 48
  29. #define WM8958_MBC_COMBINED_REGS 56
  30. #define WM8958_VSS_HPF_REGS 2
  31. #define WM8958_VSS_REGS 148
  32. #define WM8958_ENH_EQ_REGS 32
  33. /**
  34. * DRC configurations are specified with a label and a set of register
  35. * values to write (the enable bits will be ignored). At runtime an
  36. * enumerated control will be presented for each DRC block allowing
  37. * the user to choose the configration to use.
  38. *
  39. * Configurations may be generated by hand or by using the DRC control
  40. * panel provided by the WISCE - see http://www.wolfsonmicro.com/wisce/
  41. * for details.
  42. */
  43. struct wm8994_drc_cfg {
  44. const char *name;
  45. u16 regs[WM8994_DRC_REGS];
  46. };
  47. /**
  48. * ReTune Mobile configurations are specified with a label, sample
  49. * rate and set of values to write (the enable bits will be ignored).
  50. *
  51. * Configurations are expected to be generated using the ReTune Mobile
  52. * control panel in WISCE - see http://www.wolfsonmicro.com/wisce/
  53. */
  54. struct wm8994_retune_mobile_cfg {
  55. const char *name;
  56. unsigned int rate;
  57. u16 regs[WM8994_EQ_REGS];
  58. };
  59. /**
  60. * Multiband compressor configurations are specified with a label and
  61. * two sets of values to write. Configurations are expected to be
  62. * generated using the multiband compressor configuration panel in
  63. * WISCE - see http://www.wolfsonmicro.com/wisce/
  64. */
  65. struct wm8958_mbc_cfg {
  66. const char *name;
  67. u16 cutoff_regs[WM8958_MBC_CUTOFF_REGS];
  68. u16 coeff_regs[WM8958_MBC_COEFF_REGS];
  69. /* Coefficient layout when using MBC+VSS firmware */
  70. u16 combined_regs[WM8958_MBC_COMBINED_REGS];
  71. };
  72. /**
  73. * VSS HPF configurations are specified with a label and two values to
  74. * write. Configurations are expected to be generated using the
  75. * multiband compressor configuration panel in WISCE - see
  76. * http://www.wolfsonmicro.com/wisce/
  77. */
  78. struct wm8958_vss_hpf_cfg {
  79. const char *name;
  80. u16 regs[WM8958_VSS_HPF_REGS];
  81. };
  82. /**
  83. * VSS configurations are specified with a label and array of values
  84. * to write. Configurations are expected to be generated using the
  85. * multiband compressor configuration panel in WISCE - see
  86. * http://www.wolfsonmicro.com/wisce/
  87. */
  88. struct wm8958_vss_cfg {
  89. const char *name;
  90. u16 regs[WM8958_VSS_REGS];
  91. };
  92. /**
  93. * Enhanced EQ configurations are specified with a label and array of
  94. * values to write. Configurations are expected to be generated using
  95. * the multiband compressor configuration panel in WISCE - see
  96. * http://www.wolfsonmicro.com/wisce/
  97. */
  98. struct wm8958_enh_eq_cfg {
  99. const char *name;
  100. u16 regs[WM8958_ENH_EQ_REGS];
  101. };
  102. /**
  103. * Microphone detection rates, used to tune response rates and power
  104. * consumption for WM8958/WM1811 microphone detection.
  105. *
  106. * @sysclk: System clock rate to use this configuration for.
  107. * @idle: True if this configuration should use when no accessory is detected,
  108. * false otherwise.
  109. * @start: Value for MICD_BIAS_START_TIME register field (not shifted).
  110. * @rate: Value for MICD_RATE register field (not shifted).
  111. */
  112. struct wm8958_micd_rate {
  113. int sysclk;
  114. bool idle;
  115. int start;
  116. int rate;
  117. };
  118. struct wm8994_pdata {
  119. int gpio_base;
  120. /**
  121. * Default values for GPIOs if non-zero, WM8994_CONFIGURE_GPIO
  122. * can be used for all zero values.
  123. */
  124. int gpio_defaults[WM8994_NUM_GPIO];
  125. struct wm8994_ldo_pdata ldo[WM8994_NUM_LDO];
  126. int irq_base; /** Base IRQ number for WM8994, required for IRQs */
  127. unsigned long irq_flags; /** user irq flags */
  128. int num_drc_cfgs;
  129. struct wm8994_drc_cfg *drc_cfgs;
  130. int num_retune_mobile_cfgs;
  131. struct wm8994_retune_mobile_cfg *retune_mobile_cfgs;
  132. int num_mbc_cfgs;
  133. struct wm8958_mbc_cfg *mbc_cfgs;
  134. int num_vss_cfgs;
  135. struct wm8958_vss_cfg *vss_cfgs;
  136. int num_vss_hpf_cfgs;
  137. struct wm8958_vss_hpf_cfg *vss_hpf_cfgs;
  138. int num_enh_eq_cfgs;
  139. struct wm8958_enh_eq_cfg *enh_eq_cfgs;
  140. int num_micd_rates;
  141. struct wm8958_micd_rate *micd_rates;
  142. /* Power up delays to add after microphone bias power up (ms) */
  143. int micb1_delay;
  144. int micb2_delay;
  145. /* LINEOUT can be differential or single ended */
  146. unsigned int lineout1_diff:1;
  147. unsigned int lineout2_diff:1;
  148. /* Common mode feedback */
  149. unsigned int lineout1fb:1;
  150. unsigned int lineout2fb:1;
  151. /* Delay between detecting a jack and starting microphone
  152. * detect (specified in ms)
  153. */
  154. int micdet_delay;
  155. /* Delay between microphone detect completing and reporting on
  156. * insert (specified in ms)
  157. */
  158. int mic_id_delay;
  159. /* IRQ for microphone detection if brought out directly as a
  160. * signal.
  161. */
  162. int micdet_irq;
  163. /* WM8994 microphone biases: 0=0.9*AVDD1 1=0.65*AVVD1 */
  164. unsigned int micbias1_lvl:1;
  165. unsigned int micbias2_lvl:1;
  166. /* WM8994 jack detect threashold levels, see datasheet for values */
  167. unsigned int jd_scthr:2;
  168. unsigned int jd_thr:2;
  169. /* Configure WM1811 jack detection for use with external capacitor */
  170. unsigned int jd_ext_cap:1;
  171. /* WM8958 microphone bias configuration */
  172. int micbias[2];
  173. /* WM8958 microphone detection ranges */
  174. u16 micd_lvl_sel;
  175. /* Disable the internal pull downs on the LDOs if they are
  176. * always driven (eg, connected to an always on supply or
  177. * GPIO that always drives an output. If they float power
  178. * consumption will rise.
  179. */
  180. bool ldo_ena_always_driven;
  181. /*
  182. * SPKMODE must be pulled internally by the device on this
  183. * system.
  184. */
  185. bool spkmode_pu;
  186. /**
  187. * Maximum number of channels clocks will be generated for,
  188. * useful for systems where and I2S bus with multiple data
  189. * lines is mastered.
  190. */
  191. int max_channels_clocked[WM8994_NUM_AIF];
  192. /**
  193. * GPIO for the IRQ pin if host only supports edge triggering
  194. */
  195. int irq_gpio;
  196. };
  197. #endif