Skip to contentSkip to conversation

Problem and dirty Fix for hda-intel on ALC892

PATCH In review Jan Losinski 3 participants 6 messages Mar 21, 2011 – Mar 23, 2011 Sound

lore
Share & tools
lore
#0 lore raw

Hello,

Since last week I compiled 2.6.38 on my Desktop. After booting I noticed a regression at the sound stuff. The surround speaker where no longer controlled by the master volume control. I can control it separately, but not with the master control that controls the front, center and LFE volume.

After some debugging I found some differencies at module-loading output in the kernel log and in the output from alsactl store command. The dmesg and the diff of the alsactl output can be found at the end of this message.

After that I tried to understand the hda-codec code and debugged there with a lot of printks and reboots. It takes another couple of hours to find out that the index of the surround volume and switch was 0 at pre 2.6.38 and is now 1. So I wrote a dirty hack to fix this (please ignore the debugging printks):

pci/hda/hda_codec.c +9 -0
index ae5c5d5..d3fd6d2 100644
@@ -3819,7 +3819,16 @@ int snd_hda_add_new_ctls(struct hda_codec *codec, struct snd_kcontrol_new *knew)
                                kctl->id.device = addr;
                        if (idx > 0)
                                kctl->id.index = idx;
+
+                       snd_printk(KERN_INFO "PRE snd_hda_ctl_add - addr = %d, idx = %d, kctl->id.name = %s, kctl->id.index = %d, kctl->id.device = %d, kctl->count = %d",
+                                       addr, idx, kctl->id.name, kctl->id.index, kctl->id.device, kctl->count);
                        err = snd_hda_ctl_add(codec, 0, kctl);
+                       snd_printk(KERN_INFO "PASSED snd_hda_ctl_add - err = %d, addr = %d, idx = %d, kctl->id.name = %s, kctl->id.index = %d, kctl->id.device = %d, kctl->count = %d",
+                                       err, addr, idx, kctl->id.name, kctl->id.index, kctl->id.device, kctl->count);
+                       if (strncmp("Surround Playback Switch", kctl->id.name, strlen("Surround Playback Switch")))
+                               kctl->id.index = 0;
+                       if (strncmp("Surround Playback Volume", kctl->id.name, strlen("Surround Playback Volume")))
+                               kctl->id.index = 0;
                        if (!err)
                                break;
                        /* try first with another device index corresponding to

At all I dont understand what I've exactly done. I also know that this is not a real solution, because it will break the code for many other plattforms. So I hope someone can convert this to a real fix cor can guide me to make such one.

The platform is a ASUS M4A89GTD-PRO/USB3 Board. If any further information needed, please tell me.

Thanks,
Jan Losinski

dmesg of 2.6.37
HDA Intel 0000:00:14.2: PCI INT A -> GSI 16 (level, low) -> IRQ 16
hda_intel: position_fix set to 1 for device 1043:8410
ALSA sound/pci/hda/hda_intel.c:2532: chipset global capabilities = 0x4401 ALSA sound/pci/hda/hda_intel.c:913: codec_mask = 0x1
ALSA sound/pci/hda/hda_intel.c:1351: codec #0 probed OK
ALSA sound/pci/hda/patch_realtek.c:1524: SKU: Nid=0x1d sku_cfg=0x4005e601 ALSA sound/pci/hda/patch_realtek.c:1526: SKU: port_connectivity=0x1
ALSA sound/pci/hda/patch_realtek.c:1527: SKU: enable_pcbeep=0x0
ALSA sound/pci/hda/patch_realtek.c:1528: SKU: check_sum=0x00000005
ALSA sound/pci/hda/patch_realtek.c:1529: SKU: customization=0x000000e6 ALSA sound/pci/hda/patch_realtek.c:1530: SKU: external_amp=0x0
ALSA sound/pci/hda/patch_realtek.c:1531: SKU: platform_type=0x0
ALSA sound/pci/hda/patch_realtek.c:1532: SKU: swap=0x0
ALSA sound/pci/hda/patch_realtek.c:1533: SKU: override=0x1
hda_codec: ALC892: BIOS auto-probing.
ALSA sound/pci/hda/hda_codec.c:4633: autoconfig: line_outs=4 (0x14/0x15/0x16/0x17/0x0)

 ALSA sound/pci/hda/hda_codec.c:4637:    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
 ALSA sound/pci/hda/hda_codec.c:4641:    hp_outs=1 (0x1b/0x0/0x0/0x0/0x0)
 ALSA sound/pci/hda/hda_codec.c:4642:    mono: mono_out=0x0
 ALSA sound/pci/hda/hda_codec.c:4645:    dig-out=0x11/0x1e
 ALSA sound/pci/hda/hda_codec.c:4646:    inputs:
 ALSA sound/pci/hda/hda_codec.c:4650:  Rear Mic=0x18
 ALSA sound/pci/hda/hda_codec.c:4650:  Front Mic=0x19
 ALSA sound/pci/hda/hda_codec.c:4650:  Line=0x1a

ALSA sound/pci/hda/hda_codec.c:4652:
ALSA sound/pci/hda/patch_realtek.c:1581: realtek: No valid SSID, checking pincfg 0x4005e601 for NID 0x1d ALSA sound/pci/hda/patch_realtek.c:1597: realtek: Enabling init ASM_ID=0xe601 CODEC_ID=10ec0892 ALSA sound/pci/hda/hda_codec.c:2164: Cannot find slave Side Playback Volume, skipped ALSA sound/pci/hda/hda_codec.c:2164: Cannot find slave Speaker Playback Volume, skipped ALSA sound/pci/hda/hda_codec.c:2164: Cannot find slave Mono Playback Volume, skipped ALSA sound/pci/hda/hda_codec.c:2164: Cannot find slave Line-Out Playback Volume, skipped ALSA sound/pci/hda/hda_codec.c:2164: Cannot find slave PCM Playback Volume, skipped ALSA sound/pci/hda/hda_codec.c:2164: Cannot find slave Side Playback Switch, skipped ALSA sound/pci/hda/hda_codec.c:2164: Cannot find slave Speaker Playback Switch, skipped ALSA sound/pci/hda/hda_codec.c:2164: Cannot find slave Mono Playback Switch, skipped ALSA sound/pci/hda/hda_codec.c:2164: Cannot find slave Line-Out Playback Switch, skipped ALSA sound/pci/hda/hda_codec.c:2164: Cannot find slave PCM Playback Switch, skipped

dmesg of 2.6.38
HDA Intel 0000:00:14.2: PCI INT A -> GSI 16 (level, low) -> IRQ 16
hda_intel: position_fix set to 1 for device 1043:8410
ALSA sound/pci/hda/hda_intel.c:2535: chipset global capabilities = 0x4401 ALSA sound/pci/hda/hda_intel.c:913: codec_mask = 0x1
ALSA sound/pci/hda/hda_intel.c:1353: codec #0 probed OK
ALSA sound/pci/hda/patch_realtek.c:1527: SKU: Nid=0x1d sku_cfg=0x4005e601 ALSA sound/pci/hda/patch_realtek.c:1529: SKU: port_connectivity=0x1
ALSA sound/pci/hda/patch_realtek.c:1530: SKU: enable_pcbeep=0x0
ALSA sound/pci/hda/patch_realtek.c:1531: SKU: check_sum=0x00000005
ALSA sound/pci/hda/patch_realtek.c:1532: SKU: customization=0x000000e6 ALSA sound/pci/hda/patch_realtek.c:1533: SKU: external_amp=0x0
ALSA sound/pci/hda/patch_realtek.c:1534: SKU: platform_type=0x0
ALSA sound/pci/hda/patch_realtek.c:1535: SKU: swap=0x0
ALSA sound/pci/hda/patch_realtek.c:1536: SKU: override=0x1
hda_codec: ALC892: BIOS auto-probing.
ALSA sound/pci/hda/hda_codec.c:4633: autoconfig: line_outs=4 (0x14/0x15/0x16/0x17/0x0)

 ALSA sound/pci/hda/hda_codec.c:4637:    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
 ALSA sound/pci/hda/hda_codec.c:4641:    hp_outs=1 (0x1b/0x0/0x0/0x0/0x0)
 ALSA sound/pci/hda/hda_codec.c:4642:    mono: mono_out=0x0
 ALSA sound/pci/hda/hda_codec.c:4645:    dig-out=0x11/0x1e
 ALSA sound/pci/hda/hda_codec.c:4646:    inputs:
 ALSA sound/pci/hda/hda_codec.c:4650:  Rear Mic=0x18
 ALSA sound/pci/hda/hda_codec.c:4650:  Front Mic=0x19
 ALSA sound/pci/hda/hda_codec.c:4650:  Line=0x1a

ALSA sound/pci/hda/hda_codec.c:4652:
ALSA sound/pci/hda/patch_realtek.c:1584: realtek: No valid SSID, checking pincfg 0x4005e601 for NID 0x1d ALSA sound/pci/hda/patch_realtek.c:1600: realtek: Enabling init ASM_ID=0xe601 CODEC_ID=10ec0892 ALSA sound/pci/hda/hda_codec.c:2164: Cannot find slave Surround Playback Volume, skipped ALSA sound/pci/hda/hda_codec.c:2164: Cannot find slave Side Playback Volume, skipped ALSA sound/pci/hda/hda_codec.c:2164: Cannot find slave Speaker Playback Volume, skipped ALSA sound/pci/hda/hda_codec.c:2164: Cannot find slave Mono Playback Volume, skipped ALSA sound/pci/hda/hda_codec.c:2164: Cannot find slave Line-Out Playback Volume, skipped ALSA sound/pci/hda/hda_codec.c:2164: Cannot find slave PCM Playback Volume, skipped ALSA sound/pci/hda/hda_codec.c:2164: Cannot find slave Surround Playback Switch, skipped ALSA sound/pci/hda/hda_codec.c:2164: Cannot find slave Side Playback Switch, skipped ALSA sound/pci/hda/hda_codec.c:2164: Cannot find slave Speaker Playback Switch, skipped ALSA sound/pci/hda/hda_codec.c:2164: Cannot find slave Mono Playback Switch, skipped ALSA sound/pci/hda/hda_codec.c:2164: Cannot find slave Line-Out Playback Switch, skipped ALSA sound/pci/hda/hda_codec.c:2164: Cannot find slave PCM Playback Switch, skipped

Diff of alsactl store output:

store.28 renamed from store.27 +7 -8
@@ -29,8 +29,9 @@
 		comment.dbmax 0
 		iface MIXER
 		name 'Surround Playback Volume'
-		value.0 64
-		value.1 64
+		index 1
+		value.0 38
+		value.1 38
 	}
 	control.4 {
 		comment.access 'read write'
@@ -38,6 +39,7 @@
 		comment.count 2
 		iface MIXER
 		name 'Surround Playback Switch'
+		index 1
 		value.0 true
 		value.1 true
 	}
@@ -130,7 +132,6 @@
 		comment.dbmax 1200
 		iface MIXER
 		name 'Front Mic Playback Volume'
-		index 1
 		value.0 0
 		value.1 0
 	}
@@ -140,7 +141,6 @@
 		comment.count 2
 		iface MIXER
 		name 'Front Mic Playback Switch'
-		index 1
 		value.0 false
 		value.1 false
 	}
@@ -173,7 +173,7 @@
 		comment.dbmin 0
 		comment.dbmax 3000
 		iface MIXER
-		name 'Rear Mic Boost'
+		name 'Rear Mic Boost Volume'
 		value.0 0
 		value.1 0
 	}
@@ -185,8 +185,7 @@
 		comment.dbmin 0
 		comment.dbmax 3000
 		iface MIXER
-		name 'Front Mic Boost'
-		index 1
+		name 'Front Mic Boost Volume'
 		value.0 0
 		value.1 0
 	}
@@ -314,7 +313,7 @@
 		comment.count 1
 		iface MIXER
 		name 'Master Playback Switch'
-		value true
+		value false
 	}
 	control.32 {
 		comment.access 'read write user'

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#1 lore raw
Quoted 13 lines · Jan Losinski

Hello,

Since last week I compiled 2.6.38 on my Desktop. After booting I noticed a regression at the sound stuff. The surround speaker where no longer controlled by the master volume control. I can control it separately, but not with the master control that controls the front, center and LFE volume.

After some debugging I found some differencies at module-loading output in the kernel log and in the output from alsactl store command. The dmesg and the diff of the alsactl output can be found at the end of this message.

Quoted 5 lines

After that I tried to understand the hda-codec code and debugged there with a lot of printks and reboots. It takes another couple of hours to find out that the index of the surround volume and switch was 0 at pre 2.6.38 and is now 1. So I wrote a dirty hack to fix this (please ignore the debugging printks):

Hmm, I made one or two patches in relation to this but they aimed at moving index 1 to index 0, not the other way around. Could you please give alsa-info (see wiki.ubuntu.com/Audio/AlsaInfo ) information, preferably with 2.6.38 (and without your workaround) installed?

Thanks!

Signature · 2 lines
David Henningsson, Canonical Ltd.
http://launchpad.net/~diwic
#2 lore raw
Quoted 4 lines · David Henningsson

Hmm, I made one or two patches in relation to this but they aimed at=20 moving index 1 to index 0, not the other way around. Could you please=20 give alsa-info (see wiki.ubuntu.com/Audio/AlsaInfo ) information,=20 preferably with 2.6.38 (and without your workaround) installed?

Of course, it's located at [1] (2.6.38 without my "fix". Let me know if you need more information or if you need someone to test).

Jan Losinski

[1] http://www.alsa-project.org/db/?f=3D80bc05cada24ed993c4f964d4188add6d0e=
1dddb

PS1: The tool does not work with LANG=3Dde_DE.UTF-8
PS2: I've subscribed the list ;)

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#3 lore raw

PATCH 1/1 ALSA: HDA: Realtek: Avoid unnecessary volume control index on Surround/Side

Quoted 6 lines · Jan Losinski
Quoted 4 lines · David Henningsson

Hmm, I made one or two patches in relation to this but they aimed at=20 moving index 1 to index 0, not the other way around. Could you please=20 give alsa-info (see wiki.ubuntu.com/Audio/AlsaInfo ) information,=20 preferably with 2.6.38 (and without your workaround) installed?

Quoted 7 lines

Of course, it's located at [1] (2.6.38 without my "fix". Let me know if you need more information or if you need someone to test).

Jan Losinski

[1] http://www.alsa-project.org/db/?f=3D80bc05cada24ed993c4f964d4188add6d0e=
1dddb

Thanks, I've attached a patch that fixes this issue - Takashi, will you apply it?

Quoted 1 line

PS1: The tool does not work with LANG=3Dde_DE.UTF-8

Could not reproduce here, tried "LANG=de_DE.UTF-8 ./alsa-info.sh" and it succeeded normally.

Quoted 1 line

PS2: I've subscribed the list ;)

Great! Nevertheless I like being CC:ed myself when something concerns me in person, so I tend to do the same to others.

Signature · 2 lines
David Henningsson, Canonical Ltd.
http://launchpad.net/~diwic
Quoted 1 line

From bda10a777732d2f31d1a5a51954fe73b37177f2d Mon Sep 17 00:00:00 2001

From: David Henningsson <[email protected]>
Date: Wed, 23 Mar 2011 08:35:07 +0100
Subject: [PATCH] ALSA: HDA: Realtek: Avoid unnecessary volume control index on Surround/Side

Similar to commit 7e59e097c09b82760bb0fe08b0fa2b704d76c3f4, this patch avoids unnecessary volume control indices for more
Realtek auto-parsers, e g the ALC66x family, on the "Surround" and "Side" controls.
These indices cause these volume controls to be ignored by PulseAudio and vmaster and should be removed whenever possible.

---
 sound/pci/hda/patch_realtek.c |   25 +++++++++++++++++--------
 1 files changed, 17 insertions(+), 8 deletions(-)
sound/pci/hda/patch_realtek.c +17 -8
index f1a03f2..dc67c5d 100644
@@ -16006,9 +16006,12 @@ static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
 				return err;
 		} else {
 			const char *name = pfx;
-			if (!name)
+			int index = i;
+			if (!name) {
 				name = chname[i];
-			err = __alc861_create_out_sw(codec, name, nid, i, 3);
+				index = 0;
+			}
+			err = __alc861_create_out_sw(codec, name, nid, index, 3);
 			if (err < 0)
 				return err;
 		}
@@ -17159,16 +17162,19 @@ static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
 				return err;
 		} else {
 			const char *name = pfx;
-			if (!name)
+			int index = i;
+			if (!name) {
 				name = chname[i];
+				index = 0;
+			}
 			err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
-						name, i,
+						name, index,
 					  HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
 							      HDA_OUTPUT));
 			if (err < 0)
 				return err;
 			err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
-					       name, i,
+					       name, index,
 					  HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
 							      HDA_INPUT));
 			if (err < 0)
@@ -19217,12 +19223,15 @@ static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
 				return err;
 		} else {
 			const char *name = pfx;
-			if (!name)
+			int index = i;
+			if (!name) {
 				name = chname[i];
-			err = __alc662_add_vol_ctl(spec, name, nid, i, 3);
+				index = 0;
+			}
+			err = __alc662_add_vol_ctl(spec, name, nid, index, 3);
 			if (err < 0)
 				return err;
-			err = __alc662_add_sw_ctl(spec, name, mix, i, 3);
+			err = __alc662_add_sw_ctl(spec, name, mix, index, 3);
 			if (err < 0)
 				return err;
 		}
Signature · 1 line
1.7.1

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#4 lore raw

Re: [PATCH] ALSA: HDA: Realtek: Avoid unnecessary volume control index on Surround/Side

At Wed, 23 Mar 2011 08:56:34 +0100,

Quoted 12 lines · David Henningsson

[1 <text/plain; ISO-8859-1 (7bit)>]

Quoted 9 lines · Jan Losinski
Quoted 4 lines · David Henningsson

Hmm, I made one or two patches in relation to this but they aimed at=20 moving index 1 to index 0, not the other way around. Could you please=20 give alsa-info (see wiki.ubuntu.com/Audio/AlsaInfo ) information,=20 preferably with 2.6.38 (and without your workaround) installed?

Of course, it's located at [1] (2.6.38 without my "fix". Let me know if you need more information or if you need someone to test).

Quoted 7 lines
Quoted 4 lines

Jan Losinski

[1] http://www.alsa-project.org/db/?f=3D80bc05cada24ed993c4f964d4188add6d0e=
1dddb

Thanks, I've attached a patch that fixes this issue - Takashi, will you apply it?

Yes, applied now. Thanks.

Takashi

Quoted 97 lines
Quoted 1 line

PS1: The tool does not work with LANG=3Dde_DE.UTF-8

Could not reproduce here, tried "LANG=de_DE.UTF-8 ./alsa-info.sh" and it succeeded normally.

Quoted 1 line

PS2: I've subscribed the list ;)

Great! Nevertheless I like being CC:ed myself when something concerns me in person, so I tend to do the same to others.

Signature · 3 lines
David Henningsson, Canonical Ltd.
http://launchpad.net/~diwic
[2 0001-ALSA-HDA-Realtek-Avoid-unnecessary-volume-control-in.patch <text/x-patch (7bit)>]
Quoted 1 line

From bda10a777732d2f31d1a5a51954fe73b37177f2d Mon Sep 17 00:00:00 2001

From: David Henningsson <[email protected]>
Date: Wed, 23 Mar 2011 08:35:07 +0100
Subject: [PATCH] ALSA: HDA: Realtek: Avoid unnecessary volume control index on Surround/Side

Similar to commit 7e59e097c09b82760bb0fe08b0fa2b704d76c3f4, this patch avoids unnecessary volume control indices for more
Realtek auto-parsers, e g the ALC66x family, on the "Surround" and "Side" controls.
These indices cause these volume controls to be ignored by PulseAudio and vmaster and should be removed whenever possible.

---
 sound/pci/hda/patch_realtek.c |   25 +++++++++++++++++--------
 1 files changed, 17 insertions(+), 8 deletions(-)
sound/pci/hda/patch_realtek.c +17 -8
index f1a03f2..dc67c5d 100644
@@ -16006,9 +16006,12 @@ static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
 				return err;
 		} else {
 			const char *name = pfx;
-			if (!name)
+			int index = i;
+			if (!name) {
 				name = chname[i];
-			err = __alc861_create_out_sw(codec, name, nid, i, 3);
+				index = 0;
+			}
+			err = __alc861_create_out_sw(codec, name, nid, index, 3);
 			if (err < 0)
 				return err;
 		}
@@ -17159,16 +17162,19 @@ static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
 				return err;
 		} else {
 			const char *name = pfx;
-			if (!name)
+			int index = i;
+			if (!name) {
 				name = chname[i];
+				index = 0;
+			}
 			err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
-						name, i,
+						name, index,
 					  HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
 							      HDA_OUTPUT));
 			if (err < 0)
 				return err;
 			err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
-					       name, i,
+					       name, index,
 					  HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
 							      HDA_INPUT));
 			if (err < 0)
@@ -19217,12 +19223,15 @@ static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
 				return err;
 		} else {
 			const char *name = pfx;
-			if (!name)
+			int index = i;
+			if (!name) {
 				name = chname[i];
-			err = __alc662_add_vol_ctl(spec, name, nid, i, 3);
+				index = 0;
+			}
+			err = __alc662_add_vol_ctl(spec, name, nid, index, 3);
 			if (err < 0)
 				return err;
-			err = __alc662_add_sw_ctl(spec, name, mix, i, 3);
+			err = __alc662_add_sw_ctl(spec, name, mix, index, 3);
 			if (err < 0)
 				return err;
 		}
Signature · 1 line
1.7.1