diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index 929ca472c524..30014e5867db 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -964,10 +964,13 @@ static const char *fbcon_startup(void) ops->cur_blink_jiffies = HZ / 5; ops->info = info; info->fbcon_par = ops; - if (initial_rotation != -1) - p->con_rotate = initial_rotation; - else + + p->con_rotate = initial_rotation; + if (p->con_rotate == -1) + p->con_rotate = info->fbcon_rotate_hint; + if (p->con_rotate == -1) p->con_rotate = fbcon_platform_get_rotate(info); + set_blitting_type(vc, info); if (info->fix.type != FB_TYPE_TEXT) { @@ -1104,10 +1107,13 @@ static void fbcon_init(struct vc_data *vc, int init) ops = info->fbcon_par; ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms); - if (initial_rotation != -1) - p->con_rotate = initial_rotation; - else + + p->con_rotate = initial_rotation; + if (p->con_rotate == -1) + p->con_rotate = info->fbcon_rotate_hint; + if (p->con_rotate == -1) p->con_rotate = fbcon_platform_get_rotate(info); + set_blitting_type(vc, info); cols = vc->vc_cols; diff --git a/drivers/video/fbdev/core/fbsysfs.c b/drivers/video/fbdev/core/fbsysfs.c index 15755ce1d26c..e31a182b42bf 100644 --- a/drivers/video/fbdev/core/fbsysfs.c +++ b/drivers/video/fbdev/core/fbsysfs.c @@ -58,6 +58,7 @@ struct fb_info *framebuffer_alloc(size_t size, struct device *dev) info->par = p + fb_info_size; info->device = dev; + info->fbcon_rotate_hint = -1; #ifdef CONFIG_FB_BACKLIGHT mutex_init(&info->bl_curve_mutex); diff --git a/include/linux/fb.h b/include/linux/fb.h index bc24e48e396d..d1e5bed39140 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -465,6 +465,11 @@ struct fb_info { atomic_t count; int node; int flags; + /* + * -1 by default, set to a FB_ROTATE_* value by the driver, if it knows + * a lcd is not mounted upright and fbcon should rotate to compensate. + */ + int fbcon_rotate_hint; struct mutex lock; /* Lock for open/release/ioctl funcs */ struct mutex mm_lock; /* Lock for fb_mmap and smem_* fields */ struct fb_var_screeninfo var; /* Current var */