drm/amdgpu: register a vga_switcheroo client for MacBooks with apple-gmux
authorOrlando Chamberlain <orlandoch.dev@gmail.com>
Fri, 3 Mar 2023 11:34:25 +0000 (22:34 +1100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 May 2023 14:03:07 +0000 (23:03 +0900)
commit78e32896ecc790994034a35a2edef0b6ae043537
treecce2243b897e5088edf3f8e041b7e77a6a5c077c
parent809a3fb8d8fce5801300ead8aaf52a4ee102e0db
drm/amdgpu: register a vga_switcheroo client for MacBooks with apple-gmux

[ Upstream commit d37a3929ca0363ed1dce02b2772cd5bc547ca66d ]

Commit 3840c5bcc245 ("drm/amdgpu: disentangle runtime pm and
vga_switcheroo") made amdgpu only register a vga_switcheroo client for
GPU's with PX, however AMD GPUs in dual gpu Apple Macbooks do need to
register, but don't have PX. Instead of AMD's PX, they use apple-gmux.

Use apple_gmux_detect() to identify these gpus, and
pci_is_thunderbolt_attached() to ensure eGPUs connected to Dual GPU
Macbooks don't register with vga_switcheroo.

Fixes: 3840c5bcc245 ("drm/amdgpu: disentangle runtime pm and vga_switcheroo")
Link: https://lore.kernel.org/amd-gfx/20230210044826.9834-10-orlandoch.dev@gmail.com/
Signed-off-by: Orlando Chamberlain <orlandoch.dev@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c