From: Thomas Zimmermann <tzimmermann@suse.de>
To: tzungbi@kernel.org, briannorris@chromium.org,
jwerner@chromium.org, javierm@redhat.com, samuel@sholland.org,
maarten.lankhorst@linux.intel.com, mripard@kernel.org,
airlied@gmail.com, simona@ffwll.ch
Cc: chrome-platform@lists.linux.dev, dri-devel@lists.freedesktop.org,
Thomas Zimmermann <tzimmermann@suse.de>
Subject: [PATCH v4 12/12] drm/sysfb: corebootdrm: Support panel orientation
Date: Tue, 17 Feb 2026 16:56:22 +0100 [thread overview]
Message-ID: <20260217155836.96267-13-tzimmermann@suse.de> (raw)
In-Reply-To: <20260217155836.96267-1-tzimmermann@suse.de>
Add fields and constants for coreboot framebuffer orientation. Set
corebootdrm's DRM connector state from the values. Not all firmware
provides orientation, so make it optional. Systems without, continue
to use unknown orientation.
v3:
- comment on _HAS_ORIENTATION semantics (Tzung-Bi)
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Acked-by: Julius Werner <jwerner@chromium.org>
Acked-by: Tzung-Bi Shih <tzungbi@kernel.org> # coreboot
---
drivers/gpu/drm/sysfb/corebootdrm.c | 30 +++++++++++++++++++++++++----
include/linux/coreboot.h | 13 +++++++++++++
2 files changed, 39 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/sysfb/corebootdrm.c b/drivers/gpu/drm/sysfb/corebootdrm.c
index 745318580a5d..5dc6f3c76f7b 100644
--- a/drivers/gpu/drm/sysfb/corebootdrm.c
+++ b/drivers/gpu/drm/sysfb/corebootdrm.c
@@ -110,6 +110,26 @@ static phys_addr_t corebootdrm_get_address_fb(struct drm_device *dev, resource_s
return fb->physical_address;
}
+static enum drm_panel_orientation corebootdrm_get_orientation_fb(struct drm_device *dev,
+ const struct lb_framebuffer *fb)
+{
+ if (!LB_FRAMEBUFFER_HAS_ORIENTATION(fb))
+ return DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
+
+ switch (fb->orientation) {
+ case LB_FRAMEBUFFER_ORIENTATION_NORMAL:
+ return DRM_MODE_PANEL_ORIENTATION_NORMAL;
+ case LB_FRAMEBUFFER_ORIENTATION_BOTTOM_UP:
+ return DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP;
+ case LB_FRAMEBUFFER_ORIENTATION_LEFT_UP:
+ return DRM_MODE_PANEL_ORIENTATION_LEFT_UP;
+ case LB_FRAMEBUFFER_ORIENTATION_RIGHT_UP:
+ return DRM_MODE_PANEL_ORIENTATION_RIGHT_UP;
+ }
+
+ return DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
+}
+
/*
* Simple Framebuffer device
*/
@@ -168,7 +188,8 @@ static const struct drm_mode_config_funcs corebootdrm_mode_config_funcs = {
DRM_SYSFB_MODE_CONFIG_FUNCS,
};
-static int corebootdrm_mode_config_init(struct corebootdrm_device *cdev)
+static int corebootdrm_mode_config_init(struct corebootdrm_device *cdev,
+ enum drm_panel_orientation orientation)
{
struct drm_sysfb_device *sysfb = &cdev->sysfb;
struct drm_device *dev = &sysfb->dev;
@@ -234,8 +255,7 @@ static int corebootdrm_mode_config_init(struct corebootdrm_device *cdev)
if (ret)
return ret;
drm_connector_helper_add(connector, &corebootdrm_connector_helper_funcs);
- drm_connector_set_panel_orientation_with_quirk(connector,
- DRM_MODE_PANEL_ORIENTATION_UNKNOWN,
+ drm_connector_set_panel_orientation_with_quirk(connector, orientation,
width, height);
ret = drm_connector_attach_encoder(connector, encoder);
@@ -276,6 +296,7 @@ static int corebootdrm_probe(struct platform_device *pdev)
int width, height, pitch;
resource_size_t size;
phys_addr_t address;
+ enum drm_panel_orientation orientation;
struct resource *res, *mem = NULL;
struct resource aperture;
void __iomem *screen_base;
@@ -320,6 +341,7 @@ static int corebootdrm_probe(struct platform_device *pdev)
address = corebootdrm_get_address_fb(dev, size, fb);
if (!address)
return -EINVAL;
+ orientation = corebootdrm_get_orientation_fb(dev, fb);
sysfb->fb_mode = drm_sysfb_mode(width, height, 0, 0);
sysfb->fb_format = format;
@@ -375,7 +397,7 @@ static int corebootdrm_probe(struct platform_device *pdev)
* DRM mode setting and registration
*/
- ret = corebootdrm_mode_config_init(cdev);
+ ret = corebootdrm_mode_config_init(cdev, orientation);
if (ret)
return ret;
diff --git a/include/linux/coreboot.h b/include/linux/coreboot.h
index 885da106fee3..5d40ca7a1d89 100644
--- a/include/linux/coreboot.h
+++ b/include/linux/coreboot.h
@@ -47,6 +47,11 @@ struct lb_cbmem_entry {
u32 id;
};
+#define LB_FRAMEBUFFER_ORIENTATION_NORMAL 0
+#define LB_FRAMEBUFFER_ORIENTATION_BOTTOM_UP 1
+#define LB_FRAMEBUFFER_ORIENTATION_LEFT_UP 2
+#define LB_FRAMEBUFFER_ORIENTATION_RIGHT_UP 3
+
/* Describes framebuffer setup by coreboot */
struct lb_framebuffer {
u32 tag;
@@ -65,6 +70,7 @@ struct lb_framebuffer {
u8 blue_mask_size;
u8 reserved_mask_pos;
u8 reserved_mask_size;
+ u8 orientation;
};
/*
@@ -74,4 +80,11 @@ struct lb_framebuffer {
#define LB_FRAMEBUFFER_HAS_LFB(__fb) \
((__fb)->size >= offsetofend(struct lb_framebuffer, reserved_mask_size))
+/*
+ * True if the coreboot-provided data is large enough to hold information
+ * on the display orientation. False otherwise.
+ */
+#define LB_FRAMEBUFFER_HAS_ORIENTATION(__fb) \
+ ((__fb)->size >= offsetofend(struct lb_framebuffer, orientation))
+
#endif /* _LINUX_COREBOOT_H */
--
2.52.0
prev parent reply other threads:[~2026-02-17 15:59 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-17 15:56 [PATCH v4 00/12] drm, coreboot: Add DRM coreboot driver Thomas Zimmermann
2026-02-17 15:56 ` [PATCH v4 01/12] firmware: google: framebuffer: Do not unregister platform device Thomas Zimmermann
2026-02-17 15:56 ` [PATCH v4 02/12] firmware: google: framebuffer: Do not mark framebuffer as busy Thomas Zimmermann
2026-02-17 15:56 ` [PATCH v4 03/12] firmware: google: framebuffer: Init memory resource with helper macro Thomas Zimmermann
2026-02-17 15:56 ` [PATCH v4 04/12] firmware: google: framebuffer: Tie platform device to PCI hardware Thomas Zimmermann
2026-02-17 15:56 ` [PATCH v4 05/12] firmware: google: framebuffer: Fix dependencies Thomas Zimmermann
2026-02-17 15:56 ` [PATCH v4 06/12] firmware: google: Init coreboot bus with subsys_initcall() Thomas Zimmermann
2026-02-17 15:56 ` [PATCH v4 07/12] firmware: google: Clean up include statements in coreboot_table.h Thomas Zimmermann
2026-02-17 15:56 ` [PATCH v4 08/12] firmware: google: Export coreboot table entries Thomas Zimmermann
2026-02-17 15:56 ` [PATCH v4 09/12] firmware: google: Pack structures for " Thomas Zimmermann
2026-02-17 15:56 ` [PATCH v4 10/12] drm/sysfb: Generalize pixel-format matching Thomas Zimmermann
2026-02-17 15:56 ` [PATCH v4 11/12] drm/sysfb: corebootdrm: Add DRM driver for coreboot framebuffers Thomas Zimmermann
2026-02-17 15:56 ` Thomas Zimmermann [this message]
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=20260217155836.96267-13-tzimmermann@suse.de \
--to=tzimmermann@suse.de \
--cc=airlied@gmail.com \
--cc=briannorris@chromium.org \
--cc=chrome-platform@lists.linux.dev \
--cc=dri-devel@lists.freedesktop.org \
--cc=javierm@redhat.com \
--cc=jwerner@chromium.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=samuel@sholland.org \
--cc=simona@ffwll.ch \
--cc=tzungbi@kernel.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