summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authororion <orion@FreeBSD.org>2003-08-23 21:39:51 +0000
committerorion <orion@FreeBSD.org>2003-08-23 21:39:51 +0000
commit7aa303c874a0cec013236a47988ea5ea3809c622 (patch)
tree6b2dea1a9a15480e63ebbca01d31f9cedaa34b2c
parentb011b87da1a60331782e10f6f2868f007e21f9b3 (diff)
downloadFreeBSD-src-7aa303c874a0cec013236a47988ea5ea3809c622.zip
FreeBSD-src-7aa303c874a0cec013236a47988ea5ea3809c622.tar.gz
When present use ogain instead of master for surround sound channels.
The latter has lead to reports of broken audio. Do not swap ogain and master when headphones detected.
-rw-r--r--sys/dev/sound/pcm/ac97.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/sys/dev/sound/pcm/ac97.c b/sys/dev/sound/pcm/ac97.c
index 4b25de9..94e9bd4 100644
--- a/sys/dev/sound/pcm/ac97.c
+++ b/sys/dev/sound/pcm/ac97.c
@@ -443,16 +443,16 @@ ac97_setmixer(struct ac97_info *codec, unsigned channel, unsigned left, unsigned
static void
ac97_fix_auxout(struct ac97_info *codec)
{
+ int keep_ogain;
+
/*
- * Determine if AUX_OUT is a valid control.
+ * By default, The ac97 aux_out register (0x04) corresponds to OSS's
+ * OGAIN setting.
*
- * Control will read zero if not valid after a reset, other gain
- * controls read muted (0x8000).
+ * We first check whether aux_out is a valid register. If not
+ * we may not want to keep ogain.
*/
- if (ac97_rdcd(codec, AC97_MIX_AUXOUT) == 0) {
- bzero(&codec->mix[SOUND_MIXER_OGAIN],
- sizeof(codec->mix[SOUND_MIXER_OGAIN]));
- }
+ keep_ogain = ac97_rdcd(codec, AC97_MIX_AUXOUT) & 0x8000;
/*
* Determine what AUX_OUT really means, it can be:
@@ -465,13 +465,13 @@ ac97_fix_auxout(struct ac97_info *codec)
*/
if (codec->extcaps & AC97_EXTCAP_SDAC &&
ac97_rdcd(codec, AC97_MIXEXT_SURROUND) == 0x8080) {
- codec->mix[SOUND_MIXER_VOLUME].reg = AC97_MIXEXT_SURROUND;
- } else if (codec->caps & AC97_CAP_HEADPHONE) {
- /* Headphone out present/selected AUX_OUT is effectively
- * master volume control. */
- struct ac97mixtable_entry tmp = codec->mix[SOUND_MIXER_VOLUME];
- codec->mix[SOUND_MIXER_VOLUME] = codec->mix[SOUND_MIXER_OGAIN];
- codec->mix[SOUND_MIXER_OGAIN] = tmp;
+ codec->mix[SOUND_MIXER_OGAIN].reg = AC97_MIXEXT_SURROUND;
+ keep_ogain = 1;
+ }
+
+ if (keep_ogain == 0) {
+ bzero(&codec->mix[SOUND_MIXER_OGAIN],
+ sizeof(codec->mix[SOUND_MIXER_OGAIN]));
}
}
OpenPOWER on IntegriCloud