1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * include/linux/mfd/wm8994/pdata.h -- Platform data for WM8994
5 * Copyright 2009 Wolfson Microelectronics PLC.
7 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
10 #ifndef __MFD_WM8994_PDATA_H__
11 #define __MFD_WM8994_PDATA_H__
13 #define WM8994_NUM_LDO 2
14 #define WM8994_NUM_GPIO 11
15 #define WM8994_NUM_AIF 3
17 struct wm8994_ldo_pdata {
18 const struct regulator_init_data *init_data;
21 #define WM8994_CONFIGURE_GPIO 0x10000
23 #define WM8994_DRC_REGS 5
24 #define WM8994_EQ_REGS 20
25 #define WM8958_MBC_CUTOFF_REGS 20
26 #define WM8958_MBC_COEFF_REGS 48
27 #define WM8958_MBC_COMBINED_REGS 56
28 #define WM8958_VSS_HPF_REGS 2
29 #define WM8958_VSS_REGS 148
30 #define WM8958_ENH_EQ_REGS 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 configuration to use.
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/
42 struct wm8994_drc_cfg {
44 u16 regs[WM8994_DRC_REGS];
48 * ReTune Mobile configurations are specified with a label, sample
49 * rate and set of values to write (the enable bits will be ignored).
51 * Configurations are expected to be generated using the ReTune Mobile
52 * control panel in WISCE - see http://www.wolfsonmicro.com/wisce/
54 struct wm8994_retune_mobile_cfg {
57 u16 regs[WM8994_EQ_REGS];
61 * Multiband compressor configurations are specified with a label and
62 * two sets of values to write. Configurations are expected to be
63 * generated using the multiband compressor configuration panel in
64 * WISCE - see http://www.wolfsonmicro.com/wisce/
66 struct wm8958_mbc_cfg {
68 u16 cutoff_regs[WM8958_MBC_CUTOFF_REGS];
69 u16 coeff_regs[WM8958_MBC_COEFF_REGS];
71 /* Coefficient layout when using MBC+VSS firmware */
72 u16 combined_regs[WM8958_MBC_COMBINED_REGS];
76 * VSS HPF configurations are specified with a label and two values to
77 * write. Configurations are expected to be generated using the
78 * multiband compressor configuration panel in WISCE - see
79 * http://www.wolfsonmicro.com/wisce/
81 struct wm8958_vss_hpf_cfg {
83 u16 regs[WM8958_VSS_HPF_REGS];
87 * VSS configurations are specified with a label and array of values
88 * to write. Configurations are expected to be generated using the
89 * multiband compressor configuration panel in WISCE - see
90 * http://www.wolfsonmicro.com/wisce/
92 struct wm8958_vss_cfg {
94 u16 regs[WM8958_VSS_REGS];
98 * Enhanced EQ configurations are specified with a label and array of
99 * values to write. Configurations are expected to be generated using
100 * the multiband compressor configuration panel in WISCE - see
101 * http://www.wolfsonmicro.com/wisce/
103 struct wm8958_enh_eq_cfg {
105 u16 regs[WM8958_ENH_EQ_REGS];
109 * Microphone detection rates, used to tune response rates and power
110 * consumption for WM8958/WM1811 microphone detection.
112 * @sysclk: System clock rate to use this configuration for.
113 * @idle: True if this configuration should use when no accessory is detected,
115 * @start: Value for MICD_BIAS_START_TIME register field (not shifted).
116 * @rate: Value for MICD_RATE register field (not shifted).
118 struct wm8958_micd_rate {
125 struct wm8994_pdata {
129 * Default values for GPIOs if non-zero, WM8994_CONFIGURE_GPIO
130 * can be used for all zero values.
132 int gpio_defaults[WM8994_NUM_GPIO];
134 struct wm8994_ldo_pdata ldo[WM8994_NUM_LDO];
136 int irq_base; /** Base IRQ number for WM8994, required for IRQs */
137 unsigned long irq_flags; /** user irq flags */
140 struct wm8994_drc_cfg *drc_cfgs;
142 int num_retune_mobile_cfgs;
143 struct wm8994_retune_mobile_cfg *retune_mobile_cfgs;
146 struct wm8958_mbc_cfg *mbc_cfgs;
149 struct wm8958_vss_cfg *vss_cfgs;
151 int num_vss_hpf_cfgs;
152 struct wm8958_vss_hpf_cfg *vss_hpf_cfgs;
155 struct wm8958_enh_eq_cfg *enh_eq_cfgs;
158 struct wm8958_micd_rate *micd_rates;
160 /* Power up delays to add after microphone bias power up (ms) */
164 /* LINEOUT can be differential or single ended */
165 unsigned int lineout1_diff:1;
166 unsigned int lineout2_diff:1;
168 /* Common mode feedback */
169 unsigned int lineout1fb:1;
170 unsigned int lineout2fb:1;
172 /* Delay between detecting a jack and starting microphone
173 * detect (specified in ms)
177 /* Delay between microphone detect completing and reporting on
178 * insert (specified in ms)
182 /* IRQ for microphone detection if brought out directly as a
187 /* WM8994 microphone biases: 0=0.9*AVDD1 1=0.65*AVVD1 */
188 unsigned int micbias1_lvl:1;
189 unsigned int micbias2_lvl:1;
191 /* WM8994 jack detect threashold levels, see datasheet for values */
192 unsigned int jd_scthr:2;
193 unsigned int jd_thr:2;
195 /* Configure WM1811 jack detection for use with external capacitor */
196 unsigned int jd_ext_cap:1;
198 /* WM8958 microphone bias configuration */
201 /* WM8958 microphone detection ranges */
204 /* Disable the internal pull downs on the LDOs if they are
205 * always driven (eg, connected to an always on supply or
206 * GPIO that always drives an output. If they float power
207 * consumption will rise.
209 bool ldo_ena_always_driven;
212 * SPKMODE must be pulled internally by the device on this
218 * CS/ADDR must be pulled internally by the device on this
224 * Maximum number of channels clocks will be generated for,
225 * useful for systems where and I2S bus with multiple data
228 int max_channels_clocked[WM8994_NUM_AIF];
231 * GPIO for the IRQ pin if host only supports edge triggering