aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Wunner <lukas@wunner.de>2016-01-11 14:09:20 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2016-02-09 05:21:12 -0500
commit98b3a3402eb6e38c3bf5dd4281e60e1f186f0041 (patch)
tree004f9b16321a3b70651fc6f5fdcbb764aee3eea3
parent704ab614ec1201138032003c03113a81526638ab (diff)
drm/nouveau: 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://bugzilla.kernel.org/show_bug.cgi?id=88861 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=61115 Tested-by: Lukas Wunner <lukas@wunner.de> [MBP 9,1 2012 intel IVB + nvidia GK107 pre-retina 15"] Signed-off-by: Lukas Wunner <lukas@wunner.de> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/d9542ca5041178165d3ff286c90cc99634f7d2ce.1452525860.git.lukas@wunner.de
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drm.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 2f2f252e3fb6..bb8498c9b13e 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -22,11 +22,13 @@
22 * Authors: Ben Skeggs 22 * Authors: Ben Skeggs
23 */ 23 */
24 24
25#include <linux/apple-gmux.h>
25#include <linux/console.h> 26#include <linux/console.h>
26#include <linux/delay.h> 27#include <linux/delay.h>
27#include <linux/module.h> 28#include <linux/module.h>
28#include <linux/pci.h> 29#include <linux/pci.h>
29#include <linux/pm_runtime.h> 30#include <linux/pm_runtime.h>
31#include <linux/vgaarb.h>
30#include <linux/vga_switcheroo.h> 32#include <linux/vga_switcheroo.h>
31 33
32#include "drmP.h" 34#include "drmP.h"
@@ -312,6 +314,15 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
312 bool boot = false; 314 bool boot = false;
313 int ret; 315 int ret;
314 316
317 /*
318 * apple-gmux is needed on dual GPU MacBook Pro
319 * to probe the panel if we're the inactive GPU.
320 */
321 if (IS_ENABLED(CONFIG_VGA_ARB) && IS_ENABLED(CONFIG_VGA_SWITCHEROO) &&
322 apple_gmux_present() && pdev != vga_default_device() &&
323 !vga_switcheroo_handler_flags())
324 return -EPROBE_DEFER;
325
315 /* remove conflicting drivers (vesafb, efifb etc) */ 326 /* remove conflicting drivers (vesafb, efifb etc) */
316 aper = alloc_apertures(3); 327 aper = alloc_apertures(3);
317 if (!aper) 328 if (!aper)