summaryrefslogtreecommitdiffstats
path: root/sys/dev/sound
diff options
context:
space:
mode:
authororion <orion@FreeBSD.org>2002-08-23 06:19:28 +0000
committerorion <orion@FreeBSD.org>2002-08-23 06:19:28 +0000
commit00febb565fe89c9f65a3565d5638b1e8995ad225 (patch)
treebf90e0a0c7c4caf31ede99d8e474f934c1212a67 /sys/dev/sound
parentce369afc71580c329f919c0060d5b1788349976e (diff)
downloadFreeBSD-src-00febb565fe89c9f65a3565d5638b1e8995ad225.zip
FreeBSD-src-00febb565fe89c9f65a3565d5638b1e8995ad225.tar.gz
s/AC97_MIX_PHONES/AC97_MIX_AUXOUT/ to match ac97r2.{2,3}.
Attempt to determine what function of AUX_OUT is: "True line level out", "Headphone out", or "4-Channel out" and frig OSS mixer label accordingly. Addresses problem raised by Randy Bush on -multimedia of not being able to hear audio on ich2 m/b which was eventually found to be because the mixer monitor value was 0. On this h/w the label "monitor" should now be presented as the marginally more intuitive "ogain".
Diffstat (limited to 'sys/dev/sound')
-rw-r--r--sys/dev/sound/pci/cs4281.c2
-rw-r--r--sys/dev/sound/pcm/ac97.c39
-rw-r--r--sys/dev/sound/pcm/ac97.h4
3 files changed, 39 insertions, 6 deletions
diff --git a/sys/dev/sound/pci/cs4281.c b/sys/dev/sound/pci/cs4281.c
index 64ec50d..e34a162 100644
--- a/sys/dev/sound/pci/cs4281.c
+++ b/sys/dev/sound/pci/cs4281.c
@@ -644,7 +644,7 @@ cs4281_init(struct sc_info *sc)
CS4281PCI_ACOSV_SLV(3) | CS4281PCI_ACOSV_SLV(4));
/* Set Master and headphone to max */
- cs4281_wrcd(0, sc, AC97_MIX_PHONES, 0);
+ cs4281_wrcd(0, sc, AC97_MIX_AUXOUT, 0);
cs4281_wrcd(0, sc, AC97_MIX_MASTER, 0);
/* Power on the DAC */
diff --git a/sys/dev/sound/pcm/ac97.c b/sys/dev/sound/pcm/ac97.c
index 2de618f..4dcfb9e 100644
--- a/sys/dev/sound/pcm/ac97.c
+++ b/sys/dev/sound/pcm/ac97.c
@@ -65,7 +65,7 @@ struct ac97_codecid {
static const struct ac97mixtable_entry ac97mixtable_default[32] = {
[SOUND_MIXER_VOLUME] = { AC97_MIX_MASTER, 5, 0, 1, 1, 6, 0, 1 },
- [SOUND_MIXER_MONITOR] = { AC97_MIX_PHONES, 5, 0, 1, 1, 0, 0, 0 },
+ [SOUND_MIXER_MONITOR] = { AC97_MIX_AUXOUT, 5, 0, 1, 1, 0, 0, 0 },
[SOUND_MIXER_PHONEOUT] = { AC97_MIX_MONO, 5, 0, 0, 1, 7, 0, 0 },
[SOUND_MIXER_BASS] = { AC97_MIX_TONE, 4, 8, 0, 0, 0, 1, 0 },
[SOUND_MIXER_TREBLE] = { AC97_MIX_TONE, 4, 0, 0, 0, 0, 1, 0 },
@@ -368,6 +368,35 @@ ac97_getmixer(struct ac97_info *codec, int channel)
}
#endif
+static void
+ac97_fix_auxout(struct ac97_info *codec)
+{
+ /* Determine what AUXOUT really means, it can be:
+ *
+ * 1. Headphone out.
+ * 2. 4-Channel Out
+ * 3. True line level out (effectively master volume).
+ *
+ * See Sections 5.2.1 and 5.27 for AUX_OUT Options in AC97r2.{2,3}.
+ */
+ if (codec->caps & AC97_CAP_HEADPHONE) {
+ /* XXX We should probably check the AUX_OUT initial value.
+ * Leave AC97_MIX_AUXOUT - SOUND_MIXER_MONITOR relationship */
+ return;
+ } else if (codec->extcaps & AC97_EXTCAP_SDAC &&
+ rdcd(codec, AC97_MIXEXT_SURROUND) == 0x8080) {
+ /* 4-Channel Out, add an additional gain setting. */
+ codec->mix[SOUND_MIXER_OGAIN] = codec->mix[SOUND_MIXER_MONITOR];
+ } else {
+ /* Master volume is/maybe fixed in h/w, not sufficiently
+ * clear in spec to blat SOUND_MIXER_MASTER. */
+ codec->mix[SOUND_MIXER_OGAIN] = codec->mix[SOUND_MIXER_MONITOR];
+ }
+ /* Blat monitor, inappropriate label if we get here */
+ bzero(&codec->mix[SOUND_MIXER_MONITOR],
+ sizeof(codec->mix[SOUND_MIXER_MONITOR]));
+}
+
static unsigned
ac97_initmixer(struct ac97_info *codec)
{
@@ -375,9 +404,6 @@ ac97_initmixer(struct ac97_info *codec)
u_int32_t id;
snd_mtxlock(codec->lock);
- for (i = 0; i < 32; i++)
- codec->mix[i] = ac97mixtable_default[i];
-
codec->count = AC97_INIT(codec->methods, codec->devinfo);
if (codec->count == 0) {
device_printf(codec->dev, "ac97 codec init failed\n");
@@ -423,6 +449,11 @@ ac97_initmixer(struct ac97_info *codec)
}
for (i = 0; i < 32; i++) {
+ codec->mix[i] = ac97mixtable_default[i];
+ }
+ ac97_fix_auxout(codec);
+
+ for (i = 0; i < 32; i++) {
k = codec->noext? codec->mix[i].enable : 1;
if (k && (codec->mix[i].reg > 0)) {
old = rdcd(codec, codec->mix[i].reg);
diff --git a/sys/dev/sound/pcm/ac97.h b/sys/dev/sound/pcm/ac97.h
index 67dbc3f..9c18121 100644
--- a/sys/dev/sound/pcm/ac97.h
+++ b/sys/dev/sound/pcm/ac97.h
@@ -39,7 +39,7 @@
#define AC97_CAP_ADC_18 (1 << 8)
#define AC97_CAP_ADC_20 (1 << 9)
#define AC97_MIX_MASTER 0x02
-#define AC97_MIX_PHONES 0x04
+#define AC97_MIX_AUXOUT 0x04
#define AC97_MIX_MONO 0x06
#define AC97_MIX_TONE 0x08
#define AC97_MIX_BEEP 0x0a
@@ -67,6 +67,8 @@
#define AC97_EXTCAP_DRA (1 << 1)
#define AC97_EXTCAP_VRM (1 << 3)
#define AC97_EXTCAPS (AC97_EXTCAP_VRA | AC97_EXTCAP_DRA | AC97_EXTCAP_VRM)
+#define AC97_EXTCAP_SDAC (1 << 7)
+
#define AC97_REGEXT_STAT 0x2a
#define AC97_REGEXT_FDACRATE 0x2c
#define AC97_REGEXT_SDACRATE 0x2e
OpenPOWER on IntegriCloud