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