vga_switcheroo: set audio client id according to bound GPU id
authorJim Qu <Jim.Qu@amd.com>
Tue, 17 Jul 2018 08:20:50 +0000 (16:20 +0800)
committerTakashi Iwai <tiwai@suse.de>
Tue, 17 Jul 2018 09:12:00 +0000 (11:12 +0200)
commit4aaf448fa9754e2d5ee188d32327b24ffc15ca4d
tree1f625d14bdfaf5a48c461c6ce357181dc5d809a4
parent9d3cce1e8b8561fed5f383d22a4d6949db4eadbe
vga_switcheroo: set audio client id according to bound GPU id

On modern laptop, there are more and more platforms
have two GPUs, and each of them maybe have audio codec
for HDMP/DP output. For some dGPU which is no output,
audio codec usually is disabled.

In currect HDA audio driver, it will set all codec as
VGA_SWITCHEROO_DIS, the audio which is binded to UMA
will be suspended if user use debugfs to contorl power

In HDA driver side, it is difficult to know which GPU
the audio has binded to. So set the bound gpu pci dev
to vga_switcheroo.

if the audio client is not the third registration, audio
id will set in vga_switcheroo enable function. if the
audio client is the last registration when vga_switcheroo
_ready() get true, we should get audio client id from bound
GPU directly.

Signed-off-by: Jim Qu <Jim.Qu@amd.com>
Reviewed-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
drivers/gpu/vga/vga_switcheroo.c
include/linux/vga_switcheroo.h
sound/pci/hda/hda_intel.c