From: bugzilla-daemon@freedesktop.org Subject: [Bug 106597] [vga_switcheroo] commit 07f4f97d7b4bf325d9f558c5b58230387e4e57e0 breaks dpm on Alienware 15R3 Date: Thu, 24 May 2018 08:56:44 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0737411594==" Return-path: Received: from culpepper.freedesktop.org (culpepper.freedesktop.org [131.252.210.165]) by gabe.freedesktop.org (Postfix) with ESMTP id A27366E368 for ; Thu, 24 May 2018 08:56:44 +0000 (UTC) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org --===============0737411594== Content-Type: multipart/alternative; boundary="15271522041.c66Ee.23839" Content-Transfer-Encoding: 7bit --15271522041.c66Ee.23839 Date: Thu, 24 May 2018 08:56:44 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://bugs.freedesktop.org/ Auto-Submitted: auto-generated https://bugs.freedesktop.org/show_bug.cgi?id=3D106597 --- Comment #21 from Lukas Wunner --- Okay so the reason the HDA controller doesn't suspend is because the codec_powered bitmask is not null: snd_hda_intel 0000:01:00.1: azx_runtime_idle: !power_save_controller =3D 0, !azx_has_pm_runtime(chip) =3D 0, azx_bus(chip)->codec_powered =3D 0x1, !chip->running =3D 0 The lowest bit is set. In other words, the single codec on that HDA bus is considered powered on, so the HDA controller is prevented from suspending. Bits in the codec_powered bitmask are set or cleared using snd_hdac_codec_link_up() and snd_hdac_codec_link_down(), which are only cal= led during runtime suspend and resume of the codec. Looking at hda_codec_runtime_suspend(), we can see that the bit is only cle= ared conditionally: https://elixir.bootlin.com/linux/latest/source/sound/pci/hda/hda_codec.c#L2= 906 if (codec_has_clkstop(codec) && codec_has_epss(codec) && (state & AC_PWRST_CLK_STOP_OK)) snd_hdac_codec_link_down(&codec->core); The codec_has_clkstop() and codec_has_epss() macros just query bits in the power_caps bitmask. That bitmask can also be retrieved from sysfs, could you please post the output of: grep . /sys/bus/hdaudio/devices/hdaudioC1D0/widgets/*/power_caps I'll prepare another debug patch so that we get a better understanding why = the codec isn't powered down. We've either got a bug in the HDA code here or we're missing a quirk for th= is specific HDA controller. Sooner or later we'll have to pull in Takashi Iwai (hda maintainer) and/or AMD engineers responsible for the HDA portion of th= eir GPUs. Previously we just papered over such issues by forcing the HDA controller o= ff when the GPU runtime suspends, but since my commit 07f4f97d7b4b such bugs a= re now exposed as we deliberately keep the GPU awake as long as the HDA contro= ller is in use. Thanks for helping identify and tracking down this issue. --=20 You are receiving this mail because: You are the assignee for the bug.= --15271522041.c66Ee.23839 Date: Thu, 24 May 2018 08:56:44 +0000 MIME-Version: 1.0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://bugs.freedesktop.org/ Auto-Submitted: auto-generated

Comme= nt # 21 on bug 10659= 7 from Lukas Wunner
Okay so the reason the HDA controller doesn't suspend is becau=
se the
codec_powered bitmask is not null:

snd_hda_intel 0000:01:00.1: azx_runtime_idle: !power_save_controller =3D 0,
!azx_has_pm_runtime(chip) =3D 0, azx_bus(chip)->codec_powered =3D 0x1,
!chip->running =3D 0

The lowest bit is set. In other words, the single codec on that HDA bus is
considered powered on, so the HDA controller is prevented from suspending.

Bits in the codec_powered bitmask are set or cleared using
snd_hdac_codec_link_up() and snd_hdac_codec_link_down(), which are only cal=
led
during runtime suspend and resume of the codec.

Looking at hda_codec_runtime_suspend(), we can see that the bit is only cle=
ared
conditionally:

https://elixir.bootlin.com/linux/latest/source/sound/pci/hd=
a/hda_codec.c#L2906

        if (codec_has_clkstop(codec) && codec_has_epss(codec) &=
&
            (state & AC_PWRST_CLK_STOP_OK))
                snd_hdac_codec_link_down(&codec->core);

The codec_has_clkstop() and codec_has_epss() macros just query bits in the
power_caps bitmask. That bitmask can also be retrieved from sysfs, could you
please post the output of:
grep . /sys/bus/hdaudio/devices/hdaudioC1D0/widgets/*/power_caps

I'll prepare another debug patch so that we get a better understanding why =
the
codec isn't powered down.

We've either got a bug in the HDA code here or we're missing a quirk for th=
is
specific HDA controller. Sooner or later we'll have to pull in Takashi Iwai
(hda maintainer) and/or AMD engineers responsible for the HDA portion of th=
eir
GPUs.

Previously we just papered over such issues by forcing the HDA controller o=
ff
when the GPU runtime suspends, but since my commit 07f4f97d7b4b such bugs a=
re
now exposed as we deliberately keep the GPU awake as long as the HDA contro=
ller
is in use. Thanks for helping identify and tracking down this issue.


You are receiving this mail because:
  • You are the assignee for the bug.
= --15271522041.c66Ee.23839-- --===============0737411594== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vZHJpLWRldmVsCg== --===============0737411594==--