Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/radeon almost add radeondrmkms suspend...



details:   https://anonhg.NetBSD.org/src/rev/aa752c8fb7ce
branches:  trunk
changeset: 337289:aa752c8fb7ce
user:      mrg <mrg%NetBSD.org@localhost>
date:      Fri Apr 10 02:03:14 2015 +0000

description:
almost add radeondrmkms suspend/resume support.  it unfortunately doesn't work.

diffstat:

 sys/external/bsd/drm2/radeon/radeon_pci.c |  43 +++++++++++++++++++++++++++++-
 1 files changed, 41 insertions(+), 2 deletions(-)

diffs (78 lines):

diff -r dbe8d0dc2981 -r aa752c8fb7ce sys/external/bsd/drm2/radeon/radeon_pci.c
--- a/sys/external/bsd/drm2/radeon/radeon_pci.c Thu Apr 09 21:33:54 2015 +0000
+++ b/sys/external/bsd/drm2/radeon/radeon_pci.c Fri Apr 10 02:03:14 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: radeon_pci.c,v 1.7 2015/03/01 10:07:01 mrg Exp $       */
+/*     $NetBSD: radeon_pci.c,v 1.8 2015/04/10 02:03:14 mrg Exp $       */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: radeon_pci.c,v 1.7 2015/03/01 10:07:01 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeon_pci.c,v 1.8 2015/04/10 02:03:14 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "vga.h"
@@ -105,6 +105,8 @@
 static void    radeon_attach(device_t, device_t, void *);
 static void    radeon_attach_real(device_t);
 static int     radeon_detach(device_t, int);
+static bool    radeon_do_suspend(device_t, const pmf_qual_t *);
+static bool    radeon_do_resume(device_t, const pmf_qual_t *);
 
 static void    radeon_task_work(struct work *, void *);
 
@@ -163,6 +165,9 @@
 
        pci_aprint_devinfo(pa, NULL);
 
+       if (!pmf_device_register(self, &radeon_do_suspend, &radeon_do_resume))
+               aprint_error_dev(self, "unable to establish power handler\n");
+
        /*
         * Trivial initialization first; the rest will come after we
         * have mounted the root file system and can load firmware
@@ -277,6 +282,40 @@
        return 0;
 }
 
+static bool
+radeon_do_suspend(device_t self, const pmf_qual_t *qual)
+{
+       struct radeon_softc *const sc = device_private(self);
+       struct drm_device *const dev = sc->sc_drm_dev;
+       int ret;
+
+       if (dev == NULL)
+               return true;
+
+       ret = radeon_suspend_kms(dev, true, true);
+       if (ret)
+               return false;
+
+       return true;
+}
+
+static bool
+radeon_do_resume(device_t self, const pmf_qual_t *qual)
+{
+       struct radeon_softc *const sc = device_private(self);
+       struct drm_device *const dev = sc->sc_drm_dev;
+       int ret;
+
+       if (dev == NULL)
+               return true;
+
+       ret = radeon_resume_kms(dev, true, true);
+       if (ret)
+               return false;
+
+       return true;
+}
+
 static void
 radeon_task_work(struct work *work, void *cookie __unused)
 {



Home | Main Index | Thread Index | Old Index