Bug 104981 - clicks and blaps on boot
Summary: clicks and blaps on boot
Status: RESOLVED CODE_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: Sound(ALSA) (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Jaroslav Kysela
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-25 10:46 UTC by Oleksij Rempel
Modified: 2015-10-05 08:38 UTC (History)
1 user (show)

See Also:
Kernel Version: v4.1 and later
Subsystem:
Regression: No
Bisected commit-id:


Attachments
asound/card0/codec#2 (12.43 KB, text/plain)
2015-09-25 10:47 UTC, Oleksij Rempel
Details
dmi (15.11 KB, text/plain)
2015-09-25 10:48 UTC, Oleksij Rempel
Details
alsa-info.txt (39.45 KB, text/plain)
2015-09-25 11:15 UTC, Oleksij Rempel
Details
alsa-info_bad (39.41 KB, text/plain)
2015-09-25 12:46 UTC, Oleksij Rempel
Details
Test patch (596 bytes, patch)
2015-09-25 13:05 UTC, Takashi Iwai
Details | Diff
alsa-info_plain (no codec) (21.19 KB, text/plain)
2015-09-25 17:02 UTC, Oleksij Rempel
Details
alsa-info_plain_2 (no codec) (20.05 KB, text/plain)
2015-09-25 18:30 UTC, Oleksij Rempel
Details
Test fix patch (3.33 KB, patch)
2015-09-28 12:31 UTC, Takashi Iwai
Details | Diff
Test fix patch (2.92 KB, patch)
2015-10-01 07:28 UTC, Takashi Iwai
Details | Diff
Patch to disable widget power saving for IDT 92HD73xx (1.40 KB, patch)
2015-10-04 20:49 UTC, Takashi Iwai
Details | Diff

Description Oleksij Rempel 2015-09-25 10:46:54 UTC
This is regression was introduced by kernel v4.1.
As workaround i disabled power_save_node
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 9d947ae..56663c8 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -4520,7 +4520,7 @@ static int patch_stac92hd73xx(struct hda_codec *codec)
                return err;

        spec = codec->spec;
-       codec->power_save_node = 1;
+       //codec->power_save_node = 1;
        spec->linear_tone_beep = 0;
        spec->gen.mixer_nid = 0x1d;
        spec->have_spdif_mux = 1;
~                                          


My hw:
Board: Intel DG45ID
Codec: IDT 92HD73E1X5
Comment 1 Oleksij Rempel 2015-09-25 10:47:42 UTC
Created attachment 188361 [details]
asound/card0/codec#2
Comment 2 Oleksij Rempel 2015-09-25 10:48:18 UTC
Created attachment 188371 [details]
dmi
Comment 3 Takashi Iwai 2015-09-25 11:11:10 UTC
Could you give alsa-info.sh output?  Run the script with --no-upload option and attach to Bugzilla.
Comment 4 Oleksij Rempel 2015-09-25 11:15:27 UTC
Created attachment 188401 [details]
alsa-info.txt
Comment 5 Oleksij Rempel 2015-09-25 11:40:48 UTC
it was output with disabled power_save_node. Is it ok or you need other one too?
Comment 6 Takashi Iwai 2015-09-25 11:55:31 UTC
At best could you give both cases?
Comment 7 Oleksij Rempel 2015-09-25 12:46:46 UTC
Created attachment 188421 [details]
alsa-info_bad
Comment 8 Takashi Iwai 2015-09-25 13:04:53 UTC
Thanks.  Could you try the patch below?  It just adds some waits at power up cycle, which is known to help often.
Comment 9 Takashi Iwai 2015-09-25 13:05:33 UTC
Created attachment 188431 [details]
Test patch
Comment 10 Oleksij Rempel 2015-09-25 15:04:14 UTC
With this patch instead of one "Cchraz" it makes 3x "Klaz".
Comment 11 Takashi Iwai 2015-09-25 15:05:34 UTC
Increasing msleep() value (e.g. 100) changes anything?
Comment 12 Oleksij Rempel 2015-09-25 15:21:37 UTC
No, same 3x "Klaz" issue
Comment 13 Takashi Iwai 2015-09-25 15:42:34 UTC
Ah, OK, so it just delays between noises.

We should go back to basic.  Scratch the previous patch.  Does relogin snd-hda-intel module re-triggers the noise?  If so, it makes easier to test / diagnose.
Comment 14 Oleksij Rempel 2015-09-25 15:45:56 UTC
Yea, i can reproduce it with: pusleaudio -k
Comment 15 Takashi Iwai 2015-09-25 16:08:07 UTC
OK, then please try without pulseaudio.  Maybe better to test on Linux console (runlevel 3).  There,
- unload snd-hda-intel module once.
- If you have /var/lib/alsa/asound.state or such file that is restored by udev, remove it once (better to back up).
- Load snd-hda-intel module again but with probe_only=1 option.
  # modprobe snd-hda-intel probe_only=1

This should *not* give any clicks.  At this moment, there is no codec driver, thus power_save_node plays anything at all.  Take alsa-info.sh snapshot now once, and attach to Bugzilla.

Then, try to reconfigure the codec manually by
  # echo 1 > /sys/class/sound/hwC0D0/reconfigure

Now it gives clicks?  Run alsamixer to see whether all volumes are muted there.  If it's not, udev (or else) did restore the mixer state.  This must be eliminated for testing.

If this doesn't click noise, try to start pulseaudio manually at this point.  Does it give click?

If the click happens without pulseaudio, good, we can go forward.  This can be easily reproduced with emulator.
Comment 16 Oleksij Rempel 2015-09-25 16:57:28 UTC
(In reply to Takashi Iwai from comment #15)
> OK, then please try without pulseaudio.  Maybe better to test on Linux
> console (runlevel 3).  There,
> - unload snd-hda-intel module once.
> - If you have /var/lib/alsa/asound.state or such file that is restored by
> udev, remove it once (better to back up).
> - Load snd-hda-intel module again but with probe_only=1 option.
>   # modprobe snd-hda-intel probe_only=1
> 
> This should *not* give any clicks.  At this moment, there is no codec
> driver, thus power_save_node plays anything at all.  Take alsa-info.sh
> snapshot now once, and attach to Bugzilla.

There was same kind of click.. probably because codec was already preloaded. I removed codec and reloaded snd-hda-intel, this time no sounds was triggered.

> 
> Then, try to reconfigure the codec manually by
>   # echo 1 > /sys/class/sound/hwC0D0/reconfigure

At this stage i don't have "klick" instead of it i has "peep", which i noticed earlier too, but it was not so annoying.

Then i tried to reload snd-hda-intel again and got "klick".

No pulseaudio was loaded.
Comment 17 Oleksij Rempel 2015-09-25 17:02:14 UTC
Created attachment 188461 [details]
alsa-info_plain (no codec)
Comment 18 Oleksij Rempel 2015-09-25 17:05:03 UTC
by last alsa-info did you expected values provided by BIOS?
Comment 19 Takashi Iwai 2015-09-25 18:08:35 UTC
(In reply to Oleksij Rempel from comment #16)
> (In reply to Takashi Iwai from comment #15)
> > OK, then please try without pulseaudio.  Maybe better to test on Linux
> > console (runlevel 3).  There,
> > - unload snd-hda-intel module once.
> > - If you have /var/lib/alsa/asound.state or such file that is restored by
> > udev, remove it once (better to back up).
> > - Load snd-hda-intel module again but with probe_only=1 option.
> >   # modprobe snd-hda-intel probe_only=1
> > 
> > This should *not* give any clicks.  At this moment, there is no codec
> > driver, thus power_save_node plays anything at all.  Take alsa-info.sh
> > snapshot now once, and attach to Bugzilla.
> 
> There was same kind of click.. probably because codec was already preloaded.
> I removed codec and reloaded snd-hda-intel, this time no sounds was
> triggered.

Hm, this is an important point, so please double-check.  That is, try to add blacklist snd-hda-intel, do clean boot, then try to load snd-hda-intel manually with probe_only=1.  If this causes the same click noise, it's strange that power_save_node=0 ever influences.

Oh, also, try to set the option power_save=0, too.  It seems that power_save=5 is set (or set via Kconfig), and the driver will power down after 5 seconds.

> > Then, try to reconfigure the codec manually by
> >   # echo 1 > /sys/class/sound/hwC0D0/reconfigure
> 
> At this stage i don't have "klick" instead of it i has "peep", which i
> noticed earlier too, but it was not so annoying.

OK.
 
> Then i tried to reload snd-hda-intel again and got "klick".
> 
> No pulseaudio was loaded.

Try to start pulseaudio manually, and see whether you get clicks here.  I'm afraid that it gets there.

(In reply to Oleksij Rempel from comment #18)
> by last alsa-info did you expected values provided by BIOS?

Yes, sort of.  This is the state before the codec driver tries to parse and initialize.  It can be used as the default state for emulator.
Comment 20 Oleksij Rempel 2015-09-25 18:25:15 UTC
(In reply to Takashi Iwai from comment #19)
> (In reply to Oleksij Rempel from comment #16)
> > (In reply to Takashi Iwai from comment #15)
> > > OK, then please try without pulseaudio.  Maybe better to test on Linux
> > > console (runlevel 3).  There,
> > > - unload snd-hda-intel module once.
> > > - If you have /var/lib/alsa/asound.state or such file that is restored by
> > > udev, remove it once (better to back up).
> > > - Load snd-hda-intel module again but with probe_only=1 option.
> > >   # modprobe snd-hda-intel probe_only=1
> > > 
> > > This should *not* give any clicks.  At this moment, there is no codec
> > > driver, thus power_save_node plays anything at all.  Take alsa-info.sh
> > > snapshot now once, and attach to Bugzilla.
> > 
> > There was same kind of click.. probably because codec was already
> preloaded.
> > I removed codec and reloaded snd-hda-intel, this time no sounds was
> > triggered.
> 
> Hm, this is an important point, so please double-check.  That is, try to add
> blacklist snd-hda-intel, do clean boot, then try to load snd-hda-intel
> manually with probe_only=1.  If this causes the same click noise, it's
> strange that power_save_node=0 ever influences.
> 
> Oh, also, try to set the option power_save=0, too.  It seems that
> power_save=5 is set (or set via Kconfig), and the driver will power down
> after 5 seconds.

With clean start (blacklisted snd_hda_intel and boot directly to level 3), no sounds was reproduced. Even after manual load of snd_hda_intel

> > > Then, try to reconfigure the codec manually by
> > >   # echo 1 > /sys/class/sound/hwC0D0/reconfigure
> > 
> > At this stage i don't have "klick" instead of it i has "peep", which i
> > noticed earlier too, but it was not so annoying.
> 
> OK.

On this stage i got "beep"


> > Then i tried to reload snd-hda-intel again and got "klick".
> > 
> > No pulseaudio was loaded.
> 
> Try to start pulseaudio manually, and see whether you get clicks here.  I'm
> afraid that it gets there.

here i got the klick :)
Comment 21 Oleksij Rempel 2015-09-25 18:30:18 UTC
Created attachment 188471 [details]
alsa-info_plain_2 (no codec)

Clean start, with blacklisted snd_hda_intel and runlevel 3. Info was captured after manual module load.
Comment 22 Takashi Iwai 2015-09-28 12:30:56 UTC
Does the patch below give any improvement?
Comment 23 Takashi Iwai 2015-09-28 12:31:25 UTC
Created attachment 188761 [details]
Test fix patch
Comment 24 Oleksij Rempel 2015-09-30 17:41:08 UTC
Results with last patch: Still same popping sound. Time distance between klicks is a bit bigger.
Comment 25 Takashi Iwai 2015-09-30 18:38:17 UTC
Too bad...

Then we need the manual tests.  Could you try the following?

- Install hda-verb program

- Load snd-hda-intel (no matter with or without the fix patch), but with probe_only=1 option.

- Run like
  hda-verb /dev/snd/hwC0D0 0x15 SET_AMP 0xb073
  hda-verb /dev/snd/hwC0D0 0x0d SET_PIN_WID 0x40
  hda-verb /dev/snd/hwC0D0 0x15 SET_POWER 0x03

Does this cause a click noise?

Then try
  hda-verb /dev/snd/hwC0D0 0x15 SET_POWER 0x00

Any click noise?

At next,
  hda-verb /dev/snd/hwC0D0 0x15 SET_AMP 0xb0f3
  hda-verb /dev/snd/hwC0D0 0x15 SET_POWER 0x03

and
  hda-verb /dev/snd/hwC0D0 0x15 SET_POWER 0x00

Do these still give click noises?
Comment 26 Oleksij Rempel 2015-09-30 19:14:26 UTC
(In reply to Takashi Iwai from comment #25)
> Too bad...
> 
> Then we need the manual tests.  Could you try the following?
> 
> - Install hda-verb program
> 
> - Load snd-hda-intel (no matter with or without the fix patch), but with
> probe_only=1 option.
> 
> - Run like
>   hda-verb /dev/snd/hwC0D2 0x15 SET_AMP 0xb073
>   hda-verb /dev/snd/hwC0D2 0x0d SET_PIN_WID 0x40
>   hda-verb /dev/snd/hwC0D2 0x15 SET_POWER 0x03
> 
> Does this cause a click noise?

yes

> 
> Then try
>   hda-verb /dev/snd/hwC0D2 0x15 SET_POWER 0x00
> 
> Any click noise?

yes

> 
> At next,
>   hda-verb /dev/snd/hwC0D2 0x15 SET_AMP 0xb0f3
>   hda-verb /dev/snd/hwC0D2 0x15 SET_POWER 0x03

here yes

> and
>   hda-verb /dev/snd/hwC0D2 0x15 SET_POWER 0x00
> 
> Do these still give click noises?

and here too.
Comment 27 Takashi Iwai 2015-09-30 19:32:49 UTC
OK, then how about this?
   hda-verb /dev/snd/hwC0D2 0x0d SET_PIN_WID 0x00
   hda-verb /dev/snd/hwC0D2 0x15 SET_AMP 0xb073
   hda-verb /dev/snd/hwC0D2 0x15 SET_POWER 0x03

and
   hda-verb /dev/snd/hwC0D2 0x15 SET_POWER 0x00

and
   hda-verb /dev/snd/hwC0D2 0x15 SET_AMP 0xb0f3
   hda-verb /dev/snd/hwC0D2 0x15 SET_POWER 0x03

and
   hda-verb /dev/snd/hwC0D2 0x15 SET_POWER 0x00

If this still gives the loud click, the power change is basically no-go, and we'd need to forget about the new power save feature...
Comment 28 Oleksij Rempel 2015-10-01 06:06:59 UTC
(In reply to Takashi Iwai from comment #27)
> OK, then how about this?
>    hda-verb /dev/snd/hwC0D2 0x0d SET_PIN_WID 0x00
>    hda-verb /dev/snd/hwC0D2 0x15 SET_AMP 0xb073
>    hda-verb /dev/snd/hwC0D2 0x15 SET_POWER 0x03
> 

Nothing here.

> and
>    hda-verb /dev/snd/hwC0D2 0x15 SET_POWER 0x00

Nothing here

> and
>    hda-verb /dev/snd/hwC0D2 0x15 SET_AMP 0xb0f3
>    hda-verb /dev/snd/hwC0D2 0x15 SET_POWER 0x03

Nothing here

> and
>    hda-verb /dev/snd/hwC0D2 0x15 SET_POWER 0x00

Nothing here

> If this still gives the loud click, the power change is basically no-go, and
> we'd need to forget about the new power save feature...
Comment 29 Takashi Iwai 2015-10-01 07:27:22 UTC
Aha, so the pin clear works around it indeed.
Could you try the patch below instead, then?
Comment 30 Takashi Iwai 2015-10-01 07:28:42 UTC
Created attachment 189111 [details]
Test fix patch
Comment 31 Oleksij Rempel 2015-10-01 09:52:55 UTC
hmm... still same issue.
Comment 32 Takashi Iwai 2015-10-01 10:01:03 UTC
Weird.  Could you double-check the test procedure in comment 25 and 27?  You meant "nothing" as there is no click noise, right?

Also, try to execute commands in 27 in a batch, e.g. write a shell script to execute all these at once, and check whether you still get any clicks.
Comment 33 Oleksij Rempel 2015-10-01 13:58:15 UTC
"nothing" means no noice, right.

i retested and still same result. even if it is scripted.
May be the right pin excluded by some of this checks:
 	

		if (path->path[0] != cvt_nid) /* only for output */
			continue;
		if (!path->pin_fixed && !path->pin_enabled)
			continue;
		if (clear && path->stream_enabled)
			continue;


For example, pin can be configured by BIOS? so it is enabled?
Comment 34 Takashi Iwai 2015-10-01 14:10:56 UTC
Well, you can just give it a try remove some of checks and see whether it gives any difference.  Let me know if you find anything.
Comment 35 Oleksij Rempel 2015-10-01 14:38:42 UTC
Excluded all of them and added msleep(10) at the end of this function. Still same issue, with delay between klicks.
Comment 36 Takashi Iwai 2015-10-02 09:16:16 UTC
There's one another check:

	if (clear && is_active_nid(codec, pin, HDA_OUTPUT, 0))
			continue;

excluding this also doesn't matter?
Comment 37 Oleksij Rempel 2015-10-02 20:49:56 UTC
hm.. if i remove this one i'll get additional "bzzzit" noise. but still with old klicking pick on the end.
Comment 38 Takashi Iwai 2015-10-04 20:48:54 UTC
OK, this is pretty hard to be covered properly, so let's just disable the feature for these chips.  There are other new chips that use the same parser code, and it works for them, at least.  The patch below disables the widget power saving only for IDT 92HD73xx chips.
Comment 39 Takashi Iwai 2015-10-04 20:49:50 UTC
Created attachment 189431 [details]
Patch to disable widget power saving for IDT 92HD73xx
Comment 40 Takashi Iwai 2015-10-04 20:52:32 UTC
I queued the patch now to for-linus tree.  Thanks for your patient testing.
Comment 41 Oleksij Rempel 2015-10-05 08:38:16 UTC
Thank you. I also testes with this amp my laptop and was not able to reproduce this issue,  so you right... it is some kind of limited issue.

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