patch-2.4.0-test12 linux/drivers/sound/ac97_codec.c
Next file: linux/drivers/sound/cs4281.c
Previous file: linux/drivers/sound/Makefile
Back to the patch index
Back to the overall index
- Lines: 77
- Date:
Thu Dec 7 00:21:37 2000
- Orig file:
v2.4.0-test11/linux/drivers/sound/ac97_codec.c
- Orig date:
Tue Oct 31 12:42:27 2000
diff -u --recursive --new-file v2.4.0-test11/linux/drivers/sound/ac97_codec.c linux/drivers/sound/ac97_codec.c
@@ -134,7 +134,7 @@
{SOUND_MIXER_PCM, 0x4343},
{SOUND_MIXER_SPEAKER, 0x4343},
{SOUND_MIXER_LINE, 0x4343},
- {SOUND_MIXER_MIC, 0x4343},
+ {SOUND_MIXER_MIC, 0x0000},
{SOUND_MIXER_CD, 0x4343},
{SOUND_MIXER_ALTPCM, 0x4343},
{SOUND_MIXER_IGAIN, 0x4343},
@@ -284,6 +284,10 @@
if (oss_channel == SOUND_MIXER_IGAIN) {
right = (right * mh->scale) / 100;
left = (left * mh->scale) / 100;
+ if (right >= mh->scale)
+ right = mh->scale-1;
+ if (left >= mh->scale)
+ left = mh->scale-1;
} else {
/* these may have 5 or 6 bit resolution */
if (oss_channel == SOUND_MIXER_VOLUME ||
@@ -294,27 +298,49 @@
right = ((100 - right) * scale) / 100;
left = ((100 - left) * scale) / 100;
- }
+ if (right >= scale)
+ right = scale-1;
+ if (left >= scale)
+ left = scale-1;
+ }
val = (left << 8) | right;
}
} else if (oss_channel == SOUND_MIXER_BASS) {
val = codec->codec_read(codec , mh->offset) & ~0x0f00;
- val |= ((((100 - left) * mh->scale) / 100) << 8) & 0x0e00;
+ left = ((100 - left) * mh->scale) / 100;
+ if (left >= mh->scale)
+ left = mh->scale-1;
+ val |= (left << 8) & 0x0e00;
} else if (oss_channel == SOUND_MIXER_TREBLE) {
val = codec->codec_read(codec , mh->offset) & ~0x000f;
- val |= (((100 - left) * mh->scale) / 100) & 0x000e;
+ left = ((100 - left) * mh->scale) / 100;
+ if (left >= mh->scale)
+ left = mh->scale-1;
+ val |= left & 0x000e;
} else if(left == 0) {
val = AC97_MUTE;
} else if (oss_channel == SOUND_MIXER_SPEAKER) {
- val = (((100 - left) * mh->scale) / 100) << 1;
+ left = ((100 - left) * mh->scale) / 100;
+ if (left >= mh->scale)
+ left = mh->scale-1;
+ val = left << 1;
} else if (oss_channel == SOUND_MIXER_PHONEIN) {
- val = (((100 - left) * mh->scale) / 100);
+ left = ((100 - left) * mh->scale) / 100;
+ if (left >= mh->scale)
+ left = mh->scale-1;
+ val = left;
} else if (oss_channel == SOUND_MIXER_PHONEOUT) {
scale = (1 << codec->bit_resolution);
- val = (((100 - left) * scale) / 100);
+ left = ((100 - left) * scale) / 100;
+ if (left >= mh->scale)
+ left = mh->scale-1;
+ val = left;
} else if (oss_channel == SOUND_MIXER_MIC) {
val = codec->codec_read(codec , mh->offset) & ~0x801f;
- val |= (((100 - left) * mh->scale) / 100);
+ left = ((100 - left) * mh->scale) / 100;
+ if (left >= mh->scale)
+ left = mh->scale-1;
+ val |= left;
/* the low bit is optional in the tone sliders and masking
it lets us avoid the 0xf 'bypass'.. */
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)