34 static int mode_control;
36 #define POSSIBLE_RECORDING_DEVICES (SOUND_MASK_SYNTH | SOUND_MASK_SPEAKER | SOUND_MASK_LINE | SOUND_MASK_MIC | \
37 SOUND_MASK_CD | SOUND_MASK_ALTPCM)
39 #define SUPPORTED_MIXER_DEVICES (SOUND_MASK_SYNTH | SOUND_MASK_PCM | SOUND_MASK_SPEAKER | SOUND_MASK_LINE | SOUND_MASK_MIC | \
40 SOUND_MASK_CD | SOUND_MASK_ALTPCM | SOUND_MASK_IMIX | \
41 SOUND_MASK_VOLUME | SOUND_MASK_BASS | SOUND_MASK_TREBLE | SOUND_MASK_RECLEV)
45 static int default_levels[32] =
81 mixer_output(
int right_vol,
int left_vol,
int div,
int bits,
84 int left = left_vol * div / 100;
85 int right = right_vol * div / 100;
93 if (bits == 0x03 || bits == 0x04)
106 return (left_vol | (right_vol << 8));
115 mode_control = new_mode;
119 pas_mixer_set(
int whichDev,
unsigned int level)
123 DEB(
printk(
"static int pas_mixer_set(int whichDev = %d, unsigned int level = %X)\n", whichDev, level));
126 right = (level & 0x7f00) >> 8;
129 if ((1 << whichDev) & rec_devices)
138 levels[whichDev] = mixer_output(right, left, 63, 0x01, 0);
146 levels[whichDev] = mixer_output(right, left, 12, 0x03, 0);
149 levels[whichDev] = mixer_output(right, left, 12, 0x04, 0);
153 levels[whichDev] = mixer_output(right, left, 31, 0x10 | 0x00, mixer);
156 levels[whichDev] = mixer_output(right, left, 31, 0x10 | 0x05, mixer);
159 levels[whichDev] = mixer_output(right, left, 31, 0x10 | 0x07, mixer);
162 levels[whichDev] = mixer_output(right, left, 31, 0x10 | 0x06, mixer);
165 levels[whichDev] = mixer_output(right, left, 31, 0x10 | 0x02, mixer);
168 levels[whichDev] = mixer_output(right, left, 31, 0x10 | 0x03, mixer);
171 levels[whichDev] = mixer_output(right, left, 31, 0x10 | 0x04, mixer);
174 levels[whichDev] = mixer_output(right, left, 31, 0x10 | 0x01,
178 levels[whichDev] = mixer_output(right, left, 15, 0x02, 0);
185 changed = devmask ^ rec_devices;
186 rec_devices = devmask;
189 if (changed & (1 << i))
191 pas_mixer_set(i, levels[i]);
200 return (levels[whichDev]);
206 pas_mixer_reset(
void)
210 DEB(
printk(
"pas2_mixer.c: void pas_mixer_reset(void)\n"));
213 pas_mixer_set(foo, levels[foo]);
218 static int pas_mixer_ioctl(
int dev,
unsigned int cmd,
void __user *
arg)
223 DEB(
printk(
"pas2_mixer.c: int pas_mixer_ioctl(unsigned int cmd = %X, unsigned int arg = %X)\n", cmd, arg));
228 level = (mode_control & 0x04);
230 mode_control &= ~0x04;
232 mode_control |= 0x04;
242 if (!(mode_control & 0x03))
245 level = ((mode_control & 0x03) + 1) * 20;
251 i = (level / 20) - 1;
252 mode_control &= ~0x03;
253 mode_control |= i & 0x03;
276 if (((cmd >> 8) & 0xff) ==
'M') {
280 v = pas_mixer_set(cmd & 0xff, v);
282 switch (cmd & 0xff) {
304 v = levels[cmd & 0xff];
317 .name =
"Pro Audio Spectrum 16",
318 .ioctl = pas_mixer_ioctl