[PATCH 3/5] tty/vt: add con_bind and con_unbind functions

Paulo Zanoni przanoni at gmail.com
Thu Sep 26 16:06:00 PDT 2013


From: Paulo Zanoni <paulo.r.zanoni at intel.com>

The consoles who need to do something when unbinding or binding can
optionally implement these functions.

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 at intel.com>
---
 drivers/tty/vt/vt.c     | 6 ++++++
 include/linux/console.h | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 9a8e8c5..beb5986 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -3014,6 +3014,9 @@ static int do_bind_con_driver(const struct consw *csw, int first, int last,
 	if (retval)
 		goto err;
 
+	if (csw->con_bind)
+		csw->con_bind();
+
 	if (!(con_driver->flag & CON_DRIVER_FLAG_INIT)) {
 		csw->con_startup();
 		con_driver->flag |= CON_DRIVER_FLAG_INIT;
@@ -3152,6 +3155,9 @@ int do_unbind_con_driver(const struct consw *csw, int first, int last, int deflt
 	if (!con_is_bound(csw))
 		goto err;
 
+	if (csw->con_unbind)
+		csw->con_unbind();
+
 	first = max(first, con_driver->first);
 	last = min(last, con_driver->last);
 
diff --git a/include/linux/console.h b/include/linux/console.h
index 7571a16..5cd2c35 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -65,6 +65,8 @@ struct consw {
 	 * Restore the console to its pre-debug state as closely as possible.
 	 */
 	int	(*con_debug_leave)(struct vc_data *);
+	void	(*con_bind)(void);
+	void	(*con_unbind)(void);
 };
 
 extern const struct consw *conswitchp;
-- 
1.8.3.1



More information about the dri-devel mailing list