Fix advanced EQ menu
[maemo-rb.git] / firmware / export / wm8751.h
blob3bbf7444630794c6e285bee8bffce880a1c0ea76
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2005 by Dave Chapman
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
21 #ifndef _WM8751_H
22 #define _WM8751_H
24 /* volume/balance/treble/bass interdependency */
25 #define VOLUME_MIN -730
26 #define VOLUME_MAX 60
28 #if defined(HAVE_WM8750)
29 #define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP | PRESCALER_CAP | \
30 BASS_CUTOFF_CAP | TREBLE_CUTOFF_CAP | \
31 DEPTH_3D_CAP)
32 #else
34 #define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP | PRESCALER_CAP | \
35 BASS_CUTOFF_CAP | TREBLE_CUTOFF_CAP)
36 #endif
38 extern int tenthdb2master(int db);
40 extern void audiohw_set_master_vol(int vol_l, int vol_r);
41 extern void audiohw_set_lineout_vol(int vol_l, int vol_r);
42 #if defined(HAVE_WM8750) && defined(HAVE_RECORDING)
43 void audiohw_set_recsrc(int source, bool recording);
44 #endif
46 /* Register addresses and bits */
47 #define OUTPUT_MUTED 0x2f
48 #define OUTPUT_0DB 0x79
50 #if defined(HAVE_WM8750)
51 #define LINVOL 0x00
52 #define LINVOL_LINVOL(x) ((x) & 0x3f)
53 #define LINVOL_LIZC (1 << 6)
54 #define LINVOL_LINMUTE (1 << 7)
55 #define LINVOL_LIVU (1 << 8)
57 #define RINVOL 0x01
58 #define RINVOL_RINVOL(x) ((x) & 0x3f)
59 #define RINVOL_RIZC (1 << 6)
60 #define RINVOL_RINMUTE (1 << 7)
61 #define RINVOL_RIVU (1 << 8)
62 #endif
64 #define LOUT1 0x02
65 #define LOUT1_LOUT1VOL_MASK 0x07f
66 #define LOUT1_LOUT1VOL(x) ((x) & 0x7f)
67 #define LOUT1_LO1ZC (1 << 7)
68 #define LOUT1_LO1VU (1 << 8)
70 #define ROUT1 0x03
71 #define ROUT1_ROUT1VOL_MASK 0x17f
72 #define ROUT1_ROUT1VOL(x) ((x) & 0x7f)
73 #define ROUT1_RO1ZC (1 << 7)
74 #define ROUT1_RO1VU (1 << 8)
76 #define DACCTRL 0x05
77 #define DACCTRL_DEEMPH_NONE (0 << 1)
78 #define DACCTRL_DEEMPH_32 (1 << 1)
79 #define DACCTRL_DEEMPH_44 (2 << 1)
80 #define DACCTRL_DEEMPH_48 (3 << 1)
81 #define DACCTRL_DEEMPH(x) ((x) & (0x3 << 1))
82 #define DACCTRL_DACMU (1 << 3)
83 #define DACCTRL_DAT (1 << 7)
85 #define AINTFCE 0x07
86 #define AINTFCE_FORMAT_RJUST (0 << 0)
87 #define AINTFCE_FORMAT_LJUST (1 << 0)
88 #define AINTFCE_FORMAT_I2S (2 << 0)
89 #define AINTFCE_FORMAT_DSP (3 << 0)
90 #define AINTFCE_FORMAT(x) ((x) & 0x3)
91 #define AINTFCE_WL_16 (0 << 2)
92 #define AINTFCE_WL_20 (1 << 2)
93 #define AINTFCE_WL_24 (2 << 2)
94 #define AINTFCE_WL_32 (3 << 2)
95 #define AINTFCE_WL(x) ((x) & (0x3 << 2))
96 #define AINTFCE_LRP (1 << 4)
97 #define AINTFCE_LRSWAP (1 << 5)
98 #define AINTFCE_MS (1 << 6)
99 #define AINTFCE_BCLKINV (1 << 7)
101 #define CLOCKING 0x08
102 #define CLOCKING_SR_USB (1 << 0)
103 #define CLOCKING_SR(x) ((x) & (0x1f << 1))
104 #define CLOCKING_MCLK_DIV2 (1 << 6)
105 #define CLOCKING_BCLK_DIV2 (1 << 7)
107 #define LEFTGAIN 0x0a
108 #define LEFTGAIN_LDACVOL 0xff
109 #define LEFTGAIN_LDVU (1 << 8)
111 #define RIGHTGAIN 0x0b
112 #define RIGHTGAIN_RDACVOL 0xff
113 #define RIGHTGAIN_RDVU (1 << 8)
115 #define BASSCTRL 0x0c
116 #define BASSCTRL_BASS_MASK 0x0f
117 #define BASSCTRL_BASS(x) ((x) & 0xf)
118 #define BASSCTRL_BC (1 << 6)
119 #define BASSCTRL_BB (1 << 7)
121 #define TREBCTRL 0x0d
122 #define TREBCTRL_TREB_MASK 0x0f
123 #define TREBCTRL_TREB(x) ((x) & 0xf)
124 #define TREBCTRL_TC (1 << 6)
126 #define RESET 0x0f
127 #define RESET_RESET 0x000
129 #if defined(HAVE_WM8750)
130 #define ENHANCE_3D 0x10
131 #define ENHANCE_3D_3DEN (1 << 0)
132 #define ENHANCE_3D_DEPTH(x) (((x) & 0xf) << 1)
133 #define ENHANCE_3D_DEPTH_MASK (0x0f << 1)
134 #define ENHANCE_3D_3DLC (1 << 5)
135 #define ENHANCE_3D_3DUC (1 << 6)
136 #define ENHANCE_3D_MODE3D_PLAYBACK (1 << 7)
137 #define ENHANCE_3D_MODE3D_RECORD (0 << 7)
139 #define ALC1 0x11
140 #define ALC1_ALCL(x) ((x) & 0x0f)
141 #define ALC1_MAXGAIN(x) (((x) & 0x07) << 4)
142 #define ALC1_ALCSEL_DISABLED (0 << 7)
143 #define ALC1_ALCSEL_RIGHT (1 << 7)
144 #define ALC1_ALCSEL_LEFT (2 << 7)
145 #define ALC1_ALCSEL_STEREO (3 << 7)
146 #define ALC1_ALCSEL_MASK (3 << 7)
148 #define ALC2 0x12
149 #define ALC2_HLD(x) ((x) & 0x0f)
150 #define ALC2_ALCZC (1 << 7)
152 #define ALC3 0x13
153 #define ALC3_ATK(x) ((x) & 0x0f)
154 #define ALC3_DCY(x) (((x) & 0x0f) << 4)
156 #define NGAT 0x14
157 #define NGAT_NGAT (1 << 0)
158 #define NGAT_NGG_CONST (0 << 1)
159 #define NGAT_NGG_MUTEADC (1 << 1)
160 #define NGAT_NGG(x) (((x) & 0x3) << 1)
161 #define NGAT_NGTH(x) (((x) & 0x1f) << 3)
163 #define LADCVOL 0x15
164 #define LADCVOL_LADCVOL(x) ((x) & 0xff)
165 #define LADCVOL_LAVU (1 << 8)
167 #define RADCVOL 0x16
168 #define RADCVOL_RADCVOL(x) ((x) & 0xff)
169 #define RADCVOL_RAVU (1 << 8)
170 #endif
172 #define ADDITIONAL1 0x17
173 #define ADDITIONAL1_TOEN (1 << 0)
174 #define ADDITIONAL1_DACINV (1 << 1)
175 #define ADDITIONAL1_DMONOMIX_LLRR (0 << 4)
176 #define ADDITIONAL1_DMONOMIX_ML0R (1 << 4)
177 #define ADDITIONAL1_DMONOMIX_0LMR (2 << 4)
178 #define ADDITIONAL1_DMONOMIX_MLMR (3 << 4)
179 #define ADDITIONAL1_DMONOMIX(x) ((x) & (0x03 << 4))
180 #define ADDITIONAL1_VSEL_LOWEST (0 << 6)
181 #define ADDITIONAL1_VSEL_LOW (1 << 6)
182 #define ADDITIONAL1_VSEL_DEFAULT2 (2 << 6)
183 #define ADDITIONAL1_VSEL_DEFAULT (3 << 6)
184 #define ADDITIONAL1_VSEL(x) ((x) & (0x3 << 6))
185 #define ADDITIONAL1_VSEL_MASK (3 << 6)
186 #define ADDITIONAL1_TSDEN (1 << 8)
188 #define ADDITIONAL2 0x18
189 #define ADDITIONAL2_DACOSR (1 << 0)
190 #define ADDITIONAL2_HPSWZC (1 << 3)
191 #define ADDITIONAL2_ROUT2INV (1 << 4)
192 #define ADDITIONAL2_HPSWPOL (1 << 5)
193 #define ADDITIONAL2_HPSWEN (1 << 6)
194 #define ADDITIONAL2_OUT3SW_VREF (0 << 7)
195 #define ADDITIONAL2_OUT3SW_ROUT1 (1 << 7)
196 #define ADDITIONAL2_OUT3SW_MONOOUT (2 << 7)
197 #define ADDITIONAL2_OUT3SW_R_MIX_OUT (3 << 7)
198 #define ADDITIONAL2_OUT3SW(x) ((x) & (0x3 << 7))
200 #define PWRMGMT1 0x19
201 #define PWRMGMT1_DIGENB (1 << 0)
202 #if defined(HAVE_WM8750)
203 #define PWRMGMT1_MICBIAS (1 << 1)
204 #define PWRMGMT1_ADCR (1 << 2)
205 #define PWRMGMT1_ADCL (1 << 3)
206 #define PWRMGMT1_AINR (1 << 4)
207 #define PWRMGMT1_AINL (1 << 5)
208 #endif
209 #define PWRMGMT1_VREF (1 << 6)
210 #define PWRMGMT1_VMIDSEL_DISABLED (0 << 7)
211 #define PWRMGMT1_VMIDSEL_50K (1 << 7)
212 #define PWRMGMT1_VMIDSEL_500K (2 << 7)
213 #define PWRMGMT1_VMIDSEL_5K (3 << 7)
214 #define PWRMGMT1_VMIDSEL(x) ((x) & (0x3 << 7))
215 #define PWRMGMT1_VMIDSEL_MASK ((1<<8)|(1<<7))
217 #define PWRMGMT2 0x1a
218 #define PWRMGMT2_OUT3 (1 << 1)
219 #define PWRMGMT2_MOUT (1 << 2)
220 #define PWRMGMT2_ROUT2 (1 << 3)
221 #define PWRMGMT2_LOUT2 (1 << 4)
222 #define PWRMGMT2_ROUT1 (1 << 5)
223 #define PWRMGMT2_LOUT1 (1 << 6)
224 #define PWRMGMT2_DACR (1 << 7)
225 #define PWRMGMT2_DACL (1 << 8)
227 #define ADDITIONAL3 0x1b
228 #define ADDITIONAL3_ADCLRM ((x) & (0x3 << 7))
229 #define ADDITIONAL3_HPFLREN (1 << 5)
230 #define ADDITIONAL3_VROI (1 << 6)
232 #if defined(HAVE_WM8750)
233 #define ADCIM 0x1f
234 #define ADCIM_LDCM (1 << 4)
235 #define ADCIM_RDCM (1 << 5)
236 #define ADCIM_MONOMIX_STEREO (0 << 6)
237 #define ADCIM_MONOMIX_AMONOL (1 << 6)
238 #define ADCIM_MONOMIX_AMONOR (2 << 6)
239 #define ADCIM_MONOMIX_DMONO (3 << 6)
240 #define ADCIM_MONOMIX(x) ((x) & (0x3 << 6))
241 #define ADCIM_DS (1 << 8)
243 #define ADCL 0x20
244 #define ADCL_LMICBOOST_DISABLED (0 << 4)
245 #define ADCL_LMICBOOST_13DB (1 << 4)
246 #define ADCL_LMICBOOST_20DB (2 << 4)
247 #define ADCL_LMICBOOST_29DB (3 << 4)
248 #define ADCL_LMICBOOST(x) (((x) & 0x3) << 4))
249 #define ADCL_LINSEL_LINPUT1 (0 << 6)
250 #define ADCL_LINSEL_LINPUT2 (1 << 6)
251 #define ADCL_LINSEL_LINPUT3 (2 << 6)
252 #define ADCL_LINSEL_DIFF (3 << 6)
253 #define ADCL_LINSEL_MASK (3 << 6)
255 #define ADCR 0x21
256 #define ADCR_RMICBOOST_DISABLED (0 << 4)
257 #define ADCR_RMICBOOST_13DB (1 << 4)
258 #define ADCR_RMICBOOST_20DB (2 << 4)
259 #define ADCR_RMICBOOST_29DB (3 << 4)
260 #define ADCR_RMICBOOST(x) ((x) & (0x3 << 7))
261 #define ADCR_RINSEL_RINPUT1 (0 << 6)
262 #define ADCR_RINSEL_RINPUT2 (1 << 6)
263 #define ADCR_RINSEL_RINPUT3 (2 << 6)
264 #define ADCR_RINSEL_DIFF (3 << 6)
265 #define ADCR_RINSEL_MASK (3 << 6)
266 #endif
268 #define LEFTMIX1 0x22
269 #if defined(HAVE_WM8750)
270 #define LEFTMIX1_LMIXSEL_LINPUT1 (0 << 0)
271 #define LEFTMIX1_LMIXSEL_LINPUT2 (1 << 0)
272 #define LEFTMIX1_LMIXSEL_LINPUT3 (2 << 0)
273 #define LEFTMIX1_LMIXSEL_ADCLIN (3 << 0)
274 #define LEFTMIX1_LMIXSEL_DIFF (4 << 0)
275 #endif
276 #define LEFTMIX1_LI2LO_DEFAULT (5 << 4)
277 #define LEFTMIX1_LI2LOVOL(x) ((x) & (0x7 << 4))
278 #define LEFTMIX1_LI2LOVOL_MASK (0x7 << 4)
279 #define LEFTMIX1_LI2LO (1 << 7)
280 #define LEFTMIX1_LD2LO (1 << 8)
282 #define LEFTMIX2 0x23
283 #define LEFTMIX2_MI2LO_DEFAULT (5 << 4)
284 #define LEFTMIX2_MI2LOVOL(x) ((x) & (0x7 << 4))
285 #if defined(HAVE_WM8750)
286 #define LEFTMIX2_RI2LO (1 << 7)
287 #elif defined(HAVE_WM8751)
288 #define LEFTMIX2_MI2LO (1 << 7)
289 #endif
290 #define LEFTMIX2_RD2LO (1 << 8)
292 #define RIGHTMIX1 0x24
293 #if defined(HAVE_WM8750)
294 #define RIGHTMIX1_RMIXSEL_RINPUT1 (0 << 0)
295 #define RIGHTMIX1_RMIXSEL_RINPUT2 (1 << 0)
296 #define RIGHTMIX1_RMIXSEL_RINPUT3 (2 << 0)
297 #define RIGHTMIX1_RMIXSEL_ADCRIN (3 << 0)
298 #define RIGHTMIX1_RMIXSEL_DIFF (4 << 0)
299 #define RIGHTMIX1_LI2RO_DEFAULT (5 << 4)
300 #define RIGHTMIX1_LI2ROVOL(x) ((x) & (0x7 << 4))
301 #define RIGHTMIX1_LI2RO (1 << 7)
302 #define RIGHTMIX1_LD2RO (1 << 8)
303 #elif defined(HAVE_WM8751)
304 #define RIGHTMIX1_MI2RO_DEFAULT (5 << 4)
305 #define RIGHTMIX1_MI2ROVOL(x) ((x) & (0x7 << 4))
306 #define RIGHTMIX1_MI2RO (1 << 7)
307 #define RIGHTMIX1_LD2RO (1 << 8)
308 #endif
310 #define RIGHTMIX2 0x25
311 #if defined(HAVE_WM8750)
312 #define RIGHTMIX2_RMIXSEL_RINPUT1 (0 << 0)
313 #define RIGHTMIX2_RMIXSEL_RINPUT2 (1 << 0)
314 #define RIGHTMIX2_RMIXSEL_RINPUT3 (2 << 0)
315 #define RIGHTMIX2_RMIXSEL_ADCRIN (3 << 0)
316 #define RIGHTMIX2_RMIXSEL_DIFF (4 << 0)
317 #endif
318 #define RIGHTMIX2_RI2RO_DEFAULT (5 << 4)
319 #define RIGHTMIX2_RI2ROVOL(x) ((x) & (0x7 << 4))
320 #define RIGHTMIX2_RI2ROVOL_MASK (0x7 << 4)
321 #define RIGHTMIX2_RI2RO (1 << 7)
322 #define RIGHTMIX2_RD2RO (1 << 8)
324 #define MONOMIX1 0x26
325 #define MONOMIX1_DMEN (1 << 0)
326 #define MONOMIX1_LI2MOVOL(x) ((x) & (0x7 << 4))
327 #define MONOMIX1_LI2MO (1 << 7)
328 #define MONOMIX1_LD2MO (1 << 8)
330 #define MONOMIX2 0x27
331 #define MONOMIX2_RI2MOVOL(x) ((x) & (0x7 << 4))
332 #define MONOMIX2_RI2MO (1 << 7)
333 #define MONOMIX2_RD2MO (1 << 8)
335 #define LOUT2 0x28
336 #define LOUT2_LOUT2VOL_MASK 0x7f
337 #define LOUT2_LOUT2VOL(x) ((x) & 0x7f)
338 #define LOUT2_LO2ZC (1 << 7)
339 #define LOUT2_LO2VU (1 << 8)
341 #define ROUT2 0x29
342 #define ROUT2_ROUT2VOL_MASK 0x17f
343 #define ROUT2_ROUT2VOL(x) ((x) & 0x7f)
344 #define ROUT2_RO2ZC (1 << 7)
345 #define ROUT2_RO2VU (1 << 8)
347 #define MONOOUT 0x2a
348 #define MONOOUT_MOZC (1 << 7)
350 #define WM_NUM_REGS 0x2b
351 #endif /* _WM8751_H */