|
|
@@ -396,6 +396,51 @@ void drm_mode_object_reference(struct drm_mode_object *obj)
|
|
|
}
|
|
|
EXPORT_SYMBOL(drm_mode_object_reference);
|
|
|
|
|
|
+/**
|
|
|
+ * drm_crtc_force_disable - Forcibly turn off a CRTC
|
|
|
+ * @crtc: CRTC to turn off
|
|
|
+ *
|
|
|
+ * Returns:
|
|
|
+ * Zero on success, error code on failure.
|
|
|
+ */
|
|
|
+int drm_crtc_force_disable(struct drm_crtc *crtc)
|
|
|
+{
|
|
|
+ struct drm_mode_set set = {
|
|
|
+ .crtc = crtc,
|
|
|
+ };
|
|
|
+
|
|
|
+ return drm_mode_set_config_internal(&set);
|
|
|
+}
|
|
|
+EXPORT_SYMBOL(drm_crtc_force_disable);
|
|
|
+
|
|
|
+/**
|
|
|
+ * drm_crtc_force_disable_all - Forcibly turn off all enabled CRTCs
|
|
|
+ * @dev: DRM device whose CRTCs to turn off
|
|
|
+ *
|
|
|
+ * Drivers may want to call this on unload to ensure that all displays are
|
|
|
+ * unlit and the GPU is in a consistent, low power state. Takes modeset locks.
|
|
|
+ *
|
|
|
+ * Returns:
|
|
|
+ * Zero on success, error code on failure.
|
|
|
+ */
|
|
|
+int drm_crtc_force_disable_all(struct drm_device *dev)
|
|
|
+{
|
|
|
+ struct drm_crtc *crtc;
|
|
|
+ int ret = 0;
|
|
|
+
|
|
|
+ drm_modeset_lock_all(dev);
|
|
|
+ drm_for_each_crtc(crtc, dev)
|
|
|
+ if (crtc->enabled) {
|
|
|
+ ret = drm_crtc_force_disable(crtc);
|
|
|
+ if (ret)
|
|
|
+ goto out;
|
|
|
+ }
|
|
|
+out:
|
|
|
+ drm_modeset_unlock_all(dev);
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+EXPORT_SYMBOL(drm_crtc_force_disable_all);
|
|
|
+
|
|
|
static void drm_framebuffer_free(struct kref *kref)
|
|
|
{
|
|
|
struct drm_framebuffer *fb =
|