Skip to content

Commit 14d2000

Browse files
l1kdanvet
authored andcommitted
drm/radeon: Defer probe if gmux is present but its driver isn't
gmux is a microcontroller built into dual GPU MacBook Pros. On pre-retina MBPs, if we're the inactive GPU, we need apple-gmux to temporarily switch DDC so that we can probe the panel's EDID. The checks for CONFIG_VGA_ARB and CONFIG_VGA_SWITCHEROO are necessary because if either of them is disabled but gmux is present, the driver would never load, even if we're the active GPU. (vga_default_device() would evaluate to NULL and vga_switcheroo_handler_flags() would evaluate to 0.) Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=61115 Signed-off-by: Lukas Wunner <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/552da6d85a82092146af7b0693595fa2a9ea376b.1452525860.git.lukas@wunner.de
1 parent 98b3a34 commit 14d2000

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

drivers/gpu/drm/radeon/radeon_drv.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@
3434
#include "radeon_drv.h"
3535

3636
#include <drm/drm_pciids.h>
37+
#include <linux/apple-gmux.h>
3738
#include <linux/console.h>
3839
#include <linux/module.h>
3940
#include <linux/pm_runtime.h>
41+
#include <linux/vgaarb.h>
4042
#include <linux/vga_switcheroo.h>
4143
#include <drm/drm_gem.h>
4244

@@ -319,6 +321,15 @@ static int radeon_pci_probe(struct pci_dev *pdev,
319321
{
320322
int ret;
321323

324+
/*
325+
* apple-gmux is needed on dual GPU MacBook Pro
326+
* to probe the panel if we're the inactive GPU.
327+
*/
328+
if (IS_ENABLED(CONFIG_VGA_ARB) && IS_ENABLED(CONFIG_VGA_SWITCHEROO) &&
329+
apple_gmux_present() && pdev != vga_default_device() &&
330+
!vga_switcheroo_handler_flags())
331+
return -EPROBE_DEFER;
332+
322333
/* Get rid of things like offb */
323334
ret = radeon_kick_out_firmware_fb(pdev);
324335
if (ret)

0 commit comments

Comments
 (0)