Console Rotation 3

---
 drivers/video/console/bitblit.c      |   15 ++--
 drivers/video/console/fbcon.c        |  128 ++++++++++++++++++++++++++++++-----
 drivers/video/console/fbcon.h        |    7 +
 drivers/video/console/fbcon_ccw.c    |   14 ++-
 drivers/video/console/fbcon_cw.c     |   14 ++-
 drivers/video/console/fbcon_rotate.c |   21 ++++-
 drivers/video/console/fbcon_ud.c     |   14 ++-
 drivers/video/fbmem.c                |   66 +++++++++++++-----
 drivers/video/fbsysfs.c              |   41 +++++++++++
 include/linux/fb.h                   |   16 +++-
 10 files changed, 268 insertions(+), 68 deletions(-)


diff --git a/drivers/video/console/bitblit.c b/drivers/video/console/bitblit.c
index ecaa29a..136a4f5 100644
--- a/drivers/video/console/bitblit.c
+++ b/drivers/video/console/bitblit.c
@@ -392,12 +392,17 @@ static void bit_cursor(struct vc_data *v
 static int bit_update_start(struct fb_info *info, u32 xoff, u32 yoff,
 			    u32 vmode)
 {
-	struct fb_var_screeninfo var = info->var;
+	struct fbcon_ops *ops = info->fbcon_par;
+	int err;
 
-	var.xoffset = xoff;
-	var.yoffset = yoff;
-	var.vmode = vmode;
-	return fb_pan_display(info, &var);
+	ops->var.xoffset = xoff;
+	ops->var.yoffset = yoff;
+	ops->var.vmode = vmode;
+	err = fb_pan_display(info, &ops->var);
+	ops->var.xoffset = info->var.xoffset;
+	ops->var.yoffset = info->var.yoffset;
+	ops->var.vmode = info->var.vmode;
+	return err;
 }
 
 void fbcon_set_bitops(struct fbcon_ops *ops)
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index f83cf18..e36e005 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -132,6 +132,9 @@ static char fontname[40];
 /* current fb_info */
 static int info_idx = -1;
 
+/* console rotation */
+static int rotate;
+
 static const struct consw fb_con;
 
 #define CM_SOFTBACK	(8)
@@ -190,6 +193,8 @@ static void fbcon_preset_disp(struct fb_
 			      int unit);
 static void fbcon_redraw_move(struct vc_data *vc, struct display *p,
 			      int line, int count, int dy);
+static void fbcon_modechanged(struct fb_info *info);
+static void fbcon_set_all_vcs(struct fb_info *info);
 
 #ifdef CONFIG_MAC
 /*
@@ -205,26 +210,88 @@ static irqreturn_t fb_vbl_detect(int irq
 #endif
 
 #ifdef CONFIG_FRAMEBUFFER_CONSOLE_ROTATION
-static inline void fbcon_set_rotation(struct fb_info *info)
+static inline void fbcon_set_rotation(struct fb_info *info, struct display *p)
 {
 	struct fbcon_ops *ops = info->fbcon_par;
 
-	if (!(info->flags & FBINFO_HW_ROTATE) &&
-	    !(info->flags & FBINFO_MISC_TILEBLITTING) &&
-	      info->var.rotate < 4)
-		ops->rotate = info->var.rotate;
+	if (!(info->flags & FBINFO_MISC_TILEBLITTING) &&
+	    p->rotate < 4)
+		ops->rotate = p->con_rotate;
 	else
 		ops->rotate = 0;
 }
+
+static void fbcon_rotate(struct fb_info *info, u32 rotate)
+{
+	struct fbcon_ops *ops= info->fbcon_par;
+	struct fb_info *fb_info;
+
+	if (!ops || ops->currcon == -1)
+		return;
+
+	fb_info = registered_fb[con2fb_map[ops->currcon]];
+
+	if (info == fb_info) {
+		struct display *p = &fb_display[ops->currcon];
+
+		if (rotate < 4)
+			p->con_rotate = rotate;
+		else
+			p->con_rotate = 0;
+
+		fbcon_modechanged(info);
+	}
+}
+
+static void fbcon_rotate_all(struct fb_info *info, u32 rotate)
+{
+	struct fbcon_ops *ops = info->fbcon_par;
+	struct vc_data *vc;
+	struct display *p;
+	int i;
+
+	if (!ops || ops->currcon < 0 || rotate > 3)
+		return;
+
+	for (i = 0; i < MAX_NR_CONSOLES; i++) {
+		vc = vc_cons[i].d;
+		if (!vc || vc->vc_mode != KD_TEXT ||
+		    registered_fb[con2fb_map[i]] != info)
+			continue;
+
+		p = &fb_display[vc->vc_num];
+		p->con_rotate = rotate;
+	}
+
+	fbcon_set_all_vcs(info);
+}
 #else
-static inline void fbcon_set_rotation(struct fb_info *info)
+static inline void fbcon_set_rotation(struct fb_info *info, struct display *p)
 {
 	struct fbcon_ops *ops = info->fbcon_par;
 
 	ops->rotate = 0;
 }
+
+static void fbcon_rotate(struct fb_info *info, u32 rotate)
+{
+	return;
+}
+
+static void fbcon_rotate_all(struct fb_info *info, u32 rotate)
+{
+	return;
+}
 #endif
 
+static int fbcon_get_rotate(struct fb_info *info)
+{
+	struct fbcon_ops *ops = info->fbcon_par;
+
+	return (ops) ? ops->rotate : 0;
+}
+
+
 static inline int fbcon_is_inactive(struct vc_data *vc, struct fb_info *info)
 {
 	struct fbcon_ops *ops = info->fbcon_par;
@@ -444,6 +511,14 @@ static int __init fb_console_setup(char 
 				last_fb_vc = simple_strtoul(options, &options, 10) - 1;
 			fbcon_is_default = 0; 
 		}	
+
+		if (!strncmp(options, "rotate:", 7)) {
+			options += 7;
+			if (*options)
+				rotate = simple_strtoul(options, &options, 0);
+			if (rotate > 3)
+				rotate = 0;
+		}
 	}
 	return 0;
 }
@@ -501,6 +576,7 @@ static void fbcon_prepare_logo(struct vc
 			       int cols, int rows, int new_cols, int new_rows)
 {
 	/* Need to make room for the logo */
+	struct fbcon_ops *ops = info->fbcon_par;
 	int cnt, erase = vc->vc_video_erase_char, step;
 	unsigned short *save = NULL, *r, *q;
 
@@ -510,7 +586,7 @@ static void fbcon_prepare_logo(struct vc
 	 */
 	if (fb_get_color_depth(&info->var, &info->fix) == 1)
 		erase &= ~0x400;
-	logo_height = fb_prepare_logo(info);
+	logo_height = fb_prepare_logo(info, ops->rotate);
 	logo_lines = (logo_height + vc->vc_font.height - 1) /
 		vc->vc_font.height;
 	q = (unsigned short *) (vc->vc_origin +
@@ -614,9 +690,11 @@ static int con2fb_acquire_newinfo(struct
 	}
 
 	if (!err) {
+		struct display *p = &fb_display[vc->vc_num];
+
 		memset(ops, 0, sizeof(struct fbcon_ops));
 		info->fbcon_par = ops;
-		fbcon_set_rotation(info);
+		fbcon_set_rotation(info, p);
 		set_blitting_type(vc, info, NULL);
 	}
 
@@ -850,8 +928,10 @@ static const char *fbcon_startup(void)
 	memset(ops, 0, sizeof(struct fbcon_ops));
 	ops->currcon = -1;
 	ops->graphics = 1;
+	ops->cur_rotate = -1;
 	info->fbcon_par = ops;
-	fbcon_set_rotation(info);
+	p->con_rotate = rotate;
+	fbcon_set_rotation(info, p);
 	set_blitting_type(vc, info, NULL);
 
 	if (info->fix.type != FB_TYPE_TEXT) {
@@ -1011,6 +1091,9 @@ static void fbcon_init(struct vc_data *v
 		con_copy_unimap(vc, svc);
 
 	ops = info->fbcon_par;
+	p->con_rotate = rotate;
+	fbcon_set_rotation(info, p);
+	set_blitting_type(vc, info, NULL);
 
 	cols = vc->vc_cols;
 	rows = vc->vc_rows;
@@ -1232,7 +1315,7 @@ static void fbcon_set_disp(struct fb_inf
 	var->yoffset = info->var.yoffset;
 	var->xoffset = info->var.xoffset;
 	fb_set_var(info, var);
-
+	ops->var = info->var;
 	vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1);
 	vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800;
 	if (charcnt == 256) {
@@ -1943,6 +2026,7 @@ static int fbcon_resize(struct vc_data *
 			fb_set_var(info, &var);
 		}
 		var_to_display(p, &info->var, info);
+		ops->var = info->var;
 	}
 	updatescrollmode(p, info, vc);
 	return 0;
@@ -2005,7 +2089,9 @@ static int fbcon_switch(struct vc_data *
 	info->var.activate = var.activate;
 	var.yoffset = info->var.yoffset;
 	var.xoffset = info->var.xoffset;
+	var.vmode = info->var.vmode;
 	fb_set_var(info, &var);
+	ops->var = info->var;
 
 	if (old_info != NULL && old_info != info) {
 		if (info->fbops->fb_set_par)
@@ -2014,7 +2100,7 @@ static int fbcon_switch(struct vc_data *
 		fbcon_add_cursor_timer(info);
 	}
 
-	fbcon_set_rotation(info);
+	fbcon_set_rotation(info, p);
 	set_blitting_type(vc, info, p);
 	ops->cursor_reset = 1;
 
@@ -2053,7 +2139,7 @@ static int fbcon_switch(struct vc_data *
 
 		logo_shown = fg_console;
 		/* This is protected above by initmem_freed */
-		fb_show_logo(info);
+		fb_show_logo(info, ops->rotate);
 		update_region(vc,
 			      vc->vc_origin + vc->vc_size_row * vc->vc_top,
 			      vc->vc_size_row * (vc->vc_bottom -
@@ -2092,6 +2178,7 @@ static int fbcon_blank(struct vc_data *v
 			var.activate = FB_ACTIVATE_NOW | FB_ACTIVATE_FORCE;
 			fb_set_var(info, &var);
 			ops->graphics = 0;
+			ops->var = info->var;
 		}
 	}
 
@@ -2627,10 +2714,10 @@ static void fbcon_modechanged(struct fb_
 		return;
 
 	p = &fb_display[vc->vc_num];
+	fbcon_set_rotation(info, p);
+	set_blitting_type(vc, info, p);
 
 	if (CON_IS_VISIBLE(vc)) {
-		fbcon_set_rotation(info);
-		set_blitting_type(vc, info, p);
 		var_to_display(p, &info->var, info);
 		cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres);
 		rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
@@ -2666,7 +2753,8 @@ static void fbcon_set_all_vcs(struct fb_
 			continue;
 
 		p = &fb_display[vc->vc_num];
-
+		fbcon_set_rotation(info, p);
+		set_blitting_type(vc, info, p);
 		var_to_display(p, &info->var, info);
 		cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres);
 		rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
@@ -2675,8 +2763,6 @@ static void fbcon_set_all_vcs(struct fb_
 		vc_resize(vc, cols, rows);
 
 		if (CON_IS_VISIBLE(vc)) {
-			fbcon_set_rotation(info);
-			set_blitting_type(vc, info, p);
 			updatescrollmode(p, info, vc);
 			scrollback_max = 0;
 			scrollback_current = 0;
@@ -2831,6 +2917,14 @@ static int fbcon_event_notify(struct not
 	case FB_EVENT_NEW_MODELIST:
 		fbcon_new_modelist(info);
 		break;
+	case FB_EVENT_SET_CON_ROTATE:
+		fbcon_rotate(info, *(int *)event->data);
+		break;
+	case FB_EVENT_GET_CON_ROTATE:
+		ret = fbcon_get_rotate(info);
+		break;
+	case FB_EVENT_SET_CON_ROTATE_ALL:
+		fbcon_rotate_all(info, *(int *)event->data);
 	}
 
 	return ret;
diff --git a/drivers/video/console/fbcon.h b/drivers/video/console/fbcon.h
index f6a8880..d3f9d23 100644
--- a/drivers/video/console/fbcon.h
+++ b/drivers/video/console/fbcon.h
@@ -27,15 +27,15 @@
     */
 
 struct display {
-    /* Filled in by the frame buffer device */
-    u_short inverse;                /* != 0 text black on white as default */
     /* Filled in by the low-level console driver */
     const u_char *fontdata;
     int userfont;                   /* != 0 if fontdata kmalloc()ed */
     u_short scrollmode;             /* Scroll Method */
+    u_short inverse;                /* != 0 text black on white as default */
     short yscroll;                  /* Hardware scrolling */
     int vrows;                      /* number of virtual rows */
     int cursor_shape;
+    int con_rotate;
     u32 xres_virtual;
     u32 yres_virtual;
     u32 height;
@@ -71,6 +71,7 @@ struct fbcon_ops {
 			     u32 vmode);
 	int  (*rotate_font)(struct fb_info *info, struct vc_data *vc,
 			    struct display *p);
+	struct fb_var_screeninfo var;  /* copy of the current fb_var_screeninfo */
 	struct timer_list cursor_timer; /* Cursor timer */
 	struct fb_cursor cursor_state;
         int    currcon;	                /* Current VC. */
@@ -80,8 +81,10 @@ struct fbcon_ops {
 	int    graphics;
 	int    flags;
 	int    rotate;
+	int    cur_rotate;
 	char  *cursor_data;
 	u8    *fontbuffer;
+	u8    *fontdata;
 	u32    fd_size;
 };
     /*
diff --git a/drivers/video/console/fbcon_ccw.c b/drivers/video/console/fbcon_ccw.c
index 4d6a56e..4ed31e7 100644
--- a/drivers/video/console/fbcon_ccw.c
+++ b/drivers/video/console/fbcon_ccw.c
@@ -382,16 +382,20 @@ int ccw_update_start(struct fb_info *inf
 		     u32 vmode)
 {
 	struct fbcon_ops *ops = info->fbcon_par;
-	struct fb_var_screeninfo var = info->var;
 	struct display *p = &fb_display[ops->currcon];
 	u32 yoffset;
 	u32 vyres = GETVYRES(p->scrollmode, info);
+	int err;
 
 	yoffset = (vyres - info->var.yres) - xoff;
-	var.xoffset = yoff;
-	var.yoffset = yoffset;
-	var.vmode = vmode;
-	return fb_pan_display(info, &var);
+	ops->var.xoffset = yoff;
+	ops->var.yoffset = yoffset;
+	ops->var.vmode = vmode;
+	err = fb_pan_display(info, &ops->var);
+	ops->var.xoffset = info->var.xoffset;
+	ops->var.yoffset = info->var.yoffset;
+	ops->var.vmode = info->var.vmode;
+	return err;
 }
 
 void fbcon_rotate_ccw(struct fbcon_ops *ops)
diff --git a/drivers/video/console/fbcon_cw.c b/drivers/video/console/fbcon_cw.c
index ae98103..0ab0395 100644
--- a/drivers/video/console/fbcon_cw.c
+++ b/drivers/video/console/fbcon_cw.c
@@ -371,16 +371,20 @@ int cw_update_start(struct fb_info *info
 		    u32 vmode)
 {
 	struct fbcon_ops *ops = info->fbcon_par;
-	struct fb_var_screeninfo var = info->var;
 	struct display *p = &fb_display[ops->currcon];
 	u32 xoffset;
 	u32 vxres = GETVXRES(p->scrollmode, info);
+	int err;
 
 	xoffset = (vxres - info->var.xres) - yoff;
-	var.yoffset = xoff;
-	var.xoffset = xoffset;
-	var.vmode = vmode;
-	return fb_pan_display(info, &var);
+	ops->var.yoffset = xoff;
+	ops->var.xoffset = xoffset;
+	ops->var.vmode = vmode;
+	err = fb_pan_display(info, &ops->var);
+	ops->var.xoffset = info->var.xoffset;
+	ops->var.yoffset = info->var.yoffset;
+	ops->var.vmode = info->var.vmode;
+	return err;
 }
 
 void fbcon_rotate_cw(struct fbcon_ops *ops)
diff --git a/drivers/video/console/fbcon_rotate.c b/drivers/video/console/fbcon_rotate.c
index 3b4b362..c186db6 100644
--- a/drivers/video/console/fbcon_rotate.c
+++ b/drivers/video/console/fbcon_rotate.c
@@ -90,12 +90,18 @@ static int fbcon_rotate_font(struct fb_i
 			     struct display *p)
 {
 	struct fbcon_ops *ops = info->fbcon_par;
-	int len;
+	int len, err = 0;
 	int s_cellsize, d_cellsize, i;
-	const u8 *src = vc->vc_font.data;
+	const u8 *src;
 	u8 *dst;
 
-	len = (!p->userfont) ? 256 : FNTCHARCNT(vc->vc_font.data);
+	if (vc->vc_font.data == ops->fontdata &&
+	    p->con_rotate == ops->cur_rotate)
+		goto finished;
+
+	src = ops->fontdata = vc->vc_font.data;
+	ops->cur_rotate = p->con_rotate;
+	len = (!p->userfont) ? 256 : FNTCHARCNT(src);
 	s_cellsize = ((vc->vc_font.width + 7)/8) *
 		vc->vc_font.height;
 	d_cellsize = s_cellsize;
@@ -111,8 +117,10 @@ static int fbcon_rotate_font(struct fb_i
 	if (ops->fd_size < d_cellsize * len) {
 		dst = kmalloc(d_cellsize * len, GFP_KERNEL);
 
-		if (dst == NULL)
-			return -ENOMEM;
+		if (dst == NULL) {
+			err = -ENOMEM;
+			goto finished;
+		}
 
 		ops->fd_size = d_cellsize * len;
 		kfree(ops->fontbuffer);
@@ -150,7 +158,8 @@ static int fbcon_rotate_font(struct fb_i
 		break;
 	}
 
-	return 0;
+finished:
+	return err;
 }
 
 void fbcon_set_rotate(struct fbcon_ops *ops)
diff --git a/drivers/video/console/fbcon_ud.c b/drivers/video/console/fbcon_ud.c
index 28cd2c8..6c71a89 100644
--- a/drivers/video/console/fbcon_ud.c
+++ b/drivers/video/console/fbcon_ud.c
@@ -422,18 +422,22 @@ int ud_update_start(struct fb_info *info
 		    u32 vmode)
 {
 	struct fbcon_ops *ops = info->fbcon_par;
-	struct fb_var_screeninfo var = info->var;
 	struct display *p = &fb_display[ops->currcon];
 	u32 xoffset, yoffset;
 	u32 vyres = GETVYRES(p->scrollmode, info);
 	u32 vxres = GETVXRES(p->scrollmode, info);
+	int err;
 
 	xoffset = (vxres - info->var.xres) - xoff;
 	yoffset = (vyres - info->var.yres) - yoff;
-	var.xoffset = xoffset;
-	var.yoffset = yoffset;
-	var.vmode = vmode;
-	return fb_pan_display(info, &var);
+	ops->var.xoffset = xoffset;
+	ops->var.yoffset = yoffset;
+	ops->var.vmode = vmode;
+	err = fb_pan_display(info, &ops->var);
+	ops->var.xoffset = info->var.xoffset;
+	ops->var.yoffset = info->var.yoffset;
+	ops->var.vmode = info->var.vmode;
+	return err;
 }
 
 void fbcon_rotate_ud(struct fbcon_ops *ops)
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 5a6eef2..c5c422e 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -352,23 +352,23 @@ static void fb_rotate_logo_ccw(const u8 
 }
 
 static void fb_rotate_logo(struct fb_info *info, u8 *dst,
-			   struct fb_image *image)
+			   struct fb_image *image, int rotate)
 {
 	u32 tmp;
 
-	if (info->var.rotate == FB_ROTATE_UD) {
+	if (rotate == FB_ROTATE_UD) {
 		image->dx = info->var.xres - image->width;
 		image->dy = info->var.yres - image->height;
 		fb_rotate_logo_ud(image->data, dst, image->width,
 				  image->height);
-	} else if (info->var.rotate == FB_ROTATE_CW) {
+	} else if (rotate == FB_ROTATE_CW) {
 		tmp = image->width;
 		image->width = image->height;
 		image->height = tmp;
 		image->dx = info->var.xres - image->height;
 		fb_rotate_logo_cw(image->data, dst, image->width,
 				  image->height);
-	} else if (info->var.rotate == FB_ROTATE_CCW) {
+	} else if (rotate == FB_ROTATE_CCW) {
 		tmp = image->width;
 		image->width = image->height;
 		image->height = tmp;
@@ -380,32 +380,33 @@ static void fb_rotate_logo(struct fb_inf
 	image->data = dst;
 }
 
-static void fb_do_show_logo(struct fb_info *info, struct fb_image *image)
+static void fb_do_show_logo(struct fb_info *info, struct fb_image *image,
+			    int rotate)
 {
 	int x;
 
-	if (info->var.rotate == FB_ROTATE_UR) {
+	if (rotate == FB_ROTATE_UR) {
 		for (x = 0; x < num_online_cpus() &&
 			     x * (fb_logo.logo->width + 8) <=
 			     info->var.xres - fb_logo.logo->width; x++) {
 			info->fbops->fb_imageblit(info, image);
 			image->dx += fb_logo.logo->width + 8;
 		}
-	} else if (info->var.rotate == FB_ROTATE_UD) {
+	} else if (rotate == FB_ROTATE_UD) {
 		for (x = 0; x < num_online_cpus() &&
 			     x * (fb_logo.logo->width + 8) <=
 			     info->var.xres - fb_logo.logo->width; x++) {
 			info->fbops->fb_imageblit(info, image);
 			image->dx -= fb_logo.logo->width + 8;
 		}
-	} else if (info->var.rotate == FB_ROTATE_CW) {
+	} else if (rotate == FB_ROTATE_CW) {
 		for (x = 0; x < num_online_cpus() &&
 			     x * (fb_logo.logo->width + 8) <=
 			     info->var.yres - fb_logo.logo->width; x++) {
 			info->fbops->fb_imageblit(info, image);
 			image->dy += fb_logo.logo->width + 8;
 		}
-	} else if (info->var.rotate == FB_ROTATE_CCW) {
+	} else if (rotate == FB_ROTATE_CCW) {
 		for (x = 0; x < num_online_cpus() &&
 			     x * (fb_logo.logo->width + 8) <=
 			     info->var.yres - fb_logo.logo->width; x++) {
@@ -415,9 +416,10 @@ static void fb_do_show_logo(struct fb_in
 	}
 }
 
-int fb_prepare_logo(struct fb_info *info)
+int fb_prepare_logo(struct fb_info *info, int rotate)
 {
 	int depth = fb_get_color_depth(&info->var, &info->fix);
+	int yres;
 
 	memset(&fb_logo, 0, sizeof(struct logo_data));
 
@@ -450,10 +452,16 @@ int fb_prepare_logo(struct fb_info *info
 	/* Return if no suitable logo was found */
 	fb_logo.logo = fb_find_logo(depth);
 	
-	if (!fb_logo.logo || fb_logo.logo->height > info->var.yres) {
+	if (rotate == FB_ROTATE_UR || rotate == FB_ROTATE_UD)
+		yres = info->var.yres;
+	else
+		yres = info->var.xres;
+
+	if (fb_logo.logo && fb_logo.logo->height > yres) {
 		fb_logo.logo = NULL;
 		return 0;
 	}
+
 	/* What depth we asked for might be different from what we get */
 	if (fb_logo.logo->type == LINUX_LOGO_CLUT224)
 		fb_logo.depth = 8;
@@ -464,7 +472,7 @@ int fb_prepare_logo(struct fb_info *info
 	return fb_logo.logo->height;
 }
 
-int fb_show_logo(struct fb_info *info)
+int fb_show_logo(struct fb_info *info, int rotate)
 {
 	u32 *palette = NULL, *saved_pseudo_palette = NULL;
 	unsigned char *logo_new = NULL, *logo_rotate = NULL;
@@ -513,14 +521,14 @@ int fb_show_logo(struct fb_info *info)
 	image.width = fb_logo.logo->width;
 	image.height = fb_logo.logo->height;
 
-	if (info->var.rotate && !(info->flags & FBINFO_HW_ROTATE)) {
+	if (rotate) {
 		logo_rotate = kmalloc(fb_logo.logo->width *
 				      fb_logo.logo->height, GFP_KERNEL);
 		if (logo_rotate)
-			fb_rotate_logo(info, logo_rotate, &image);
+			fb_rotate_logo(info, logo_rotate, &image, rotate);
 	}
 
-	fb_do_show_logo(info, &image);
+	fb_do_show_logo(info, &image, rotate);
 
 	kfree(palette);
 	if (saved_pseudo_palette != NULL)
@@ -530,8 +538,8 @@ int fb_show_logo(struct fb_info *info)
 	return fb_logo.logo->height;
 }
 #else
-int fb_prepare_logo(struct fb_info *info) { return 0; }
-int fb_show_logo(struct fb_info *info) { return 0; }
+int fb_prepare_logo(struct fb_info *info, int rotate) { return 0; }
+int fb_show_logo(struct fb_info *info, int rotate) { return 0; }
 #endif /* CONFIG_LOGO */
 
 static int fbmem_read_proc(char *buf, char **start, off_t offset,
@@ -726,9 +734,9 @@ fb_pan_display(struct fb_info *info, str
 
         if (var->vmode & FB_VMODE_YWRAP)
                 info->var.vmode |= FB_VMODE_YWRAP;
-
         else
                 info->var.vmode &= ~FB_VMODE_YWRAP;
+
         return 0;
 }
 
@@ -1315,6 +1323,28 @@ int fb_new_modelist(struct fb_info *info
 	return err;
 }
 
+/**
+ * fb_con_duit - user<->fbcon passthrough
+ * @info: struct fb_info
+ * @event: notification event to be passed to fbcon
+ * @data: private data
+ *
+ * DESCRIPTION
+ * This function is an fbcon-user event passing channel
+ * which bypasses fbdev.  This is hopefully temporary
+ * until a user interface for fbcon is created
+ */
+int fb_con_duit(struct fb_info *info, int event, void *data)
+{
+	struct fb_event evnt;
+
+	evnt.info = info;
+	evnt.data = data;
+
+	return notifier_call_chain(&fb_notifier_list, event, &evnt);
+}
+EXPORT_SYMBOL(fb_con_duit);
+
 static char *video_options[FB_MAX];
 static int ofonly;
 
diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c
index 369bbc1..be8f195 100644
--- a/drivers/video/fbsysfs.c
+++ b/drivers/video/fbsysfs.c
@@ -238,6 +238,45 @@ static ssize_t show_rotate(struct class_
 	return snprintf(buf, PAGE_SIZE, "%d\n", fb_info->var.rotate);
 }
 
+static ssize_t store_con_rotate(struct class_device *class_device,
+				const char *buf, size_t count)
+{
+        struct fb_info *fb_info = class_get_devdata(class_device);
+	int rotate;
+	char **last = NULL;
+
+	acquire_console_sem();
+	rotate = simple_strtoul(buf, last, 0);
+	fb_con_duit(fb_info, FB_EVENT_SET_CON_ROTATE, &rotate);
+	release_console_sem();
+	return count;
+}
+
+static ssize_t store_con_rotate_all(struct class_device *class_device,
+				const char *buf, size_t count)
+{
+        struct fb_info *fb_info = class_get_devdata(class_device);
+	int rotate;
+	char **last = NULL;
+
+	acquire_console_sem();
+	rotate = simple_strtoul(buf, last, 0);
+	fb_con_duit(fb_info, FB_EVENT_SET_CON_ROTATE_ALL, &rotate);
+	release_console_sem();
+	return count;
+}
+
+static ssize_t show_con_rotate(struct class_device *class_device, char *buf)
+{
+	struct fb_info *fb_info = class_get_devdata(class_device);
+	int rotate;
+
+	acquire_console_sem();
+	rotate = fb_con_duit(fb_info, FB_EVENT_GET_CON_ROTATE, NULL);
+	release_console_sem();
+	return snprintf(buf, PAGE_SIZE, "%d\n", rotate);
+}
+
 static ssize_t store_virtual(struct class_device *class_device,
 			     const char * buf, size_t count)
 {
@@ -458,6 +497,8 @@ static struct class_device_attribute cla
 	__ATTR(virtual_size, S_IRUGO|S_IWUSR, show_virtual, store_virtual),
 	__ATTR(name, S_IRUGO, show_name, NULL),
 	__ATTR(rotate, S_IRUGO|S_IWUSR, show_rotate, store_rotate),
+	__ATTR(con_rotate, S_IRUGO|S_IWUSR, show_con_rotate, store_con_rotate),
+	__ATTR(con_rotate_all, S_IWUSR, NULL, store_con_rotate_all),
 };
 
 int fb_init_class_device(struct fb_info *fb_info)
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 4c0a518..04a58f3 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -497,9 +497,9 @@ struct fb_cursor_user {
 #define FB_EVENT_MODE_DELETE            0x04
 /*      A driver registered itself */
 #define FB_EVENT_FB_REGISTERED          0x05
-/*      get console to framebuffer mapping */
+/*      CONSOLE-SPECIFIC: get console to framebuffer mapping */
 #define FB_EVENT_GET_CONSOLE_MAP        0x06
-/*      set console to framebuffer mapping */
+/*      CONSOLE-SPECIFIC: set console to framebuffer mapping */
 #define FB_EVENT_SET_CONSOLE_MAP        0x07
 /*      A display blank is requested       */
 #define FB_EVENT_BLANK                  0x08
@@ -508,6 +508,12 @@ struct fb_cursor_user {
 /*	The resolution of the passed in fb_info about to change and
         all vc's should be changed         */
 #define FB_EVENT_MODE_CHANGE_ALL	0x0A
+/*      CONSOLE-SPECIFIC: set console rotation */
+#define FB_EVENT_SET_CON_ROTATE         0x0B
+/*      CONSOLE-SPECIFIC: get console rotation */
+#define FB_EVENT_GET_CON_ROTATE         0x0C
+/*      CONSOLE-SPECIFIC: rotate all consoles */
+#define FB_EVENT_SET_CON_ROTATE_ALL     0x0D
 
 struct fb_event {
 	struct fb_info *info;
@@ -719,7 +725,6 @@ struct fb_tile_ops {
 #define FBINFO_MISC_USEREVENT          0x10000 /* event request
 						  from userspace */
 #define FBINFO_MISC_TILEBLITTING       0x20000 /* use tile blitting */
-#define FBINFO_HW_ROTATE               0x40000 /* hardware can rotate display */
 
 struct fb_info {
 	int node;
@@ -826,8 +831,8 @@ extern void cfb_imageblit(struct fb_info
 /* drivers/video/fbmem.c */
 extern int register_framebuffer(struct fb_info *fb_info);
 extern int unregister_framebuffer(struct fb_info *fb_info);
-extern int fb_prepare_logo(struct fb_info *fb_info);
-extern int fb_show_logo(struct fb_info *fb_info);
+extern int fb_prepare_logo(struct fb_info *fb_info, int rotate);
+extern int fb_show_logo(struct fb_info *fb_info, int rotate);
 extern char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size);
 extern void fb_pad_unaligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 idx,
 				u32 height, u32 shift_high, u32 shift_low, u32 mod);
@@ -837,6 +842,7 @@ extern int fb_get_color_depth(struct fb_
 			      struct fb_fix_screeninfo *fix);
 extern int fb_get_options(char *name, char **option);
 extern int fb_new_modelist(struct fb_info *info);
+extern int fb_con_duit(struct fb_info *info, int event, void *data);
 
 extern struct fb_info *registered_fb[FB_MAX];
 extern int num_registered_fb;
