Bug 113511 - Weird noise coming out from speakers at driver unload
Summary: Weird noise coming out from speakers at driver unload
Status: NEW
Alias: None
Product: Drivers
Classification: Unclassified
Component: Sound(ALSA) (show other bugs)
Hardware: x86-64 Linux
: P1 normal
Assignee: Jaroslav Kysela
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-01 15:44 UTC by Armin K.
Modified: 2016-03-10 16:43 UTC (History)
1 user (show)

See Also:
Kernel Version: 4.5-rc5
Subsystem:
Regression: No
Bisected commit-id:


Attachments
Recorded noise (504.73 KB, audio/x-wav)
2016-03-01 16:41 UTC, Armin K.
Details
Test patch (623 bytes, patch)
2016-03-07 15:39 UTC, Takashi Iwai
Details | Diff
Another patch to disable power_save_node (466 bytes, patch)
2016-03-09 14:19 UTC, Takashi Iwai
Details | Diff

Description Armin K. 2016-03-01 15:44:44 UTC
Now, since #112731 was fixed, I'm getting sound just fine. However, there's one more issue probably specific to this model.

When I load the kernel from a cold boot or reboot from Windows, play some sound (music, whatever), and then either shut down or reboot, I hear a loud "bang" static noise from the speakers when driver is unloading (at shutdown, but I assume that's when the driver is unloaded). This doesn't happen if I don't play any sound during the system uptime.

When I boot it up next time (after when I hear the "bang" sound at shutdown and after I reboot to either Windows or Linux), I hear the same sound twice when booting either Windows or Linux (when the driver is modprobed again).

One could think the Linux driver leaves the hardware in an invalid state at unload.

This doesn't happen on Windows.
Comment 1 Armin K. 2016-03-01 16:41:51 UTC
Created attachment 206561 [details]
Recorded noise

I've managed to record what I'm hearing. At 7s you can hear the sound it makes at shutdown (driver unload). At 27s you can hear what happens at boot (driver load).
Comment 2 Takashi Iwai 2016-03-03 09:50:38 UTC
The driver isn't unloaded usually at shutdown.  Does the noise happen even if you mute the output before shutdown?
Comment 3 Armin K. 2016-03-06 22:11:31 UTC
I'll correct myself first. It's not on the driver unload, but in between the "reboot" and "post screen" (when the hardware resets).

And no, no change when I mute before I reboot.
Comment 4 Takashi Iwai 2016-03-07 15:39:00 UTC
OK, then could you try the patch below?
Comment 5 Takashi Iwai 2016-03-07 15:39:24 UTC
Created attachment 207921 [details]
Test patch
Comment 6 Armin K. 2016-03-08 19:37:50 UTC
Yes, that gets rid of the noise at shutdown/boot up.

However, when codec is first initialized, and I run speaker-test as root (to bypass pulseaudio which would run as normal user), I still hear the similar noise before speaker-test begins outputting the sound. Similar thing happens when I switch from root to normal user (which uses pulse) after I run speaker-test as root and play any sound (the noise before it begins, later on all normal).
Comment 7 Takashi Iwai 2016-03-09 14:18:48 UTC
The rest issues are likely about the runtime PM.  Does the additional patch below improve the situation?
Comment 8 Takashi Iwai 2016-03-09 14:19:13 UTC
Created attachment 208391 [details]
Another patch to disable power_save_node
Comment 9 Armin K. 2016-03-10 10:08:26 UTC
The latest patch doesn't fix the second issue mentioned in comment 6. However, I've noticed it's against patch_cirrus.c, while the first patch is against patch_conexant.c (conexant is the codec my system uses).
Comment 10 Takashi Iwai 2016-03-10 10:33:14 UTC
Gah, of course, it's a wrong place.

Which kernel are you testing?  Is it the latest 4.5-rc?
If yes, try to *enable* power_save_node option, e.g.

diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 6122b8ca872f..6e0030a982b4 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -901,7 +906,8 @@ static int patch_conexant_auto(struct hda_codec *codec)
 		snd_hda_pick_fixup(codec, cxt5051_fixup_models,
 				   cxt5051_fixups, cxt_fixups);
 		break;
-	case 0x14f150f2:
+	case 0x14f150f2: /* CX20722 */
+	case 0x14f150f4: /* CX20724 */
 		codec->power_save_node = 1;
 		/* Fall through */
 	default:
Comment 11 Armin K. 2016-03-10 10:35:19 UTC
(In reply to Takashi Iwai from comment #10)
> Gah, of course, it's a wrong place.
> 
> Which kernel are you testing?  Is it the latest 4.5-rc?
> If yes, try to *enable* power_save_node option, e.g.
> 

I'm now at 4.5-rc7. I'll try the following patch and report back.
Comment 12 Armin K. 2016-03-10 16:36:06 UTC
The patch from Comment 10 doesn't solve my other issue.
Comment 13 Takashi Iwai 2016-03-10 16:42:16 UTC
OK, so at least it's not about the recent power-saving stuff.

Then there is no much known workaround for the issue, and there is no general hint, unfortunately.  It's specific to each machine, so you have to try different methods one by one, e.g. putting a delay after the codec resume, or prevent some power down, etc.
Comment 14 Armin K. 2016-03-10 16:43:45 UTC
O well, I suppose it's nothing really important. The original issue has been fixed. Feel free to close the bug when the patch has landed upstream.

Note You need to log in before you can comment on or make changes to this bug.