From: Andrew Zhou <zhoulol888@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: maarten.lankhorst@linux.intel.com, mripard@kernel.org,
tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch,
linux-kernel@vger.kernel.org, Andrew Zhou <zhoulol888@gmail.com>
Subject: [PATCH] drm: make panel orientation quirks optional
Date: Thu, 16 Jul 2026 14:51:06 +0800 [thread overview]
Message-ID: <20260716065106.150760-1-zhoulol888@gmail.com> (raw)
DRM currently selects DRM_PANEL_ORIENTATION_QUIRKS unconditionally,
forcing all DRM users to compile embedded LCD panel quirk detection.
This is unnecessary on desktop and server systems with external
monitors.
Add a static inline stub in drm_utils.h that returns
DRM_MODE_PANEL_ORIENTATION_UNKNOWN when the option is disabled,
and make the Kconfig option user-visible with a description.
Compile-tested with CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y and =n.
Boot-tested in QEMU with TinyCorePure64.
Signed-off-by: Andrew Zhou <zhoulol888@gmail.com>
---
drivers/gpu/drm/Kconfig | 14 ++++++++++++--
drivers/gpu/drm/drm_panel_orientation_quirks.c | 6 ++++--
include/drm/drm_utils.h | 8 ++++++++
3 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 323422861e8f..da4ac94bbf61 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -8,7 +8,6 @@
menuconfig DRM
tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)"
depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && HAS_DMA
- select DRM_PANEL_ORIENTATION_QUIRKS
select HDMI
select I2C
select DMA_SHARED_BUFFER
@@ -369,4 +368,15 @@ endif
# Separate option because drm_panel_orientation_quirks.c is shared with fbdev
config DRM_PANEL_ORIENTATION_QUIRKS
- tristate
+ tristate "Panel orientation quirks for DMI-based detection"
+ depends on DRM
+ help
+ Enable DMI-based quirk detection for devices where the
+ built-in LCD panel is mounted in a non-standard orientation
+ relative to the casing (e.g., handheld PCs, tablets).
+
+ This allows userspace to automatically rotate the display
+ to match the physical orientation of the device.
+
+ Desktop and server systems with external monitors do not
+ need this. If unsure, say N.
diff --git a/drivers/gpu/drm/drm_panel_orientation_quirks.c b/drivers/gpu/drm/drm_panel_orientation_quirks.c
index 3a218fb592ce..fb09078a831a 100644
--- a/drivers/gpu/drm/drm_panel_orientation_quirks.c
+++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c
@@ -14,7 +14,7 @@
#include <drm/drm_connector.h>
#include <drm/drm_utils.h>
-#ifdef CONFIG_DMI
+#if defined(CONFIG_DMI) && defined(CONFIG_DRM_PANEL_ORIENTATION_QUIRKS)
/*
* Some x86 clamshell design devices use portrait tablet screens and a display
@@ -589,7 +589,7 @@ EXPORT_SYMBOL(drm_get_panel_orientation_quirk);
#else
-/* There are no quirks for non x86 devices yet */
+/* Fallback stub when DMI or the entire quirk module is disabled. */
int drm_get_panel_orientation_quirk(int width, int height)
{
return DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
@@ -598,5 +598,7 @@ EXPORT_SYMBOL(drm_get_panel_orientation_quirk);
#endif
+#ifdef CONFIG_DRM_PANEL_ORIENTATION_QUIRKS
MODULE_DESCRIPTION("Quirks for non-normal panel orientation");
MODULE_LICENSE("Dual MIT/GPL");
+#endif
diff --git a/include/drm/drm_utils.h b/include/drm/drm_utils.h
index 6a46f755daba..947b8e71260e 100644
--- a/include/drm/drm_utils.h
+++ b/include/drm/drm_utils.h
@@ -11,10 +11,18 @@
#define __DRM_UTILS_H__
#include <linux/types.h>
+#include <drm/drm_connector.h>
struct drm_edid;
+#ifdef CONFIG_DRM_PANEL_ORIENTATION_QUIRKS
int drm_get_panel_orientation_quirk(int width, int height);
+#else
+static inline int drm_get_panel_orientation_quirk(int width, int height)
+{
+ return DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
+}
+#endif
struct drm_panel_backlight_quirk {
u16 min_brightness;
--
2.54.0
next reply other threads:[~2026-07-16 6:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-16 6:51 Andrew Zhou [this message]
2026-07-16 6:59 ` Thomas Zimmermann
2026-08-15 4:13 ` kernel test robot
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=20260716065106.150760-1-zhoulol888@gmail.com \
--to=zhoulol888@gmail.com \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/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
all inboxes | Powered by JetHome®