Updated our source code header to explicitly mention that we are GPL v2 or
[Rockbox.git] / firmware / export / wm8978.h
blob3c01f76bef8764885204d28a3be2a07eafa32c07
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2008 by Michael Sevakis
12 * Header file for WM8978 codec
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
19 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20 * KIND, either express or implied.
22 ****************************************************************************/
23 #ifndef _WM8978_H
24 #define _WM8978_H
26 #define VOLUME_MIN -900
27 #define VOLUME_MAX 60
29 int tenthdb2master(int db);
30 void audiohw_set_headphone_vol(int vol_l, int vol_r);
32 #define WMC_I2C_ADDR 0x34
34 /* Registers */
35 #define WMC_SOFTWARE_RESET 0x00
36 #define WMC_POWER_MANAGEMENT1 0x01
37 #define WMC_POWER_MANAGEMENT2 0x02
38 #define WMC_POWER_MANAGEMENT3 0x03
39 #define WMC_AUDIO_INTERFACE 0x04
40 #define WMC_COMPANDING_CTRL 0x05
41 #define WMC_CLOCK_GEN_CTRL 0x06
42 #define WMC_ADDITIONAL_CTRL 0x07
43 #define WMC_GPIO 0x08
44 #define WMC_JACK_DETECT_CONTROL1 0x09
45 #define WMC_DAC_CONTROL 0x0a
46 #define WMC_LEFT_DAC_DIGITAL_VOL 0x0b
47 #define WMC_RIGHT_DAC_DIGITAL_VOL 0x0c
48 #define WMC_JACK_DETECT_CONTROL2 0x0d
49 #define WMC_ADC_CONTROL 0x0e
50 #define WMC_LEFT_ADC_DIGITAL_VOL 0x0f
51 #define WMC_RIGHT_ADC_DIGITAL_VOL 0x10
52 #define WMC_EQ1_LOW_SHELF 0x12
53 #define WMC_EQ2_PEAK1 0x13
54 #define WMC_EQ3_PEAK2 0x14
55 #define WMC_EQ4_PEAK3 0x15
56 #define WMC_EQ5_HIGH_SHELF 0x16
57 #define WMC_DAC_LIMITER1 0x18
58 #define WMC_DAC_LIMITER2 0x19
59 #define WMC_NOTCH_FILTER1 0x1b
60 #define WMC_NOTCH_FILTER2 0x1c
61 #define WMC_NOTCH_FILTER3 0x1d
62 #define WMC_NOTCH_FILTER4 0x1e
63 #define WMC_ALC_CONTROL1 0x20
64 #define WMC_ALC_CONTROL2 0x21
65 #define WMC_ALC_CONTROL3 0x22
66 #define WMC_NOISE_GATE 0x23
67 #define WMC_PLL_N 0x24
68 #define WMC_PLL_K1 0x25
69 #define WMC_PLL_K2 0x26
70 #define WMC_PLL_K3 0x27
71 #define WMC_3D_CONTROL 0x29
72 #define WMC_BEEP_CONTROL 0x2b
73 #define WMC_INPUT_CTRL 0x2c
74 #define WMC_LEFT_INP_PGA_GAIN_CTRL 0x2d
75 #define WMC_RIGHT_INP_PGA_GAIN_CTRL 0x2e
76 #define WMC_LEFT_ADC_BOOST_CTRL 0x2f
77 #define WMC_RIGHT_ADC_BOOST_CTRL 0x30
78 #define WMC_OUTPUT_CTRL 0x31
79 #define WMC_LEFT_MIXER_CTRL 0x32
80 #define WMC_RIGHT_MIXER_CTRL 0x33
81 #define WMC_LOUT1_HP_VOLUME_CTRL 0x34
82 #define WMC_ROUT1_HP_VOLUME_CTRL 0x35
83 #define WMC_LOUT2_SPK_VOLUME_CTRL 0x36
84 #define WMC_ROUT2_SPK_VOLUME_CTRL 0x37
85 #define WMC_OUT3_MIXER_CTRL 0x38
86 #define WMC_OUT4_MONO_MIXER_CTRL 0x39
87 #define WMC_NUM_REGISTERS 0x3a
89 /* Register bitmasks */
91 /* Volume update bit for volume registers */
92 #define WMC_VU (1 << 8)
94 /* Zero-crossing bit for volume registers */
95 #define WMC_ZC (1 << 7)
97 /* Mute bit for volume registers */
98 #define WMC_MUTE (1 << 6)
100 /* Volume masks and macros for digital volumes */
101 #define WMC_DVOL 0xff
102 #define WMC_DVOLr(x) ((x) & WMC_DVOL)
103 #define WMC_DVOLw(x) ((x) & WMC_DVOL)
105 /* Volums masks and macros for analogue volumes */
106 #define WMC_AVOL 0x3f
107 #define WMC_AVOLr(x) ((x) & WMC_AVOLUME_MASK)
108 #define WMC_AVOLw(x) ((x) & WMC_AVOLUME_MASK)
110 /* WMC_SOFTWARE_RESET (0x00) */
111 #define WMC_RESET
112 /* Write any value */
114 /* WMC_POWER_MANAGEMENT1 (0x01) */
115 #define WMC_BUFDCOMPEN (1 << 8)
116 #define WMC_OUT4MIXEN (1 << 7)
117 #define WMC_OUT3MIXEN (1 << 6)
118 #define WMC_PLLEN (1 << 5)
119 #define WMC_MICBEN (1 << 4)
120 #define WMC_BIASEN (1 << 3)
121 #define WMC_BUFIOEN (1 << 2)
122 #define WMC_VMIDSEL (3 << 0)
123 #define WMC_VMIDSEL_OFF (0 << 0)
124 #define WMC_VMIDSEL_75K (1 << 0)
125 #define WMC_VMIDSEL_300K (2 << 0)
126 #define WMC_VMIDSEL_5K (3 << 0)
128 /* WMC_POWER_MANAGEMENT2 (0x02) */
129 #define WMC_ROUT1EN (1 << 8)
130 #define WMC_LOUT1EN (1 << 7)
131 #define WMC_SLEEP (1 << 6)
132 #define WMC_BOOSTENR (1 << 5)
133 #define WMC_BOOSTENL (1 << 4)
134 #define WMC_INPPGAENR (1 << 3)
135 #define WMC_INPPGAENL (1 << 2)
136 #define WMC_ADCENR (1 << 1)
137 #define WMC_ADCENL (1 << 0)
139 /* WMC_POWER_MANAGEMENT3 (0x03) */
140 #define WMC_OUT4EN (1 << 8)
141 #define WMC_OUT3EN (1 << 7)
142 #define WMC_LOUT2EN (1 << 6)
143 #define WMC_ROUT2EN (1 << 5)
144 #define WMC_RMIXEN (1 << 3)
145 #define WMC_LMIXEN (1 << 2)
146 #define WMC_DACENR (1 << 1)
147 #define WMC_DACENL (1 << 0)
149 /* WMC_AUDIO_INTERFACE (0x04) */
150 #define WMC_BCP (1 << 8)
151 #define WMC_LRP (1 << 7)
152 #define WMC_WL (3 << 5)
153 #define WMC_WL_16 (0 << 5)
154 #define WMC_WL_20 (1 << 5)
155 #define WMC_WL_24 (2 << 5)
156 #define WMC_WL_32 (3 << 5)
157 #define WMC_FMT (3 << 3)
158 #define WMC_FMT_RJUST (0 << 3)
159 #define WMC_FMT_LJUST (1 << 3)
160 #define WMC_FMT_I2S (2 << 3)
161 #define WMC_FMT_DSP_PCM (3 << 3)
162 #define WMC_DACLRSWAP (1 << 2)
163 #define WMC_ADCLRSWAP (1 << 1)
164 #define WMC_MONO (1 << 0)
166 /* WMC_COMPANDING_CTRL (0x05) */
167 #define WMC_WL8 (1 << 5)
168 #define WMC_DAC_COMP (3 << 3)
169 #define WMC_DAC_COMP_OFF (0 << 3)
170 #define WMC_DAC_COMP_U_LAW (2 << 3)
171 #define WMC_DAC_COMP_A_LAW (3 << 3)
172 #define WMC_ADC_COMP (3 << 1)
173 #define WMC_ADC_COMP_OFF (0 << 1)
174 #define WMC_ADC_COMP_U_LAW (2 << 1)
175 #define WMC_ADC_COMP_A_LAW (3 << 1)
176 #define WMC_LOOPBACK (1 << 0)
178 /* WMC_CLOCK_GEN_CTRL (0x06) */
179 #define WMC_CLKSEL (1 << 8)
180 #define WMC_MCLKDIV (7 << 5)
181 #define WMC_MCLKDIV_1 (0 << 5)
182 #define WMC_MCLKDIV_1_5 (1 << 5)
183 #define WMC_MCLKDIV_2 (2 << 5)
184 #define WMC_MCLKDIV_3 (3 << 5)
185 #define WMC_MCLKDIV_4 (4 << 5)
186 #define WMC_MCLKDIV_6 (5 << 5)
187 #define WMC_MCLKDIV_8 (6 << 5)
188 #define WMC_MCLKDIV_12 (7 << 5)
189 #define WMC_BCLKDIV (7 << 2)
190 #define WMC_BCLKDIV_1 (0 << 2)
191 #define WMC_BCLKDIV_2 (1 << 2)
192 #define WMC_BCLKDIV_4 (2 << 2)
193 #define WMC_BCLKDIV_8 (3 << 2)
194 #define WMC_BCLKDIV_16 (4 << 2)
195 #define WMC_BCLKDIV_32 (5 << 2)
196 #define WMC_MS (1 << 0)
198 /* WMC_ADDITIONAL_CTRL (0x07) */
199 /* This configure the digital filter coefficients - pick the closest
200 * to what's really being used (greater than or equal). */
201 #define WMC_SR (7 << 1)
202 #define WMC_SR_48KHZ (0 << 1)
203 #define WMC_SR_32KHZ (1 << 1)
204 #define WMC_SR_24KHZ (2 << 1)
205 #define WMC_SR_16KHZ (3 << 1)
206 #define WMC_SR_12KHZ (4 << 1)
207 #define WMC_SR_8KHZ (5 << 1)
208 /* 110-111=reserved */
209 #define WMC_SLOWCLKEN (1 << 0)
211 /* WMC_GPIO (0x08) */
212 #define WMC_OPCLKDIV (3 << 4)
213 #define WMC_OPCLKDIV_1 (0 << 4)
214 #define WMC_OPCLKDIV_2 (1 << 4)
215 #define WMC_OPCLKDIV_3 (2 << 4)
216 #define WMC_OPCLKDIV_4 (3 << 4)
217 #define WMC_GPIO1POL (1 << 3)
218 #define WMC_GPIO1SEL (7 << 0)
219 #define WMC_GPIO1SEL_TEMP_OK (2 << 0)
220 #define WMC_GPIO1SEL_AMUTE_ACTIVE (3 << 0)
221 #define WMC_GPIO1SEL_PLL_CLK_OP (4 << 0)
222 #define WMC_GPIO1SEL_PLL_LOCK (5 << 0)
223 #define WMC_GPIO1SEL_LOGIC_1 (6 << 0)
224 #define WMC_GPIO1SEL_LOGIC_0 (7 << 0)
226 /* WMC_JACK_DETECT_CONTROL1 (0x09) */
227 #define WMC_JD_VMID (3 << 7)
228 #define WMC_JD_VMID_EN_0 (1 << 7)
229 #define WMC_JD_VMID_EN_1 (2 << 7)
230 #define WMC_JD_EN (1 << 6)
231 #define WMC_JD_SEL (3 << 4)
232 #define WMC_JD_SEL_GPIO1 (0 << 4)
233 #define WMC_JD_SEL_GPIO2 (1 << 4)
234 #define WMC_JD_SEL_GPIO3 (2 << 4)
236 /* WMC_DAC_CONTROL (0x0a) */
237 #define WMC_SOFT_MUTE (1 << 6)
238 #define WMC_DACOSR_128 (1 << 3)
239 #define WMC_AMUTE (1 << 2)
240 #define WMC_DACPOLR (1 << 1)
241 #define WMC_DACPOLL (1 << 0)
243 /* WMC_LEFT_DAC_DIGITAL_VOL (0x0b) */
244 /* WMC_RIGHT_DAC_DIGITAL_VOL (0x0c) */
245 /* 00000000=mute, 00000001=-127dB...(0.5dB steps)...11111111=0dB */
246 /* Use WMC_DVOL* macros */
248 /* WMC_JACK_DETECT_CONTROL2 (0x0d) */
249 #define WMC_JD_EN1 (0xf << 4)
250 #define WMC_OUT1_EN1 (1 << 4)
251 #define WMC_OUT2_EN1 (2 << 4)
252 #define WMC_OUT3_EN1 (4 << 4)
253 #define WMC_OUT4_EN1 (8 << 4)
254 #define WMC_JD_EN0 (0xf << 0)
255 #define WMC_OUT1_EN0 (1 << 0)
256 #define WMC_OUT2_EN0 (2 << 0)
257 #define WMC_OUT3_EN0 (4 << 0)
258 #define WMC_OUT4_EN0 (8 << 0)
260 /* WMC_ADC_CONTROL (0x0e) */
261 #define WMC_HPFEN (1 << 8)
262 #define WMC_HPFAPP (1 << 7)
263 #define WMC_HPFCUT (7 << 4)
264 #define WMC_ADCOSR (1 << 3)
265 #define WMC_ADCRPOL (1 << 1)
266 #define WMC_ADCLPOL (1 << 0)
268 /* WMC_LEFT_ADC_DIGITAL_VOL (0x0f) */
269 /* WMC_RIGHT_ADC_DITIGAL_VOL (0x10) */
270 /* 0.5dB steps: Mute:0x00, -127dB:0x01...0dB:0xff */
271 /*Use WMC_DVOL* macros */
273 /* Macros for EQ gain and cutoff */
274 #define WMC_EQGC 0x1f
275 #define WMC_EQGCr(x) ((x) & WMC_EQGC)
276 #define WMC_EQGCw(x) ((x) & WMC_EQGC)
278 /* WMC_EQ1_LOW_SHELF (0x12) */
279 #define WMC_EQ3DMODE (1 << 8)
280 #define WMC_EQ1C (3 << 5) /* Cutoff */
281 #define WMC_EQ1C_80HZ (0 << 5) /* 80Hz */
282 #define WMC_EQ1C_105HZ (1 << 5) /* 105Hz */
283 #define WMC_EQ1C_135HZ (2 << 5) /* 135Hz */
284 #define WMC_EQ1C_175HZ (3 << 5) /* 175Hz */
285 /* 00000=+12dB, 00001=+11dB...(-1dB steps)...11000=-12dB, 11001-11111=reserved */
287 /* WMC_EQ2_PEAK1 (0x13) */
288 #define WMC_EQ2BW (1 << 8)
289 #define WMC_EQ2C (3 << 5) /* Center */
290 #define WMC_EQ2C_230HZ (0 << 5) /* 230Hz */
291 #define WMC_EQ2C_300HZ (1 << 5) /* 300Hz */
292 #define WMC_EQ2C_385HZ (2 << 5) /* 385Hz */
293 #define WMC_EQ2C_500HZ (3 << 5) /* 500Hz */
294 /* 00000=+12dB, 00001=+11dB...(-1dB steps)...11000=-12dB,
295 11001-11111=reserved */
297 /* WMC_EQ3_PEAK2 (0x14) */
298 #define WMC_EQ3BW (1 << 8)
299 #define WMC_EQ3C (3 << 5) /* Center */
300 #define WMC_EQ3C_650HZ (0 << 5) /* 650Hz */
301 #define WMC_EQ3C_850HZ (1 << 5) /* 850Hz */
302 #define WMC_EQ3C_1_1KHZ (2 << 5) /* 1.1kHz */
303 #define WMC_EQ3C_1_4KHZ (3 << 5) /* 1.4kHz */
304 /* 00000=+12dB, 00001=+11dB...(-1dB steps)...11000=-12dB,
305 11001-11111=reserved */
307 /* WMC_EQ4_PEAK3 (0x15) */
308 #define WMC_EQ4BW (1 << 8)
309 #define WMC_EQ4C (3 << 5) /* Center */
310 #define WMC_EQ4C_1_8KHZ (0 << 5) /* 1.8kHz */
311 #define WMC_EQ4C_2_4KHZ (1 << 5) /* 2.4kHz */
312 #define WMC_EQ4C_3_2KHZ (2 << 5) /* 3.2kHz */
313 #define WMC_EQ4C_4_1KHZ (3 << 5) /* 4.1kHz */
314 /* 00000=+12dB, 00001=+11dB...(-1dB steps)...11000=-12dB,
315 11001-11111=reserved */
317 /* WMC_EQ5_HIGH_SHELF (0x16) */
318 #define WMC_EQ5C (3 << 5) /* Cutoff */
319 #define WMC_EQ5C_5_3KHZ (0 << 5) /* 5.3kHz */
320 #define WMC_EQ5C_6_9KHZ (1 << 5) /* 6.9kHz */
321 #define WMC_EQ5C_9KHZ (2 << 5) /* 9.0kHz */
322 #define WMC_EQ5C_11_7KHZ (3 << 5) /* 11.7kHz */
323 /* 00000=+12dB, 00001=+11dB...(-1dB steps)...11000=-12dB,
324 11001-11111=reserved */
326 /* WMC_DAC_LIMITER1 (0x18) */
327 #define WMC_LIMEN (1 << 8)
328 /* 0000=750uS, 0001=1.5mS...(x2 each step)...1010-1111=768mS */
329 #define WMC_LIMDCY (0xf << 4)
330 #define WMC_LIMDCYr(x) (((x) & WMC_LIMDCY) >> 4)
331 #define WMC_LIMDCYw(x) (((x) << 4) & WMC_LIMDCY)
332 /* 0000=94uS, 0001=188uS...(x2 each step)...1011-1111=192mS */
333 #define WMC_LIMATK (0xf << 0)
334 #define WMC_LIMATKr(x) ((x) & WMC_LIMATK)
335 #define WMC_LIMATKw(x) ((x) & WMC_LIMATK)
337 /* WMC_DAC_LIMITER2 (0x19) */
338 #define WMC_LIMLVL (7 << 4)
339 /* 000=-1dB, 001=-2dB...(-1dB steps)...101-111:-6dB */
340 #define WMC_LIMLVLr(x) (((x) & WMC_LIMLVL) >> 4)
341 #define WMC_LIMLVLw(x) (((x) << 4) & WMC_LIMLVL)
342 #define WMC_LIMBOOST (0xf << 0)
343 /* 0000=0dB, 0001=+1dB...1100=+12dB, 1101-1111=reserved */
344 #define WMC_LIMBOOSTr(x) (((x) & WMC_LIMBOOST)
345 #define WMC_LIMBOOSTw(x) (((x) & WMC_LIMBOOST)
348 /* Generic notch filter bits and macros */
349 #define WMC_NFU (1 << 8)
350 #define WMC_NFA (0x7f << 0)
351 #define WMC_NFAr(x) ((x) & WMC_NFA)
352 #define WMC_NFAw(x) ((x) & WMC_NFA)
354 /* WMC_NOTCH_FILTER1 (0x1b) */
355 #define WMC_NFEN (1 << 7)
356 /* WMC_NOTCH_FILTER2 (0x1c) */
357 /* WMC_NOTCH_FILTER3 (0x1d) */
358 /* WMC_NOTCH_FILTER4 (0x1e) */
360 /* WMC_ALC_CONTROL1 (0x20) */
361 #define WMC_ALCSEL (3 << 7)
362 #define WMC_ALCSEL_OFF (0 << 7)
363 #define WMC_ALCSEL_RIGHT_ONLY (1 << 7)
364 #define WMC_ALCSEL_LEFT_ONLY (2 << 7)
365 #define WMC_ALCSEL_BOTH_ON (3 << 7)
366 /* 000=-6.75dB, 001=-0.75dB...(6dB steps)...111=+35.25dB */
367 #define WMC_ALCMAXGAIN (7 << 3)
368 #define WMC_ALCMAXGAINr(x) (((x) & WMC_ALCMAXGAIN) >> 3)
369 #define WMC_ALCMAXGAINw(x) (((x) << 3) & WMC_ALCMAXGAIN)
370 /* 000:-12dB...(6dB steps)...111:+30dB */
371 #define WMC_ALCMINGAIN (7 << 0)
372 #define WMC_ALCMINGAINr(x) ((x) & WMC_ALCMINGAIN)
373 #define WMC_ALCMINGAINw(x) ((x) & WMC_ALCMINGAIN)
375 /* WMC_ALC_CONTROL2 (0x21) */
376 /* 0000=0ms, 0001=2.67ms, 0010=5.33ms...
377 (2x with every step)...43.691s */
378 #define WMC_ALCHLD (0xf << 4)
379 #define WMC_ALCHLDr(x) (((x) & WMC_ALCHLD) >> 4)
380 #define WMC_ALCHLDw(x) (((x) << 4) & WMC_ALCHLD)
381 /* 1111:-1.5dBFS, 1110:-1.5dBFS, 1101:-3dBFS, 1100:-4.5dBFS...
382 (-1.5dB steps)...0001:-21dBFS, 0000:-22.5dBFS */
383 #define WMC_ALCLVL (0xf << 0)
384 #define WMC_ALCLVLr(x) ((x) & WMC_ALCLVL)
385 #define WMC_ALCLVLw(x) ((x) & WMC_ALCLVL)
387 /* WMC_ALC_CONTROL3 (0x22) */
388 #define WMC_ALCMODE (1 << 8)
389 #define WMC_ALCDCY (0xf << 4)
390 #define WMC_ALCATK (0xf << 0)
392 /* WMC_NOISE_GATE (0x23) */
393 #define WMC_NGEN (1 << 3)
394 /* 000=-39dB, 001=-45dB, 010=-51dB...(6dB steps)...111=-81dB */
395 #define WMC_NGTH (7 << 0)
396 #define WMC_NGTHr(x) ((x) & WMC_NGTH)
397 #define WMC_NGTHw(x) ((x) & WMC_NGTH)
399 /* WMC_PLL_N (0x24) */
400 #define WMC_PLL_PRESCALE (1 << 4)
401 #define WMC_PLLN (0xf << 0)
402 #define WMC_PLLNr(x) ((x) & WMC_PLLN)
403 #define WMC_PLLNw(x) ((x) & WMC_PLLN)
405 /* WMC_PLL_K1 (0x25) */
406 #define WMC_PLLK_23_18 (0x3f << 0)
407 #define WMC_PLLK_23_18r(x) ((x) & WMC_PLLK_23_18)
408 #define WMC_PLLK_23_18w(x) ((x) & WMC_PLLK_23_18)
410 /* WMC_PLL_K2 (0x26) */
411 #define WMC_PLLK_17_9 (0x1ff << 0)
412 #define WMC_PLLK_17_9r(x) ((x) & WMC_PLLK_17_9)
413 #define WMC_PLLK_17_9w(x) ((x) & WMC_PLLK_17_9)
415 /* WMC_PLL_K3 (0x27) */
416 #define WMC_PLLK_8_0 (0x1ff << 0)
417 #define WMC_PLLK_8_0r(x) ((x) & WMC_PLLK_8_0)
418 #define WMC_PLLK_8_0w(x) ((x) & WMC_PLLK_8_0)
420 /* WMC_3D_CONTROL (0x29) */
421 /* 0000: 0%, 0001: 6.67%...1110: 93.3%, 1111: 100% */
422 #define WMC_DEPTH3D (0xf << 0)
423 #define WMC_DEPTH3Dw(x) ((x) & WMC_DEPTH3D)
424 #define WMC_DEPTH3Dr(x) ((x) & WMC_DEPTH3D)
426 /* WMC_BEEP_CONTROL (0x2b) */
427 #define WMC_MUTERPGA2INV (1 << 5)
428 #define WMC_INVROUT2 (1 << 4)
429 /* 000=-15dB, 001=-12dB...111=+6dB */
430 #define WMC_BEEPVOL (7 << 1)
431 #define WMC_BEEPVOLr(x) (((x) & WMC_BEEPVOL) >> 1)
432 #define WMC_BEEPVOLw(x) (((x) << 1) & WMC_BEEPVOL)
433 #define WMC_BEEPEN (1 << 0)
435 /* WMC_INPUT_CTRL (0x2c) */
436 #define WMC_MBVSEL (1 << 8)
437 #define WMC_R2_2INPPGA (1 << 6)
438 #define WMC_RIN2INPPGA (1 << 5)
439 #define WMC_RIP2INPPGA (1 << 4)
440 #define WMC_L2_2INPPGA (1 << 2)
441 #define WMC_LIN2INPPGA (1 << 1)
442 #define WMC_LIP2INPPGA (1 << 0)
444 /* WMC_LEFT_INP_PGA_GAIN_CTRL (0x2d) */
445 /* 000000=-12dB, 000001=-11.25dB...010000=0dB, 111111=+35.25dB */
446 /* Uses WMC_AVOL* macros */
448 /* WMC_RIGHT_INP_PGA_GAIN_CTRL (0x2e) */
449 /* 000000=-12dB, 000001=-11.25dB...010000=0dB, 111111=+35.25dB */
450 /* Uses WMC_AVOL* macros */
452 /* WMC_LEFT_ADC_BOOST_CTRL (0x2f) */
453 #define WMC_PGABOOSTL (1 << 8)
454 /* 000=disabled, 001=-12dB, 010=-9dB...111=+6dB */
455 #define WMC_L2_2BOOSTVOL (7 << 4)
456 #define WMC_L2_2BOOSTVOLr(x) ((x) & WMC_L2_2_BOOSTVOL) >> 4)
457 #define WMC_L2_2BOOSTVOLw(x) ((x) << 4) & WMC_L2_2_BOOSTVOL)
458 /* 000=disabled, 001=-12dB, 010=-9dB...111=+6dB */
459 #define WMC_AUXL2BOOSTVOL (7 << 0)
460 #define WMC_AUXL2BOOSTVOLr(x) ((x) & WMC_AUXL2BOOSTVOL)
461 #define WMC_AUXL2BOOSTVOLw(x) ((x) & WMC_AUXL2BOOSTVOL)
463 /* WMC_RIGHT_ADC_BOOST_CTRL (0x30) */
464 #define WMC_PGABOOSTR (1 << 8)
465 /* 000=disabled, 001=-12dB, 010=-9dB...111=+6dB */
466 #define WMC_R2_2_BOOSTVOL (7 << 4)
467 #define WMC_R2_2BOOSTVOLr(x) ((x) & WMC_R2_2_BOOSTVOL) >> 4)
468 #define WMC_R2_2BOOSTVOLw(x) ((x) << 4) & WMC_R2_2_BOOSTVOL)
469 /* 000=disabled, 001=-12dB, 010=-9dB...111=+6dB */
470 #define WMC_AUXR2BOOSTVOL (7 << 0)
471 #define WMC_AUXR2BOOSTVOLr(x) ((x) & WMC_AUXR2BOOSTVOL)
472 #define WMC_AUXR2BOOSTVOLw(x) ((x) & WMC_AUXR2BOOSTVOL)
474 /* WMC_OUTPUT_CTRL (0x31) */
475 #define WMC_DACL2RMIX (1 << 6)
476 #define WMC_DACR2LMIX (1 << 5)
477 #define WMC_OUT4BOOST (1 << 4)
478 #define WMC_OUT3BOOST (1 << 3)
479 #define WMC_SPKBOOST (1 << 2)
480 #define WMC_TSDEN (1 << 1)
481 #define WMC_VROI (1 << 0)
483 /* WMC_LEFT_MIXER_CTRL (0x32) */
484 /* 000=-15dB, 001=-12dB...101=0dB, 110=+3dB, 111=+6dB */
485 #define WMC_AUXLMIXVOL (7 << 6)
486 #define WMC_AUXLMIXVOLr(x) ((x) & WMC_AUXLMIXVOL) >> 6)
487 #define WMC_AUXLMIXVOLw(x) ((x) << 6) & WMC_AUXLMIXVOL)
488 #define WMC_AUXL2LMIX (1 << 5)
489 /* 000=-15dB, 001=-12dB...101=0dB, 110=+3dB, 111=+6dB */
490 #define WMC_BYPLMIXVOL (7 << 2)
491 #define WMC_BYPLMIXVOLr(x) ((x) & WMC_BYPLMIXVOL) >> 2)
492 #define WMC_BYPLMIXVOLw(x) ((x) << 2) & WMC_BYPLMIXVOL)
493 #define WMC_BYPL2LMIX (1 << 1)
494 #define WMC_DACL2LMIX (1 << 0)
496 /* WMC_RIGHT_MIXER_CTRL (0x33) */
497 /* 000=-15dB, 001=-12dB...101=0dB, 110=+3dB, 111=+6dB */
498 #define WMC_AUXRMIXVOL (7 << 6)
499 #define WMC_AUXRMIXVOLr(x) ((x) & WMC_AUXRMIXVOL) >> 6)
500 #define WMC_AUXRMIXVOLw(x) ((x) << 6) & WMC_AUXRMIXVOL)
501 #define WMC_AUXR2RMIX (1 << 5)
502 /* 000=-15dB, 001=-12dB...101=0dB, 110=+3dB, 111=+6dB */
503 #define WMC_BYPRMIXVOL (7 << 2)
504 #define WMC_BYPRMIXVOLr(x) ((x) & WMC_BYPRMIXVOL) >> 2)
505 #define WMC_BYPRMIXVOLw(x) ((x) << 2) & WMC_BYPRMIXVOL)
506 #define WMC_BYPR2RMIX (1 << 1)
507 #define WMC_DACR2RMIX (1 << 0)
509 /* WMC_LOUT1_HP_VOLUME_CTRL (0x34) */
510 /* WMC_ROUT1_HP_VOLUME_CTRL (0x35) */
511 /* WMC_LOUT2_SPK_VOLUME_CTRL (0x36) */
512 /* WMC_ROUT2_SPK_VOLUME_CTRL (0x37) */
513 /* 000000=-57dB...111001=0dB...111111=+6dB */
514 /* Uses WMC_AVOL* macros */
516 /* WMC_OUT3_MIXER_CTRL (0x38) */
517 #define WMC_OUT3MUTE (1 << 6)
518 #define WMC_OUT42OUT3 (1 << 3)
519 #define WMC_BYPL2OUT3 (1 << 2)
520 #define WMC_LMIX2OUT3 (1 << 1)
521 #define WMC_LDAC2OUT3 (1 << 0)
523 /* WMC_OUT4_MONO_MIXER_CTRL (0x39) */
524 #define WMC_OUT4MUTE (1 << 6)
525 #define WMC_HALFSIG (1 << 5)
526 #define WMC_LMIX2OUT4 (1 << 4)
527 #define WMC_LDAC2OUT4 (1 << 3)
528 #define WMC_BYPR2OUT4 (1 << 2)
529 #define WMC_RMIX2OUT4 (1 << 1)
530 #define WMC_RDAC2OUT4 (1 << 0)
532 #endif /* _WM8978_H */