Index: radeon/radeon_pci.c =================================================================== RCS file: /cvsroot/src/sys/external/bsd/drm2/radeon/radeon_pci.c,v retrieving revision 1.7 diff -p -r1.7 radeon_pci.c *** radeon/radeon_pci.c 1 Mar 2015 10:07:01 -0000 1.7 --- radeon/radeon_pci.c 8 Apr 2015 06:04:27 -0000 *************** static int radeon_match(device_t, cfdata *** 105,110 **** --- 105,112 ---- 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 *); *************** radeon_attach(device_t parent, device_t *** 163,168 **** --- 165,173 ---- 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 *************** radeon_detach(device_t self, int flags) *** 277,282 **** --- 282,321 ---- 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) {