diff mbox

[4/5] console/fbcon: implement con_bind and con_unbind

Message ID 1380236762-1698-5-git-send-email-przanoni@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Paulo Zanoni Sept. 26, 2013, 11:06 p.m. UTC
From: Paulo Zanoni <paulo.r.zanoni@intel.com>

And create fb_bind and fb_unbind fb_ops that the drivers can
implement.

The current problem I'm trying to solve is that when i915+fbcon is
loaded on Haswell, if we disable the power well (to save power) the
VGA interface gets completely disabled, so when we unbind fbcon we
need to restore the VGA interface to allow vgacon to work.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
 drivers/video/console/fbcon.c | 26 ++++++++++++++++++++++++++
 include/linux/fb.h            |  4 ++++
 2 files changed, 30 insertions(+)
diff mbox

Patch

diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index cd8a802..68d316a 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -3298,6 +3298,30 @@  done:
 	return ret;
 }
 
+static void fbcon_con_bind(void)
+{
+	struct fb_info *info = NULL;
+
+	info = registered_fb[info_idx];
+	if (!info)
+		return;
+
+	if (info->fbops->fb_bind)
+		info->fbops->fb_bind(info);
+}
+
+static void fbcon_con_unbind(void)
+{
+	struct fb_info *info = NULL;
+
+	info = registered_fb[info_idx];
+	if (!info)
+		return;
+
+	if (info->fbops->fb_unbind)
+		info->fbops->fb_unbind(info);
+}
+
 /*
  *  The console `switch' structure for the frame buffer based console
  */
@@ -3328,6 +3352,8 @@  static const struct consw fb_con = {
 	.con_resize             = fbcon_resize,
 	.con_debug_enter	= fbcon_debug_enter,
 	.con_debug_leave	= fbcon_debug_leave,
+	.con_bind		= fbcon_con_bind,
+	.con_unbind		= fbcon_con_unbind,
 };
 
 static struct notifier_block fbcon_event_notifier = {
diff --git a/include/linux/fb.h b/include/linux/fb.h
index ffac70a..8074bd5 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -304,6 +304,10 @@  struct fb_ops {
 	/* called at KDB enter and leave time to prepare the console */
 	int (*fb_debug_enter)(struct fb_info *info);
 	int (*fb_debug_leave)(struct fb_info *info);
+
+	/* called when binding/unbinding */
+	void  (*fb_bind)(struct fb_info *info);
+	void  (*fb_unbind)(struct fb_info *info);
 };
 
 #ifdef CONFIG_FB_TILEBLITTING