]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
fbcon: Add fbcon_rotate_hint to struct fb_info
authorHans de Goede <j.w.r.degoede@gmail.com>
Sat, 25 Nov 2017 19:35:47 +0000 (20:35 +0100)
committerHans de Goede <hdegoede@redhat.com>
Mon, 4 Dec 2017 22:03:21 +0000 (23:03 +0100)
On some hardware the LCD panel is not mounted upright in the casing,
but upside-down or rotated 90 degrees. In this case we want the console
to automatically be rotated to compensate.

The fbdev-driver may know about the need to rotate. Add a new
fbcon_rotate_hint field to struct fb_info, which gets initialized to -1.
If the fbdev-driver knows that some sort of rotation is necessary then
it can set this field to a FB_ROTATE_* value to tell the fbcon console
driver to rotate the console.

Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171125193553.23986-2-hdegoede@redhat.com
drivers/video/fbdev/core/fbcon.c
drivers/video/fbdev/core/fbsysfs.c
include/linux/fb.h

index 929ca472c5242ef50bd9653cffe315d72daac2aa..30014e5867dbc850bbda40914a1f43c8f50519ce 100644 (file)
@@ -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;
index 15755ce1d26c817587f7f600db41963c46e16c7e..e31a182b42bf206ed9c1f682072e1e3e003dc8e1 100644 (file)
@@ -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);
index bc24e48e396d0b6153c95d347878e43fa28be21e..d1e5bed39140e60ef81632e9357d57f4839ac877 100644 (file)
@@ -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 */