1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
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 ****************************************************************************/
25 /* volume/balance/treble/bass interdependency */
26 #define VOLUME_MIN -730
29 #define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP)
31 extern int tenthdb2master(int db
);
33 extern void audiohw_set_master_vol(int vol_l
, int vol_r
);
34 extern void audiohw_set_lineout_vol(int vol_l
, int vol_r
);
36 /* Register addresses and bits */
39 #define LINVOL_MASK 0x3f
40 #define LINVOL_LZCEN (1 << 6)
41 #define LINVOL_LINMUTE (1 << 7)
42 #define LINVOL_LIVU (1 << 8)
45 #define RINVOL_MASK 0x3f
46 #define RINVOL_RZCEN (1 << 6)
47 #define RINVOL_RINMUTE (1 << 7)
48 #define RINVOL_RIVU (1 << 8)
51 #define LOUT1VOL_MASK 0x7f
52 #define LOUT1VOL_LO1ZC (1 << 7)
53 #define LOUT1VOL_LO1VU (1 << 8)
56 #define ROUT1VOL_MASK 0x7f
57 #define ROUT1VOL_RO1ZC (1 << 7)
58 #define ROUT1VOL_RO1VU (1 << 8)
60 #define DAPCTRL 0x05 /* Digital audio path control */
61 #define DAPCTRL_ADCHPD (1 << 0)
62 #define DAPCTRL_DEEMP_DISABLE (0 << 1)
63 #define DAPCTRL_DEEMP_32KHz (1 << 1)
64 #define DAPCTRL_DEEMP_44KHz (2 << 1)
65 #define DAPCTRL_DEEMP_48KHz (3 << 1)
66 #define DAPCTRL_DEEMP_MASK (3 << 1)
67 #define DAPCTRL_DACMU (1 << 3)
68 #define DAPCTRL_HPOR (1 << 4)
69 #define DAPCTRL_ADCPOL_NORMAL (0 << 5)
70 #define DAPCTRL_ADCPOL_LINVERT (1 << 5)
71 #define DAPCTRL_ADCPOL_RINVERT (2 << 5)
72 #define DAPCTRL_ADCPOL_LRINVERT (3 << 5)
73 #define DAPCTRL_ADCPOL_MASK (3 << 5)
74 #define DAPCTRL_DACDIV2 (1 << 7)
75 #define DAPCTRL_ADCDIV2 (1 << 8)
78 #define AINTFCE_FORMAT_MSB_RJUST (0 << 0)
79 #define AINTFCE_FORMAT_MSB_LJUST (1 << 0)
80 #define AINTFCE_FORMAT_I2S (2 << 0)
81 #define AINTFCE_FORMAT_DSP (3 << 0)
82 #define AINTFCE_FORMAT_MASK (3 << 0)
83 #define AINTFCE_IWL_16BIT (0 << 2)
84 #define AINTFCE_IWL_20BIT (1 << 2)
85 #define AINTFCE_IWL_24BIT (2 << 2)
86 #define AINTFCE_IWL_32BIT (3 << 2)
87 #define AINTFCE_IWL_MASK (3 << 2)
88 #define AINTFCE_LRP_I2S_RLO (0 << 4)
89 #define AINTFCE_LRP_I2S_RHI (1 << 4)
90 #define AINTFCE_DSP_MODE_B (0 << 4)
91 #define AINTFCE_DSP_MODE_A (1 << 4)
92 #define AINTFCE_LRSWAP (1 << 5)
93 #define AINTFCE_MS (1 << 6)
94 #define AINTFCE_BCLKINV (1 << 7)
97 #define SAMPCTRL_USB (1 << 0)
99 * Sample rate setting are device-specific. See datasheet
100 * for proper settings for the device's clocking */
101 #define SAMPCTRL_SR_MASK (0x1f << 1)
102 #define SAMPCTRL_CLKDIV2 (1 << 6)
103 #define SAMPCTRL_BCM_OFF (0 << 7)
104 #define SAMPCTRL_BCM_MCLK_4 (1 << 7)
105 #define SAMPCTRL_BCM_MCLK_8 (2 << 7)
106 #define SAMPCTRL_BCM_MCLK_16 (3 << 7)
109 #define LDACVOL_MASK 0xff
110 #define LDACVOL_LDVU (1 << 8)
113 #define RDACVOL_MASK 0xff
114 #define RDACVOL_RDVU (1 << 8)
116 #define BASSCTRL 0x0c
117 #define BASSCTRL_MASK 0x0f
118 #define BASSCTRL_BC (1 << 6)
119 #define BASSCTRL_BB (1 << 7)
121 #define TREBCTRL 0x0d
122 #define TREBCTRL_MASK 0x0f
123 #define TREBCTRL_TC (1 << 6)
126 #define RESET_RESET 0x0
132 #define NOISEGATE 0x14
135 #define LADCVOL_MASK 0xff
136 #define LADCVOL_LAVU (1 << 8)
139 #define RADCVOL_MASK 0xff
140 #define RADCVOL_RAVU (1 << 8)
142 #define ADDCTRL1 0x17
143 #define ADDCTRL1_TOEN (1 << 0)
144 #define ADDCTRL1DACINV (1 << 1)
145 #define ADDCTRL1_DATSEL_NORMAL (0 << 2)
146 #define ADDCTRL1_DATSEL_LADC (1 << 2)
147 #define ADDCTRL1_DATSEL_RADC (2 << 2)
148 #define ADDCTRL1_DATSEL_SWAPPED (3 << 2)
149 #define ADDCTRL1_DMONOMIX_STEREO (0 << 4)
150 #define ADDCTRL1_DMONOMIX_MONOLEFT (1 << 4)
151 #define ADDCTRL1_DMONOMIX_MONORIGHT (2 << 4)
152 #define ADDCTRL1_DMONOMIX_MONO (3 << 4)
153 #define ADDCTRL1_VSEL_HIGHBIAS (0 << 6)
154 #define ADDCTRL1_VSEL_MEDBIAS (1 << 6)
155 #define ADDCTRL1_VSEL_LOWBIAS (3 << 6)
156 #define ADDCTRL1_TSDEN (1 << 8)
158 #define ADDCTRL2 0x18
159 #define ADDCTRL2_DACOSR (1 << 0)
160 #define ADDCTRL2_ADCOSR (1 << 1)
161 #define ADDCTRL2_LRCM (1 << 2)
162 #define ADDCTRL2_TRI (1 << 3)
163 #define ADDCTRL2_ROUT2INV (1 << 4)
164 #define ADDCTRL2_HPSWPOL (1 << 5)
165 #define ADDCTRL2_HPSWEN (1 << 6)
166 #define ADDCTRL2_OUT3SW_VREF (0 << 7)
167 #define ADDCTRL2_OUT3SW_ROUT1 (1 << 7)
168 #define ADDCTRL2_OUT3SW_MONOOUT (2 << 7)
169 #define ADDCTRL2_OUT3SW_ROUTMIX (3 << 7)
171 #define PWRMGMT1 0x19
172 #define PWRMGMT1_DIGENB (1 << 0)
173 #define PWRMGMT1_MICB (1 << 1)
174 #define PWRMGMT1_ADCR (1 << 2)
175 #define PWRMGMT1_ADCL (1 << 3)
176 #define PWRMGMT1_AINR (1 << 4)
177 #define PWRMGMT1_AINL (1 << 5)
178 #define PWRMGMT1_VREF (1 << 6)
179 #define PWRMGMT1_VMIDSEL_OFF (0 << 7)
180 #define PWRMGMT1_VMIDSEL_50K (1 << 7)
181 #define PWRMGMT1_VMIDSEL_500K (2 << 7)
182 #define PWRMGMT1_VMIDSEL_5K (3 << 7)
183 #define PWRMGMT1_VMIDSEL_MASK (3 << 7)
185 #define PWRMGMT2 0x1a
186 #define PWRMGMT2_OUT3 (1 << 1)
187 #define PWRMGMT2_MONO (1 << 2)
188 #define PWRMGMT2_ROUT2 (1 << 3)
189 #define PWRMGMT2_LOUT2 (1 << 4)
190 #define PWRMGMT2_ROUT1 (1 << 5)
191 #define PWRMGMT2_LOUT1 (1 << 6)
192 #define PWRMGMT2_DACR (1 << 7)
193 #define PWRMGMT2_DACL (1 << 8)
195 #define ADDCTRL3 0x1b
196 #define ADDCTRL3_HPFLREN (1 << 5)
197 #define ADDCTRL3_VROI (1 << 6)
198 #define ADDCTRL3_ADCLRM_IN (0 << 7)
199 #define ADDCTRL3_ADCLRM_MCLK (1 << 7)
200 #define ADDCTRL3_ADCLRM_MCLK_55 (2 << 7)
201 #define ADDCTRL3_ADCLRM_MCLK_6 (3 << 7)
203 #define ADCINMODE 0x1f
204 #define ADCINMODE_LDCM (1 << 4)
205 #define ADCINMODE_RDCM (1 << 5)
206 #define ADCINMODE_MONOMIX_STEREO (0 << 6)
207 #define ADCINMODE_MONOMIX_LADC (1 << 6)
208 #define ADCINMODE_MONOMIX_RADC (2 << 6)
209 #define ADCINMODE_MONOMIX_DIGITAL (3 << 6)
210 #define ADCINMODE_DS (1 << 8)
212 #define ADCLPATH 0x20
213 #define ADCLPATH_LMICBOOST_OFF (0 << 4)
214 #define ADCLPATH_LMICBOOST_13dB (1 << 4)
215 #define ADCLPATH_LMICBOOST_20dB (2 << 4)
216 #define ADCLPATH_LMICBOOST_29dB (3 << 4)
217 #define ADCLPATH_LINSEL_LIN1 (0 << 6)
218 #define ADCLPATH_LINSEL_LIN2 (1 << 6)
219 #define ADCLPATH_LINSEL_LIN3 (2 << 6)
220 #define ADCLPATH_LINSEL_DIFF (3 << 6)
222 #define ADCRPATH 0x21
223 #define ADCRPATH_RMICBOOST_OFF (0 << 4)
224 #define ADCRPATH_RMICBOOST_13dB (1 << 4)
225 #define ADCRPATH_RMICBOOST_20dB (2 << 4)
226 #define ADCRPATH_RMICBOOST_29dB (3 << 4)
227 #define ADCRPATH_RINSEL_RIN1 (0 << 6)
228 #define ADCRPATH_RINSEL_RIN2 (1 << 6)
229 #define ADCRPATH_RINSEL_RIN3 (2 << 6)
230 #define ADCRPATH_RINSEL_DIFF (3 << 6)
232 #define LOUTMIX1 0x22
233 #define LOUTMIX1_LMIXSEL_LIN1 (0 << 0)
234 #define LOUTMIX1_LMIXSEL_LIN2 (1 << 0)
235 #define LOUTMIX1_LMIXSEL_LIN3 (2 << 0)
236 #define LOUTMIX1_LMIXSEL_LADCIN (3 << 0)
237 #define LOUTMIX1_LMIXSEL_DIFF (4 << 0)
238 #define LOUTMIX1_LI2LOVOL(x) ((x & 7) << 4)
239 #define LOUTMIX1_LI2LOVOL_MASK (7 << 4)
240 #define LOUTMIX1_LI2LO (1 << 7)
241 #define LOUTMIX1_LD2LO (1 << 8)
243 #define LOUTMIX2 0x23
244 #define LOUTMIX2_RI2LOVOL(x) ((x & 7) << 4)
245 #define LOUTMIX2_RI2LOVOL_MASK (7 << 4)
246 #define LOUTMIX2_RI2LO (1 << 7)
247 #define LOUTMIX2_RD2LO (1 << 8)
249 #define ROUTMIX1 0x24
250 #define ROUTMIX1_RMIXSEL_RIN1 (0 << 0)
251 #define ROUTMIX1_RMIXSEL_RIN2 (1 << 0)
252 #define ROUTMIX1_RMIXSEL_RIN3 (2 << 0)
253 #define ROUTMIX1_RMIXSEL_RADCIN (3 << 0)
254 #define ROUTMIX1_RMIXSEL_DIFF (4 << 0)
255 #define ROUTMIX1_LI2ROVOL(x) ((x & 7) << 4)
256 #define ROUTMIX1_LI2ROVOL_MASK (7 << 4)
257 #define ROUTMIX1_LI2RO (1 << 7)
258 #define ROUTMIX1_LD2RO (1 << 8)
260 #define ROUTMIX2 0x25
261 #define ROUTMIX2_RI2ROVOL(x) ((x & 7) << 4)
262 #define ROUTMIX2_RI2ROVOL_MASK (7 << 4)
263 #define ROUTMIX2_RI2RO (1 << 7)
264 #define ROUTMIX2_RD2RO (1 << 8)
266 #define MOUTMIX1 0x26
267 #define MOUTMIX1_LI2MOVOL(x) ((x & 7) << 4)
268 #define MOUTMIX1_LI2MOVOL_MASK (7 << 4)
269 #define MOUTMIX1_LI2MO (1 << 7)
270 #define MOUTMIX1_LD2MO (1 << 8)
272 #define MOUTMIX2 0x27
273 #define MOUTMIX2_RI2MOVOL(x) ((x & 7) << 4)
274 #define MOUTMIX2_RI2MOVOL_MASK (7 << 4)
275 #define MOUTMIX2_RI2MO (1 << 7)
276 #define MOUTMIX2_RD2MO (1 << 8)
278 #define LOUT2VOL 0x28
279 #define LOUT2VOL_MASK 0x7f
280 #define LOUT2VOL_LO2ZC (1 << 7)
281 #define LOUT2VOL_LO2VU (1 << 8)
283 #define ROUT2VOL 0x29
284 #define ROUT2VOL_MASK 0x7f
285 #define ROUT2VOL_RO2ZC (1 << 7)
286 #define ROUT2VOL_RO2VU (1 << 8)
289 #define MOUTVOL_MASK 0x7f
290 #define MOUTVOL_MOZC (1 << 7)
293 /* SAMPCTRL values for the supported samplerates: */
294 #define WM8975_8000HZ 0x4d
295 #define WM8975_12000HZ 0x61
296 #define WM8975_16000HZ 0x55
297 #define WM8975_22050HZ 0x77
298 #define WM8975_24000HZ 0x79
299 #define WM8975_32000HZ 0x59
300 #define WM8975_44100HZ 0x63
301 #define WM8975_48000HZ 0x41
302 #define WM8975_88200HZ 0x7f
303 #define WM8975_96000HZ 0x5d
305 #endif /* _WM8975_H */