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  * 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  * Modified:
  29  *      Hunyue Yau      Jan 6 1994
  30  *      Added defines for the Sound Galaxy NX Pro mixer.
  31  * 
  32  */
  33 
  34 #define SBPRO_RECORDING_DEVICES (SOUND_MASK_LINE | SOUND_MASK_MIC | SOUND_MASK_CD)
  35 
  36 /* Same as SB Pro, unless I find otherwise */
  37 #define SGNXPRO_RECORDING_DEVICES SBPRO_RECORDING_DEVICES
  38 
  39 #define SBPRO_MIXER_DEVICES             (SOUND_MASK_SYNTH | SOUND_MASK_PCM | SOUND_MASK_LINE | SOUND_MASK_MIC | \
  40                                          SOUND_MASK_CD | SOUND_MASK_VOLUME)
  41 
  42 /* SG NX Pro has treble and bass settings on the mixer. The 'speaker'
  43  * channel is the COVOX/DisneySoundSource emulation volume control
  44  * on the mixer. It does NOT control speaker volume. Should have own
  45  * mask eventually?
  46  */
  47 #define SGNXPRO_MIXER_DEVICES   (SBPRO_MIXER_DEVICES|SOUND_MASK_BASS| \
  48                                  SOUND_MASK_TREBLE|SOUND_MASK_SPEAKER )
  49 
  50 #define SB16_RECORDING_DEVICES          (SOUND_MASK_SYNTH | SOUND_MASK_LINE | SOUND_MASK_MIC | \
  51                                          SOUND_MASK_CD)
  52 
  53 #define SB16_MIXER_DEVICES              (SOUND_MASK_SYNTH | SOUND_MASK_PCM | SOUND_MASK_SPEAKER | SOUND_MASK_LINE | SOUND_MASK_MIC | \
  54                                          SOUND_MASK_CD | \
  55                                          SOUND_MASK_IGAIN | SOUND_MASK_OGAIN | \
  56                                          SOUND_MASK_VOLUME | SOUND_MASK_BASS | SOUND_MASK_TREBLE)
  57 
  58 /*
  59  * Mixer registers
  60  * 
  61  * NOTE!        RECORD_SRC == IN_FILTER
  62  */
  63 
  64 /* 
  65  * Mixer registers of SB Pro
  66  */
  67 #define VOC_VOL         0x04
  68 #define MIC_VOL         0x0A
  69 #define MIC_MIX         0x0A
  70 #define RECORD_SRC      0x0C
  71 #define IN_FILTER       0x0C
  72 #define OUT_FILTER      0x0E
  73 #define MASTER_VOL      0x22
  74 #define FM_VOL          0x26
  75 #define CD_VOL          0x28
  76 #define LINE_VOL        0x2E
  77 #define IRQ_NR          0x80
  78 #define DMA_NR          0x81
  79 #define IRQ_STAT        0x82
  80 #define OPSW            0x3c
  81 
  82 /*
  83  * Additional registers on the SG NX Pro 
  84  */
  85 #define COVOX_VOL       0x42
  86 #define TREBLE_LVL      0x44
  87 #define BASS_LVL        0x46
  88 
  89 #define FREQ_HI         (1 << 3)/* Use High-frequency ANFI filters */
  90 #define FREQ_LOW        0       /* Use Low-frequency ANFI filters */
  91 #define FILT_ON         0       /* Yes, 0 to turn it on, 1 for off */
  92 #define FILT_OFF        (1 << 5)
  93 
  94 #define MONO_DAC        0x00
  95 #define STEREO_DAC      0x02
  96 
  97 /*
  98  * Mixer registers of SB16
  99  */
 100 #define SB16_IMASK_L    0x3d
 101 #define SB16_IMASK_R    0x3e
 102 
 103 #define LEFT_CHN        0
 104 #define RIGHT_CHN       1
 105 
 106 struct mixer_def {
 107         unsigned int regno: 8;
 108         unsigned int bitoffs:4;
 109         unsigned int nbits:4;
 110 };
 111 
 112 
 113 typedef struct mixer_def mixer_tab[32][2];
 114 typedef struct mixer_def mixer_ent;
 115 
 116 #define MIX_ENT(name, reg_l, bit_l, len_l, reg_r, bit_r, len_r) \
 117         {{reg_l, bit_l, len_l}, {reg_r, bit_r, len_r}}
 118 
 119 #ifdef __SB_MIXER_C__
 120 mixer_tab sbpro_mix = {
 121 MIX_ENT(SOUND_MIXER_VOLUME,     0x22, 7, 4, 0x22, 3, 4),
 122 MIX_ENT(SOUND_MIXER_BASS,       0x00, 0, 0, 0x00, 0, 0),
 123 MIX_ENT(SOUND_MIXER_TREBLE,     0x00, 0, 0, 0x00, 0, 0),
 124 MIX_ENT(SOUND_MIXER_SYNTH,      0x26, 7, 4, 0x26, 3, 4),
 125 MIX_ENT(SOUND_MIXER_PCM,        0x04, 7, 4, 0x04, 3, 4),
 126 MIX_ENT(SOUND_MIXER_SPEAKER,    0x00, 0, 0, 0x00, 0, 0),
 127 MIX_ENT(SOUND_MIXER_LINE,       0x2e, 7, 4, 0x2e, 3, 4),
 128 MIX_ENT(SOUND_MIXER_MIC,        0x0a, 2, 3, 0x00, 0, 0),
 129 MIX_ENT(SOUND_MIXER_CD,         0x28, 7, 4, 0x28, 3, 4),
 130 MIX_ENT(SOUND_MIXER_IMIX,       0x00, 0, 0, 0x00, 0, 0),
 131 MIX_ENT(SOUND_MIXER_ALTPCM,     0x00, 0, 0, 0x00, 0, 0),
 132 MIX_ENT(SOUND_MIXER_RECLEV,     0x00, 0, 0, 0x00, 0, 0)
 133 };
 134 
 135 #ifdef  __SGNXPRO__
 136 mixer_tab sgnxpro_mix = {
 137 MIX_ENT(SOUND_MIXER_VOLUME,     0x22, 7, 4, 0x22, 3, 4),
 138 MIX_ENT(SOUND_MIXER_BASS,       0x46, 2, 3, 0x00, 0, 0),
 139 MIX_ENT(SOUND_MIXER_TREBLE,     0x44, 2, 3, 0x00, 0, 0),
 140 MIX_ENT(SOUND_MIXER_SYNTH,      0x26, 7, 4, 0x26, 3, 4),
 141 MIX_ENT(SOUND_MIXER_PCM,        0x04, 7, 4, 0x04, 3, 4),
 142 MIX_ENT(SOUND_MIXER_SPEAKER,    0x42, 2, 3, 0x00, 0, 0),
 143 MIX_ENT(SOUND_MIXER_LINE,       0x2e, 7, 4, 0x2e, 3, 4),
 144 MIX_ENT(SOUND_MIXER_MIC,        0x0a, 2, 3, 0x00, 0, 0),
 145 MIX_ENT(SOUND_MIXER_CD,         0x28, 7, 4, 0x28, 3, 4),
 146 MIX_ENT(SOUND_MIXER_IMIX,       0x00, 0, 0, 0x00, 0, 0),
 147 MIX_ENT(SOUND_MIXER_ALTPCM,     0x00, 0, 0, 0x00, 0, 0),
 148 MIX_ENT(SOUND_MIXER_RECLEV,     0x00, 0, 0, 0x00, 0, 0),
 149 MIX_ENT(SOUND_MIXER_IGAIN,      0x00, 0, 0, 0x00, 0, 0),
 150 MIX_ENT(SOUND_MIXER_OGAIN,      0x00, 0, 0, 0x00, 0, 0)
 151 };
 152 #endif
 153 
 154 mixer_tab sb16_mix = {
 155 MIX_ENT(SOUND_MIXER_VOLUME,     0x30, 7, 5, 0x31, 7, 5),
 156 MIX_ENT(SOUND_MIXER_BASS,       0x46, 7, 4, 0x47, 7, 4),
 157 MIX_ENT(SOUND_MIXER_TREBLE,     0x44, 7, 4, 0x45, 7, 4),
 158 MIX_ENT(SOUND_MIXER_SYNTH,      0x34, 7, 5, 0x35, 7, 5),
 159 MIX_ENT(SOUND_MIXER_PCM,        0x32, 7, 5, 0x33, 7, 5),
 160 MIX_ENT(SOUND_MIXER_SPEAKER,    0x3b, 7, 2, 0x00, 0, 0),
 161 MIX_ENT(SOUND_MIXER_LINE,       0x38, 7, 5, 0x39, 7, 5),
 162 MIX_ENT(SOUND_MIXER_MIC,        0x3a, 7, 5, 0x00, 0, 0),
 163 MIX_ENT(SOUND_MIXER_CD,         0x36, 7, 5, 0x37, 7, 5),
 164 MIX_ENT(SOUND_MIXER_IMIX,       0x00, 0, 0, 0x00, 0, 0),
 165 MIX_ENT(SOUND_MIXER_ALTPCM,     0x00, 0, 0, 0x00, 0, 0),
 166 MIX_ENT(SOUND_MIXER_RECLEV,     0x3f, 7, 2, 0x40, 7, 2), /* Obsolete. Use IGAIN */
 167 MIX_ENT(SOUND_MIXER_IGAIN,      0x3f, 7, 2, 0x40, 7, 2),
 168 MIX_ENT(SOUND_MIXER_OGAIN,      0x41, 7, 2, 0x42, 7, 2)
 169 };
 170 
 171 #ifdef SM_GAMES       /* Master volume is lower and PCM & FM volumes
 172                              higher than with SB Pro. This improves the
 173                              sound quality */
 174 
 175 static unsigned short levels[SOUND_MIXER_NRDEVICES] =
 176 {
 177   0x2020,                       /* Master Volume */
 178   0x4b4b,                       /* Bass */
 179   0x4b4b,                       /* Treble */
 180   0x6464,                       /* FM */
 181   0x6464,                       /* PCM */
 182   0x4b4b,                       /* PC Speaker */
 183   0x4b4b,                       /* Ext Line */
 184   0x0000,                       /* Mic */
 185   0x4b4b,                       /* CD */
 186   0x4b4b,                       /* Recording monitor */
 187   0x4b4b,                       /* SB PCM */
 188   0x4b4b,                       /* Recording level */
 189   0x4b4b,                       /* Input gain */
 190   0x4b4b};                      /* Output gain */
 191 
 192 #else  /* If the user selected just plain SB Pro */
 193 
 194 static unsigned short levels[SOUND_MIXER_NRDEVICES] =
 195 {
 196   0x5a5a,                       /* Master Volume */
 197   0x4b4b,                       /* Bass */
 198   0x4b4b,                       /* Treble */
 199   0x4b4b,                       /* FM */
 200   0x4b4b,                       /* PCM */
 201   0x4b4b,                       /* PC Speaker */
 202   0x4b4b,                       /* Ext Line */
 203   0x1010,                       /* Mic */
 204   0x4b4b,                       /* CD */
 205   0x4b4b,                       /* Recording monitor */
 206   0x4b4b,                       /* SB PCM */
 207   0x4b4b,                       /* Recording level */
 208   0x4b4b,                       /* Input gain */
 209   0x4b4b};                      /* Output gain */
 210 #endif /* SM_GAMES */
 211 
 212 static unsigned char sb16_recmasks_L[SOUND_MIXER_NRDEVICES] =
 213 {
 214         0x00,   /* SOUND_MIXER_VOLUME   */
 215         0x00,   /* SOUND_MIXER_BASS     */
 216         0x00,   /* SOUND_MIXER_TREBLE   */
 217         0x40,   /* SOUND_MIXER_SYNTH    */
 218         0x00,   /* SOUND_MIXER_PCM      */
 219         0x00,   /* SOUND_MIXER_SPEAKER  */
 220         0x10,   /* SOUND_MIXER_LINE     */
 221         0x01,   /* SOUND_MIXER_MIC      */
 222         0x04,   /* SOUND_MIXER_CD       */
 223         0x00,   /* SOUND_MIXER_IMIX     */
 224         0x00,   /* SOUND_MIXER_ALTPCM   */
 225         0x00,   /* SOUND_MIXER_RECLEV   */
 226         0x00,   /* SOUND_MIXER_IGAIN    */
 227         0x00    /* SOUND_MIXER_OGAIN    */
 228 };
 229 
 230 static unsigned char sb16_recmasks_R[SOUND_MIXER_NRDEVICES] =
 231 {
 232         0x00,   /* SOUND_MIXER_VOLUME   */
 233         0x00,   /* SOUND_MIXER_BASS     */
 234         0x00,   /* SOUND_MIXER_TREBLE   */
 235         0x20,   /* SOUND_MIXER_SYNTH    */
 236         0x00,   /* SOUND_MIXER_PCM      */
 237         0x00,   /* SOUND_MIXER_SPEAKER  */
 238         0x08,   /* SOUND_MIXER_LINE     */
 239         0x01,   /* SOUND_MIXER_MIC      */
 240         0x02,   /* SOUND_MIXER_CD       */
 241         0x00,   /* SOUND_MIXER_IMIX     */
 242         0x00,   /* SOUND_MIXER_ALTPCM   */
 243         0x00,   /* SOUND_MIXER_RECLEV   */
 244         0x00,   /* SOUND_MIXER_IGAIN    */
 245         0x00    /* SOUND_MIXER_OGAIN    */
 246 };
 247 
 248 /*
 249  *      Recording sources (SB Pro)
 250  */
 251 
 252 #define SRC_MIC         1       /* Select Microphone recording source */
 253 #define SRC_CD          3       /* Select CD recording source */
 254 #define SRC_LINE        7       /* Use Line-in for recording source */
 255 
 256 #endif

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