Fix svn:keywords property in as3525 target tree
[kugel-rb.git] / firmware / export / wm8758.h
blob29304b87944e151ee5df968cf4d07e6c066665a4
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 ****************************************************************************/
22 #ifndef _WM8758_H
23 #define _WM8758_H
25 /* volume/balance/treble/bass interdependency */
26 #define VOLUME_MIN -570
27 #define VOLUME_MAX 60
29 #define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP | BASS_CUTOFF_CAP | TREBLE_CUTOFF_CAP)
31 extern int tenthdb2master(int db);
32 extern int tenthdb2mixer(int db);
34 extern void audiohw_set_master_vol(int vol_l, int vol_r);
35 extern void audiohw_set_lineout_vol(int vol_l, int vol_r);
36 extern void audiohw_set_mixer_vol(int channel1, int channel2);
38 #define RESET 0x00
39 #define RESET_RESET 0x0
41 #define PWRMGMT1 0x01
42 #define PWRMGMT1_VMIDSEL_OFF (0 << 0)
43 #define PWRMGMT1_VMIDSEL_75K (1 << 0)
44 #define PWRMGMT1_VMIDSEL_300K (2 << 0)
45 #define PWRMGMT1_VMIDSEL_5K (3 << 0)
46 #define PWRMGMT1_BUFIOEN (1 << 2)
47 #define PWRMGMT1_BIASEN (1 << 3)
48 #define PWRMGMT1_MICBEN (1 << 4)
49 #define PWRMGMT1_PLLEN (1 << 5)
50 #define PWRMGMT1_OUT3MIXEN (1 << 6)
51 #define PWRMGMT1_OUT4MIXEN (1 << 7)
52 #define PWRMGMT1_BUFDCOPEN (1 << 8)
54 #define PWRMGMT2 0x02
55 #define PWRMGMT2_ADCENL (1 << 0)
56 #define PWRMGMT2_ADCENR (1 << 1)
57 #define PWRMGMT2_INPGAENL (1 << 2)
58 #define PWRMGMT2_INPGAENR (1 << 3)
59 #define PWRMGMT2_BOOSTENL (1 << 4)
60 #define PWRMGMT2_BOOSTENR (1 << 5)
61 #define PWRMGMT2_SLEEP (1 << 6)
62 #define PWRMGMT2_LOUT1EN (1 << 7)
63 #define PWRMGMT2_ROUT1EN (1 << 8)
65 #define PWRMGMT3 0x03
66 #define PWRMGMT3_DACENL (1 << 0)
67 #define PWRMGMT3_DACENR (1 << 1)
68 #define PWRMGMT3_LMIXEN (1 << 2)
69 #define PWRMGMT3_RMIXEN (1 << 3)
70 #define PWRMGMT3_ROUT2EN (1 << 5)
71 #define PWRMGMT3_LOUT2EN (1 << 6)
72 #define PWRMGMT3_OUT3EN (1 << 7)
73 #define PWRMGMT3_OUT4EN (1 << 8)
75 #define AINTFCE 0x04
76 #define AINTFCE_MONO (1 << 0)
77 #define AINTFCE_ALRSWAP (1 << 1)
78 #define AINTFCE_DLRSWAP (1 << 2)
79 #define AINTFCE_FORMAT_MSB_RJUST (0 << 3)
80 #define AINTFCE_FORMAT_MSB_LJUST (1 << 3)
81 #define AINTFCE_FORMAT_I2S (2 << 3)
82 #define AINTFCE_FORMAT_DSP (3 << 3)
83 #define AINTFCE_FORMAT_MASK (3 << 3)
84 #define AINTFCE_IWL_16BIT (0 << 5)
85 #define AINTFCE_IWL_20BIT (1 << 5)
86 #define AINTFCE_IWL_24BIT (2 << 5)
87 #define AINTFCE_IWL_32BIT (3 << 5)
88 #define AINTFCE_IWL_MASK (3 << 5)
89 #define AINTFCE_LRP (1 << 7)
90 #define AINTFCE_BCP (1 << 8)
92 #define COMPCTRL 0x05 /* unused */
94 #define CLKCTRL 0x06
95 #define CLKCTRL_MS (1 << 0)
96 #define CLKCTRL_BCLKDIV_1 (0 << 2)
97 #define CLKCTRL_BCLKDIV_2 (1 << 2)
98 #define CLKCTRL_BCLKDIV_4 (2 << 2)
99 #define CLKCTRL_BCLKDIV_8 (3 << 2)
100 #define CLKCTRL_BCLKDIV_16 (4 << 2)
101 #define CLKCTRL_BCLKDIV_32 (5 << 2)
102 #define CLKCTRL_MCLKDIV_1 (0 << 5)
103 #define CLKCTRL_MCLKDIV_1_5 (1 << 5)
104 #define CLKCTRL_MCLKDIV_2 (2 << 5)
105 #define CLKCTRL_MCLKDIV_3 (3 << 5)
106 #define CLKCTRL_MCLKDIV_4 (4 << 5)
107 #define CLKCTRL_MCLKDIV_6 (5 << 5)
108 #define CLKCTRL_MCLKDIV_8 (6 << 5)
109 #define CLKCTRL_MCLKDIV_12 (7 << 5)
110 #define CLKCTRL_MCLKDIV_MASK (7 << 5)
111 #define CLKCTRL_CLKSEL (1 << 8)
113 #define ADDCTRL 0x07
114 #define ADDCTRL_SLOWCLKEN (1 << 0)
115 #define ADDCTRL_SR_48kHz (0 << 1)
116 #define ADDCTRL_SR_32kHz (1 << 1)
117 #define ADDCTRL_SR_24kHz (2 << 1)
118 #define ADDCTRL_SR_16kHz (3 << 1)
119 #define ADDCTRL_SR_12kHz (4 << 1)
120 #define ADDCTRL_SR_8kHz (5 << 1)
121 #define ADDCTRL_SR_MASK (7 << 1)
123 /* unused */
124 #define GPIOCTRL 0x08
125 #define JACKDETECTCTRL1 0x09
127 #define DACCTRL 0x0a
128 #define DACCTRL_DACLPOL (1 << 0)
129 #define DACCTRL_DACRPOL (1 << 1)
130 #define DACCTRL_AMUTE (1 << 2)
131 #define DACCTRL_DACOSR128 (1 << 3)
132 #define DACCTRL_SOFTMUTE (1 << 6)
134 #define LDACVOL 0x0b
135 #define LDACVOL_MASK 0xff
136 #define LDACVOL_DACVU (1 << 8)
138 #define RDACVOL 0x0c
139 #define RDACVOL_MASK 0xff
140 #define RDACVOL_DACVU (1 << 8)
142 #define JACKDETECTCTRL2 0x0d /* unused */
144 #define ADCCTRL 0x0e
145 #define ADCCTRL_ADCLPOL (1 << 0)
146 #define ADCCTRL_ADCRPOL (1 << 1)
147 #define ADCCTRL_ADCOSR128 (1 << 3)
148 #define ADCCTRL_HPFCUT_MASK (7 << 4)
149 #define ADCCTRL_HPFAPP (1 << 7)
150 #define ADCCTRL_HPFEN (1 << 8)
152 #define LADCVOL 0x0f
153 #define LADCVOL_MASK 0xff
154 #define LADCVOL_ADCVU (1 << 8)
156 #define RADCVOL 0x10
157 #define RADCVOL_MASK 0xff
158 #define RADCVOL_ADCVU (1 << 8)
160 #define EQ1 0x12
161 #define EQ5 0x16
162 /* note: the WM8983 used for reference has a true 5 band EQ, but the WM8758
163 * does only have low shelf & high shelf (tested). Not sure about 3D mode. */
164 #define EQ1_EQ3DMODE (1 << 8)
165 #define EQ_GAIN_MASK 0x1f
166 #define EQ_CUTOFF_MASK (3 << 5)
167 #define EQ_GAIN_VALUE(x) (((-x) + 12) & 0x1f)
168 #define EQ_CUTOFF_VALUE(x) ((((x) - 1) & 0x03) << 5)
170 /* unused */
171 #define DACLIMITER1 0x18
172 #define DACLIMITER2 0x19
173 #define NOTCHFILTER1 0x1b
174 #define NOTCHFILTER2 0x1c
175 #define NOTCHFILTER3 0x1d
176 #define NOTCHFILTER4 0x1e
177 #define ALCCONTROL1 0x20
178 #define ALCCONTROL2 0x21
179 #define ALCCONTROL3 0x22
180 #define NOISEGATE 0x23
182 #define PLLN 0x24
183 #define PLLN_PLLN_MASK 0x0f
184 #define PLLN_PLLPRESCALE (1 << 4)
186 #define PLLK1 0x25
187 #define PLLK1_MASK 0x3f
189 #define PLLK2 0x26
190 #define PLLK3 0x27
192 #define THREEDCTRL 0x29
193 #define THREEDCTRL_DEPTH3D_MASK 0x0f
195 #define OUT4TOADC 0x2a
196 #define OUT4TOADC_OUT1DEL (1 << 0)
197 #define OUT4TOADC_DELEN (1 << 1)
198 #define OUT4TOADC_POBCTRL (1 << 2)
199 #define OUT4TOADC_OUT4_2LNR (1 << 5)
200 #define OUT4TOADC_OUT4_ADCVOL_MASK (7 << 6)
202 #define BEEPCTRL 0x2b
203 #define BEEPCTRL_BEEPEN (1 << 0)
204 #define BEEPCTRL_BEEPVOL_MASK (7 << 1)
205 #define BEEPCTRL_INVROUT2 (1 << 4)
206 #define BEEPCTRL_MUTERPGA2INV (1 << 5)
207 #define BEEPCTRL_BYPR2LMIX (1 << 7)
208 #define BEEPCTRL_BYPL2RMIX (1 << 8)
210 #define INCTRL 0x2c
211 #define INCTRL_LIP2INPGA (1 << 0)
212 #define INCTRL_LIN2INPGA (1 << 1)
213 #define INCTRL_L2_2INPGA (1 << 2)
214 #define INCTRL_RIP2INPGA (1 << 4)
215 #define INCTRL_RIN2INPGA (1 << 5)
216 #define INCTRL_R2_2INPGA (1 << 6)
217 #define INCTRL_MBVSEL (1 << 8)
219 #define LINPGAVOL 0x2d
220 #define LINPGAVOL_INPGAVOL_MASK 0x3f
221 #define LINPGAVOL_INPGAMUTEL (1 << 6)
222 #define LINPGAVOL_INPGAZCL (1 << 7)
223 #define LINPGAVOL_INPGAVU (1 << 8)
225 #define RINPGAVOL 0x2e
226 #define RINPGAVOL_INPGAVOL_MASK 0x3f
227 #define RINPGAVOL_INPGAMUTER (1 << 6)
228 #define RINPGAVOL_INPGAZCR (1 << 7)
229 #define RINPGAVOL_INPGAVU (1 << 8)
231 #define LADCBOOST 0x2f
232 #define LADCBOOST_AUXL2BOOST_MASK (7 << 0)
233 #define LADCBOOST_L2_2BOOST_MASK (7 << 4)
234 #define LADCBOOST_L2_2BOOST(x) ((x) << 4)
235 #define LADCBOOST_PGABOOSTL (1 << 8)
237 #define RADCBOOST 0x30
238 #define RADCBOOST_AUXR2BOOST_MASK (7 << 0)
239 #define RADCBOOST_R2_2BOOST_MASK (7 << 4)
240 #define RADCBOOST_R2_2BOOST(x) ((x) << 4)
241 #define RADCBOOST_PGABOOSTR (1 << 8)
243 #define OUTCTRL 0x31
244 #define OUTCTRL_VROI (1 << 0)
245 #define OUTCTRL_TSDEN (1 << 1)
246 #define OUTCTRL_SPKBOOST (1 << 2)
247 #define OUTCTRL_OUT3BOOST (1 << 3)
248 #define OUTCTRL_OUT4BOOST (1 << 4)
249 #define OUTCTRL_DACR2LMIX (1 << 5)
250 #define OUTCTRL_DACL2RMIX (1 << 6)
252 #define LOUTMIX 0x32
253 #define LOUTMIX_DACL2LMIX (1 << 0)
254 #define LOUTMIX_BYPL2LMIX (1 << 1)
255 #define LOUTMIX_BYP2LMIXVOL_MASK (7 << 2)
256 #define LOUTMIX_BYP2LMIXVOL(x) ((x) << 2)
257 #define LOUTMIX_AUXL2LMIX (1 << 5)
258 #define LOUTMIX_AUXLMIXVOL_MASK (7 << 6)
260 #define ROUTMIX 0x33
261 #define ROUTMIX_DACR2RMIX (1 << 0)
262 #define ROUTMIX_BYPR2RMIX (1 << 1)
263 #define ROUTMIX_BYP2RMIXVOL_MASK (7 << 2)
264 #define ROUTMIX_BYP2RMIXVOL(x) ((x) << 2)
265 #define ROUTMIX_AUXR2RMIX (1 << 5)
266 #define ROUTMIX_AUXRMIXVOL_MASK (7 << 6)
268 #define LOUT1VOL 0x34
269 #define LOUT1VOL_MASK 0x3f
270 #define LOUT1VOL_LOUT1MUTE (1 << 6)
271 #define LOUT1VOL_LOUT1ZC (1 << 7)
272 #define LOUT1VOL_OUT1VU (1 << 8)
274 #define ROUT1VOL 0x35
275 #define ROUT1VOL_MASK 0x3f
276 #define ROUT1VOL_ROUT1MUTE (1 << 6)
277 #define ROUT1VOL_ROUT1ZC (1 << 7)
278 #define ROUT1VOL_OUT1VU (1 << 8)
280 #define LOUT2VOL 0x36
281 #define LOUT2VOL_MASK 0x3f
282 #define LOUT2VOL_LOUT2MUTE (1 << 6)
283 #define LOUT2VOL_LOUT2ZC (1 << 7)
284 #define LOUT2VOL_OUT2VU (1 << 8)
286 #define ROUT2VOL 0x37
287 #define ROUT2VOL_MASK 0x3f
288 #define ROUT2VOL_ROUT2MUTE (1 << 6)
289 #define ROUT2VOL_ROUT2ZC (1 << 7)
290 #define ROUT2VOL_OUT2VU (1 << 8)
293 /* Dummy definition, to be removed when the audio driver API gets reworked. */
294 #define WM8758_44100HZ 0
296 #endif /* _WM8758_H */