From: Hans de Goede <j.w.r.degoede@gmail.com>
To: Daniel Vetter <daniel.vetter@intel.com>,
Jani Nikula <jani.nikula@linux.intel.com>,
Sean Paul <seanpaul@chromium.org>,
David Airlie <airlied@linux.ie>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: linux-fbdev@vger.kernel.org,
intel-gfx <intel-gfx@lists.freedesktop.org>,
dri-devel@lists.freedesktop.org,
Daniel Drake <drake@endlessm.com>,
Hans de Goede <hdegoede@redhat.com>,
Carlo Caione <carlo@endlessm.com>,
Bastien Nocera <hadess@hadess.net>,
Robert McQueen <robert@endlessm.com>
Subject: [PATCH v5 6/7] efifb: Set info->fbcon_rotate_hint based on drm_get_panel_orientation_quirk
Date: Sat, 04 Nov 2017 14:08:27 +0000 [thread overview]
Message-ID: <20171104140828.32469-7-hdegoede@redhat.com> (raw)
In-Reply-To: <20171104140828.32469-1-hdegoede@redhat.com>
On some hardware the LCD panel is not mounted upright in the casing,
but rotated by 90 degrees. In this case we want the console to
automatically be rotated to compensate.
The drm subsys has a quirk table for this, use the
drm_get_panel_orientation_quirk function to get the panel orientation
and set info->fbcon_rotate_hint based on this, so that the fbcon console
on top of efifb gets automatically rotated to compensate for the panel
orientation.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/video/fbdev/Kconfig | 1 +
drivers/video/fbdev/efifb.c | 21 ++++++++++++++++++++-
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index 5e58f5ec0a28..c4a90c497839 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -772,6 +772,7 @@ config FB_VESA
config FB_EFI
bool "EFI-based Framebuffer Support"
depends on (FB = y) && !IA64 && EFI
+ select DRM_PANEL_ORIENTATION_QUIRKS
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
select FB_CFB_IMAGEBLIT
diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c
index 3a010641f630..8c7f6aeee205 100644
--- a/drivers/video/fbdev/efifb.c
+++ b/drivers/video/fbdev/efifb.c
@@ -15,6 +15,8 @@
#include <linux/screen_info.h>
#include <video/vga.h>
#include <asm/efi.h>
+#include <drm/drm_utils.h> /* For drm_get_panel_orientation_quirk */
+#include <drm/drm_mode.h> /* For DRM_MODE_PANEL_ORIENTATION_* */
static bool request_mem_succeeded = false;
static bool nowc = false;
@@ -156,7 +158,7 @@ static u64 bar_offset;
static int efifb_probe(struct platform_device *dev)
{
struct fb_info *info;
- int err;
+ int err, orientation;
unsigned int size_vmode;
unsigned int size_remap;
unsigned int size_total;
@@ -328,6 +330,23 @@ static int efifb_probe(struct platform_device *dev)
info->fix = efifb_fix;
info->flags = FBINFO_FLAG_DEFAULT | FBINFO_MISC_FIRMWARE;
+ orientation = drm_get_panel_orientation_quirk(efifb_defined.xres,
+ efifb_defined.yres);
+ switch (orientation) {
+ default:
+ info->fbcon_rotate_hint = FB_ROTATE_UR;
+ break;
+ case DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP:
+ info->fbcon_rotate_hint = FB_ROTATE_UD;
+ break;
+ case DRM_MODE_PANEL_ORIENTATION_LEFT_UP:
+ info->fbcon_rotate_hint = FB_ROTATE_CCW;
+ break;
+ case DRM_MODE_PANEL_ORIENTATION_RIGHT_UP:
+ info->fbcon_rotate_hint = FB_ROTATE_CW;
+ break;
+ }
+
err = sysfs_create_groups(&dev->dev.kobj, efifb_groups);
if (err) {
pr_err("efifb: cannot add sysfs attrs\n");
--
2.14.3
next prev parent reply other threads:[~2017-11-04 14:08 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-04 14:08 [PATCH v5 0/7] drm/fbdev: Panel orientation connector property support Hans de Goede
2017-11-04 14:08 ` [PATCH v5 1/7] fbcon: Add fbcon_rotate_hint to struct fb_info Hans de Goede
2017-11-04 14:08 ` [PATCH v5 2/7] drm: Add panel orientation quirks Hans de Goede
2017-11-06 9:12 ` [Intel-gfx] " Daniel Vetter
2017-11-04 14:08 ` [PATCH v5 3/7] drm: Add support for a panel-orientation connector property Hans de Goede
2017-11-06 9:17 ` [Intel-gfx] " Daniel Vetter
2017-11-04 14:08 ` [PATCH v5 4/7] drm/fb-helper: Apply panel orientation connector prop to the primary plane Hans de Goede
2017-11-06 9:20 ` [Intel-gfx] [PATCH v5 4/7] drm/fb-helper: Apply panel orientation connector prop to the primary Daniel Vetter
2017-11-04 14:08 ` [PATCH v5 5/7] drm/i915: Add "panel orientation" property to the panel connector Hans de Goede
2017-11-06 10:17 ` [Intel-gfx] " Daniel Vetter
2017-11-25 15:10 ` Hans de Goede
2017-11-04 14:08 ` Hans de Goede [this message]
2017-11-04 14:08 ` [PATCH v5 7/7] fbcon: Remove dmi quirk table Hans de Goede
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171104140828.32469-7-hdegoede@redhat.com \
--to=j.w.r.degoede@gmail.com \
--cc=airlied@linux.ie \
--cc=b.zolnierkie@samsung.com \
--cc=carlo@endlessm.com \
--cc=daniel.vetter@intel.com \
--cc=drake@endlessm.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=hadess@hadess.net \
--cc=hdegoede@redhat.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=linux-fbdev@vger.kernel.org \
--cc=robert@endlessm.com \
--cc=seanpaul@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).