blob: 90c60524a496c71425a228794950861a1fcf7ae7 [file] [log] [blame]
Mark Brown9e501082010-01-29 18:20:29 +00001/*
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
Mark Brown3cf956e2013-03-20 10:12:10 +010020#define WM8994_NUM_AIF 3
Mark Brown9e501082010-01-29 18:20:29 +000021
22struct wm8994_ldo_pdata {
23 /** GPIOs to enable regulator, 0 or less if not available */
24 int enable;
25
Mark Brown43913e52011-11-28 18:48:14 +000026 const struct regulator_init_data *init_data;
Mark Brown9e501082010-01-29 18:20:29 +000027};
28
Mark Brown8efcc572011-08-03 18:04:29 +090029#define WM8994_CONFIGURE_GPIO 0x10000
Mark Brown9e501082010-01-29 18:20:29 +000030
31#define WM8994_DRC_REGS 5
Uk Kim3fcc0af2010-12-05 17:32:16 +090032#define WM8994_EQ_REGS 20
Mark Brown131d8102010-11-30 17:03:39 +000033#define WM8958_MBC_CUTOFF_REGS 20
34#define WM8958_MBC_COEFF_REGS 48
Mark Brown09e10d72011-03-16 22:57:47 +000035#define WM8958_MBC_COMBINED_REGS 56
36#define WM8958_VSS_HPF_REGS 2
37#define WM8958_VSS_REGS 148
Mark Brown31215872011-03-17 20:23:43 +000038#define WM8958_ENH_EQ_REGS 32
Mark Brown9e501082010-01-29 18:20:29 +000039
40/**
41 * DRC configurations are specified with a label and a set of register
42 * values to write (the enable bits will be ignored). At runtime an
43 * enumerated control will be presented for each DRC block allowing
44 * the user to choose the configration to use.
45 *
46 * Configurations may be generated by hand or by using the DRC control
47 * panel provided by the WISCE - see http://www.wolfsonmicro.com/wisce/
48 * for details.
49 */
50struct wm8994_drc_cfg {
51 const char *name;
52 u16 regs[WM8994_DRC_REGS];
53};
54
55/**
56 * ReTune Mobile configurations are specified with a label, sample
57 * rate and set of values to write (the enable bits will be ignored).
58 *
59 * Configurations are expected to be generated using the ReTune Mobile
60 * control panel in WISCE - see http://www.wolfsonmicro.com/wisce/
61 */
62struct wm8994_retune_mobile_cfg {
63 const char *name;
64 unsigned int rate;
65 u16 regs[WM8994_EQ_REGS];
66};
67
Mark Brown131d8102010-11-30 17:03:39 +000068/**
69 * Multiband compressor configurations are specified with a label and
70 * two sets of values to write. Configurations are expected to be
71 * generated using the multiband compressor configuration panel in
72 * WISCE - see http://www.wolfsonmicro.com/wisce/
73 */
74struct wm8958_mbc_cfg {
75 const char *name;
76 u16 cutoff_regs[WM8958_MBC_CUTOFF_REGS];
77 u16 coeff_regs[WM8958_MBC_COEFF_REGS];
Mark Brown09e10d72011-03-16 22:57:47 +000078
79 /* Coefficient layout when using MBC+VSS firmware */
80 u16 combined_regs[WM8958_MBC_COMBINED_REGS];
81};
82
83/**
84 * VSS HPF configurations are specified with a label and two values to
85 * write. Configurations are expected to be generated using the
86 * multiband compressor configuration panel in WISCE - see
87 * http://www.wolfsonmicro.com/wisce/
88 */
89struct wm8958_vss_hpf_cfg {
90 const char *name;
91 u16 regs[WM8958_VSS_HPF_REGS];
92};
93
94/**
95 * VSS configurations are specified with a label and array of values
96 * to write. Configurations are expected to be generated using the
97 * multiband compressor configuration panel in WISCE - see
98 * http://www.wolfsonmicro.com/wisce/
99 */
100struct wm8958_vss_cfg {
101 const char *name;
102 u16 regs[WM8958_VSS_REGS];
Mark Brown131d8102010-11-30 17:03:39 +0000103};
104
Mark Brown31215872011-03-17 20:23:43 +0000105/**
106 * Enhanced EQ configurations are specified with a label and array of
107 * values to write. Configurations are expected to be generated using
108 * the multiband compressor configuration panel in WISCE - see
109 * http://www.wolfsonmicro.com/wisce/
110 */
111struct wm8958_enh_eq_cfg {
112 const char *name;
113 u16 regs[WM8958_ENH_EQ_REGS];
114};
115
Mark Browncd1707a2011-12-01 13:44:25 +0000116/**
117 * Microphone detection rates, used to tune response rates and power
118 * consumption for WM8958/WM1811 microphone detection.
119 *
120 * @sysclk: System clock rate to use this configuration for.
121 * @idle: True if this configuration should use when no accessory is detected,
122 * false otherwise.
123 * @start: Value for MICD_BIAS_START_TIME register field (not shifted).
124 * @rate: Value for MICD_RATE register field (not shifted).
125 */
126struct wm8958_micd_rate {
127 int sysclk;
128 bool idle;
129 int start;
130 int rate;
131};
132
Mark Brown9e501082010-01-29 18:20:29 +0000133struct wm8994_pdata {
134 int gpio_base;
135
136 /**
137 * Default values for GPIOs if non-zero, WM8994_CONFIGURE_GPIO
138 * can be used for all zero values.
139 */
140 int gpio_defaults[WM8994_NUM_GPIO];
141
142 struct wm8994_ldo_pdata ldo[WM8994_NUM_LDO];
143
Mark Brownc9fbf7e2010-03-26 16:49:15 +0000144 int irq_base; /** Base IRQ number for WM8994, required for IRQs */
Mark Brownb0ab907d2012-06-01 16:33:19 +0100145 unsigned long irq_flags; /** user irq flags */
Mark Brown9e501082010-01-29 18:20:29 +0000146
147 int num_drc_cfgs;
148 struct wm8994_drc_cfg *drc_cfgs;
149
150 int num_retune_mobile_cfgs;
151 struct wm8994_retune_mobile_cfg *retune_mobile_cfgs;
152
Mark Brown131d8102010-11-30 17:03:39 +0000153 int num_mbc_cfgs;
154 struct wm8958_mbc_cfg *mbc_cfgs;
155
Mark Brown09e10d72011-03-16 22:57:47 +0000156 int num_vss_cfgs;
157 struct wm8958_vss_cfg *vss_cfgs;
158
159 int num_vss_hpf_cfgs;
160 struct wm8958_vss_hpf_cfg *vss_hpf_cfgs;
161
Mark Brown31215872011-03-17 20:23:43 +0000162 int num_enh_eq_cfgs;
163 struct wm8958_enh_eq_cfg *enh_eq_cfgs;
164
Mark Browncd1707a2011-12-01 13:44:25 +0000165 int num_micd_rates;
166 struct wm8958_micd_rate *micd_rates;
167
Mark Brown02e79472012-08-21 17:54:52 +0100168 /* Power up delays to add after microphone bias power up (ms) */
169 int micb1_delay;
170 int micb2_delay;
171
Mark Brown9e501082010-01-29 18:20:29 +0000172 /* LINEOUT can be differential or single ended */
173 unsigned int lineout1_diff:1;
174 unsigned int lineout2_diff:1;
175
176 /* Common mode feedback */
177 unsigned int lineout1fb:1;
178 unsigned int lineout2fb:1;
179
Mark Brownc0cc3f12012-09-28 16:50:15 +0100180 /* Delay between detecting a jack and starting microphone
181 * detect (specified in ms)
182 */
183 int micdet_delay;
184
Mark Brown2da1c4b2013-05-30 13:42:29 +0100185 /* Delay between microphone detect completing and reporting on
186 * insert (specified in ms)
187 */
188 int mic_id_delay;
189
Mark Brown9b7c5252011-02-17 20:05:44 -0800190 /* IRQ for microphone detection if brought out directly as a
191 * signal.
192 */
193 int micdet_irq;
194
Mark Brown48e028e2011-02-21 17:11:59 -0800195 /* WM8994 microphone biases: 0=0.9*AVDD1 1=0.65*AVVD1 */
Mark Brown9e501082010-01-29 18:20:29 +0000196 unsigned int micbias1_lvl:1;
197 unsigned int micbias2_lvl:1;
198
Mark Brown48e028e2011-02-21 17:11:59 -0800199 /* WM8994 jack detect threashold levels, see datasheet for values */
Mark Brown9e501082010-01-29 18:20:29 +0000200 unsigned int jd_scthr:2;
201 unsigned int jd_thr:2;
Mark Brown48e028e2011-02-21 17:11:59 -0800202
Mark Brown07fb9d92012-02-21 16:23:35 +0000203 /* Configure WM1811 jack detection for use with external capacitor */
204 unsigned int jd_ext_cap:1;
205
Mark Brown48e028e2011-02-21 17:11:59 -0800206 /* WM8958 microphone bias configuration */
207 int micbias[2];
Mark Brown881de672011-08-22 15:43:55 +0200208
Mark Brown4585790d2011-11-30 10:55:14 +0000209 /* WM8958 microphone detection ranges */
210 u16 micd_lvl_sel;
211
Mark Brown881de672011-08-22 15:43:55 +0200212 /* Disable the internal pull downs on the LDOs if they are
213 * always driven (eg, connected to an always on supply or
214 * GPIO that always drives an output. If they float power
215 * consumption will rise.
216 */
217 bool ldo_ena_always_driven;
Mark Brown26c34c22011-11-03 13:20:38 +0000218
219 /*
220 * SPKMODE must be pulled internally by the device on this
221 * system.
222 */
223 bool spkmode_pu;
Mark Brown3cf956e2013-03-20 10:12:10 +0100224
225 /**
226 * Maximum number of channels clocks will be generated for,
227 * useful for systems where and I2S bus with multiple data
228 * lines is mastered.
229 */
230 int max_channels_clocked[WM8994_NUM_AIF];
Mark Brown7c884442013-05-06 16:12:56 +0100231
232 /**
233 * GPIO for the IRQ pin if host only supports edge triggering
234 */
235 int irq_gpio;
Mark Brown9e501082010-01-29 18:20:29 +0000236};
237
238#endif