pdata.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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 char *supply;
  22. 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. 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. /* LINEOUT can be differential or single ended */
  142. unsigned int lineout1_diff:1;
  143. unsigned int lineout2_diff:1;
  144. /* Common mode feedback */
  145. unsigned int lineout1fb:1;
  146. unsigned int lineout2fb:1;
  147. /* IRQ for microphone detection if brought out directly as a
  148. * signal.
  149. */
  150. int micdet_irq;
  151. /* WM8994 microphone biases: 0=0.9*AVDD1 1=0.65*AVVD1 */
  152. unsigned int micbias1_lvl:1;
  153. unsigned int micbias2_lvl:1;
  154. /* WM8994 jack detect threashold levels, see datasheet for values */
  155. unsigned int jd_scthr:2;
  156. unsigned int jd_thr:2;
  157. /* WM8958 microphone bias configuration */
  158. int micbias[2];
  159. /* WM8958 microphone detection ranges */
  160. u16 micd_lvl_sel;
  161. /* Disable the internal pull downs on the LDOs if they are
  162. * always driven (eg, connected to an always on supply or
  163. * GPIO that always drives an output. If they float power
  164. * consumption will rise.
  165. */
  166. bool ldo_ena_always_driven;
  167. };
  168. #endif