1 /* 2 * sound/ad1848_mixer.h 3 * 4 * Definitions for the mixer of AD1848 and compatible codecs. 5 * 6 * Copyright by Hannu Savolainen 1994 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 * The AD1848 codec has generic input lines called Line, Aux1 and Aux2. 30 * Soundcard manufacturers have connected actual inputs (CD, synth, line, 31 * etc) to these inputs in different order. Therefore it's difficult 32 * to assign mixer channels to to these inputs correctly. The following 33 * contains two alternative mappings. The first one is for GUS MAX and 34 * the second is just a generic one (line1, line2 and line3). 35 * (Actually this is not a mapping but rather some kind of interleaving 36 * solution). 37 */ 38 #ifdef GUSMAX_MIXER
39 #defineMODE1_REC_DEVICES (SOUND_MASK_LINE | SOUND_MASK_MIC | \
40 SOUND_MASK_CD)
41
42 #defineMODE1_MIXER_DEVICES (SOUND_MASK_SYNTH | SOUND_MASK_MIC | \
43 SOUND_MASK_CD | \
44 SOUND_MASK_IGAIN | \
45 SOUND_MASK_PCM|SOUND_MASK_IMIX)
46
47 #defineMODE2_MIXER_DEVICES (SOUND_MASK_SYNTH | SOUND_MASK_LINE | SOUND_MASK_MIC | \
48 SOUND_MASK_CD | SOUND_MASK_SPEAKER | \
49 SOUND_MASK_IGAIN | \
50 SOUND_MASK_PCM | SOUND_MASK_IMIX)
51 #else/* Generic mapping */ 52 #defineMODE1_REC_DEVICES (SOUND_MASK_LINE3 | SOUND_MASK_MIC | \
53 SOUND_MASK_LINE1)
54
55 #defineMODE1_MIXER_DEVICES (SOUND_MASK_LINE1 | SOUND_MASK_MIC | \
56 SOUND_MASK_LINE2 | \
57 SOUND_MASK_IGAIN | \
58 SOUND_MASK_PCM | SOUND_MASK_IMIX)
59
60 #defineMODE2_MIXER_DEVICES (SOUND_MASK_LINE1 | SOUND_MASK_LINE2 | SOUND_MASK_MIC | \
61 SOUND_MASK_LINE3 | SOUND_MASK_SPEAKER | \
62 SOUND_MASK_IGAIN | \
63 SOUND_MASK_PCM | SOUND_MASK_IMIX)
64 #endif 65
66 structmixer_def{ 67 unsignedintregno: 7;
68 unsignedintpolarity:1; /* 0=normal, 1=reversed */ 69 unsignedintbitpos:4;
70 unsignedintnbits:4;
71 };
72
73
74 typedefstructmixer_defmixer_ent;
75
76 /* 77 * Most of the mixer entries work in backwards. Setting the polarity field 78 * makes them to work correctly. 79 * 80 * The channel numbering used by individual soundcards is not fixed. Some 81 * cards have assigned different meanings for the AUX1, AUX2 and LINE inputs. 82 * The current version doesn't try to compensate this. 83 */ 84
85 #defineMIX_ENT(name, reg_l, pola_l, pos_l, len_l, reg_r, pola_r, pos_r, len_r) \
86 {{reg_l, pola_l, pos_r, len_l}, {reg_r, pola_r, pos_r, len_r}} 87
88 mixer_entmix_devices[32][2] = {/* As used in GUS MAX */ 89 MIX_ENT(SOUND_MIXER_VOLUME, 0, 0, 0, 0, 0, 0, 0, 0),
90 MIX_ENT(SOUND_MIXER_BASS, 0, 0, 0, 0, 0, 0, 0, 0),
91 MIX_ENT(SOUND_MIXER_TREBLE, 0, 0, 0, 0, 0, 0, 0, 0),
92 MIX_ENT(SOUND_MIXER_SYNTH, 4, 1, 0, 5, 5, 1, 0, 5),
93 MIX_ENT(SOUND_MIXER_PCM, 6, 1, 0, 6, 7, 1, 0, 6),
94 MIX_ENT(SOUND_MIXER_SPEAKER, 26, 1, 0, 4, 0, 0, 0, 0),
95 MIX_ENT(SOUND_MIXER_LINE, 18, 1, 0, 5, 19, 1, 0, 5),
96 MIX_ENT(SOUND_MIXER_MIC, 0, 0, 5, 1, 1, 0, 5, 1),
97 MIX_ENT(SOUND_MIXER_CD, 2, 1, 0, 5, 3, 1, 0, 5),
98 MIX_ENT(SOUND_MIXER_IMIX, 13, 1, 2, 6, 0, 0, 0, 0),
99 MIX_ENT(SOUND_MIXER_ALTPCM, 0, 0, 0, 0, 0, 0, 0, 0),
100 MIX_ENT(SOUND_MIXER_RECLEV, 0, 0, 0, 0, 0, 0, 0, 0),
101 MIX_ENT(SOUND_MIXER_IGAIN, 0, 0, 0, 4, 1, 0, 0, 4),
102 MIX_ENT(SOUND_MIXER_OGAIN, 0, 0, 0, 0, 0, 0, 0, 0),
103 MIX_ENT(SOUND_MIXER_LINE1, 2, 1, 0, 5, 3, 1, 0, 5),
104 MIX_ENT(SOUND_MIXER_LINE2, 4, 1, 0, 5, 5, 1, 0, 5),
105 MIX_ENT(SOUND_MIXER_LINE3, 18, 1, 0, 5, 19, 1, 0, 5)
106 };
107
108 staticunsignedshortdefault_mixer_levels[SOUND_MIXER_NRDEVICES] =
109 { 110 0x5a5a, /* Master Volume */ 111 0x3232, /* Bass */ 112 0x3232, /* Treble */ 113 0x4b4b, /* FM */ 114 0x6464, /* PCM */ 115 0x4b4b, /* PC Speaker */ 116 0x4b4b, /* Ext Line */ 117 0x1010, /* Mic */ 118 0x4b4b, /* CD */ 119 0x0000, /* Recording monitor */ 120 0x4b4b, /* SB PCM */ 121 0x4b4b, /* Recording level */ 122 0x4b4b, /* Input gain */ 123 0x4b4b, /* Output gain */ 124 0x4b4b, /* Line1 */ 125 0x4b4b, /* Line2 */ 126 0x3232 /* Line3 (usually line in)*/ 127 };
128
129 #defineLEFT_CHN 0
130 #defineRIGHT_CHN 1