Module Name: src
Committed By: riz
Date: Sun Nov 21 02:51:57 UTC 2010
Modified Files:
src/sys/external/bsd/drm/dist/bsd-core [netbsd-5]: radeon_drv.c
Log Message:
Pull up following patch (requested by mrg in ticket #1406):
sys/external/bsd/drm/dist/bsd-core/radeon_drv.c: patch
Make suspend/resume actually work with radeondrm configured.
>From Pierre Pronchery in kern/43327.
To generate a diff of this commit:
cvs rdiff -u -r1.2.10.1 -r1.2.10.2 \
src/sys/external/bsd/drm/dist/bsd-core/radeon_drv.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/external/bsd/drm/dist/bsd-core/radeon_drv.c
diff -u src/sys/external/bsd/drm/dist/bsd-core/radeon_drv.c:1.2.10.1 src/sys/external/bsd/drm/dist/bsd-core/radeon_drv.c:1.2.10.2
--- src/sys/external/bsd/drm/dist/bsd-core/radeon_drv.c:1.2.10.1 Sat Jun 20 23:36:59 2009
+++ src/sys/external/bsd/drm/dist/bsd-core/radeon_drv.c Sun Nov 21 02:51:57 2010
@@ -134,6 +134,38 @@
#elif defined(__NetBSD__)
+static bool
+radeondrm_suspend(device_t self PMF_FN_ARGS)
+{
+ struct drm_device *dev = device_private(self);
+ drm_radeon_cp_stop_t stop_args;
+ bool rv = true;
+
+ stop_args.flush = stop_args.idle = 0;
+ DRM_LOCK();
+ if (drm_find_file_by_proc(dev, curlwp->l_proc) &&
+ radeon_cp_stop(dev, &stop_args, dev->lock.file_priv) != 0)
+ rv = false;
+ DRM_UNLOCK();
+
+ return rv;
+}
+
+static bool
+radeondrm_resume(device_t self PMF_FN_ARGS)
+{
+ struct drm_device *dev = device_private(self);
+ bool rv = true;
+
+ DRM_LOCK();
+ if (drm_find_file_by_proc(dev, curlwp->l_proc) &&
+ radeon_cp_resume(dev, NULL, NULL) != 0)
+ rv = false;
+ DRM_UNLOCK();
+
+ return rv;
+}
+
static int
radeondrm_probe(device_t parent, cfdata_t match, void *aux)
{
@@ -152,11 +184,22 @@
radeon_configure(dev);
+ if (!pmf_device_register(self, radeondrm_suspend, radeondrm_resume))
+ aprint_error_dev(self, "couldn't establish power handler\n");
+
drm_attach(self, pa, radeon_pciidlist);
}
+static int
+radeondrm_detach(device_t self, int flags)
+{
+ pmf_device_deregister(self);
+
+ return drm_detach(self, flags);
+}
+
CFATTACH_DECL_NEW(radeondrm, sizeof(struct drm_device),
- radeondrm_probe, radeondrm_attach, drm_detach, drm_activate);
+ radeondrm_probe, radeondrm_attach, radeondrm_detach, NULL);
#ifdef _MODULE