root/drivers/sound/sb_mixer.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  * sound/sb_mixer.h
   3  * 
   4  * Definitions for the SB Pro and SB16 mixers
   5  */
   6 /*
   7  * Copyright by Hannu Savolainen 1993-1996
   8  *
   9  * Redistribution and use in source and binary forms, with or without
  10  * modification, are permitted provided that the following conditions are
  11  * met: 1. Redistributions of source code must retain the above copyright
  12  * notice, this list of conditions and the following disclaimer. 2.
  13  * Redistributions in binary form must reproduce the above copyright notice,
  14  * this list of conditions and the following disclaimer in the documentation
  15  * and/or other materials provided with the distribution.
  16  *
  17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
  18  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  20  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
  21  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  23  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  24  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  27  * SUCH DAMAGE.
  28  */
  29 
  30 /*
  31  * Modified:
  32  *      Hunyue Yau      Jan 6 1994
  33  *      Added defines for the Sound Galaxy NX Pro mixer.
  34  * 
  35  */
  36 
  37 #define SBPRO_RECORDING_DEVICES (SOUND_MASK_LINE | SOUND_MASK_MIC | SOUND_MASK_CD)
  38 
  39 /* Same as SB Pro, unless I find otherwise */
  40 #define SGNXPRO_RECORDING_DEVICES SBPRO_RECORDING_DEVICES
  41 
  42 #define SBPRO_MIXER_DEVICES             (SOUND_MASK_SYNTH | SOUND_MASK_PCM | SOUND_MASK_LINE | SOUND_MASK_MIC | \
  43                                          SOUND_MASK_CD | SOUND_MASK_VOLUME)
  44 
  45 /* SG NX Pro has treble and bass settings on the mixer. The 'speaker'
  46  * channel is the COVOX/DisneySoundSource emulation volume control
  47  * on the mixer. It does NOT control speaker volume. Should have own
  48  * mask eventually?
  49  */
  50 #define SGNXPRO_MIXER_DEVICES   (SBPRO_MIXER_DEVICES|SOUND_MASK_BASS| \
  51                                  SOUND_MASK_TREBLE|SOUND_MASK_SPEAKER )
  52 
  53 #define SB16_RECORDING_DEVICES          (SOUND_MASK_SYNTH | SOUND_MASK_LINE | SOUND_MASK_MIC | \
  54                                          SOUND_MASK_CD)
  55 
  56 #define ES688_RECORDING_DEVICES SBPRO_RECORDING_DEVICES
  57 #define ES688_MIXER_DEVICES (SBPRO_MIXER_DEVICES|SOUND_MASK_LINE2|SOUND_MASK_SPEAKER)
  58 
  59 #define SB16_MIXER_DEVICES              (SOUND_MASK_SYNTH | SOUND_MASK_PCM | SOUND_MASK_SPEAKER | SOUND_MASK_LINE | SOUND_MASK_MIC | \
  60                                          SOUND_MASK_CD | \
  61                                          SOUND_MASK_IGAIN | SOUND_MASK_OGAIN | \
  62                                          SOUND_MASK_VOLUME | SOUND_MASK_BASS | SOUND_MASK_TREBLE)
  63 
  64 /*
  65  * Mixer registers
  66  * 
  67  * NOTE!        RECORD_SRC == IN_FILTER
  68  */
  69 
  70 /* 
  71  * Mixer registers of SB Pro
  72  */
  73 #define VOC_VOL         0x04
  74 #define MIC_VOL         0x0A
  75 #define MIC_MIX         0x0A
  76 #define RECORD_SRC      0x0C
  77 #define IN_FILTER       0x0C
  78 #define OUT_FILTER      0x0E
  79 #define MASTER_VOL      0x22
  80 #define FM_VOL          0x26
  81 #define CD_VOL          0x28
  82 #define LINE_VOL        0x2E
  83 #define IRQ_NR          0x80
  84 #define DMA_NR          0x81
  85 #define IRQ_STAT        0x82
  86 #define OPSW            0x3c
  87 
  88 /*
  89  * Additional registers on the SG NX Pro 
  90  */
  91 #define COVOX_VOL       0x42
  92 #define TREBLE_LVL      0x44
  93 #define BASS_LVL        0x46
  94 
  95 #define FREQ_HI         (1 << 3)/* Use High-frequency ANFI filters */
  96 #define FREQ_LOW        0       /* Use Low-frequency ANFI filters */
  97 #define FILT_ON         0       /* Yes, 0 to turn it on, 1 for off */
  98 #define FILT_OFF        (1 << 5)
  99 
 100 #define MONO_DAC        0x00
 101 #define STEREO_DAC      0x02
 102 
 103 /*
 104  * Mixer registers of SB16
 105  */
 106 #define SB16_IMASK_L    0x3d
 107 #define SB16_IMASK_R    0x3e
 108 
 109 #define LEFT_CHN        0
 110 #define RIGHT_CHN       1
 111 
 112 struct mixer_def {
 113         unsigned int regno: 8;
 114         unsigned int bitoffs:4;
 115         unsigned int nbits:4;
 116 };
 117 
 118 
 119 typedef struct mixer_def mixer_tab[32][2];
 120 typedef struct mixer_def mixer_ent;
 121 
 122 #define MIX_ENT(name, reg_l, bit_l, len_l, reg_r, bit_r, len_r) \
 123         {{reg_l, bit_l, len_l}, {reg_r, bit_r, len_r}}
 124 
 125 #ifdef __SB_MIXER_C__
 126 mixer_tab sbpro_mix = {
 127 MIX_ENT(SOUND_MIXER_VOLUME,     0x22, 7, 4, 0x22, 3, 4),
 128 MIX_ENT(SOUND_MIXER_BASS,       0x00, 0, 0, 0x00, 0, 0),
 129 MIX_ENT(SOUND_MIXER_TREBLE,     0x00, 0, 0, 0x00, 0, 0),
 130 MIX_ENT(SOUND_MIXER_SYNTH,      0x26, 7, 4, 0x26, 3, 4),
 131 MIX_ENT(SOUND_MIXER_PCM,        0x04, 7, 4, 0x04, 3, 4),
 132 MIX_ENT(SOUND_MIXER_SPEAKER,    0x00, 0, 0, 0x00, 0, 0),
 133 MIX_ENT(SOUND_MIXER_LINE,       0x2e, 7, 4, 0x2e, 3, 4),
 134 MIX_ENT(SOUND_MIXER_MIC,        0x0a, 2, 3, 0x00, 0, 0),
 135 MIX_ENT(SOUND_MIXER_CD,         0x28, 7, 4, 0x28, 3, 4),
 136 MIX_ENT(SOUND_MIXER_IMIX,       0x00, 0, 0, 0x00, 0, 0),
 137 MIX_ENT(SOUND_MIXER_ALTPCM,     0x00, 0, 0, 0x00, 0, 0),
 138 MIX_ENT(SOUND_MIXER_RECLEV,     0x00, 0, 0, 0x00, 0, 0)
 139 };
 140 mixer_tab es688_mix = {
 141 MIX_ENT(SOUND_MIXER_VOLUME,     0x32, 7, 4, 0x32, 3, 4),
 142 MIX_ENT(SOUND_MIXER_BASS,       0x00, 0, 0, 0x00, 0, 0),
 143 MIX_ENT(SOUND_MIXER_TREBLE,     0x00, 0, 0, 0x00, 0, 0),
 144 MIX_ENT(SOUND_MIXER_SYNTH,      0x36, 7, 4, 0x36, 3, 4),
 145 MIX_ENT(SOUND_MIXER_PCM,        0x14, 7, 4, 0x14, 3, 4),
 146 MIX_ENT(SOUND_MIXER_SPEAKER,    0x3c, 2, 3, 0x00, 0, 0),
 147 MIX_ENT(SOUND_MIXER_LINE,       0x3e, 7, 4, 0x3e, 3, 4),
 148 MIX_ENT(SOUND_MIXER_MIC,        0x1a, 7, 4, 0x1a, 3, 4),
 149 MIX_ENT(SOUND_MIXER_CD,         0x38, 7, 4, 0x38, 3, 4),
 150 MIX_ENT(SOUND_MIXER_IMIX,       0x00, 0, 0, 0x00, 0, 0),
 151 MIX_ENT(SOUND_MIXER_ALTPCM,     0x00, 0, 0, 0x00, 0, 0),
 152 MIX_ENT(SOUND_MIXER_RECLEV,     0x00, 0, 0, 0x00, 0, 0),
 153 MIX_ENT(SOUND_MIXER_IGAIN,      0x00, 0, 0, 0x00, 0, 0),
 154 MIX_ENT(SOUND_MIXER_OGAIN,      0x00, 0, 0, 0x00, 0, 0),
 155 MIX_ENT(SOUND_MIXER_LINE1,      0x00, 0, 0, 0x00, 0, 0),
 156 MIX_ENT(SOUND_MIXER_LINE2,      0x3a, 7, 4, 0x3a, 3, 4),
 157 MIX_ENT(SOUND_MIXER_LINE3,      0x00, 0, 0, 0x00, 0, 0)
 158 };
 159 
 160 #ifdef  __SGNXPRO__
 161 mixer_tab sgnxpro_mix = {
 162 MIX_ENT(SOUND_MIXER_VOLUME,     0x22, 7, 4, 0x22, 3, 4),
 163 MIX_ENT(SOUND_MIXER_BASS,       0x46, 2, 3, 0x00, 0, 0),
 164 MIX_ENT(SOUND_MIXER_TREBLE,     0x44, 2, 3, 0x00, 0, 0),
 165 MIX_ENT(SOUND_MIXER_SYNTH,      0x26, 7, 4, 0x26, 3, 4),
 166 MIX_ENT(SOUND_MIXER_PCM,        0x04, 7, 4, 0x04, 3, 4),
 167 MIX_ENT(SOUND_MIXER_SPEAKER,    0x42, 2, 3, 0x00, 0, 0),
 168 MIX_ENT(SOUND_MIXER_LINE,       0x2e, 7, 4, 0x2e, 3, 4),
 169 MIX_ENT(SOUND_MIXER_MIC,        0x0a, 2, 3, 0x00, 0, 0),
 170 MIX_ENT(SOUND_MIXER_CD,         0x28, 7, 4, 0x28, 3, 4),
 171 MIX_ENT(SOUND_MIXER_IMIX,       0x00, 0, 0, 0x00, 0, 0),
 172 MIX_ENT(SOUND_MIXER_ALTPCM,     0x00, 0, 0, 0x00, 0, 0),
 173 MIX_ENT(SOUND_MIXER_RECLEV,     0x00, 0, 0, 0x00, 0, 0),
 174 MIX_ENT(SOUND_MIXER_IGAIN,      0x00, 0, 0, 0x00, 0, 0),
 175 MIX_ENT(SOUND_MIXER_OGAIN,      0x00, 0, 0, 0x00, 0, 0)
 176 };
 177 #endif
 178 
 179 mixer_tab sb16_mix = {
 180 MIX_ENT(SOUND_MIXER_VOLUME,     0x30, 7, 5, 0x31, 7, 5),
 181 MIX_ENT(SOUND_MIXER_BASS,       0x46, 7, 4, 0x47, 7, 4),
 182 MIX_ENT(SOUND_MIXER_TREBLE,     0x44, 7, 4, 0x45, 7, 4),
 183 MIX_ENT(SOUND_MIXER_SYNTH,      0x34, 7, 5, 0x35, 7, 5),
 184 MIX_ENT(SOUND_MIXER_PCM,        0x32, 7, 5, 0x33, 7, 5),
 185 MIX_ENT(SOUND_MIXER_SPEAKER,    0x3b, 7, 2, 0x00, 0, 0),
 186 MIX_ENT(SOUND_MIXER_LINE,       0x38, 7, 5, 0x39, 7, 5),
 187 MIX_ENT(SOUND_MIXER_MIC,        0x3a, 7, 5, 0x00, 0, 0),
 188 MIX_ENT(SOUND_MIXER_CD,         0x36, 7, 5, 0x37, 7, 5),
 189 MIX_ENT(SOUND_MIXER_IMIX,       0x00, 0, 0, 0x00, 0, 0),
 190 MIX_ENT(SOUND_MIXER_ALTPCM,     0x00, 0, 0, 0x00, 0, 0),
 191 MIX_ENT(SOUND_MIXER_RECLEV,     0x3f, 7, 2, 0x40, 7, 2), /* Obsolete. Use IGAIN */
 192 MIX_ENT(SOUND_MIXER_IGAIN,      0x3f, 7, 2, 0x40, 7, 2),
 193 MIX_ENT(SOUND_MIXER_OGAIN,      0x41, 7, 2, 0x42, 7, 2)
 194 };
 195 
 196 #ifdef SM_GAMES       /* Master volume is lower and PCM & FM volumes
 197                              higher than with SB Pro. This improves the
 198                              sound quality */
 199 
 200 static unsigned short levels[SOUND_MIXER_NRDEVICES] =
 201 {
 202   0x2020,                       /* Master Volume */
 203   0x4b4b,                       /* Bass */
 204   0x4b4b,                       /* Treble */
 205   0x6464,                       /* FM */
 206   0x6464,                       /* PCM */
 207   0x4b4b,                       /* PC Speaker */
 208   0x4b4b,                       /* Ext Line */
 209   0x0000,                       /* Mic */
 210   0x4b4b,                       /* CD */
 211   0x4b4b,                       /* Recording monitor */
 212   0x4b4b,                       /* SB PCM */
 213   0x4b4b,                       /* Recording level */
 214   0x4b4b,                       /* Input gain */
 215   0x4b4b,                       /* Output gain */
 216   0x4040,                       /* Line1 */
 217   0x4040,                       /* Line2 */
 218   0x1515                        /* Line3 */
 219 };
 220 
 221 #else  /* If the user selected just plain SB Pro */
 222 
 223 static unsigned short levels[SOUND_MIXER_NRDEVICES] =
 224 {
 225   0x5a5a,                       /* Master Volume */
 226   0x4b4b,                       /* Bass */
 227   0x4b4b,                       /* Treble */
 228   0x4b4b,                       /* FM */
 229   0x4b4b,                       /* PCM */
 230   0x4b4b,                       /* PC Speaker */
 231   0x4b4b,                       /* Ext Line */
 232   0x1010,                       /* Mic */
 233   0x4b4b,                       /* CD */
 234   0x4b4b,                       /* Recording monitor */
 235   0x4b4b,                       /* SB PCM */
 236   0x4b4b,                       /* Recording level */
 237   0x4b4b,                       /* Input gain */
 238   0x4b4b,                       /* Output gain */
 239   0x4040,                       /* Line1 */
 240   0x4040,                       /* Line2 */
 241   0x1515                        /* Line3 */
 242 };
 243 #endif /* SM_GAMES */
 244 
 245 static unsigned char sb16_recmasks_L[SOUND_MIXER_NRDEVICES] =
 246 {
 247         0x00,   /* SOUND_MIXER_VOLUME   */
 248         0x00,   /* SOUND_MIXER_BASS     */
 249         0x00,   /* SOUND_MIXER_TREBLE   */
 250         0x40,   /* SOUND_MIXER_SYNTH    */
 251         0x00,   /* SOUND_MIXER_PCM      */
 252         0x00,   /* SOUND_MIXER_SPEAKER  */
 253         0x10,   /* SOUND_MIXER_LINE     */
 254         0x01,   /* SOUND_MIXER_MIC      */
 255         0x04,   /* SOUND_MIXER_CD       */
 256         0x00,   /* SOUND_MIXER_IMIX     */
 257         0x00,   /* SOUND_MIXER_ALTPCM   */
 258         0x00,   /* SOUND_MIXER_RECLEV   */
 259         0x00,   /* SOUND_MIXER_IGAIN    */
 260         0x00    /* SOUND_MIXER_OGAIN    */
 261 };
 262 
 263 static unsigned char sb16_recmasks_R[SOUND_MIXER_NRDEVICES] =
 264 {
 265         0x00,   /* SOUND_MIXER_VOLUME   */
 266         0x00,   /* SOUND_MIXER_BASS     */
 267         0x00,   /* SOUND_MIXER_TREBLE   */
 268         0x20,   /* SOUND_MIXER_SYNTH    */
 269         0x00,   /* SOUND_MIXER_PCM      */
 270         0x00,   /* SOUND_MIXER_SPEAKER  */
 271         0x08,   /* SOUND_MIXER_LINE     */
 272         0x01,   /* SOUND_MIXER_MIC      */
 273         0x02,   /* SOUND_MIXER_CD       */
 274         0x00,   /* SOUND_MIXER_IMIX     */
 275         0x00,   /* SOUND_MIXER_ALTPCM   */
 276         0x00,   /* SOUND_MIXER_RECLEV   */
 277         0x00,   /* SOUND_MIXER_IGAIN    */
 278         0x00    /* SOUND_MIXER_OGAIN    */
 279 };
 280 
 281 /*
 282  *      Recording sources (SB Pro)
 283  */
 284 
 285 #define SRC_MIC         1       /* Select Microphone recording source */
 286 #define SRC_CD          3       /* Select CD recording source */
 287 #define SRC_LINE        7       /* Use Line-in for recording source */
 288 
 289 #endif

/* [previous][next][first][last][top][bottom][index][help] */