On Mar 10, 2018, at 2:50 PM, Lukas Wunner <lukas@xxxxxxxxx> wrote:
On Fri, Mar 09, 2018 at 05:30:15PM +0800, Kai Heng Feng wrote:
On Thursday 08 March 2018 17:10:23 Kai-Heng Feng wrote:
Some Dell platforms (Preicsion 7510/7710/7520/7720) have a BIOS option
"Switchable Graphics" (SG).
When SG is enabled, we have:
00:02.0 VGA compatible controller: Intel Corporation Device 591b (rev
04)
00:1f.3 Audio device: Intel Corporation CM238 HD Audio Controller (rev
31)
01:00.0 VGA compatible controller: Advanced Micro Devices, Inc.
[AMD/ATI] Ellesmere [Polaris10]
01:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Ellesmere
[Radeon RX 580]
The Intel Audio outputs all the sound, including HDMI audio. The audio
controller comes with AMD graphics doesn't get used.
When SG is disabled, we have:
00:1f.3 Audio device: Intel Corporation CM238 HD Audio Controller (rev
31)
01:00.0 VGA compatible controller: Advanced Micro Devices, Inc.
[AMD/ATI] Ellesmere [Polaris10]
01:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Ellesmere
[Radeon RX 580]
Now it's a typical discrete-only system. HDMI audio comes from AMD audio
controller, others from Intel audio controller.
When SG is enabled, the unused AMD audio controller still exposes its
sysfs, so userspace still opens the control file and stream. If
userspace tries to output sound through the stream, it hangs when
runtime suspend kicks in:
[ 12.796265] snd_hda_intel 0000:01:00.1: Disabling via vga_switcheroo
[ 12.796367] snd_hda_intel 0000:01:00.1: Cannot lock devices!
Since the discrete audio controller isn't useful when SG enabled, we
should just disable the device.
The platform does have a NVIDIA variant, but the discrete NVIDIA have a
audio controller, hence it doesn't have the issue.
Sorry, I don't quite understand: The AMD variant *also* has an audio
controller, so what's the difference? Or did you mean the Nvidia
variant *doesn't* have an audio controller?
It does, but the audio controller only shows under SG disabled.
Pretty much all modern Nvidia GPUs do have an integrated HDA
controller, however it's possible to hide it by clearing a bit
at offset 0x488 in the GPU's config space. Some BIOSes hide
the HDA if no external display is attached.
This is how the Nvidia variant works:
When SG is enabled:
One audio controller, the integrated one.
All sounds comes from the integrated one, including DP/HDMI.
When SG is disabled:
Two audio controller.
The DP/HDMI sounds come from the Nvidia audio controller. Others are from
the integrated audio controller.
I could imagine that the BIOS of the Dell machines in question
hides the HDA if Switchable Graphics is enabled. If that is the
case, be aware that there's an ongoing discussion to always expose
the HDA controller because the behavior of some BIOSes to only
expose the HDA when a display is attached causes massive problems
with Linux' HDA driver:
https://bugs.freedesktop.org/show_bug.cgi?id=75985
The system in the bug doesn't have "Switchable Graphics".
Right now all sounds output are from integrated audio controller on SG
enabled machines.
If we decide to always expose the HDA controller on Nvidia cards,
you may need to also match for the Nvidia vendor ID here.
Thanks for the info, I'll also put Nvidia vendor ID on next patch version.
Thanks,
Lukas