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