aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/sound/pcm/ac97.c
diff options
context:
space:
mode:
authorOrion Hodson <orion@FreeBSD.org>2003-08-23 21:39:51 +0000
committerOrion Hodson <orion@FreeBSD.org>2003-08-23 21:39:51 +0000
commitcfd5696d2217aead6f6e1dd9a51230579e9a30b2 (patch)
tree6b2dea1a9a15480e63ebbca01d31f9cedaa34b2c /sys/dev/sound/pcm/ac97.c
parentaec5c3d0cc81995c715500d6679cb153c00e6d3b (diff)
downloadsrc-cfd5696d2217aead6f6e1dd9a51230579e9a30b2.tar.gz
src-cfd5696d2217aead6f6e1dd9a51230579e9a30b2.zip
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.
Notes
Notes: svn path=/head/; revision=119375
Diffstat (limited to 'sys/dev/sound/pcm/ac97.c')
-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 4b25de9eaf42..94e9bd4efae0 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]));
}
}