blob: fc87be4fdc2501a8106b18664102c793ccdb588b [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
20
21struct wm8994_ldo_pdata {
22 /** GPIOs to enable regulator, 0 or less if not available */
23 int enable;
24
Mark Brown43913e52011-11-28 18:48:14 +000025 const struct regulator_init_data *init_data;
Mark Brown9e501082010-01-29 18:20:29 +000026};
27
Mark Brown8efcc572011-08-03 18:04:29 +090028#define WM8994_CONFIGURE_GPIO 0x10000
Mark Brown9e501082010-01-29 18:20:29 +000029
30#define WM8994_DRC_REGS 5
Uk Kim3fcc0af2010-12-05 17:32:16 +090031#define WM8994_EQ_REGS 20
Mark Brown131d8102010-11-30 17:03:39 +000032#define WM8958_MBC_CUTOFF_REGS 20
33#define WM8958_MBC_COEFF_REGS 48
Mark Brown09e10d72011-03-16 22:57:47 +000034#define WM8958_MBC_COMBINED_REGS 56
35#define WM8958_VSS_HPF_REGS 2
36#define WM8958_VSS_REGS 148
Mark Brown31215872011-03-17 20:23:43 +000037#define WM8958_ENH_EQ_REGS 32
Mark Brown9e501082010-01-29 18:20:29 +000038
39/**
40 * DRC configurations are specified with a label and a set of register
41 * values to write (the enable bits will be ignored). At runtime an
42 * enumerated control will be presented for each DRC block allowing
43 * the user to choose the configration to use.
44 *
45 * Configurations may be generated by hand or by using the DRC control
46 * panel provided by the WISCE - see http://www.wolfsonmicro.com/wisce/
47 * for details.
48 */
49struct wm8994_drc_cfg {
50 const char *name;
51 u16 regs[WM8994_DRC_REGS];
52};
53
54/**
55 * ReTune Mobile configurations are specified with a label, sample
56 * rate and set of values to write (the enable bits will be ignored).
57 *
58 * Configurations are expected to be generated using the ReTune Mobile
59 * control panel in WISCE - see http://www.wolfsonmicro.com/wisce/
60 */
61struct wm8994_retune_mobile_cfg {
62 const char *name;
63 unsigned int rate;
64 u16 regs[WM8994_EQ_REGS];
65};
66
Mark Brown131d8102010-11-30 17:03:39 +000067/**
68 * Multiband compressor configurations are specified with a label and
69 * two sets of values to write. Configurations are expected to be
70 * generated using the multiband compressor configuration panel in
71 * WISCE - see http://www.wolfsonmicro.com/wisce/
72 */
73struct wm8958_mbc_cfg {
74 const char *name;
75 u16 cutoff_regs[WM8958_MBC_CUTOFF_REGS];
76 u16 coeff_regs[WM8958_MBC_COEFF_REGS];
Mark Brown09e10d72011-03-16 22:57:47 +000077
78 /* Coefficient layout when using MBC+VSS firmware */
79 u16 combined_regs[WM8958_MBC_COMBINED_REGS];
80};
81
82/**
83 * VSS HPF configurations are specified with a label and two values to
84 * write. Configurations are expected to be generated using the
85 * multiband compressor configuration panel in WISCE - see
86 * http://www.wolfsonmicro.com/wisce/
87 */
88struct wm8958_vss_hpf_cfg {
89 const char *name;
90 u16 regs[WM8958_VSS_HPF_REGS];
91};
92
93/**
94 * VSS configurations are specified with a label and array of values
95 * to write. Configurations are expected to be generated using the
96 * multiband compressor configuration panel in WISCE - see
97 * http://www.wolfsonmicro.com/wisce/
98 */
99struct wm8958_vss_cfg {
100 const char *name;
101 u16 regs[WM8958_VSS_REGS];
Mark Brown131d8102010-11-30 17:03:39 +0000102};
103
Mark Brown31215872011-03-17 20:23:43 +0000104/**
105 * Enhanced EQ configurations are specified with a label and array of
106 * values to write. Configurations are expected to be generated using
107 * the multiband compressor configuration panel in WISCE - see
108 * http://www.wolfsonmicro.com/wisce/
109 */
110struct wm8958_enh_eq_cfg {
111 const char *name;
112 u16 regs[WM8958_ENH_EQ_REGS];
113};
114
Mark Browncd1707a2011-12-01 13:44:25 +0000115/**
116 * Microphone detection rates, used to tune response rates and power
117 * consumption for WM8958/WM1811 microphone detection.
118 *
119 * @sysclk: System clock rate to use this configuration for.
120 * @idle: True if this configuration should use when no accessory is detected,
121 * false otherwise.
122 * @start: Value for MICD_BIAS_START_TIME register field (not shifted).
123 * @rate: Value for MICD_RATE register field (not shifted).
124 */
125struct wm8958_micd_rate {
126 int sysclk;
127 bool idle;
128 int start;
129 int rate;
130};
131
Mark Brown9e501082010-01-29 18:20:29 +0000132struct wm8994_pdata {
133 int gpio_base;
134
135 /**
136 * Default values for GPIOs if non-zero, WM8994_CONFIGURE_GPIO
137 * can be used for all zero values.
138 */
139 int gpio_defaults[WM8994_NUM_GPIO];
140
141 struct wm8994_ldo_pdata ldo[WM8994_NUM_LDO];
142
Mark Brownc9fbf7e2010-03-26 16:49:15 +0000143 int irq_base; /** Base IRQ number for WM8994, required for IRQs */
Mark Brownb0ab907d2012-06-01 16:33:19 +0100144 unsigned long irq_flags; /** user irq flags */
Mark Brown9e501082010-01-29 18:20:29 +0000145
146 int num_drc_cfgs;
147 struct wm8994_drc_cfg *drc_cfgs;
148
149 int num_retune_mobile_cfgs;
150 struct wm8994_retune_mobile_cfg *retune_mobile_cfgs;
151
Mark Brown131d8102010-11-30 17:03:39 +0000152 int num_mbc_cfgs;
153 struct wm8958_mbc_cfg *mbc_cfgs;
154
Mark Brown09e10d72011-03-16 22:57:47 +0000155 int num_vss_cfgs;
156 struct wm8958_vss_cfg *vss_cfgs;
157
158 int num_vss_hpf_cfgs;
159 struct wm8958_vss_hpf_cfg *vss_hpf_cfgs;
160
Mark Brown31215872011-03-17 20:23:43 +0000161 int num_enh_eq_cfgs;
162 struct wm8958_enh_eq_cfg *enh_eq_cfgs;
163
Mark Browncd1707a2011-12-01 13:44:25 +0000164 int num_micd_rates;
165 struct wm8958_micd_rate *micd_rates;
166
Mark Brown02e79472012-08-21 17:54:52 +0100167 /* Power up delays to add after microphone bias power up (ms) */
168 int micb1_delay;
169 int micb2_delay;
170
Mark Brown9e501082010-01-29 18:20:29 +0000171 /* LINEOUT can be differential or single ended */
172 unsigned int lineout1_diff:1;
173 unsigned int lineout2_diff:1;
174
175 /* Common mode feedback */
176 unsigned int lineout1fb:1;
177 unsigned int lineout2fb:1;
178
Mark Brown9b7c5252011-02-17 20:05:44 -0800179 /* IRQ for microphone detection if brought out directly as a
180 * signal.
181 */
182 int micdet_irq;
183
Mark Brown48e028e2011-02-21 17:11:59 -0800184 /* WM8994 microphone biases: 0=0.9*AVDD1 1=0.65*AVVD1 */
Mark Brown9e501082010-01-29 18:20:29 +0000185 unsigned int micbias1_lvl:1;
186 unsigned int micbias2_lvl:1;
187
Mark Brown48e028e2011-02-21 17:11:59 -0800188 /* WM8994 jack detect threashold levels, see datasheet for values */
Mark Brown9e501082010-01-29 18:20:29 +0000189 unsigned int jd_scthr:2;
190 unsigned int jd_thr:2;
Mark Brown48e028e2011-02-21 17:11:59 -0800191
Mark Brown07fb9d92012-02-21 16:23:35 +0000192 /* Configure WM1811 jack detection for use with external capacitor */
193 unsigned int jd_ext_cap:1;
194
Mark Brown48e028e2011-02-21 17:11:59 -0800195 /* WM8958 microphone bias configuration */
196 int micbias[2];
Mark Brown881de672011-08-22 15:43:55 +0200197
Mark Brown4585790d2011-11-30 10:55:14 +0000198 /* WM8958 microphone detection ranges */
199 u16 micd_lvl_sel;
200
Mark Brown881de672011-08-22 15:43:55 +0200201 /* Disable the internal pull downs on the LDOs if they are
202 * always driven (eg, connected to an always on supply or
203 * GPIO that always drives an output. If they float power
204 * consumption will rise.
205 */
206 bool ldo_ena_always_driven;
Mark Brown26c34c22011-11-03 13:20:38 +0000207
208 /*
209 * SPKMODE must be pulled internally by the device on this
210 * system.
211 */
212 bool spkmode_pu;
Mark Brown9e501082010-01-29 18:20:29 +0000213};
214
215#endif