vgacon: dummy implementation for vgacon_text_force
[cascardo/linux.git] / drivers / gpu / drm / nouveau / nouveau_drm.c
index 2f2f252..731c5c2 100644 (file)
  * Authors: Ben Skeggs
  */
 
+#include <linux/apple-gmux.h>
 #include <linux/console.h>
 #include <linux/delay.h>
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/pm_runtime.h>
+#include <linux/vgaarb.h>
 #include <linux/vga_switcheroo.h>
 
 #include "drmP.h"
@@ -312,6 +314,15 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
        bool boot = false;
        int ret;
 
+       /*
+        * apple-gmux is needed on dual GPU MacBook Pro
+        * to probe the panel if we're the inactive GPU.
+        */
+       if (IS_ENABLED(CONFIG_VGA_ARB) && IS_ENABLED(CONFIG_VGA_SWITCHEROO) &&
+           apple_gmux_present() && pdev != vga_default_device() &&
+           !vga_switcheroo_handler_flags())
+               return -EPROBE_DEFER;
+
        /* remove conflicting drivers (vesafb, efifb etc) */
        aper = alloc_apertures(3);
        if (!aper)
@@ -1071,10 +1082,8 @@ nouveau_drm_init(void)
        nouveau_display_options();
 
        if (nouveau_modeset == -1) {
-#ifdef CONFIG_VGA_CONSOLE
                if (vgacon_text_force())
                        nouveau_modeset = 0;
-#endif
        }
 
        if (!nouveau_modeset)