1 /*
2 * sound/sb_mixer.h
3 *
4 * Definitions for the SB Pro and SB16 mixers
5 *
6 * Copyright by Hannu Savolainen 1993
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
10 * met: 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 2.
12 * Redistributions in binary form must reproduce the above copyright notice,
13 * this list of conditions and the following disclaimer in the documentation
14 * and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
20 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 */
29 #define SBPRO_RECORDING_DEVICES (SOUND_MASK_LINE | SOUND_MASK_MIC | SOUND_MASK_CD)
30
31 #define SBPRO_MIXER_DEVICES (SOUND_MASK_SYNTH | SOUND_MASK_PCM | SOUND_MASK_LINE | SOUND_MASK_MIC | \
32 SOUND_MASK_CD | SOUND_MASK_VOLUME)
33
34 #define SB16_RECORDING_DEVICES (SOUND_MASK_SYNTH | SOUND_MASK_LINE | SOUND_MASK_MIC | \
35 SOUND_MASK_CD)
36
37 #define SB16_MIXER_DEVICES (SOUND_MASK_SYNTH | SOUND_MASK_PCM | SOUND_MASK_SPEAKER | SOUND_MASK_LINE | SOUND_MASK_MIC | \
38 SOUND_MASK_CD | SOUND_MASK_RECLEV | \
39 SOUND_MASK_VOLUME | SOUND_MASK_BASS | SOUND_MASK_TREBLE)
40
41 /*
42 * Mixer registers
43 *
44 * NOTE! RECORD_SRC == IN_FILTER
45 */
46
47 /*
48 * Mixer registers of SB Pro
49 */
50 #define VOC_VOL 0x04
51 #define MIC_VOL 0x0A
52 #define MIC_MIX 0x0A
53 #define RECORD_SRC 0x0C
54 #define IN_FILTER 0x0C
55 #define OUT_FILTER 0x0E
56 #define MASTER_VOL 0x22
57 #define FM_VOL 0x26
58 #define CD_VOL 0x28
59 #define LINE_VOL 0x2E
60 #define IRQ_NR 0x80
61 #define DMA_NR 0x81
62 #define IRQ_STAT 0x82
63 #define OPSW 0x3c
64
65 #define FREQ_HI (1 << 3)/* Use High-frequency ANFI filters */
66 #define FREQ_LOW 0 /* Use Low-frequency ANFI filters */
67 #define FILT_ON 0 /* Yes, 0 to turn it on, 1 for off */
68 #define FILT_OFF (1 << 5)
69
70 #define MONO_DAC 0x00
71 #define STEREO_DAC 0x02
72
73 /*
74 * Mixer registers of SB16
75 */
76 #define SB16_IMASK_L 0x3d
77 #define SB16_IMASK_R 0x3e
78
79 #define LEFT_CHN 0
80 #define RIGHT_CHN 1
81
82 struct mixer_def {
83 unsigned int regno: 8;
84 unsigned int bitoffs:4;
85 unsigned int nbits:4;
86 };
87
88
89 typedef struct mixer_def mixer_tab[32][2];
90 typedef struct mixer_def mixer_ent;
91
92 #define MIX_ENT(name, reg_l, bit_l, len_l, reg_r, bit_r, len_r) \
93 {{reg_l, bit_l, len_l}, {reg_r, bit_r, len_r}}
94
95 #ifdef __SB_MIXER_C__
96 mixer_tab sbpro_mix = {
97 MIX_ENT(SOUND_MIXER_VOLUME, 0x22, 7, 4, 0x22, 3, 4),
98 MIX_ENT(SOUND_MIXER_BASS, 0x00, 0, 0, 0x00, 0, 0),
99 MIX_ENT(SOUND_MIXER_TREBLE, 0x00, 0, 0, 0x00, 0, 0),
100 MIX_ENT(SOUND_MIXER_SYNTH, 0x26, 7, 4, 0x26, 3, 4),
101 MIX_ENT(SOUND_MIXER_PCM, 0x04, 7, 4, 0x04, 3, 4),
102 MIX_ENT(SOUND_MIXER_SPEAKER, 0x00, 0, 0, 0x00, 0, 0),
103 MIX_ENT(SOUND_MIXER_LINE, 0x2e, 7, 4, 0x2e, 3, 4),
104 MIX_ENT(SOUND_MIXER_MIC, 0x0a, 2, 3, 0x00, 0, 0),
105 MIX_ENT(SOUND_MIXER_CD, 0x28, 7, 4, 0x28, 3, 4),
106 MIX_ENT(SOUND_MIXER_IMIX, 0x00, 0, 0, 0x00, 0, 0),
107 MIX_ENT(SOUND_MIXER_ALTPCM, 0x00, 0, 0, 0x00, 0, 0),
108 MIX_ENT(SOUND_MIXER_RECLEV, 0x00, 0, 0, 0x00, 0, 0)
109 };
110
111 mixer_tab sb16_mix = {
112 MIX_ENT(SOUND_MIXER_VOLUME, 0x30, 7, 5, 0x31, 7, 5),
113 MIX_ENT(SOUND_MIXER_BASS, 0x46, 7, 4, 0x47, 7, 4),
114 MIX_ENT(SOUND_MIXER_TREBLE, 0x44, 7, 4, 0x45, 7, 4),
115 MIX_ENT(SOUND_MIXER_SYNTH, 0x34, 7, 5, 0x35, 7, 5),
116 MIX_ENT(SOUND_MIXER_PCM, 0x32, 7, 5, 0x33, 7, 5),
117 MIX_ENT(SOUND_MIXER_SPEAKER, 0x3b, 7, 2, 0x00, 0, 0),
118 MIX_ENT(SOUND_MIXER_LINE, 0x38, 7, 5, 0x39, 7, 5),
119 MIX_ENT(SOUND_MIXER_MIC, 0x3a, 7, 5, 0x00, 0, 0),
120 MIX_ENT(SOUND_MIXER_CD, 0x36, 7, 5, 0x37, 7, 5),
121 MIX_ENT(SOUND_MIXER_IMIX, 0x00, 0, 0, 0x00, 0, 0),
122 MIX_ENT(SOUND_MIXER_ALTPCM, 0x00, 0, 0, 0x00, 0, 0),
123 MIX_ENT(SOUND_MIXER_RECLEV, 0x3f, 7, 2, 0x40, 7, 2)
124 };
125
126 static unsigned short levels[SOUND_MIXER_NRDEVICES] =
127 {
128 0x5a5a, /* Master Volume */
129 0x3232, /* Bass */
130 0x3232, /* Treble */
131 0x4b4b, /* FM */
132 0x4b4b, /* PCM */
133 0x4b4b, /* PC Speaker */
134 0x4b4b, /* Ext Line */
135 0x0000, /* Mic */
136 0x4b4b, /* CD */
137 0x4b4b, /* Recording monitor */
138 0x4b4b, /* SB PCM */
139 0x4b4b}; /* Recording level */
140
141 static unsigned char sb16_recmasks_L[SOUND_MIXER_NRDEVICES] =
142 {
143 0x00, /* SOUND_MIXER_VOLUME */
144 0x00, /* SOUND_MIXER_BASS */
145 0x00, /* SOUND_MIXER_TREBLE */
146 0x40, /* SOUND_MIXER_SYNTH */
147 0x00, /* SOUND_MIXER_PCM */
148 0x00, /* SOUND_MIXER_SPEAKER */
149 0x10, /* SOUND_MIXER_LINE */
150 0x01, /* SOUND_MIXER_MIC */
151 0x04, /* SOUND_MIXER_CD */
152 0x00, /* SOUND_MIXER_IMIX */
153 0x00, /* SOUND_MIXER_ALTPCM */
154 0x00 /* SOUND_MIXER_RECLEV */
155 };
156
157 static unsigned char sb16_recmasks_R[SOUND_MIXER_NRDEVICES] =
158 {
159 0x00, /* SOUND_MIXER_VOLUME */
160 0x00, /* SOUND_MIXER_BASS */
161 0x00, /* SOUND_MIXER_TREBLE */
162 0x20, /* SOUND_MIXER_SYNTH */
163 0x00, /* SOUND_MIXER_PCM */
164 0x00, /* SOUND_MIXER_SPEAKER */
165 0x08, /* SOUND_MIXER_LINE */
166 0x01, /* SOUND_MIXER_MIC */
167 0x02, /* SOUND_MIXER_CD */
168 0x00, /* SOUND_MIXER_IMIX */
169 0x00, /* SOUND_MIXER_ALTPCM */
170 0x00 /* SOUND_MIXER_RECLEV */
171 };
172 #endif