aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/radeon_kms.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_kms.c')
-rw-r--r--drivers/gpu/drm/radeon/radeon_kms.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
index d6b36766e8c9..bb8710531a1b 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -32,7 +32,7 @@
32 32
33#include <linux/vga_switcheroo.h> 33#include <linux/vga_switcheroo.h>
34#include <linux/slab.h> 34#include <linux/slab.h>
35 35#include <linux/pm_runtime.h>
36/** 36/**
37 * radeon_driver_unload_kms - Main unload function for KMS. 37 * radeon_driver_unload_kms - Main unload function for KMS.
38 * 38 *
@@ -50,9 +50,14 @@ int radeon_driver_unload_kms(struct drm_device *dev)
50 50
51 if (rdev == NULL) 51 if (rdev == NULL)
52 return 0; 52 return 0;
53
53 if (rdev->rmmio == NULL) 54 if (rdev->rmmio == NULL)
54 goto done_free; 55 goto done_free;
56
57 pm_runtime_get_sync(dev->dev);
58
55 radeon_acpi_fini(rdev); 59 radeon_acpi_fini(rdev);
60
56 radeon_modeset_fini(rdev); 61 radeon_modeset_fini(rdev);
57 radeon_device_fini(rdev); 62 radeon_device_fini(rdev);
58 63
@@ -125,9 +130,20 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags)
125 "Error during ACPI methods call\n"); 130 "Error during ACPI methods call\n");
126 } 131 }
127 132
133 if (radeon_runtime_pm != 0) {
134 pm_runtime_use_autosuspend(dev->dev);
135 pm_runtime_set_autosuspend_delay(dev->dev, 5000);
136 pm_runtime_set_active(dev->dev);
137 pm_runtime_allow(dev->dev);
138 pm_runtime_mark_last_busy(dev->dev);
139 pm_runtime_put_autosuspend(dev->dev);
140 }
141
128out: 142out:
129 if (r) 143 if (r)
130 radeon_driver_unload_kms(dev); 144 radeon_driver_unload_kms(dev);
145
146
131 return r; 147 return r;
132} 148}
133 149
@@ -475,9 +491,14 @@ void radeon_driver_lastclose_kms(struct drm_device *dev)
475int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) 491int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)
476{ 492{
477 struct radeon_device *rdev = dev->dev_private; 493 struct radeon_device *rdev = dev->dev_private;
494 int r;
478 495
479 file_priv->driver_priv = NULL; 496 file_priv->driver_priv = NULL;
480 497
498 r = pm_runtime_get_sync(dev->dev);
499 if (r < 0)
500 return r;
501
481 /* new gpu have virtual address space support */ 502 /* new gpu have virtual address space support */
482 if (rdev->family >= CHIP_CAYMAN) { 503 if (rdev->family >= CHIP_CAYMAN) {
483 struct radeon_fpriv *fpriv; 504 struct radeon_fpriv *fpriv;
@@ -506,6 +527,9 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)
506 527
507 file_priv->driver_priv = fpriv; 528 file_priv->driver_priv = fpriv;
508 } 529 }
530
531 pm_runtime_mark_last_busy(dev->dev);
532 pm_runtime_put_autosuspend(dev->dev);
509 return 0; 533 return 0;
510} 534}
511 535