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
commit704ab614ec1201138032003c03113a81526638ab (patch)
tree612600df35244ec7320b92e01fde6a22a3973eaa
parent2413306c2566b729a9d17a81e9d1181e6f354d6a (diff)
drm/i915: 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/f56ee6a0600a3e1bb5bed4d0db4ed9ade7445c47.1452525860.git.lukas@wunner.de
-rw-r--r--drivers/gpu/drm/i915/i915_drv.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 11d8414edbbe..44912ecebc1a 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -35,9 +35,12 @@
35#include "i915_trace.h" 35#include "i915_trace.h"
36#include "intel_drv.h" 36#include "intel_drv.h"
37 37
38#include <linux/apple-gmux.h>
38#include <linux/console.h> 39#include <linux/console.h>
39#include <linux/module.h> 40#include <linux/module.h>
40#include <linux/pm_runtime.h> 41#include <linux/pm_runtime.h>
42#include <linux/vgaarb.h>
43#include <linux/vga_switcheroo.h>
41#include <drm/drm_crtc_helper.h> 44#include <drm/drm_crtc_helper.h>
42 45
43static struct drm_driver driver; 46static struct drm_driver driver;
@@ -969,6 +972,15 @@ static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
969 if (PCI_FUNC(pdev->devfn)) 972 if (PCI_FUNC(pdev->devfn))
970 return -ENODEV; 973 return -ENODEV;
971 974
975 /*
976 * apple-gmux is needed on dual GPU MacBook Pro
977 * to probe the panel if we're the inactive GPU.
978 */
979 if (IS_ENABLED(CONFIG_VGA_ARB) && IS_ENABLED(CONFIG_VGA_SWITCHEROO) &&
980 apple_gmux_present() && pdev != vga_default_device() &&
981 !vga_switcheroo_handler_flags())
982 return -EPROBE_DEFER;
983
972 return drm_get_pci_dev(pdev, ent, &driver); 984 return drm_get_pci_dev(pdev, ent, &driver);
973} 985}
974 986