AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Deucher <alexdeucher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Alex Deucher <alexander.deucher-5C7GfCeVMHo@public.gmane.org>
Subject: [PATCH 08/10] drm/radeon: handle runtime pm in fbcon
Date: Wed, 31 Aug 2016 18:08:54 -0400	[thread overview]
Message-ID: <1472681336-30106-8-git-send-email-alexander.deucher@amd.com> (raw)
In-Reply-To: <1472681336-30106-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org>

Ported from nouveau.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/radeon/radeon_fb.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/drivers/gpu/drm/radeon/radeon_fb.c b/drivers/gpu/drm/radeon/radeon_fb.c
index 0e3143a..1ae32c9 100644
--- a/drivers/gpu/drm/radeon/radeon_fb.c
+++ b/drivers/gpu/drm/radeon/radeon_fb.c
@@ -26,6 +26,7 @@
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/fb.h>
+#include <linux/pm_runtime.h>
 
 #include <drm/drmP.h>
 #include <drm/drm_crtc.h>
@@ -47,8 +48,32 @@ struct radeon_fbdev {
 	struct radeon_device *rdev;
 };
 
+static int
+radeonfb_open(struct fb_info *info, int user)
+{
+	struct radeon_fbdev *rfbdev = info->par;
+	struct radeon_device *rdev = rfbdev->rdev;
+	int ret = pm_runtime_get_sync(rdev->ddev->dev);
+	if (ret < 0 && ret != -EACCES)
+		return ret;
+	return 0;
+}
+
+static int
+radeonfb_release(struct fb_info *info, int user)
+{
+	struct radeon_fbdev *rfbdev = info->par;
+	struct radeon_device *rdev = rfbdev->rdev;
+
+	pm_runtime_mark_last_busy(rdev->ddev->dev);
+	pm_runtime_put_autosuspend(rdev->ddev->dev);
+	return 0;
+}
+
 static struct fb_ops radeonfb_ops = {
 	.owner = THIS_MODULE,
+	.fb_open = radeonfb_open,
+	.fb_release = radeonfb_release,
 	.fb_check_var = drm_fb_helper_check_var,
 	.fb_set_par = drm_fb_helper_set_par,
 	.fb_fillrect = drm_fb_helper_cfb_fillrect,
-- 
2.5.5

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2016-08-31 22:08 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-31 22:08 [PATCH 01/10] drm/amdgpu: handle runtime pm in drm pre/post close Alex Deucher
     [not found] ` <1472681336-30106-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
2016-08-31 22:08   ` [PATCH 02/10] drm/amdgpu: handle runtime pm correctly in amdgpu_driver_open_kms Alex Deucher
     [not found]     ` <1472681336-30106-2-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
2016-09-01  1:04       ` Michel Dänzer
2016-08-31 22:08   ` [PATCH 03/10] drm/amdgpu: handle runtime pm in fbcon Alex Deucher
     [not found]     ` <1472681336-30106-3-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
2016-09-01  1:04       ` Michel Dänzer
     [not found]         ` <c2ff0619-5d11-c443-a1b4-b57530dc89f6-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-09-01 20:44           ` Alex Deucher
     [not found]             ` <CADnq5_P+HQ=7LQfFjG8dLihbGsEKnLZFNmeFeUdL79VvuwyqdA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-09-02  1:47               ` Michel Dänzer
     [not found]                 ` <38837769-4dfc-8a19-b6de-c5d18014c889-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-09-02 13:31                   ` Deucher, Alexander
2016-08-31 22:08   ` [PATCH 04/10] drm/amdgpu: skip suspend/resume on DRM_SWITCH_POWER_DYNAMIC_OFF Alex Deucher
     [not found]     ` <1472681336-30106-4-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
2016-09-01  1:06       ` Michel Dänzer
2016-08-31 22:08   ` [PATCH 05/10] drm/amdgpu: set runtime pm state to active on resume Alex Deucher
2016-08-31 22:08   ` [PATCH 06/10] drm/radeon: handle runtime pm in drm pre/post close Alex Deucher
2016-08-31 22:08   ` [PATCH 07/10] drm/radeon: handle runtime pm correctly in amdgpu_driver_open_kms Alex Deucher
2016-08-31 22:08   ` Alex Deucher [this message]
2016-08-31 22:08   ` [PATCH 09/10] drm/radeon: skip suspend/resume on DRM_SWITCH_POWER_DYNAMIC_OFF Alex Deucher
2016-08-31 22:08   ` [PATCH 10/10] drm/radeon: set runtime pm state to active on resume Alex Deucher
2016-09-01  1:03   ` [PATCH 01/10] drm/amdgpu: handle runtime pm in drm pre/post close Michel Dänzer
     [not found]     ` <6648435f-d52e-e4d3-55f4-df1837b3b8a8-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-09-01 20:38       ` Alex Deucher
     [not found]         ` <CADnq5_N3e=xLhziKFKJog9vodd-=0sG4o2xW+kqU9ck+jFtMYA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-09-02  1:50           ` Michel Dänzer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1472681336-30106-8-git-send-email-alexander.deucher@amd.com \
    --to=alexdeucher-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=alexander.deucher-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox