From patchwork Sat Nov 4 14:08:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 10041591 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B73A760384 for ; Sat, 4 Nov 2017 14:08:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A846729438 for ; Sat, 4 Nov 2017 14:08:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9BBAA294B0; Sat, 4 Nov 2017 14:08:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2DBB329438 for ; Sat, 4 Nov 2017 14:08:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756662AbdKDOIi (ORCPT ); Sat, 4 Nov 2017 10:08:38 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:55281 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752232AbdKDOIh (ORCPT ); Sat, 4 Nov 2017 10:08:37 -0400 Received: by mail-wr0-f195.google.com with SMTP id o44so4746696wrf.11 for ; Sat, 04 Nov 2017 07:08:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=M5hdzbQjuCcNQUfYM4t7wiwAsfqhGt1QWQAlaOfvcFU=; b=ACByq8KztbYjLKkC8LDXfmzFcNzz6V6mBIN/w91CjH0Pwtb7sy3qpuQI6PJR7HoNNJ Z1J23J+Kir9lnckQWzjoHNGYOkiAZCZOcIKAQ56cvomKGp3KxvGJpm8fjLhtGXy41dDU J//AiI0YTYE0OMez29qfI1Hnd60DGWTlwJKq7jllaHI91SXgQ0qrFO/fCN/NNoWF3C9D 5xvfMjUB8Kc8CWw36I4CP9bvKaHGH92vOY/3ptHSVHQlSpV43xodnQo/9GTT2SYLX3Ri 9O3pZXnS+romzZ699HbrABAXmvRIWLPdaRVKFh9KECU0n4X+uwp49EQ5cZBR6jvAnyPT fTPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=M5hdzbQjuCcNQUfYM4t7wiwAsfqhGt1QWQAlaOfvcFU=; b=O9Uo1C+dGMR4dnhIEYe/ZNEO2drlf/sz7kH9M9P+9RF46SzDaDC9+GWDXzzzMqG4vJ mvvTmpnmOzMPsFFHM6rBjERogacmUELI7kNPxmhK2dBdrURaKIWrx3AOYFPybDOW7IhM yvxdcyY0Q3n0bSELol7Ql97UtNwkpXIbid/A76tRm3UbboHAzukBkETMnUl9wZWDuofe Hhi3sCLPqWbqS01oS+L0JAno9RAFFPHfphFhM92ZpLsBuGTbVJr9WzfHB5lWOkD+RG2V IslN4JVH0WKiG9t6/TzFLqqykQmCBBHn8tGcqEwLyFSsuVWuj9cQAlbs9ynv57yppKhn tPMw== X-Gm-Message-State: AMCzsaUNEuqX2KmjSeuKaAg5q9V1vjox8jtoiPkn8nm57Lo7CL2r1M1E GQq14Z0NG7MRaWSAvDm1MLw= X-Google-Smtp-Source: ABhQp+ShwwKCo0BpHQ9bV8uflJJt6BPoPMz9R7LNs/bG977xEMwJh4nBaD33W1GYZ+UasJ8TR27UhQ== X-Received: by 10.223.158.74 with SMTP id v10mr8881818wre.201.1509804516645; Sat, 04 Nov 2017 07:08:36 -0700 (PDT) Received: from shalem.localdomain.com (546A5441.cm-12-3b.dynamic.ziggo.nl. [84.106.84.65]) by smtp.gmail.com with ESMTPSA id p128sm4672674wmb.1.2017.11.04.07.08.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 04 Nov 2017 07:08:35 -0700 (PDT) From: Hans de Goede X-Google-Original-From: Hans de Goede To: Daniel Vetter , Jani Nikula , Sean Paul , David Airlie , Bartlomiej Zolnierkiewicz Cc: Hans de Goede , Bastien Nocera , Daniel Drake , Carlo Caione , Robert McQueen , intel-gfx , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org Subject: [PATCH v5 1/7] fbcon: Add fbcon_rotate_hint to struct fb_info Date: Sat, 4 Nov 2017 15:08:22 +0100 Message-Id: <20171104140828.32469-2-hdegoede@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171104140828.32469-1-hdegoede@redhat.com> References: <20171104140828.32469-1-hdegoede@redhat.com> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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. Signed-off-by: Hans de Goede --- drivers/video/fbdev/core/fbcon.c | 18 ++++++++++++------ drivers/video/fbdev/core/fbsysfs.c | 1 + include/linux/fb.h | 5 +++++ 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index 04612f938bab..fb317ed76b45 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -963,10 +963,13 @@ static const char *fbcon_startup(void) ops->cur_rotate = -1; ops->cur_blink_jiffies = HZ / 5; 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) { @@ -1103,10 +1106,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 f4386b0ccf40..10cf71cc5d13 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -464,6 +464,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 */