drm/radeon: fix runpm handling on APUs (v4)
[deliverable/linux.git] / drivers / gpu / drm / radeon / radeon_kms.c
index 3e49342a20e602e50f22c3068c543b7e19e9dab7..9337820e4d378a54963f90d8c94379e891c2fa30 100644 (file)
@@ -35,9 +35,9 @@
 #include <linux/pm_runtime.h>
 
 #if defined(CONFIG_VGA_SWITCHEROO)
-bool radeon_is_px(void);
+bool radeon_has_atpx(void);
 #else
-static inline bool radeon_is_px(void) { return false; }
+static inline bool radeon_has_atpx(void) { return false; }
 #endif
 
 /**
@@ -107,6 +107,13 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags)
                flags |= RADEON_IS_PCI;
        }
 
+       if (radeon_runtime_pm == 1)
+               flags |= RADEON_IS_PX;
+       else if ((radeon_runtime_pm == -1) &&
+                radeon_has_atpx() &&
+                ((flags & RADEON_IS_IGP) == 0))
+               flags |= RADEON_IS_PX;
+
        /* radeon_device_init should report only fatal error
         * like memory allocation failure or iomapping failure,
         * or memory manager initialization failure, it must
@@ -137,8 +144,7 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags)
                                "Error during ACPI methods call\n");
        }
 
-       if ((radeon_runtime_pm == 1) ||
-           ((radeon_runtime_pm == -1) && radeon_is_px())) {
+       if (radeon_is_px(dev)) {
                pm_runtime_use_autosuspend(dev->dev);
                pm_runtime_set_autosuspend_delay(dev->dev, 5000);
                pm_runtime_set_active(dev->dev);
This page took 0.038303 seconds and 5 git commands to generate.