]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/gpu/drm/i915/i915_drv.c
Merge remote-tracking branch 'device-mapper/for-next'
[karo-tx-linux.git] / drivers / gpu / drm / i915 / i915_drv.c
index f357058c74d938a41f922c4b40e3da1d67aa029a..44912ecebc1a287b93bfb2ac6294304fc1c81b5a 100644 (file)
 #include "i915_trace.h"
 #include "intel_drv.h"
 
+#include <linux/apple-gmux.h>
 #include <linux/console.h>
 #include <linux/module.h>
 #include <linux/pm_runtime.h>
+#include <linux/vgaarb.h>
+#include <linux/vga_switcheroo.h>
 #include <drm/drm_crtc_helper.h>
 
 static struct drm_driver driver;
@@ -969,6 +972,15 @@ static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        if (PCI_FUNC(pdev->devfn))
                return -ENODEV;
 
+       /*
+        * 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;
+
        return drm_get_pci_dev(pdev, ent, &driver);
 }
 
@@ -1079,7 +1091,6 @@ static int bxt_resume_prepare(struct drm_i915_private *dev_priv)
         */
        broxton_init_cdclk(dev);
        broxton_ddi_phy_init(dev);
-       intel_prepare_ddi(dev);
 
        return 0;
 }
@@ -1338,8 +1349,8 @@ static int vlv_wait_for_gt_wells(struct drm_i915_private *dev_priv,
                return 0;
 
        DRM_DEBUG_KMS("waiting for GT wells to go %s (%08x)\n",
-                       wait_for_on ? "on" : "off",
-                       I915_READ(VLV_GTLC_PW_STATUS));
+                     onoff(wait_for_on),
+                     I915_READ(VLV_GTLC_PW_STATUS));
 
        /*
         * RC6 transitioning can be delayed up to 2 msec (see
@@ -1348,7 +1359,7 @@ static int vlv_wait_for_gt_wells(struct drm_i915_private *dev_priv,
        err = wait_for(COND, 3);
        if (err)
                DRM_ERROR("timeout waiting for GT wells to go %s\n",
-                         wait_for_on ? "on" : "off");
+                         onoff(wait_for_on));
 
        return err;
 #undef COND
@@ -1359,7 +1370,7 @@ static void vlv_check_no_gt_access(struct drm_i915_private *dev_priv)
        if (!(I915_READ(VLV_GTLC_PW_STATUS) & VLV_GTLC_ALLOWWAKEERR))
                return;
 
-       DRM_ERROR("GT register access while GT waking disabled\n");
+       DRM_DEBUG_DRIVER("GT register access while GT waking disabled\n");
        I915_WRITE(VLV_GTLC_PW_STATUS, VLV_GTLC_ALLOWWAKEERR);
 }
 
@@ -1503,6 +1514,10 @@ static int intel_runtime_suspend(struct device *device)
 
        enable_rpm_wakeref_asserts(dev_priv);
        WARN_ON_ONCE(atomic_read(&dev_priv->pm.wakeref_count));
+
+       if (intel_uncore_arm_unclaimed_mmio_detection(dev_priv))
+               DRM_ERROR("Unclaimed access detected prior to suspending\n");
+
        dev_priv->pm.suspended = true;
 
        /*
@@ -1551,6 +1566,8 @@ static int intel_runtime_resume(struct device *device)
 
        intel_opregion_notify_adapter(dev, PCI_D0);
        dev_priv->pm.suspended = false;
+       if (intel_uncore_unclaimed_mmio(dev_priv))
+               DRM_DEBUG_DRIVER("Unclaimed access during suspend, bios?\n");
 
        intel_guc_resume(dev);