diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2016-08-27 12:37:22 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-09-14 15:10:40 -0400 |
commit | 7c1fa1db54549a75250763c68afb150418085db1 (patch) | |
tree | cb6662340665158e38e9113504b17e1a074e4c4d /drivers/gpu | |
parent | 6861c837e28e1b1300a1b24ddab748c8ee50da3b (diff) |
drm/amdgpu: handle runtime pm in fbcon (v2)
Ported from nouveau.
v2: re-enable runtime autosuspend in the error case
Acked-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c index 919146780a15..3c527cc72bf0 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/module.h> | 26 | #include <linux/module.h> |
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/fb.h> | 28 | #include <linux/fb.h> |
29 | #include <linux/pm_runtime.h> | ||
29 | 30 | ||
30 | #include <drm/drmP.h> | 31 | #include <drm/drmP.h> |
31 | #include <drm/drm_crtc.h> | 32 | #include <drm/drm_crtc.h> |
@@ -48,8 +49,35 @@ struct amdgpu_fbdev { | |||
48 | struct amdgpu_device *adev; | 49 | struct amdgpu_device *adev; |
49 | }; | 50 | }; |
50 | 51 | ||
52 | static int | ||
53 | amdgpufb_open(struct fb_info *info, int user) | ||
54 | { | ||
55 | struct amdgpu_fbdev *rfbdev = info->par; | ||
56 | struct amdgpu_device *adev = rfbdev->adev; | ||
57 | int ret = pm_runtime_get_sync(adev->ddev->dev); | ||
58 | if (ret < 0 && ret != -EACCES) { | ||
59 | pm_runtime_mark_last_busy(adev->ddev->dev); | ||
60 | pm_runtime_put_autosuspend(adev->ddev->dev); | ||
61 | return ret; | ||
62 | } | ||
63 | return 0; | ||
64 | } | ||
65 | |||
66 | static int | ||
67 | amdgpufb_release(struct fb_info *info, int user) | ||
68 | { | ||
69 | struct amdgpu_fbdev *rfbdev = info->par; | ||
70 | struct amdgpu_device *adev = rfbdev->adev; | ||
71 | |||
72 | pm_runtime_mark_last_busy(adev->ddev->dev); | ||
73 | pm_runtime_put_autosuspend(adev->ddev->dev); | ||
74 | return 0; | ||
75 | } | ||
76 | |||
51 | static struct fb_ops amdgpufb_ops = { | 77 | static struct fb_ops amdgpufb_ops = { |
52 | .owner = THIS_MODULE, | 78 | .owner = THIS_MODULE, |
79 | .fb_open = amdgpufb_open, | ||
80 | .fb_release = amdgpufb_release, | ||
53 | .fb_check_var = drm_fb_helper_check_var, | 81 | .fb_check_var = drm_fb_helper_check_var, |
54 | .fb_set_par = drm_fb_helper_set_par, | 82 | .fb_set_par = drm_fb_helper_set_par, |
55 | .fb_fillrect = drm_fb_helper_cfb_fillrect, | 83 | .fb_fillrect = drm_fb_helper_cfb_fillrect, |