Bug 72995 - [sound] Intel ICH2 (82801BA) - sound nearly inaudible
Summary: [sound] Intel ICH2 (82801BA) - sound nearly inaudible
Status: Closed Unable to Reproduce
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 6.0-CURRENT
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-10-22 08:50 UTC by tom
Modified: 2024-10-17 14:08 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tom 2004-10-22 08:50:26 UTC
pcm sound levels on my Dell GX240 are much lower than expected. i
am using a known good set of speakers that work well on a older
Dell box with identical FreeBSD version. sound is inaudible unless
mixer pcm & ogain are both set above 80%, mixer vol setting makes
no difference. output levels appear identical on the speaker jack
and headphone jack. headphones sound ok at ogain=50, pcm=75-100;
speakers get enough volume for a small quiet room at ogain=95-100,
pcm=75-100 but sound is clipped and distorted (probably due to
nearly maximum settings)

the application used does not seem to matter. i've tested w/ xmms,
mpg123, realplay and a variety of audio formats.

this patch (inspired by kern/66422) made no difference
===================================================================
RCS file: /home/ncvs/src/sys/dev/sound/pcm/ac97.c,v
retrieving revision 1.51
diff -u -r1.51 ac97.c
--- ac97.c      8 May 2004 03:41:40 -0000       1.51
+++ ac97.c      22 Oct 2004 06:14:11 -0000
@@ -548,7 +548,7 @@
 
        ac97_wrcd(codec, AC97_REG_POWER, (codec->flags & AC97_F_EAPD_INV)? 0x8000 : 0x0000);
        ac97_reset(codec);
-       ac97_wrcd(codec, AC97_REG_POWER, (codec->flags & AC97_F_EAPD_INV)? 0x8000 : 0x0000);
+       ac97_wrcd(codec, AC97_REG_POWER, 0x8000);
 
        i = ac97_rdcd(codec, AC97_REG_RESET);
        codec->caps = i & 0x03ff;
@@ -663,7 +663,7 @@
 
        ac97_wrcd(codec, AC97_REG_POWER, (codec->flags & AC97_F_EAPD_INV)? 0x8000 : 0x0000);
        ac97_reset(codec);
-       ac97_wrcd(codec, AC97_REG_POWER, (codec->flags & AC97_F_EAPD_INV)? 0x8000 : 0x0000);
+       ac97_wrcd(codec, AC97_REG_POWER, 0x8000);
 
        if (!codec->noext) {
                ac97_wrcd(codec, AC97_REGEXT_STAT, codec->extstat);

sound works great on a Dell GX200 (p3, Intel ICH 82801AA) running
the same build of FreeBSD-Current, and plays louder than I can
comfortably listen to if i turn the mixer settings up to similar
levels.

How-To-Repeat: run any audio application
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2004-10-24 01:53:38 UTC
Responsible Changed
From-To: freebsd-bugs->sound

Over to mailing list alias.
Comment 2 Gavin Atkinson freebsd_committer freebsd_triage 2008-07-17 15:39:40 UTC
State Changed
From-To: open->feedback

To submitter: I'm very sorry this PR has laid untouched for so long. 
Do you know if this is still a problem on newer versions of FreeBSD?
Comment 3 Russell 2008-12-27 23:19:42 UTC
I have just switched to an Intel D845WN motherboard and am experiencing
the same issue.

Sound is very low even when the volume on my speakers are maxed.

Regards,
-- 
Russell Wood <http://www.dynode.net/~rjw/>
Comment 4 WATANABE Kazuhiro 2008-12-31 15:45:52 UTC
Hello.

At Sat, 27 Dec 2008 18:50:07 GMT,
Russell J. Wood wrote:
>  I have just switched to an Intel D845WN motherboard and am experiencing
>  the same issue.
>  
>  Sound is very low even when the volume on my speakers are maxed.
>  
>  Regards,

(1) Would you try the patch attached below?  I don't know whether this
    patch is correct or not...

(2) After applied the patch, can you hear any difference between the
    following commands?

    # sysctl dev.pcm.0.eapd=0
    # sysctl dev.pcm.0.eapd=1

--- sys/dev/sound/pcm/ac97.c.releng70	2007-10-30 03:47:47.000000000 +0900
+++ sys/dev/sound/pcm/ac97.c	2008-12-31 17:26:45.000000000 +0900
@@ -133,7 +133,7 @@
 	{ 0x41445303, 0x00, 0, "AD1819",	0 },
 	{ 0x41445340, 0x00, 0, "AD1881",	0 },
 	{ 0x41445348, 0x00, 0, "AD1881A",	0 },
-	{ 0x41445360, 0x00, 0, "AD1885",	0 },
+	{ 0x41445360, 0x00, 0, "AD1885",	ad1885_patch },
 	{ 0x41445361, 0x00, 0, "AD1886", 	ad1886_patch },
 	{ 0x41445362, 0x00, 0, "AD1887", 	0 },
 	{ 0x41445363, 0x00, 0, "AD1886A", 	0 },
@@ -141,8 +141,8 @@
 	{ 0x41445370, 0x00, 0, "AD1980",	ad198x_patch },
 	{ 0x41445372, 0x00, 0, "AD1981A",	0 },
 	{ 0x41445374, 0x00, 0, "AD1981B",	ad1981b_patch },
-	{ 0x41445375, 0x00, 0, "AD1985",	ad198x_patch },
-	{ 0x41445378, 0x00, 0, "AD1986",	ad198x_patch },
+	{ 0x41445375, 0x00, 0, "AD1985",	ad1985_patch },
+	{ 0x41445378, 0x00, 0, "AD1986",	ad1986_patch },
 	{ 0x414b4d00, 0x00, 1, "AK4540", 	0 },
 	{ 0x414b4d01, 0x00, 1, "AK4542", 	0 },
 	{ 0x414b4d02, 0x00, 1, "AK4543", 	0 },
--- sys/dev/sound/pcm/ac97_patch.c.releng70	2007-10-30 03:47:27.000000000 +0900
+++ sys/dev/sound/pcm/ac97_patch.c	2008-12-31 18:01:41.000000000 +0900
@@ -30,6 +30,23 @@
 
 SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pcm/ac97_patch.c,v 1.10.2.1 2007/10/29 18:47:27 ariff Exp $");
 
+void ad1885_patch(struct ac97_info* codec)
+{
+#define AC97_AD_JACK_SPDIF 0x72
+	/*
+	 * JS0 and EAPD shares the same pin (no.47).
+	 * To use the EAPD function, we should disable jack sense(?).
+	 */
+	switch (ac97_getsubvendor(codec)) {
+	/* case 0xXXXXXXXX:	*/
+	/* 	break;		*/
+	default:
+		ac97_wrcd(codec, AC97_AD_JACK_SPDIF,
+		    ac97_rdcd(codec, AC97_AD_JACK_SPDIF) | 0x1110);
+		break;
+	}
+}
+
 void ad1886_patch(struct ac97_info* codec)
 {
 #define AC97_AD_JACK_SPDIF 0x72
@@ -44,6 +61,9 @@
 
 void ad198x_patch(struct ac97_info* codec)
 {
+	/*
+	 * Swap the aim of the LINE_OUT and SURR_OUT/HP_OUT pins.
+	 */
 	switch (ac97_getsubvendor(codec)) {
 	case 0x11931043:	/* Not for ASUS A9T (probably else too). */
 		break;
@@ -69,6 +89,68 @@
 	}
 }
 
+void ad1985_patch(struct ac97_info* codec)
+{
+	/*
+	 * Swap the aim of the LINE_OUT and SURR_OUT/HP_OUT pins.
+	 * Disable outputs of the LINE_OUT and CENTER_OUT/LFE_OUT pins.
+	 * Select the CENTER_OUT/LFE_OUT pins as the MIC inputs.
+	 * Enable the stereo microphone mode.
+	 *
+	 * Set the voltage of the VREFOUT pin.
+	 */
+	switch (ac97_getsubvendor(codec)) {
+	case 0x80f31043:	/* ASUS P4P800 Deluxe (SE) */
+		ac97_wrcd(codec, 0x76, ac97_rdcd(codec, 0x76) | 0x0420);
+		ac97_wrcd(codec, 0x76, ac97_rdcd(codec, 0x76) | 0x1800);
+		ac97_wrcd(codec, 0x74, ac97_rdcd(codec, 0x74) | 0x0200);
+		ac97_wrcd(codec, 0x76, ac97_rdcd(codec, 0x76) | 0x0040);
+
+		/*
+		 * 0x0 = 2.25V (default)
+		 * 0x1 = High-Z
+		 * 0x2 = 3.7V
+		 * 0x3 = 0V
+		 */
+		ac97_wrcd(codec, 0x76, (ac97_rdcd(codec, 0x76) & ~0xc)
+		    | 0x0 << 2);
+		break;
+	default:
+		break;
+	}
+}
+
+void ad1986_patch(struct ac97_info* codec)
+{
+	/*
+	 * Disable outputs of the SURR_OUT and CENTER_OUT/LFE_OUT pins.
+	 * Select the SURR_OUT pins as the LINE_IN inputs.
+	 * Select the CENTER_OUT/LFE_OUT pins as the MIC inputs.
+	 * Enable the stereo microphone mode.
+	 *
+	 * Set the voltage of the C/LFE VREF_OUT pin.
+	 */
+	switch (ac97_getsubvendor(codec)) {
+	case 0x818f1043:	/* ASUS P5SD2-X (SE) */
+		ac97_wrcd(codec, 0x76, ac97_rdcd(codec, 0x76) | 0x1800);
+		ac97_wrcd(codec, 0x76, ac97_rdcd(codec, 0x76) | 0x0004);
+		ac97_wrcd(codec, 0x74, ac97_rdcd(codec, 0x74) | 0x0200);
+		ac97_wrcd(codec, 0x76, ac97_rdcd(codec, 0x76) | 0x0040);
+
+		/*
+		 * 0x0 = High-Z (default)
+		 * 0x1 = 2.25V
+		 * 0x2 = 0V
+		 * 0x4 = 3.70V
+		 */
+		ac97_wrcd(codec, 0x70, (ac97_rdcd(codec, 0x70) & ~0x1c)
+		    | 0x1 << 2);
+		break;
+	default:
+		break;
+	}
+}
+
 void cmi9739_patch(struct ac97_info* codec)
 {
 	/*
--- sys/dev/sound/pcm/ac97_patch.h.releng70	2007-04-19 22:54:22.000000000 +0900
+++ sys/dev/sound/pcm/ac97_patch.h	2008-12-31 17:44:18.000000000 +0900
@@ -28,8 +28,11 @@
 
 typedef void (*ac97_patch)(struct ac97_info*);
 
+void ad1885_patch(struct ac97_info*);
 void ad1886_patch(struct ac97_info*);
 void ad198x_patch(struct ac97_info*);
 void ad1981b_patch(struct ac97_info*);
+void ad1985_patch(struct ac97_info*);
+void ad1986_patch(struct ac97_info*);
 void cmi9739_patch(struct ac97_info*);
 void alc655_patch(struct ac97_info*);

---
WATANABE Kazuhiro (CQG00620@nifty.ne.jp)
Comment 5 tom 2014-04-07 21:18:15 UTC
I no longer have this hardware. please feel free to close PR if no one else
cares
Comment 6 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:58:43 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped