[PATCH 1/2] drm/fb-helper: Add drm_fb_helper_emergency_disable

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

 



This is needed for drm_panic, to disable fbcon output that will otherwise
mix with drm_panic output.

Signed-off-by: Jocelyn Falempe <jfalempe@xxxxxxxxxx>
---
 drivers/gpu/drm/drm_fb_helper.c | 17 +++++++++++++++++
 include/drm/drm_fb_helper.h     |  5 +++++
 2 files changed, 22 insertions(+)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index d612133e2cf7e..e2e681e252e73 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -798,6 +798,23 @@ void drm_fb_helper_set_suspend_unlocked(struct drm_fb_helper *fb_helper,
 }
 EXPORT_SYMBOL(drm_fb_helper_set_suspend_unlocked);
 
+/**
+ * drm_fb_helper_emergency_disable - disable fb output in panic situation
+ * @fb_helper: driver-allocated fbdev helper, can be NULL
+ *
+ * A wrapper around fb_set_suspend, to disable fb emulation when a panic occurs.
+ */
+void drm_fb_helper_emergency_disable(struct drm_fb_helper *fb_helper)
+{
+	if (fb_helper && fb_helper->info && fb_helper->info->state == FBINFO_STATE_RUNNING) {
+		if (console_trylock()) {
+			fb_set_suspend(fb_helper->info, FBINFO_STATE_SUSPENDED);
+			console_unlock();
+		}
+	}
+}
+EXPORT_SYMBOL(drm_fb_helper_emergency_disable);
+
 static int setcmap_pseudo_palette(struct fb_cmap *cmap, struct fb_info *info)
 {
 	u32 *palette = (u32 *)info->pseudo_palette;
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index 375737fd6c36e..8c61c4fe93e3b 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -261,6 +261,7 @@ void drm_fb_helper_deferred_io(struct fb_info *info, struct list_head *pagerefli
 void drm_fb_helper_set_suspend(struct drm_fb_helper *fb_helper, bool suspend);
 void drm_fb_helper_set_suspend_unlocked(struct drm_fb_helper *fb_helper,
 					bool suspend);
+void drm_fb_helper_emergency_disable(struct drm_fb_helper *fb_helper);
 
 int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info);
 
@@ -378,6 +379,10 @@ drm_fb_helper_set_suspend_unlocked(struct drm_fb_helper *fb_helper, bool suspend
 {
 }
 
+static inline void drm_fb_helper_emergency_disable(struct drm_fb_helper *fb_helper)
+{
+}
+
 static inline int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper)
 {
 	return 0;
-- 
2.44.0




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux