pre-2.1.109-2..
[davej-history.git] / drivers / sound / ad1848_mixer.h
blobab8eb20350882108d83c9d8ab3fe4ed4274488f6
1 /*
2 * sound/ad1848_mixer.h
4 * Definitions for the mixer of AD1848 and compatible codecs.
5 */
7 /*
8 * Copyright (C) by Hannu Savolainen 1993-1997
10 * OSS/Free for Linux is distributed under the GNU GENERAL PUBLIC LICENSE (GPL)
11 * Version 2 (June 1991). See the "COPYING" file distributed with this software
12 * for more info.
17 * The AD1848 codec has generic input lines called Line, Aux1 and Aux2.
18 * Sound card manufacturers have connected actual inputs (CD, synth, line,
19 * etc) to these inputs in different order. Therefore it's difficult
20 * to assign mixer channels to to these inputs correctly. The following
21 * contains two alternative mappings. The first one is for GUS MAX and
22 * the second is just a generic one (line1, line2 and line3).
23 * (Actually this is not a mapping but rather some kind of interleaving
24 * solution).
26 #define MODE1_REC_DEVICES (SOUND_MASK_LINE3 | SOUND_MASK_MIC | \
27 SOUND_MASK_LINE1|SOUND_MASK_IMIX)
29 #define MODE1_MIXER_DEVICES (SOUND_MASK_LINE1 | SOUND_MASK_MIC | \
30 SOUND_MASK_LINE2 | \
31 SOUND_MASK_IGAIN | \
32 SOUND_MASK_PCM | SOUND_MASK_IMIX)
34 #define MODE2_MIXER_DEVICES (SOUND_MASK_LINE1 | SOUND_MASK_LINE2 | \
35 SOUND_MASK_MIC | \
36 SOUND_MASK_LINE3 | SOUND_MASK_SPEAKER | \
37 SOUND_MASK_IGAIN | \
38 SOUND_MASK_PCM | SOUND_MASK_IMIX)
40 #define MODE3_MIXER_DEVICES (MODE2_MIXER_DEVICES | SOUND_MASK_VOLUME)
42 /* OPTi 82C930 has no IMIX level control, but it can still be selected as an
43 * input
45 #define C930_MIXER_DEVICES (SOUND_MASK_LINE1 | SOUND_MASK_LINE2 | \
46 SOUND_MASK_MIC | SOUND_MASK_VOLUME | \
47 SOUND_MASK_LINE3 | \
48 SOUND_MASK_IGAIN | SOUND_MASK_PCM)
50 struct mixer_def {
51 unsigned int regno: 5;
52 unsigned int polarity:1; /* 0=normal, 1=reversed */
53 unsigned int bitpos:3;
54 unsigned int nbits:3;
55 unsigned int mutepos:4;
58 static char mix_cvt[101] = {
59 0, 0,3,7,10,13,16,19,21,23,26,28,30,32,34,35,37,39,40,42,
60 43,45,46,47,49,50,51,52,53,55,56,57,58,59,60,61,62,63,64,65,
61 65,66,67,68,69,70,70,71,72,73,73,74,75,75,76,77,77,78,79,79,
62 80,81,81,82,82,83,84,84,85,85,86,86,87,87,88,88,89,89,90,90,
63 91,91,92,92,93,93,94,94,95,95,96,96,96,97,97,98,98,98,99,99,
64 100
67 typedef struct mixer_def mixer_ent;
68 typedef mixer_ent mixer_ents[2];
71 * Most of the mixer entries work in backwards. Setting the polarity field
72 * makes them to work correctly.
74 * The channel numbering used by individual sound cards is not fixed. Some
75 * cards have assigned different meanings for the AUX1, AUX2 and LINE inputs.
76 * The current version doesn't try to compensate this.
79 #define MIX_ENT(name, reg_l, pola_l, pos_l, len_l, reg_r, pola_r, pos_r, len_r, mute_bit) \
80 {{reg_l, pola_l, pos_l, len_l, mute_bit}, {reg_r, pola_r, pos_r, len_r, mute_bit}}
82 static mixer_ents ad1848_mix_devices[32] = {
83 MIX_ENT(SOUND_MIXER_VOLUME, 27, 1, 0, 4, 29, 1, 0, 4, 8),
84 MIX_ENT(SOUND_MIXER_BASS, 0, 0, 0, 0, 0, 0, 0, 0, 8),
85 MIX_ENT(SOUND_MIXER_TREBLE, 0, 0, 0, 0, 0, 0, 0, 0, 8),
86 MIX_ENT(SOUND_MIXER_SYNTH, 4, 1, 0, 5, 5, 1, 0, 5, 7),
87 MIX_ENT(SOUND_MIXER_PCM, 6, 1, 0, 6, 7, 1, 0, 6, 7),
88 MIX_ENT(SOUND_MIXER_SPEAKER, 26, 1, 0, 4, 0, 0, 0, 0, 8),
89 MIX_ENT(SOUND_MIXER_LINE, 18, 1, 0, 5, 19, 1, 0, 5, 7),
90 MIX_ENT(SOUND_MIXER_MIC, 0, 0, 5, 1, 1, 0, 5, 1, 8),
91 MIX_ENT(SOUND_MIXER_CD, 2, 1, 0, 5, 3, 1, 0, 5, 7),
92 MIX_ENT(SOUND_MIXER_IMIX, 13, 1, 2, 6, 0, 0, 0, 0, 8),
93 MIX_ENT(SOUND_MIXER_ALTPCM, 0, 0, 0, 0, 0, 0, 0, 0, 8),
94 MIX_ENT(SOUND_MIXER_RECLEV, 0, 0, 0, 0, 0, 0, 0, 0, 8),
95 MIX_ENT(SOUND_MIXER_IGAIN, 0, 0, 0, 4, 1, 0, 0, 4, 8),
96 MIX_ENT(SOUND_MIXER_OGAIN, 0, 0, 0, 0, 0, 0, 0, 0, 8),
97 MIX_ENT(SOUND_MIXER_LINE1, 2, 1, 0, 5, 3, 1, 0, 5, 7),
98 MIX_ENT(SOUND_MIXER_LINE2, 4, 1, 0, 5, 5, 1, 0, 5, 7),
99 MIX_ENT(SOUND_MIXER_LINE3, 18, 1, 0, 5, 19, 1, 0, 5, 7)
102 static mixer_ents iwave_mix_devices[32] = {
103 MIX_ENT(SOUND_MIXER_VOLUME, 25, 1, 0, 5, 27, 1, 0, 5, 8),
104 MIX_ENT(SOUND_MIXER_BASS, 0, 0, 0, 0, 0, 0, 0, 0, 8),
105 MIX_ENT(SOUND_MIXER_TREBLE, 0, 0, 0, 0, 0, 0, 0, 0, 8),
106 MIX_ENT(SOUND_MIXER_SYNTH, 4, 1, 0, 5, 5, 1, 0, 5, 7),
107 MIX_ENT(SOUND_MIXER_PCM, 6, 1, 0, 6, 7, 1, 0, 6, 7),
108 MIX_ENT(SOUND_MIXER_SPEAKER, 26, 1, 0, 4, 0, 0, 0, 0, 8),
109 MIX_ENT(SOUND_MIXER_LINE, 18, 1, 0, 5, 19, 1, 0, 5, 7),
110 MIX_ENT(SOUND_MIXER_MIC, 0, 0, 5, 1, 1, 0, 5, 1, 8),
111 MIX_ENT(SOUND_MIXER_CD, 2, 1, 0, 5, 3, 1, 0, 5, 7),
112 MIX_ENT(SOUND_MIXER_IMIX, 16, 1, 0, 5, 17, 1, 0, 5, 8),
113 MIX_ENT(SOUND_MIXER_ALTPCM, 0, 0, 0, 0, 0, 0, 0, 0, 8),
114 MIX_ENT(SOUND_MIXER_RECLEV, 0, 0, 0, 0, 0, 0, 0, 0, 8),
115 MIX_ENT(SOUND_MIXER_IGAIN, 0, 0, 0, 4, 1, 0, 0, 4, 8),
116 MIX_ENT(SOUND_MIXER_OGAIN, 0, 0, 0, 0, 0, 0, 0, 0, 8),
117 MIX_ENT(SOUND_MIXER_LINE1, 2, 1, 0, 5, 3, 1, 0, 5, 7),
118 MIX_ENT(SOUND_MIXER_LINE2, 4, 1, 0, 5, 5, 1, 0, 5, 7),
119 MIX_ENT(SOUND_MIXER_LINE3, 18, 1, 0, 5, 19, 1, 0, 5, 7)
122 /* OPTi 82C930 has somewhat different port addresses.
123 * Note: VOLUME == SPEAKER, SYNTH == LINE2, LINE == LINE3, CD == LINE1
124 * VOLUME, SYNTH, LINE, CD are not enabled above.
125 * MIC is level of mic monitoring direct to output. Same for CD, LINE, etc.
127 static mixer_ents c930_mix_devices[32] = {
128 MIX_ENT(SOUND_MIXER_VOLUME, 22, 1, 1, 5, 23, 1, 1, 5, 7),
129 MIX_ENT(SOUND_MIXER_BASS, 0, 0, 0, 0, 0, 0, 0, 0, 8),
130 MIX_ENT(SOUND_MIXER_TREBLE, 0, 0, 0, 0, 0, 0, 0, 0, 8),
131 MIX_ENT(SOUND_MIXER_SYNTH, 4, 1, 1, 4, 5, 1, 1, 4, 7),
132 MIX_ENT(SOUND_MIXER_PCM, 6, 1, 0, 5, 7, 1, 0, 5, 7),
133 MIX_ENT(SOUND_MIXER_SPEAKER, 22, 1, 1, 5, 23, 1, 1, 5, 7),
134 MIX_ENT(SOUND_MIXER_LINE, 18, 1, 1, 4, 19, 1, 1, 4, 7),
135 MIX_ENT(SOUND_MIXER_MIC, 20, 1, 1, 4, 21, 1, 1, 4, 7),
136 MIX_ENT(SOUND_MIXER_CD, 2, 1, 1, 4, 3, 1, 1, 4, 7),
137 MIX_ENT(SOUND_MIXER_IMIX, 0, 0, 0, 0, 0, 0, 0, 0, 8),
138 MIX_ENT(SOUND_MIXER_ALTPCM, 0, 0, 0, 0, 0, 0, 0, 0, 8),
139 MIX_ENT(SOUND_MIXER_RECLEV, 0, 0, 0, 0, 0, 0, 0, 0, 8),
140 MIX_ENT(SOUND_MIXER_IGAIN, 0, 0, 0, 4, 1, 0, 0, 4, 8),
141 MIX_ENT(SOUND_MIXER_OGAIN, 0, 0, 0, 0, 0, 0, 0, 0, 8),
142 MIX_ENT(SOUND_MIXER_LINE1, 2, 1, 1, 4, 3, 1, 1, 4, 7),
143 MIX_ENT(SOUND_MIXER_LINE2, 4, 1, 1, 4, 5, 1, 1, 4, 7),
144 MIX_ENT(SOUND_MIXER_LINE3, 18, 1, 1, 4, 19, 1, 1, 4, 7)
147 static int default_mixer_levels[32] =
149 0x3232, /* Master Volume */
150 0x3232, /* Bass */
151 0x3232, /* Treble */
152 0x4b4b, /* FM */
153 0x3232, /* PCM */
154 0x1515, /* PC Speaker */
155 0x2020, /* Ext Line */
156 0x1010, /* Mic */
157 0x4b4b, /* CD */
158 0x0000, /* Recording monitor */
159 0x4b4b, /* Second PCM */
160 0x4b4b, /* Recording level */
161 0x4b4b, /* Input gain */
162 0x4b4b, /* Output gain */
163 0x2020, /* Line1 */
164 0x2020, /* Line2 */
165 0x1515 /* Line3 (usually line in)*/
168 #define LEFT_CHN 0
169 #define RIGHT_CHN 1
172 * Channel enable bits for ioctl(SOUND_MIXER_PRIVATE1)
175 #ifndef AUDIO_SPEAKER
176 #define AUDIO_SPEAKER 0x01 /* Enable mono output */
177 #define AUDIO_HEADPHONE 0x02 /* Sparc only */
178 #define AUDIO_LINE_OUT 0x04 /* Sparc only */
179 #endif