blob: 2fbfdb3124650558a058433b704f94f48c94843f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
|
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2005 by Dave Chapman
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#ifndef _WM8751_H
#define _WM8751_H
/* volume/balance/treble/bass interdependency */
#define VOLUME_MIN -730
#define VOLUME_MAX 60
#define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP)
extern int tenthdb2master(int db);
extern void audiohw_set_master_vol(int vol_l, int vol_r);
extern void audiohw_set_lineout_vol(int vol_l, int vol_r);
extern void audiohw_set_frequency(int fsel);
/* Register addresses and bits */
#define OUTPUT_MUTED 0x2f
#define OUTPUT_0DB 0x79
#define LOUT1 0x02
#define LOUT1_LOUT1VOL_MASK (0x07f << 0)
#define LOUT1_LOUT1VOL(x) ((x) & 0x7f)
#define LOUT1_LO1ZC (1 << 7)
#define LOUT1_LO1VU (1 << 8)
#define ROUT1 0x03
#define ROUT1_ROUT1VOL(x) ((x) & 0x7f)
#define ROUT1_RO1ZC (1 << 7)
#define ROUT1_RO1VU (1 << 8)
#define DACCTRL 0x05
#define DACCTRL_DEEMPH_NONE (0 << 1)
#define DACCTRL_DEEMPH_32 (1 << 1)
#define DACCTRL_DEEMPH_44 (2 << 1)
#define DACCTRL_DEEMPH_48 (3 << 1)
#define DACCTRL_DEEMPH(x) ((x) & (0x3 << 1))
#define DACCTRL_DACMU (1 << 3)
#define DACCTRL_DAT (1 << 7)
#define AINTFCE 0x07
#define AINTFCE_FORMAT_RJUST (0 << 0)
#define AINTFCE_FORMAT_LJUST (1 << 0)
#define AINTFCE_FORMAT_I2S (2 << 0)
#define AINTFCE_FORMAT_DSP (3 << 0)
#define AINTFCE_FORMAT(x) ((x) & 0x3)
#define AINTFCE_WL_16 (0 << 2)
#define AINTFCE_WL_20 (1 << 2)
#define AINTFCE_WL_24 (2 << 2)
#define AINTFCE_WL_32 (3 << 2)
#define AINTFCE_WL(x) ((x) & (0x3 << 2))
#define AINTFCE_LRP (1 << 4)
#define AINTFCE_LRSWAP (1 << 5)
#define AINTFCE_MS (1 << 6)
#define AINTFCE_BCLKINV (1 << 7)
#define CLOCKING 0x08
#define CLOCKING_SR_USB (1 << 0)
#define CLOCKING_SR(x) ((x) & (0x1f << 1))
#define CLOCKING_MCLK_DIV2 (1 << 6)
#define CLOCKING_BCLK_DIV2 (1 << 7)
#define LEFTGAIN 0x0a
#define LEFTGAIN_LDACVOL(x) ((x) & 0xff)
#define LEFTGAIN_LDVU (1 << 8)
#define RIGHTGAIN 0x0b
#define RIGHTGAIN_LDACVOL(x) ((x) & 0xff)
#define RIGHTGAIN_LDVU (1 << 8)
#define BASSCTRL 0x0c
#define BASSCTRL_BASS(x) ((x) & 0xf)
#define BASSCTRL_BC (1 << 6)
#define BASSCTRL_BB (1 << 7)
#define TREBCTRL 0x0d
#define TREBCTRL_TREB(x) ((x) & 0xf)
#define TREBCTRL_TC (1 << 6)
#define RESET 0x0f
#define RESET_RESET 0x000
#define ADDITIONAL1 0x17
#define ADDITIONAL1_TOEN (1 << 0)
#define ADDITIONAL1_DACINV (1 << 1)
#define ADDITIONAL1_DMONOMIX_LLRR (0 << 4)
#define ADDITIONAL1_DMONOMIX_ML0R (1 << 4)
#define ADDITIONAL1_DMONOMIX_0LMR (2 << 4)
#define ADDITIONAL1_DMONOMIX_MLMR (3 << 4)
#define ADDITIONAL1_DMONOMIX(x) ((x) & (0x03 << 4))
#define ADDITIONAL1_VSEL_LOWEST (0 << 6)
#define ADDITIONAL1_VSEL_LOW (1 << 6)
#define ADDITIONAL1_VSEL_DEFAULT2 (2 << 6)
#define ADDITIONAL1_VSEL_DEFAULT (3 << 6)
#define ADDITIONAL1_VSEL(x) ((x) & (0x3 << 6))
#define ADDITIONAL1_TSDEN (1 << 8)
#define ADDITIONAL2 0x18
#define ADDITIONAL2_DACOSR (1 << 0)
#define ADDITIONAL2_HPSWZC (1 << 3)
#define ADDITIONAL2_ROUT2INV (1 << 4)
#define ADDITIONAL2_HPSWPOL (1 << 5)
#define ADDITIONAL2_HPSWEN (1 << 6)
#define ADDITIONAL2_OUT3SW_VREF (0 << 7)
#define ADDITIONAL2_OUT3SW_ROUT1 (1 << 7)
#define ADDITIONAL2_OUT3SW_MONOOUT (2 << 7)
#define ADDITIONAL2_OUT3SW_R_MIX_OUT (3 << 7)
#define ADDITIONAL2_OUT3SW(x) ((x) & (0x3 << 7))
#define PWRMGMT1 0x19
#define PWRMGMT1_DIGENB (1 << 0)
#define PWRMGMT1_VREF (1 << 6)
#define PWRMGMT1_VMIDSEL_DISABLED (0 << 7)
#define PWRMGMT1_VMIDSEL_50K (1 << 7)
#define PWRMGMT1_VMIDSEL_500K (2 << 7)
#define PWRMGMT1_VMIDSEL_5K (3 << 7)
#define PWRMGMT1_VMIDSEL(x) ((x) & (0x3 << 7))
#define PWRMGMT2 0x1a
#define PWRMGMT2_OUT3 (1 << 1)
#define PWRMGMT2_MOUT (1 << 2)
#define PWRMGMT2_ROUT2 (1 << 3)
#define PWRMGMT2_LOUT2 (1 << 4)
#define PWRMGMT2_ROUT1 (1 << 5)
#define PWRMGMT2_LOUT1 (1 << 6)
#define PWRMGMT2_DACR (1 << 7)
#define PWRMGMT2_DACL (1 << 8)
#define ADDITIONAL3 0x1b
#define ADDITIONAL3_ADCLRM ((x) & (0x3 << 7))
#define ADDITIONAL3_HPFLREN (1 << 5)
#define ADDITIONAL3_VROI (1 << 6)
#define LEFTMIX1 0x22
#define LEFTMIX1_LI2LO_DEFAULT (5 << 4)
#define LEFTMIX1_LI2LOVOL(x) ((x) & (0x7 << 4))
#define LEFTMIX1_LI2LO (1 << 7)
#define LEFTMIX1_LD2LO (1 << 8)
#define LEFTMIX2 0x23
#define LEFTMIX2_MI2LO_DEFAULT (5 << 4)
#define LEFTMIX2_MI2LOVOL(x) ((x) & (0x7 << 4))
#define LEFTMIX2_MI2LO (1 << 7)
#define LEFTMIX2_RD2LO (1 << 8)
#define RIGHTMIX1 0x24
#define RIGHTMIX1_MI2RO_DEFAULT (5 << 4)
#define RIGHTMIX1_MI2ROVOL(x) ((x) & (0x7 << 4))
#define RIGHTMIX1_MI2RO (1 << 7)
#define RIGHTMIX1_LD2RO (1 << 8)
#define RIGHTMIX2 0x25
#define RIGHTMIX2_RI2RO_DEFAULT (5 << 4)
#define RIGHTMIX2_RI2ROVOL(x) ((x) & (0x7 << 4))
#define RIGHTMIX2_RI2RO (1 << 7)
#define RIGHTMIX2_RD2RO (1 << 8)
#define MONOMIX1 0x26
#define MONOMIX1_DMEN (1 << 0)
#define MONOMIX1_LI2MOVOL(x) ((x) & (0x7 << 4))
#define MONOMIX1_LI2MO (1 << 7)
#define MONOMIX1_LD2MO (1 << 8)
#define MONOMIX2 0x27
#define MONOMIX2_RI2MOVOL(x) ((x) & (0x7 << 4))
#define MONOMIX2_RI2MO (1 << 7)
#define MONOMIX2_RD2MO (1 << 8)
#define LOUT2 0x28
#define LOUT2_LOUT2VOL(x) ((x) & 0x7f)
#define LOUT2_LO2ZC (1 << 7)
#define LOUT2_LO2VU (1 << 8)
#define ROUT2 0x29
#define ROUT2_ROUT2VOL(x) ((x) & 0x7f)
#define ROUT2_RO2ZC (1 << 7)
#define ROUT2_RO2VU (1 << 8)
#define MONOOUT 0x2a
#define MONOOUT_MOZC (1 << 7)
#endif /* _WM8751_H */
|