1
2
3
4
5
6
7
8 #ifndef __LINUX_SND_WM8903_H
9 #define __LINUX_SND_WM8903_H
10
11
12
13
14
15 #define WM8903_GPIO_CONFIG_ZERO 0x8000
16
17
18
19
20 #define WM8903_MICDET_THR_MASK 0x0030
21 #define WM8903_MICDET_THR_SHIFT 4
22 #define WM8903_MICDET_THR_WIDTH 2
23 #define WM8903_MICSHORT_THR_MASK 0x000C
24 #define WM8903_MICSHORT_THR_SHIFT 2
25 #define WM8903_MICSHORT_THR_WIDTH 2
26 #define WM8903_MICDET_ENA 0x0002
27 #define WM8903_MICDET_ENA_MASK 0x0002
28 #define WM8903_MICDET_ENA_SHIFT 1
29 #define WM8903_MICDET_ENA_WIDTH 1
30 #define WM8903_MICBIAS_ENA 0x0001
31 #define WM8903_MICBIAS_ENA_MASK 0x0001
32 #define WM8903_MICBIAS_ENA_SHIFT 0
33 #define WM8903_MICBIAS_ENA_WIDTH 1
34
35
36
37
38
39
40 #define WM8903_GPn_FN_GPIO_OUTPUT 0
41 #define WM8903_GPn_FN_BCLK 1
42 #define WM8903_GPn_FN_IRQ_OUTPT 2
43 #define WM8903_GPn_FN_GPIO_INPUT 3
44 #define WM8903_GPn_FN_MICBIAS_CURRENT_DETECT 4
45 #define WM8903_GPn_FN_MICBIAS_SHORT_DETECT 5
46 #define WM8903_GPn_FN_DMIC_LR_CLK_OUTPUT 6
47 #define WM8903_GPn_FN_FLL_LOCK_OUTPUT 8
48 #define WM8903_GPn_FN_FLL_CLOCK_OUTPUT 9
49
50
51
52
53 #define WM8903_GP1_FN_MASK 0x1F00
54 #define WM8903_GP1_FN_SHIFT 8
55 #define WM8903_GP1_FN_WIDTH 5
56 #define WM8903_GP1_DIR 0x0080
57 #define WM8903_GP1_DIR_MASK 0x0080
58 #define WM8903_GP1_DIR_SHIFT 7
59 #define WM8903_GP1_DIR_WIDTH 1
60 #define WM8903_GP1_OP_CFG 0x0040
61 #define WM8903_GP1_OP_CFG_MASK 0x0040
62 #define WM8903_GP1_OP_CFG_SHIFT 6
63 #define WM8903_GP1_OP_CFG_WIDTH 1
64 #define WM8903_GP1_IP_CFG 0x0020
65 #define WM8903_GP1_IP_CFG_MASK 0x0020
66 #define WM8903_GP1_IP_CFG_SHIFT 5
67 #define WM8903_GP1_IP_CFG_WIDTH 1
68 #define WM8903_GP1_LVL 0x0010
69 #define WM8903_GP1_LVL_MASK 0x0010
70 #define WM8903_GP1_LVL_SHIFT 4
71 #define WM8903_GP1_LVL_WIDTH 1
72 #define WM8903_GP1_PD 0x0008
73 #define WM8903_GP1_PD_MASK 0x0008
74 #define WM8903_GP1_PD_SHIFT 3
75 #define WM8903_GP1_PD_WIDTH 1
76 #define WM8903_GP1_PU 0x0004
77 #define WM8903_GP1_PU_MASK 0x0004
78 #define WM8903_GP1_PU_SHIFT 2
79 #define WM8903_GP1_PU_WIDTH 1
80 #define WM8903_GP1_INTMODE 0x0002
81 #define WM8903_GP1_INTMODE_MASK 0x0002
82 #define WM8903_GP1_INTMODE_SHIFT 1
83 #define WM8903_GP1_INTMODE_WIDTH 1
84 #define WM8903_GP1_DB 0x0001
85 #define WM8903_GP1_DB_MASK 0x0001
86 #define WM8903_GP1_DB_SHIFT 0
87 #define WM8903_GP1_DB_WIDTH 1
88
89
90
91
92 #define WM8903_GP2_FN_MASK 0x1F00
93 #define WM8903_GP2_FN_SHIFT 8
94 #define WM8903_GP2_FN_WIDTH 5
95 #define WM8903_GP2_DIR 0x0080
96 #define WM8903_GP2_DIR_MASK 0x0080
97 #define WM8903_GP2_DIR_SHIFT 7
98 #define WM8903_GP2_DIR_WIDTH 1
99 #define WM8903_GP2_OP_CFG 0x0040
100 #define WM8903_GP2_OP_CFG_MASK 0x0040
101 #define WM8903_GP2_OP_CFG_SHIFT 6
102 #define WM8903_GP2_OP_CFG_WIDTH 1
103 #define WM8903_GP2_IP_CFG 0x0020
104 #define WM8903_GP2_IP_CFG_MASK 0x0020
105 #define WM8903_GP2_IP_CFG_SHIFT 5
106 #define WM8903_GP2_IP_CFG_WIDTH 1
107 #define WM8903_GP2_LVL 0x0010
108 #define WM8903_GP2_LVL_MASK 0x0010
109 #define WM8903_GP2_LVL_SHIFT 4
110 #define WM8903_GP2_LVL_WIDTH 1
111 #define WM8903_GP2_PD 0x0008
112 #define WM8903_GP2_PD_MASK 0x0008
113 #define WM8903_GP2_PD_SHIFT 3
114 #define WM8903_GP2_PD_WIDTH 1
115 #define WM8903_GP2_PU 0x0004
116 #define WM8903_GP2_PU_MASK 0x0004
117 #define WM8903_GP2_PU_SHIFT 2
118 #define WM8903_GP2_PU_WIDTH 1
119 #define WM8903_GP2_INTMODE 0x0002
120 #define WM8903_GP2_INTMODE_MASK 0x0002
121 #define WM8903_GP2_INTMODE_SHIFT 1
122 #define WM8903_GP2_INTMODE_WIDTH 1
123 #define WM8903_GP2_DB 0x0001
124 #define WM8903_GP2_DB_MASK 0x0001
125 #define WM8903_GP2_DB_SHIFT 0
126 #define WM8903_GP2_DB_WIDTH 1
127
128
129
130
131 #define WM8903_GP3_FN_MASK 0x1F00
132 #define WM8903_GP3_FN_SHIFT 8
133 #define WM8903_GP3_FN_WIDTH 5
134 #define WM8903_GP3_DIR 0x0080
135 #define WM8903_GP3_DIR_MASK 0x0080
136 #define WM8903_GP3_DIR_SHIFT 7
137 #define WM8903_GP3_DIR_WIDTH 1
138 #define WM8903_GP3_OP_CFG 0x0040
139 #define WM8903_GP3_OP_CFG_MASK 0x0040
140 #define WM8903_GP3_OP_CFG_SHIFT 6
141 #define WM8903_GP3_OP_CFG_WIDTH 1
142 #define WM8903_GP3_IP_CFG 0x0020
143 #define WM8903_GP3_IP_CFG_MASK 0x0020
144 #define WM8903_GP3_IP_CFG_SHIFT 5
145 #define WM8903_GP3_IP_CFG_WIDTH 1
146 #define WM8903_GP3_LVL 0x0010
147 #define WM8903_GP3_LVL_MASK 0x0010
148 #define WM8903_GP3_LVL_SHIFT 4
149 #define WM8903_GP3_LVL_WIDTH 1
150 #define WM8903_GP3_PD 0x0008
151 #define WM8903_GP3_PD_MASK 0x0008
152 #define WM8903_GP3_PD_SHIFT 3
153 #define WM8903_GP3_PD_WIDTH 1
154 #define WM8903_GP3_PU 0x0004
155 #define WM8903_GP3_PU_MASK 0x0004
156 #define WM8903_GP3_PU_SHIFT 2
157 #define WM8903_GP3_PU_WIDTH 1
158 #define WM8903_GP3_INTMODE 0x0002
159 #define WM8903_GP3_INTMODE_MASK 0x0002
160 #define WM8903_GP3_INTMODE_SHIFT 1
161 #define WM8903_GP3_INTMODE_WIDTH 1
162 #define WM8903_GP3_DB 0x0001
163 #define WM8903_GP3_DB_MASK 0x0001
164 #define WM8903_GP3_DB_SHIFT 0
165 #define WM8903_GP3_DB_WIDTH 1
166
167
168
169
170 #define WM8903_GP4_FN_MASK 0x1F00
171 #define WM8903_GP4_FN_SHIFT 8
172 #define WM8903_GP4_FN_WIDTH 5
173 #define WM8903_GP4_DIR 0x0080
174 #define WM8903_GP4_DIR_MASK 0x0080
175 #define WM8903_GP4_DIR_SHIFT 7
176 #define WM8903_GP4_DIR_WIDTH 1
177 #define WM8903_GP4_OP_CFG 0x0040
178 #define WM8903_GP4_OP_CFG_MASK 0x0040
179 #define WM8903_GP4_OP_CFG_SHIFT 6
180 #define WM8903_GP4_OP_CFG_WIDTH 1
181 #define WM8903_GP4_IP_CFG 0x0020
182 #define WM8903_GP4_IP_CFG_MASK 0x0020
183 #define WM8903_GP4_IP_CFG_SHIFT 5
184 #define WM8903_GP4_IP_CFG_WIDTH 1
185 #define WM8903_GP4_LVL 0x0010
186 #define WM8903_GP4_LVL_MASK 0x0010
187 #define WM8903_GP4_LVL_SHIFT 4
188 #define WM8903_GP4_LVL_WIDTH 1
189 #define WM8903_GP4_PD 0x0008
190 #define WM8903_GP4_PD_MASK 0x0008
191 #define WM8903_GP4_PD_SHIFT 3
192 #define WM8903_GP4_PD_WIDTH 1
193 #define WM8903_GP4_PU 0x0004
194 #define WM8903_GP4_PU_MASK 0x0004
195 #define WM8903_GP4_PU_SHIFT 2
196 #define WM8903_GP4_PU_WIDTH 1
197 #define WM8903_GP4_INTMODE 0x0002
198 #define WM8903_GP4_INTMODE_MASK 0x0002
199 #define WM8903_GP4_INTMODE_SHIFT 1
200 #define WM8903_GP4_INTMODE_WIDTH 1
201 #define WM8903_GP4_DB 0x0001
202 #define WM8903_GP4_DB_MASK 0x0001
203 #define WM8903_GP4_DB_SHIFT 0
204 #define WM8903_GP4_DB_WIDTH 1
205
206
207
208
209 #define WM8903_GP5_FN_MASK 0x1F00
210 #define WM8903_GP5_FN_SHIFT 8
211 #define WM8903_GP5_FN_WIDTH 5
212 #define WM8903_GP5_DIR 0x0080
213 #define WM8903_GP5_DIR_MASK 0x0080
214 #define WM8903_GP5_DIR_SHIFT 7
215 #define WM8903_GP5_DIR_WIDTH 1
216 #define WM8903_GP5_OP_CFG 0x0040
217 #define WM8903_GP5_OP_CFG_MASK 0x0040
218 #define WM8903_GP5_OP_CFG_SHIFT 6
219 #define WM8903_GP5_OP_CFG_WIDTH 1
220 #define WM8903_GP5_IP_CFG 0x0020
221 #define WM8903_GP5_IP_CFG_MASK 0x0020
222 #define WM8903_GP5_IP_CFG_SHIFT 5
223 #define WM8903_GP5_IP_CFG_WIDTH 1
224 #define WM8903_GP5_LVL 0x0010
225 #define WM8903_GP5_LVL_MASK 0x0010
226 #define WM8903_GP5_LVL_SHIFT 4
227 #define WM8903_GP5_LVL_WIDTH 1
228 #define WM8903_GP5_PD 0x0008
229 #define WM8903_GP5_PD_MASK 0x0008
230 #define WM8903_GP5_PD_SHIFT 3
231 #define WM8903_GP5_PD_WIDTH 1
232 #define WM8903_GP5_PU 0x0004
233 #define WM8903_GP5_PU_MASK 0x0004
234 #define WM8903_GP5_PU_SHIFT 2
235 #define WM8903_GP5_PU_WIDTH 1
236 #define WM8903_GP5_INTMODE 0x0002
237 #define WM8903_GP5_INTMODE_MASK 0x0002
238 #define WM8903_GP5_INTMODE_SHIFT 1
239 #define WM8903_GP5_INTMODE_WIDTH 1
240 #define WM8903_GP5_DB 0x0001
241 #define WM8903_GP5_DB_MASK 0x0001
242 #define WM8903_GP5_DB_SHIFT 0
243 #define WM8903_GP5_DB_WIDTH 1
244
245 #define WM8903_NUM_GPIO 5
246
247 struct wm8903_platform_data {
248 bool irq_active_low;
249
250
251
252
253
254
255 u16 micdet_cfg;
256
257 int micdet_delay;
258
259 int gpio_base;
260 u32 gpio_cfg[WM8903_NUM_GPIO];
261 };
262
263 #endif