dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/7] drm/sysfb: simpledrm: Various improvements
@ 2026-06-25  9:39 Thomas Zimmermann
  2026-06-25  9:39 ` [PATCH v3 1/7] drm/sysfb: simpledrm: Improve framebuffer-size validation Thomas Zimmermann
                   ` (8 more replies)
  0 siblings, 9 replies; 18+ messages in thread
From: Thomas Zimmermann @ 2026-06-25  9:39 UTC (permalink / raw)
  To: javierm, treding, maarten.lankhorst, mripard, airlied, simona,
	neil.armstrong, jesszhan0024, rayyan
  Cc: dri-devel, sashiko-reviews, Thomas Zimmermann

Patches 1 to 5 improve validation of the values provided by the
device firmware.

Patches 6 and 7 improve support for panel orientation. There's a rotation
property in the DT panel node. Read the value and set the connector's
orientation property accordingly. To do so, patch 6 moves the existing
code for parsing the rotation to drm_of.c. This makes it available to
simpledrm without introducing a dependency on DRM_PANEL.

v3:
- use shared helper for parsing the panel orentation (Thierry)
- fix framebuffer size checks (Sashiko)
- minor improvements
v2:
- further improve input validation (Sashiko)

Thomas Zimmermann (7):
  drm/sysfb: simpledrm: Improve framebuffer-size validation
  drm/sysfb: simpledrm: Improve panel-size validation
  drm/sysfb: simpledrm: Inline simplefb_get_validated_int()
  drm/sysfb: simpledrm: Improve stride validation
  drm/sysfb: simpledrm: Validate mmap size against framebuffer size
  drm/of: Implement drm_of_get_panel_orientation()
  drm/sysfb: simpledrm: Read panel orientation from DT node

 drivers/gpu/drm/drm_of.c          |  44 +++++++++++
 drivers/gpu/drm/drm_panel.c       |  26 +------
 drivers/gpu/drm/sysfb/simpledrm.c | 120 +++++++++++++++++++++++-------
 include/drm/drm_of.h              |  11 +++
 4 files changed, 150 insertions(+), 51 deletions(-)


base-commit: fc59f76558703febba8056be87d1c97d14f7485e
-- 
2.54.0


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v3 1/7] drm/sysfb: simpledrm: Improve framebuffer-size validation
  2026-06-25  9:39 [PATCH v3 0/7] drm/sysfb: simpledrm: Various improvements Thomas Zimmermann
@ 2026-06-25  9:39 ` Thomas Zimmermann
  2026-06-25 10:05   ` sashiko-bot
  2026-06-25  9:39 ` [PATCH v3 2/7] drm/sysfb: simpledrm: Improve panel-size validation Thomas Zimmermann
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 18+ messages in thread
From: Thomas Zimmermann @ 2026-06-25  9:39 UTC (permalink / raw)
  To: javierm, treding, maarten.lankhorst, mripard, airlied, simona,
	neil.armstrong, jesszhan0024, rayyan
  Cc: dri-devel, sashiko-reviews, Thomas Zimmermann, stable

Validate the framebuffer size from the firmware against the
limitations of struct drm_display_mode. The type only stores sizes
in 16-bit fields. Fail probing on errors.

v2:
- remove unused function simplefb_get_validated_int0() (Sashiko)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Fixes: 11e8f5fd223b ("drm: Add simpledrm driver")
Cc: <stable@vger.kernel.org> # v5.14+
---
 drivers/gpu/drm/sysfb/simpledrm.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/sysfb/simpledrm.c b/drivers/gpu/drm/sysfb/simpledrm.c
index fc168920f2c6..15dcafa9d524 100644
--- a/drivers/gpu/drm/sysfb/simpledrm.c
+++ b/drivers/gpu/drm/sysfb/simpledrm.c
@@ -48,13 +48,6 @@ simplefb_get_validated_int(struct drm_device *dev, const char *name,
 	return drm_sysfb_get_validated_int(dev, name, value, INT_MAX);
 }
 
-static int
-simplefb_get_validated_int0(struct drm_device *dev, const char *name,
-			    uint32_t value)
-{
-	return drm_sysfb_get_validated_int0(dev, name, value, INT_MAX);
-}
-
 static const struct drm_format_info *
 simplefb_get_validated_format(struct drm_device *dev, const char *format_name)
 {
@@ -88,14 +81,14 @@ static int
 simplefb_get_width_pd(struct drm_device *dev,
 		      const struct simplefb_platform_data *pd)
 {
-	return simplefb_get_validated_int0(dev, "width", pd->width);
+	return drm_sysfb_get_validated_int0(dev, "width", pd->width, U16_MAX);
 }
 
 static int
 simplefb_get_height_pd(struct drm_device *dev,
 		       const struct simplefb_platform_data *pd)
 {
-	return simplefb_get_validated_int0(dev, "height", pd->height);
+	return drm_sysfb_get_validated_int0(dev, "height", pd->height, U16_MAX);
 }
 
 static int
@@ -144,7 +137,7 @@ simplefb_get_width_of(struct drm_device *dev, struct device_node *of_node)
 
 	if (ret)
 		return ret;
-	return simplefb_get_validated_int0(dev, "width", width);
+	return drm_sysfb_get_validated_int0(dev, "width", width, U16_MAX);
 }
 
 static int
@@ -155,7 +148,7 @@ simplefb_get_height_of(struct drm_device *dev, struct device_node *of_node)
 
 	if (ret)
 		return ret;
-	return simplefb_get_validated_int0(dev, "height", height);
+	return drm_sysfb_get_validated_int0(dev, "height", height, U16_MAX);
 }
 
 static int
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 2/7] drm/sysfb: simpledrm: Improve panel-size validation
  2026-06-25  9:39 [PATCH v3 0/7] drm/sysfb: simpledrm: Various improvements Thomas Zimmermann
  2026-06-25  9:39 ` [PATCH v3 1/7] drm/sysfb: simpledrm: Improve framebuffer-size validation Thomas Zimmermann
@ 2026-06-25  9:39 ` Thomas Zimmermann
  2026-06-25  9:39 ` [PATCH v3 3/7] drm/sysfb: simpledrm: Inline simplefb_get_validated_int() Thomas Zimmermann
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 18+ messages in thread
From: Thomas Zimmermann @ 2026-06-25  9:39 UTC (permalink / raw)
  To: javierm, treding, maarten.lankhorst, mripard, airlied, simona,
	neil.armstrong, jesszhan0024, rayyan
  Cc: dri-devel, sashiko-reviews, Thomas Zimmermann, stable

Validate the panel size from the device-tree node against the
limitations of struct drm_display_mode. The type only stores sizes
in 16-bit fields. Fail transparently on errors; do not warn.

v3:
- move comments to a more prominent place (Thierry)
v2:
- only use initialized values in debugging output (Sashiko)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Fixes: 2a6d731a8f16 ("drm/simpledrm: Allow physical width and height configuration via panel node")
Cc: Rayyan Ansari <rayyan@ansari.sh>
Cc: <stable@vger.kernel.org> # v6.4+
---
 drivers/gpu/drm/sysfb/simpledrm.c | 49 +++++++++++++++++++++++++++++--
 1 file changed, 46 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/sysfb/simpledrm.c b/drivers/gpu/drm/sysfb/simpledrm.c
index 15dcafa9d524..6bbe779ec870 100644
--- a/drivers/gpu/drm/sysfb/simpledrm.c
+++ b/drivers/gpu/drm/sysfb/simpledrm.c
@@ -193,6 +193,39 @@ simplefb_get_memory_of(struct drm_device *dev, struct device_node *of_node)
 	return res;
 }
 
+static int __simplefb_get_panel_size_mm_of(struct drm_device *dev,
+					   struct device_node *of_panel_node,
+					   const char *name)
+{
+	int ret;
+	u32 value;
+
+	ret = of_property_read_u32(of_panel_node, name, &value);
+	if (ret) {
+		drm_dbg(dev, "simplefb: cannot parse panel %s: error %d\n",
+			name, ret);
+		return ret;
+	} else if (value > U16_MAX) {
+		drm_dbg(dev, "simplefb: panel %s of %u exceeds maximum value\n",
+			name, value);
+		return -EINVAL;
+	}
+
+	return value;
+}
+
+static int simplefb_get_panel_width_mm_of(struct drm_device *dev,
+					  struct device_node *of_panel_node)
+{
+	return __simplefb_get_panel_size_mm_of(dev, of_panel_node, "width-mm");
+}
+
+static int simplefb_get_panel_height_mm_of(struct drm_device *dev,
+					   struct device_node *of_panel_node)
+{
+	return __simplefb_get_panel_size_mm_of(dev, of_panel_node, "height-mm");
+}
+
 /*
  * Simple Framebuffer device
  */
@@ -594,7 +627,7 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
 	struct drm_sysfb_device *sysfb;
 	struct drm_device *dev;
 	int width, height, stride;
-	int width_mm = 0, height_mm = 0;
+	u16 width_mm = 0, height_mm = 0;
 	struct device_node *panel_node;
 	const struct drm_format_info *format;
 	struct resource *res, *mem = NULL;
@@ -658,8 +691,18 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
 			return ERR_CAST(mem);
 		panel_node = of_parse_phandle(of_node, "panel", 0);
 		if (panel_node) {
-			simplefb_read_u32_of(dev, panel_node, "width-mm", &width_mm);
-			simplefb_read_u32_of(dev, panel_node, "height-mm", &height_mm);
+			/*
+			 * Ignore errors from parsing the physical panel
+			 * size. Using the pre-initialized sizes of 0 will
+			 * make drm_sysfb_mode() calculate a default physical
+			 * size based on a resolution of 96 dpi.
+			 */
+			ret = simplefb_get_panel_width_mm_of(dev, panel_node);
+			if (ret > 0)
+				width_mm = ret;
+			ret = simplefb_get_panel_height_mm_of(dev, panel_node);
+			if (ret > 0)
+				height_mm = ret;
 			of_node_put(panel_node);
 		}
 	} else {
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 3/7] drm/sysfb: simpledrm: Inline simplefb_get_validated_int()
  2026-06-25  9:39 [PATCH v3 0/7] drm/sysfb: simpledrm: Various improvements Thomas Zimmermann
  2026-06-25  9:39 ` [PATCH v3 1/7] drm/sysfb: simpledrm: Improve framebuffer-size validation Thomas Zimmermann
  2026-06-25  9:39 ` [PATCH v3 2/7] drm/sysfb: simpledrm: Improve panel-size validation Thomas Zimmermann
@ 2026-06-25  9:39 ` Thomas Zimmermann
  2026-06-25  9:39 ` [PATCH v3 4/7] drm/sysfb: simpledrm: Improve stride validation Thomas Zimmermann
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 18+ messages in thread
From: Thomas Zimmermann @ 2026-06-25  9:39 UTC (permalink / raw)
  To: javierm, treding, maarten.lankhorst, mripard, airlied, simona,
	neil.armstrong, jesszhan0024, rayyan
  Cc: dri-devel, sashiko-reviews, Thomas Zimmermann

The helper simplefb_get_validated_int() is only a wrapper around
drm_sysfb_get_validated_int(). Inline the function into its callers.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Thierry Reding <treding@nvidia.com>
---
 drivers/gpu/drm/sysfb/simpledrm.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/sysfb/simpledrm.c b/drivers/gpu/drm/sysfb/simpledrm.c
index 6bbe779ec870..b4e91191a0ba 100644
--- a/drivers/gpu/drm/sysfb/simpledrm.c
+++ b/drivers/gpu/drm/sysfb/simpledrm.c
@@ -41,13 +41,6 @@
  * Helpers for simplefb
  */
 
-static int
-simplefb_get_validated_int(struct drm_device *dev, const char *name,
-			   uint32_t value)
-{
-	return drm_sysfb_get_validated_int(dev, name, value, INT_MAX);
-}
-
 static const struct drm_format_info *
 simplefb_get_validated_format(struct drm_device *dev, const char *format_name)
 {
@@ -95,7 +88,7 @@ static int
 simplefb_get_stride_pd(struct drm_device *dev,
 		       const struct simplefb_platform_data *pd)
 {
-	return simplefb_get_validated_int(dev, "stride", pd->stride);
+	return drm_sysfb_get_validated_int(dev, "stride", pd->stride, INT_MAX);
 }
 
 static const struct drm_format_info *
@@ -159,7 +152,7 @@ simplefb_get_stride_of(struct drm_device *dev, struct device_node *of_node)
 
 	if (ret)
 		return ret;
-	return simplefb_get_validated_int(dev, "stride", stride);
+	return drm_sysfb_get_validated_int(dev, "stride", stride, INT_MAX);
 }
 
 static const struct drm_format_info *
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 4/7] drm/sysfb: simpledrm: Improve stride validation
  2026-06-25  9:39 [PATCH v3 0/7] drm/sysfb: simpledrm: Various improvements Thomas Zimmermann
                   ` (2 preceding siblings ...)
  2026-06-25  9:39 ` [PATCH v3 3/7] drm/sysfb: simpledrm: Inline simplefb_get_validated_int() Thomas Zimmermann
@ 2026-06-25  9:39 ` Thomas Zimmermann
  2026-06-25  9:39 ` [PATCH v3 5/7] drm/sysfb: simpledrm: Validate mmap size against framebuffer size Thomas Zimmermann
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 18+ messages in thread
From: Thomas Zimmermann @ 2026-06-25  9:39 UTC (permalink / raw)
  To: javierm, treding, maarten.lankhorst, mripard, airlied, simona,
	neil.armstrong, jesszhan0024, rayyan
  Cc: dri-devel, sashiko-reviews, Thomas Zimmermann, stable

Validate the computed stride against the maximum value INT_MAX.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Fixes: 7bfa5c7b28d6 ("drm/simpledrm: Compute linestride with drm_format_info_min_pitch()")
Cc: <stable@vger.kernel.org> # v6.1+
---
 drivers/gpu/drm/sysfb/simpledrm.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/sysfb/simpledrm.c b/drivers/gpu/drm/sysfb/simpledrm.c
index b4e91191a0ba..a899dfb747bf 100644
--- a/drivers/gpu/drm/sysfb/simpledrm.c
+++ b/drivers/gpu/drm/sysfb/simpledrm.c
@@ -703,9 +703,15 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
 		return ERR_PTR(-ENODEV);
 	}
 	if (!stride) {
-		stride = drm_format_info_min_pitch(format, 0, width);
-		if (drm_WARN_ON(dev, !stride))
+		u64 pitch = drm_format_info_min_pitch(format, 0, width);
+
+		if (drm_WARN_ON(dev, !pitch)) {
+			return ERR_PTR(-EINVAL); /* driver bug */
+		} else if (pitch > INT_MAX) {
+			drm_warn(dev, "stride of %llu exceeds maximum\n", pitch);
 			return ERR_PTR(-EINVAL);
+		}
+		stride = pitch;
 	}
 
 	sysfb->fb_mode = drm_sysfb_mode(width, height, width_mm, height_mm);
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 5/7] drm/sysfb: simpledrm: Validate mmap size against framebuffer size
  2026-06-25  9:39 [PATCH v3 0/7] drm/sysfb: simpledrm: Various improvements Thomas Zimmermann
                   ` (3 preceding siblings ...)
  2026-06-25  9:39 ` [PATCH v3 4/7] drm/sysfb: simpledrm: Improve stride validation Thomas Zimmermann
@ 2026-06-25  9:39 ` Thomas Zimmermann
  2026-06-25 10:27   ` sashiko-bot
  2026-06-25  9:39 ` [PATCH v3 6/7] drm/of: Implement drm_of_get_panel_orientation() Thomas Zimmermann
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 18+ messages in thread
From: Thomas Zimmermann @ 2026-06-25  9:39 UTC (permalink / raw)
  To: javierm, treding, maarten.lankhorst, mripard, airlied, simona,
	neil.armstrong, jesszhan0024, rayyan
  Cc: dri-devel, sashiko-reviews, Thomas Zimmermann, Sashiko

The size of the mmap'ed framebuffer could be smaller than the minimum
required framebuffer size. Validate the resource size against the
framebuffer size.

Buggy firmware that triggers this check should be fixed up with a quirk
on a case-by-case base.

v3:
- fix size checks (Sashiko)
- improve error message for alignment check (Thierry)
- do not store aligned size value

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Suggested-by: Sashiko <sashiko-bot@kernel.org>
Reviewed-by: Thierry Reding <treding@nvidia.com>
---
 drivers/gpu/drm/sysfb/simpledrm.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/drivers/gpu/drm/sysfb/simpledrm.c b/drivers/gpu/drm/sysfb/simpledrm.c
index a899dfb747bf..9e0711e0095a 100644
--- a/drivers/gpu/drm/sysfb/simpledrm.c
+++ b/drivers/gpu/drm/sysfb/simpledrm.c
@@ -6,6 +6,7 @@
 #include <linux/of_address.h>
 #include <linux/of_clk.h>
 #include <linux/of_reserved_mem.h>
+#include <linux/overflow.h>
 #include <linux/platform_data/simplefb.h>
 #include <linux/platform_device.h>
 #include <linux/pm.h>
@@ -623,6 +624,7 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
 	u16 width_mm = 0, height_mm = 0;
 	struct device_node *panel_node;
 	const struct drm_format_info *format;
+	u64 size;
 	struct resource *res, *mem = NULL;
 	struct drm_plane *primary_plane;
 	struct drm_crtc *crtc;
@@ -713,6 +715,14 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
 		}
 		stride = pitch;
 	}
+	if (check_mul_overflow(height, stride, &size)) {
+		drm_err(dev, "framebuffer size exceeds maximum\n");
+		return ERR_PTR(-EINVAL);
+	}
+	if (ALIGN(size, PAGE_SIZE) < PAGE_SIZE) {
+		drm_err(dev, "page-aligned framebuffer exceeds maximum\n");
+		return ERR_PTR(-EINVAL);
+	}
 
 	sysfb->fb_mode = drm_sysfb_mode(width, height, width_mm, height_mm);
 	sysfb->fb_format = format;
@@ -738,6 +748,13 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
 
 		drm_dbg(dev, "using system memory framebuffer at %pr\n", mem);
 
+		if (size > resource_size(mem)) {
+			drm_err(dev,
+				"framebuffer size of %llu exceeds memory range %pr\n",
+				size, mem);
+			return ERR_PTR(-EINVAL);
+		}
+
 		screen_base = devm_memremap(dev->dev, mem->start, resource_size(mem), MEMREMAP_WC);
 		if (IS_ERR(screen_base))
 			return screen_base;
@@ -771,6 +788,13 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
 			mem = res;
 		}
 
+		if (size > resource_size(mem)) {
+			drm_err(dev,
+				"framebuffer size of %llu exceeds memory range %pr\n",
+				size, mem);
+			return ERR_PTR(-EINVAL);
+		}
+
 		screen_base = devm_ioremap_wc(&pdev->dev, mem->start, resource_size(mem));
 		if (!screen_base)
 			return ERR_PTR(-ENOMEM);
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 6/7] drm/of: Implement drm_of_get_panel_orientation()
  2026-06-25  9:39 [PATCH v3 0/7] drm/sysfb: simpledrm: Various improvements Thomas Zimmermann
                   ` (4 preceding siblings ...)
  2026-06-25  9:39 ` [PATCH v3 5/7] drm/sysfb: simpledrm: Validate mmap size against framebuffer size Thomas Zimmermann
@ 2026-06-25  9:39 ` Thomas Zimmermann
  2026-06-29 12:27   ` Thierry Reding
  2026-06-29 12:28   ` Thierry Reding
  2026-06-25  9:39 ` [PATCH v3 7/7] drm/sysfb: simpledrm: Read panel orientation from DT node Thomas Zimmermann
                   ` (2 subsequent siblings)
  8 siblings, 2 replies; 18+ messages in thread
From: Thomas Zimmermann @ 2026-06-25  9:39 UTC (permalink / raw)
  To: javierm, treding, maarten.lankhorst, mripard, airlied, simona,
	neil.armstrong, jesszhan0024, rayyan
  Cc: dri-devel, sashiko-reviews, Thomas Zimmermann

Implement drm_of_get_panel_orientation() to retrieve a panel's
rotation property as enum drm_panel_orientation. The code has
been taken from of_drm_get_panel_orientation(), so convert that
helper over. Callers of the old helper can be converted as well.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_of.c    | 44 +++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/drm_panel.c | 26 ++--------------------
 include/drm/drm_of.h        | 11 ++++++++++
 3 files changed, 57 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c
index d03ada82eac9..96eef327bf7e 100644
--- a/drivers/gpu/drm/drm_of.c
+++ b/drivers/gpu/drm/drm_of.c
@@ -7,6 +7,7 @@
 #include <linux/of_graph.h>
 
 #include <drm/drm_bridge.h>
+#include <drm/drm_connector.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_device.h>
 #include <drm/drm_encoder.h>
@@ -220,6 +221,49 @@ int drm_of_encoder_active_endpoint(struct device_node *node,
 }
 EXPORT_SYMBOL_GPL(drm_of_encoder_active_endpoint);
 
+/**
+ * drm_of_get_panel_orientation - look up the orientation of the panel through
+ * the "rotation" binding from a device tree node
+ * @np: device tree node of the panel
+ * @orientation: orientation enum to be filled in
+ *
+ * Looks up the rotation of a panel in the device tree. The orientation of the
+ * panel is expressed as a property name "rotation" in the device tree. The
+ * rotation in the device tree is counter clockwise.
+ *
+ * Return: 0 when a valid rotation value (0, 90, 180, or 270) is read or the
+ * rotation property doesn't exist. Return a negative error code on failure.
+ */
+int drm_of_get_panel_orientation(const struct device_node *np,
+				 enum drm_panel_orientation *orientation)
+{
+	int rotation, ret;
+
+	ret = of_property_read_u32(np, "rotation", &rotation);
+	if (ret == -EINVAL) {
+		/* Don't return an error if there's no rotation property. */
+		*orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
+		return 0;
+	}
+
+	if (ret < 0)
+		return ret;
+
+	if (rotation == 0)
+		*orientation = DRM_MODE_PANEL_ORIENTATION_NORMAL;
+	else if (rotation == 90)
+		*orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP;
+	else if (rotation == 180)
+		*orientation = DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP;
+	else if (rotation == 270)
+		*orientation = DRM_MODE_PANEL_ORIENTATION_LEFT_UP;
+	else
+		return -EINVAL;
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(drm_of_get_panel_orientation);
+
 /**
  * drm_of_find_panel_or_bridge - return connected panel or bridge device
  * @np: device tree node containing encoder output ports
diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
index 2c5649e433df..eddd13a34c03 100644
--- a/drivers/gpu/drm/drm_panel.c
+++ b/drivers/gpu/drm/drm_panel.c
@@ -28,6 +28,7 @@
 #include <linux/of.h>
 
 #include <drm/drm_crtc.h>
+#include <drm/drm_of.h>
 #include <drm/drm_panel.h>
 #include <drm/drm_print.h>
 
@@ -508,30 +509,7 @@ EXPORT_SYMBOL(of_drm_find_panel);
 int of_drm_get_panel_orientation(const struct device_node *np,
 				 enum drm_panel_orientation *orientation)
 {
-	int rotation, ret;
-
-	ret = of_property_read_u32(np, "rotation", &rotation);
-	if (ret == -EINVAL) {
-		/* Don't return an error if there's no rotation property. */
-		*orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
-		return 0;
-	}
-
-	if (ret < 0)
-		return ret;
-
-	if (rotation == 0)
-		*orientation = DRM_MODE_PANEL_ORIENTATION_NORMAL;
-	else if (rotation == 90)
-		*orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP;
-	else if (rotation == 180)
-		*orientation = DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP;
-	else if (rotation == 270)
-		*orientation = DRM_MODE_PANEL_ORIENTATION_LEFT_UP;
-	else
-		return -EINVAL;
-
-	return 0;
+	return drm_of_get_panel_orientation(np, orientation);
 }
 EXPORT_SYMBOL(of_drm_get_panel_orientation);
 #endif
diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h
index 7bcc0ccfe0f4..ebebed14c611 100644
--- a/include/drm/drm_of.h
+++ b/include/drm/drm_of.h
@@ -20,6 +20,8 @@ struct device_node;
 struct mipi_dsi_device_info;
 struct mipi_dsi_host;
 
+enum drm_panel_orientation;
+
 /**
  * enum drm_lvds_dual_link_pixels - Pixel order of an LVDS dual-link connection
  * @DRM_LVDS_DUAL_LINK_EVEN_ODD_PIXELS: Even pixels are expected to be generated
@@ -47,6 +49,8 @@ int drm_of_component_probe(struct device *dev,
 int drm_of_encoder_active_endpoint(struct device_node *node,
 				   struct drm_encoder *encoder,
 				   struct of_endpoint *endpoint);
+int drm_of_get_panel_orientation(const struct device_node *np,
+				 enum drm_panel_orientation *orientation);
 int drm_of_find_panel_or_bridge(const struct device_node *np,
 				int port, int endpoint,
 				struct drm_panel **panel,
@@ -101,6 +105,13 @@ static inline int drm_of_encoder_active_endpoint(struct device_node *node,
 {
 	return -EINVAL;
 }
+
+static inline int drm_of_get_panel_orientation(const struct device_node *np,
+					       enum drm_panel_orientation *orientation)
+{
+	return -EINVAL;
+}
+
 static inline int drm_of_find_panel_or_bridge(const struct device_node *np,
 					      int port, int endpoint,
 					      struct drm_panel **panel,
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 7/7] drm/sysfb: simpledrm: Read panel orientation from DT node
  2026-06-25  9:39 [PATCH v3 0/7] drm/sysfb: simpledrm: Various improvements Thomas Zimmermann
                   ` (5 preceding siblings ...)
  2026-06-25  9:39 ` [PATCH v3 6/7] drm/of: Implement drm_of_get_panel_orientation() Thomas Zimmermann
@ 2026-06-25  9:39 ` Thomas Zimmermann
  2026-06-29 12:27   ` Thierry Reding
  2026-06-25 10:56 ` [PATCH v3 0/7] drm/sysfb: simpledrm: Various improvements Maxime Ripard
  2026-06-29 11:02 ` Javier Martinez Canillas
  8 siblings, 1 reply; 18+ messages in thread
From: Thomas Zimmermann @ 2026-06-25  9:39 UTC (permalink / raw)
  To: javierm, treding, maarten.lankhorst, mripard, airlied, simona,
	neil.armstrong, jesszhan0024, rayyan
  Cc: dri-devel, sashiko-reviews, Thomas Zimmermann

A device-tree panel node can specify the panel's rotation in steps
of 90 degrees. Set the DRM connector orientation accordingly. Use
UNKNOWN for the orientation if the field is missing or invalid.

v3:
- read the orientation with drm_of_get_panel_orientation() (Thierry)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/sysfb/simpledrm.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/sysfb/simpledrm.c b/drivers/gpu/drm/sysfb/simpledrm.c
index 9e0711e0095a..21ddf4502ecc 100644
--- a/drivers/gpu/drm/sysfb/simpledrm.c
+++ b/drivers/gpu/drm/sysfb/simpledrm.c
@@ -28,6 +28,7 @@
 #include <drm/drm_managed.h>
 #include <drm/drm_modeset_helper.h>
 #include <drm/drm_modeset_helper_vtables.h>
+#include <drm/drm_of.h>
 #include <drm/drm_print.h>
 #include <drm/drm_probe_helper.h>
 
@@ -623,6 +624,7 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
 	int width, height, stride;
 	u16 width_mm = 0, height_mm = 0;
 	struct device_node *panel_node;
+	enum drm_panel_orientation orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
 	const struct drm_format_info *format;
 	u64 size;
 	struct resource *res, *mem = NULL;
@@ -698,6 +700,12 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
 			ret = simplefb_get_panel_height_mm_of(dev, panel_node);
 			if (ret > 0)
 				height_mm = ret;
+			/*
+			 * Ignore errors from parsing the panel orientation. With
+			 * the orientation initialized to UNKNOWN, the connector
+			 * helpers will do the right thing.
+			 */
+			drm_of_get_panel_orientation(panel_node, &orientation);
 			of_node_put(panel_node);
 		}
 	} else {
@@ -861,8 +869,7 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
 	if (ret)
 		return ERR_PTR(ret);
 	drm_connector_helper_add(connector, &simpledrm_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);
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 1/7] drm/sysfb: simpledrm: Improve framebuffer-size validation
  2026-06-25  9:39 ` [PATCH v3 1/7] drm/sysfb: simpledrm: Improve framebuffer-size validation Thomas Zimmermann
@ 2026-06-25 10:05   ` sashiko-bot
  0 siblings, 0 replies; 18+ messages in thread
From: sashiko-bot @ 2026-06-25 10:05 UTC (permalink / raw)
  To: Thomas Zimmermann; +Cc: dri-devel

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Missing validation for device tree provided `stride` against `width * bpp` allows out-of-bounds memory writes.
--

commit daaa8ad78a371c66bd2324aa7a47d551084fe671
Author: Thomas Zimmermann <tzimmermann@suse.de>
drm/sysfb: simpledrm: Improve framebuffer-size validation

This commit validates the framebuffer dimensions provided by firmware against
the 16-bit limits of struct drm_display_mode, failing the probe on errors.

Fixes: 11e8f5fd223b ("drm: Add simpledrm driver")
Cc: <stable@vger.kernel.org> # v5.14+

[ ... ]
> @@ -144,7 +137,7 @@ simplefb_get_width_of(struct drm_device *dev, struct device_node *of_node)
>  
>  	if (ret)
>  		return ret;
> -	return simplefb_get_validated_int0(dev, "width", width);
> +	return drm_sysfb_get_validated_int0(dev, "width", width, U16_MAX);
>  }
>  
>  static int
> @@ -155,7 +148,7 @@ simplefb_get_height_of(struct drm_device *dev, struct device_node *of_node)
>  
>  	if (ret)
>  		return ret;
> -	return simplefb_get_validated_int0(dev, "height", height);
> +	return drm_sysfb_get_validated_int0(dev, "height", height, U16_MAX);
>  }

[Severity: High]
This is a pre-existing issue, but does this code need to ensure a provided
stride is at least large enough for the given width and pixel format?

In simpledrm_device_create(), if the device tree or platform data provides a
non-zero stride, it bypasses the minimum pitch calculation:

	if (!stride) {
		u64 pitch = drm_format_info_min_pitch(format, 0, width);
		...
		stride = pitch;
	}

The driver then calculates the required size using this stride:

	if (check_mul_overflow(height, stride, &size)) {
		...
		if (size > resource_size(mem)) {

If firmware provides a small but non-zero stride (for example, 1), the size
calculation yields a small value, which easily passes the resource size check.

However, rendering and clearing operations write width * bpp bytes per line.
For example, in drm_sysfb_plane_helper_atomic_disable():

	for (i = 0; i < lines; ++i) {
		memset_io(dst_vmap, 0, linepixels * dst_format->cpp[0]);
		dst_vmap += dst_pitch;
	}

Can this lead to out-of-bounds memory writes if the firmware provides a stride
that is smaller than width * bpp?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260625094509.157581-1-tzimmermann@suse.de?part=1

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 5/7] drm/sysfb: simpledrm: Validate mmap size against framebuffer size
  2026-06-25  9:39 ` [PATCH v3 5/7] drm/sysfb: simpledrm: Validate mmap size against framebuffer size Thomas Zimmermann
@ 2026-06-25 10:27   ` sashiko-bot
  0 siblings, 0 replies; 18+ messages in thread
From: sashiko-bot @ 2026-06-25 10:27 UTC (permalink / raw)
  To: Thomas Zimmermann; +Cc: dri-devel

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

New issues:
- [Medium] Dead code in mathematical overflow checks for framebuffer size and alignment

Pre-existing issues:
- [High] Missing bounds check for explicitly provided stride allows out-of-bounds writes
--

commit 192f927f236077dbe56914205861b2c980ca71ec
Author: Thomas Zimmermann <tzimmermann@suse.de>

drm/sysfb: simpledrm: Validate mmap size against framebuffer size

The size of the mmap'ed framebuffer could be smaller than the minimum
required framebuffer size. Validate the resource size against the
framebuffer size.

> diff --git a/drivers/gpu/drm/sysfb/simpledrm.c b/drivers/gpu/drm/sysfb/simpledrm.c
> index a899dfb747bfa..9e0711e0095a5 100644
> --- a/drivers/gpu/drm/sysfb/simpledrm.c
> +++ b/drivers/gpu/drm/sysfb/simpledrm.c

[ ... ]

> @@ -623,6 +624,7 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
>  	u16 width_mm = 0, height_mm = 0;
>  	struct device_node *panel_node;
>  	const struct drm_format_info *format;
> +	u64 size;
>  	struct resource *res, *mem = NULL;
>  	struct drm_plane *primary_plane;
>  	struct drm_crtc *crtc;

[ ... ]

> @@ -713,6 +715,14 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
>  		}
>  		stride = pitch;
>  	}
> +	if (check_mul_overflow(height, stride, &size)) {
> +		drm_err(dev, "framebuffer size exceeds maximum\n");
> +		return ERR_PTR(-EINVAL);
> +	}
> +	if (ALIGN(size, PAGE_SIZE) < PAGE_SIZE) {
> +		drm_err(dev, "page-aligned framebuffer exceeds maximum\n");
> +		return ERR_PTR(-EINVAL);
> +	}

[Severity: Medium]
Are these overflow checks functioning as intended?

Looking at simpledrm_device_create() in drivers/gpu/drm/sysfb/simpledrm.c,
height and stride are 32-bit integers while size is a u64. Their maximum
possible product (~1.4e14) easily fits into size (~1.8e19), meaning
check_mul_overflow() mathematically cannot overflow here.

Additionally, the alignment check ALIGN(size, PAGE_SIZE) < PAGE_SIZE
only evaluates to true if size == 0. Since both height and stride are
guaranteed to be strictly greater than 0 by earlier validation, size
cannot be 0. As a u64, the PAGE_SIZE alignment cannot wrap around,
making this check dead code.

>  
>  	sysfb->fb_mode = drm_sysfb_mode(width, height, width_mm, height_mm);
>  	sysfb->fb_format = format;

[ ... ]

> @@ -738,6 +748,13 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
>  
>  		drm_dbg(dev, "using system memory framebuffer at %pr\n", mem);
>  
> +		if (size > resource_size(mem)) {
> +			drm_err(dev,
> +				"framebuffer size of %llu exceeds memory range %pr\n",
> +				size, mem);
> +			return ERR_PTR(-EINVAL);
> +		}
> +

[Severity: High]
This isn't a bug introduced by this patch, but does the size calculation
allow out-of-bounds writes if the device tree provides an artificially
small stride?

Looking at simpledrm_device_create() in drivers/gpu/drm/sysfb/simpledrm.c,
if stride is provided explicitly by the device tree, it is never validated
against the minimum required pitch (width * bytes_per_pixel). A buggy or
malicious device tree could provide a stride of 1, resulting in an
artificially small computed size that easily passes this new
size > resource_size(mem) check.

During atomic updates, DRM shadow plane blitting functions like
drm_fb_memcpy() copy width * bytes_per_pixel bytes per row. The total
memory offset accessed would reach:
(height - 1) * stride + width * bytes_per_pixel

With an artificially small stride, this could greatly exceed the validated
size and mapped resource_size(mem), leading to an out-of-bounds write
into kernel or I/O memory.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260625094509.157581-1-tzimmermann@suse.de?part=5

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 0/7] drm/sysfb: simpledrm: Various improvements
  2026-06-25  9:39 [PATCH v3 0/7] drm/sysfb: simpledrm: Various improvements Thomas Zimmermann
                   ` (6 preceding siblings ...)
  2026-06-25  9:39 ` [PATCH v3 7/7] drm/sysfb: simpledrm: Read panel orientation from DT node Thomas Zimmermann
@ 2026-06-25 10:56 ` Maxime Ripard
  2026-06-29 11:02 ` Javier Martinez Canillas
  8 siblings, 0 replies; 18+ messages in thread
From: Maxime Ripard @ 2026-06-25 10:56 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: airlied, dri-devel, javierm, jesszhan0024, maarten.lankhorst,
	mripard, neil.armstrong, rayyan, sashiko-reviews, simona, treding,
	Maxime Ripard

On Thu, 25 Jun 2026 11:39:32 +0200, Thomas Zimmermann wrote:
> Patches 1 to 5 improve validation of the values provided by the
> device firmware.
> 
> Patches 6 and 7 improve support for panel orientation. There's a rotation
> property in the DT panel node. Read the value and set the connector's
> 
> [ ... ]

Reviewed-by: Maxime Ripard <mripard@kernel.org>

Thanks!
Maxime

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 0/7] drm/sysfb: simpledrm: Various improvements
  2026-06-25  9:39 [PATCH v3 0/7] drm/sysfb: simpledrm: Various improvements Thomas Zimmermann
                   ` (7 preceding siblings ...)
  2026-06-25 10:56 ` [PATCH v3 0/7] drm/sysfb: simpledrm: Various improvements Maxime Ripard
@ 2026-06-29 11:02 ` Javier Martinez Canillas
  8 siblings, 0 replies; 18+ messages in thread
From: Javier Martinez Canillas @ 2026-06-29 11:02 UTC (permalink / raw)
  To: Thomas Zimmermann, treding, maarten.lankhorst, mripard, airlied,
	simona, neil.armstrong, jesszhan0024, rayyan
  Cc: dri-devel, sashiko-reviews, Thomas Zimmermann

Thomas Zimmermann <tzimmermann@suse.de> writes:

Hello Thomas,

> Patches 1 to 5 improve validation of the values provided by the
> device firmware.
>
> Patches 6 and 7 improve support for panel orientation. There's a rotation
> property in the DT panel node. Read the value and set the connector's
> orientation property accordingly. To do so, patch 6 moves the existing
> code for parsing the rotation to drm_of.c. This makes it available to
> simpledrm without introducing a dependency on DRM_PANEL.
>
> v3:
> - use shared helper for parsing the panel orentation (Thierry)
> - fix framebuffer size checks (Sashiko)
> - minor improvements
> v2:
> - further improve input validation (Sashiko)
>

The whole series looks good to me.

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 6/7] drm/of: Implement drm_of_get_panel_orientation()
  2026-06-25  9:39 ` [PATCH v3 6/7] drm/of: Implement drm_of_get_panel_orientation() Thomas Zimmermann
@ 2026-06-29 12:27   ` Thierry Reding
  2026-06-29 12:44     ` Thomas Zimmermann
  2026-06-29 12:28   ` Thierry Reding
  1 sibling, 1 reply; 18+ messages in thread
From: Thierry Reding @ 2026-06-29 12:27 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: javierm, maarten.lankhorst, mripard, airlied, simona,
	neil.armstrong, jesszhan0024, rayyan, dri-devel, sashiko-reviews


[-- Attachment #1.1: Type: text/plain, Size: 1361 bytes --]

On Thu, Jun 25, 2026 at 11:39:38AM +0200, Thomas Zimmermann wrote:
> Implement drm_of_get_panel_orientation() to retrieve a panel's
> rotation property as enum drm_panel_orientation. The code has
> been taken from of_drm_get_panel_orientation(), so convert that
> helper over. Callers of the old helper can be converted as well.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/drm_of.c    | 44 +++++++++++++++++++++++++++++++++++++
>  drivers/gpu/drm/drm_panel.c | 26 ++--------------------
>  include/drm/drm_of.h        | 11 ++++++++++
>  3 files changed, 57 insertions(+), 24 deletions(-)

So you're effectively renaming of_drm_get_panel_orientation() to
drm_of_get_panel_orientation(), while moving it to drm_of.c,  and then
you keep of_drm_get_panel_orientation() as an alias.

I don't understand the use of this. Maybe if we really need to move this
out of drm_panel.c to make it more widely available, fine. Maybe we also
want the drm_of_ prefix instead of of_drm_, also fine, I suppose. But in
that case we should just go ahead and update all callers of the old
helper and get rid of it while we're at it. No use in keeping around
aliases/duplicates.

I've attached a patch to do just that. Feel free to integrate it into
the series, or we can apply after your series is merged.

Thierry

[-- Attachment #1.2: Type: text/plain, Size: 15571 bytes --]

From 2aabb20fd3c8666fd9a8635e28cf6e398de7e717 Mon Sep 17 00:00:00 2001
From: Thierry Reding <treding@nvidia.com>
Date: Mon, 29 Jun 2026 14:23:27 +0200
Subject: [PATCH] drm/panel: Use drm_of_get_panel_orientation()

The old of_drm_get_panel_orientation() function was replaced by the
drm_of_get_panel_orientation() in the core DRM OF helpers. Replace all
uses of the old helper and remove it.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/gpu/drm/drm_panel.c                   | 20 -------------------
 .../drm/panel/panel-boe-th101mb31ig002-28a.c  |  2 +-
 .../gpu/drm/panel/panel-boe-tv101wum-nl6.c    |  2 +-
 .../gpu/drm/panel/panel-chipwealth-ch13726a.c |  2 +-
 drivers/gpu/drm/panel/panel-edp.c             |  2 +-
 drivers/gpu/drm/panel/panel-elida-kd35t133.c  |  2 +-
 .../gpu/drm/panel/panel-focaltech-ota7290b.c  |  2 +-
 drivers/gpu/drm/panel/panel-himax-hx83102.c   |  2 +-
 drivers/gpu/drm/panel/panel-himax-hx8394.c    |  2 +-
 .../gpu/drm/panel/panel-ilitek-ili9806e-dsi.c |  2 +-
 drivers/gpu/drm/panel/panel-ilitek-ili9881c.c |  2 +-
 drivers/gpu/drm/panel/panel-ilitek-ili9882t.c |  2 +-
 .../gpu/drm/panel/panel-jadard-jd9365da-h3.c  |  2 +-
 drivers/gpu/drm/panel/panel-lvds.c            |  2 +-
 drivers/gpu/drm/panel/panel-novatek-nt36523.c |  2 +-
 drivers/gpu/drm/panel/panel-simple.c          |  2 +-
 drivers/gpu/drm/panel/panel-sitronix-st7701.c |  2 +-
 drivers/gpu/drm/panel/panel-sitronix-st7703.c |  2 +-
 .../gpu/drm/panel/panel-sitronix-st7789v.c    |  2 +-
 include/drm/drm_panel.h                       |  8 --------
 20 files changed, 18 insertions(+), 46 deletions(-)

diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
index eddd13a34c03..d7c6f4824b2d 100644
--- a/drivers/gpu/drm/drm_panel.c
+++ b/drivers/gpu/drm/drm_panel.c
@@ -492,26 +492,6 @@ struct drm_panel *of_drm_find_panel(const struct device_node *np)
 	return ERR_PTR(-EPROBE_DEFER);
 }
 EXPORT_SYMBOL(of_drm_find_panel);
-
-/**
- * of_drm_get_panel_orientation - look up the orientation of the panel through
- * the "rotation" binding from a device tree node
- * @np: device tree node of the panel
- * @orientation: orientation enum to be filled in
- *
- * Looks up the rotation of a panel in the device tree. The orientation of the
- * panel is expressed as a property name "rotation" in the device tree. The
- * rotation in the device tree is counter clockwise.
- *
- * Return: 0 when a valid rotation value (0, 90, 180, or 270) is read or the
- * rotation property doesn't exist. Return a negative error code on failure.
- */
-int of_drm_get_panel_orientation(const struct device_node *np,
-				 enum drm_panel_orientation *orientation)
-{
-	return drm_of_get_panel_orientation(np, orientation);
-}
-EXPORT_SYMBOL(of_drm_get_panel_orientation);
 #endif
 
 /* Find panel by fwnode. This should be identical to of_drm_find_panel(). */
diff --git a/drivers/gpu/drm/panel/panel-boe-th101mb31ig002-28a.c b/drivers/gpu/drm/panel/panel-boe-th101mb31ig002-28a.c
index 01b4458e55ad..6a77c2256fd5 100644
--- a/drivers/gpu/drm/panel/panel-boe-th101mb31ig002-28a.c
+++ b/drivers/gpu/drm/panel/panel-boe-th101mb31ig002-28a.c
@@ -380,7 +380,7 @@ static int boe_th101mb31ig002_dsi_probe(struct mipi_dsi_device *dsi)
 		return dev_err_probe(&dsi->dev, PTR_ERR(ctx->reset),
 				     "Failed to get reset GPIO\n");
 
-	ret = of_drm_get_panel_orientation(dsi->dev.of_node,
+	ret = drm_of_get_panel_orientation(dsi->dev.of_node,
 					   &ctx->orientation);
 	if (ret)
 		return dev_err_probe(&dsi->dev, ret,
diff --git a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
index 658ce64c71eb..8f2de17b8b2b 100644
--- a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
+++ b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
@@ -1722,7 +1722,7 @@ static int boe_panel_add(struct boe_panel *boe)
 
 	boe->base.prepare_prev_first = true;
 
-	err = of_drm_get_panel_orientation(dev->of_node, &boe->orientation);
+	err = drm_of_get_panel_orientation(dev->of_node, &boe->orientation);
 	if (err < 0) {
 		dev_err(dev, "%pOF: failed to get orientation %d\n", dev->of_node, err);
 		return err;
diff --git a/drivers/gpu/drm/panel/panel-chipwealth-ch13726a.c b/drivers/gpu/drm/panel/panel-chipwealth-ch13726a.c
index be76bc825c3f..437ee2294a9a 100644
--- a/drivers/gpu/drm/panel/panel-chipwealth-ch13726a.c
+++ b/drivers/gpu/drm/panel/panel-chipwealth-ch13726a.c
@@ -268,7 +268,7 @@ static int ch13726a_probe(struct mipi_dsi_device *dsi)
 		return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio),
 				     "Failed to get reset-gpios\n");
 
-	ret = of_drm_get_panel_orientation(dev->of_node, &ctx->orientation);
+	ret = drm_of_get_panel_orientation(dev->of_node, &ctx->orientation);
 	if (ret < 0) {
 		dev_err(dev, "%pOF: failed to get orientation %d\n", dev->of_node, ret);
 		return ret;
diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c
index aa27d6cd932e..9af908811cf7 100644
--- a/drivers/gpu/drm/panel/panel-edp.c
+++ b/drivers/gpu/drm/panel/panel-edp.c
@@ -865,7 +865,7 @@ static int panel_edp_probe(struct device *dev, const struct panel_desc *desc,
 		return dev_err_probe(dev, PTR_ERR(panel->enable_gpio),
 				     "failed to request GPIO\n");
 
-	err = of_drm_get_panel_orientation(dev->of_node, &panel->orientation);
+	err = drm_of_get_panel_orientation(dev->of_node, &panel->orientation);
 	if (err) {
 		dev_err(dev, "%pOF: failed to get orientation %d\n", dev->of_node, err);
 		return err;
diff --git a/drivers/gpu/drm/panel/panel-elida-kd35t133.c b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
index 1f177834d629..5565f7a63fd5 100644
--- a/drivers/gpu/drm/panel/panel-elida-kd35t133.c
+++ b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
@@ -233,7 +233,7 @@ static int kd35t133_probe(struct mipi_dsi_device *dsi)
 		return ret;
 	}
 
-	ret = of_drm_get_panel_orientation(dev->of_node, &ctx->orientation);
+	ret = drm_of_get_panel_orientation(dev->of_node, &ctx->orientation);
 	if (ret < 0) {
 		dev_err(dev, "%pOF: failed to get orientation %d\n", dev->of_node, ret);
 		return ret;
diff --git a/drivers/gpu/drm/panel/panel-focaltech-ota7290b.c b/drivers/gpu/drm/panel/panel-focaltech-ota7290b.c
index ed02a8daf96f..b6c5bf3977ee 100644
--- a/drivers/gpu/drm/panel/panel-focaltech-ota7290b.c
+++ b/drivers/gpu/drm/panel/panel-focaltech-ota7290b.c
@@ -181,7 +181,7 @@ static int ota7290b_probe(struct mipi_dsi_device *dsi)
 		return dev_err_probe(&dsi->dev, PTR_ERR(ctx->vdd),
 					"Couldn't get our VDD supply\n");
 
-	ret = of_drm_get_panel_orientation(dsi->dev.of_node, &ctx->orientation);
+	ret = drm_of_get_panel_orientation(dsi->dev.of_node, &ctx->orientation);
 	if (ret) {
 		dev_err(&dsi->dev, "%pOF: failed to get orientation: %d\n",
 			dsi->dev.of_node, ret);
diff --git a/drivers/gpu/drm/panel/panel-himax-hx83102.c b/drivers/gpu/drm/panel/panel-himax-hx83102.c
index d7e5664a5838..d61d68c1a2e7 100644
--- a/drivers/gpu/drm/panel/panel-himax-hx83102.c
+++ b/drivers/gpu/drm/panel/panel-himax-hx83102.c
@@ -1264,7 +1264,7 @@ static int hx83102_panel_add(struct hx83102 *ctx)
 
 	ctx->base.prepare_prev_first = true;
 
-	err = of_drm_get_panel_orientation(dev->of_node, &ctx->orientation);
+	err = drm_of_get_panel_orientation(dev->of_node, &ctx->orientation);
 	if (err < 0)
 		return dev_err_probe(dev, err, "failed to get orientation\n");
 
diff --git a/drivers/gpu/drm/panel/panel-himax-hx8394.c b/drivers/gpu/drm/panel/panel-himax-hx8394.c
index bf80354567df..8c830f929d73 100644
--- a/drivers/gpu/drm/panel/panel-himax-hx8394.c
+++ b/drivers/gpu/drm/panel/panel-himax-hx8394.c
@@ -992,7 +992,7 @@ static int hx8394_probe(struct mipi_dsi_device *dsi)
 		return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio),
 				     "Failed to get reset gpio\n");
 
-	ret = of_drm_get_panel_orientation(dev->of_node, &ctx->orientation);
+	ret = drm_of_get_panel_orientation(dev->of_node, &ctx->orientation);
 	if (ret < 0) {
 		dev_err(dev, "%pOF: failed to get orientation %d\n", dev->of_node, ret);
 		return ret;
diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c b/drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c
index ecdbed8d4a3a..c9241796e1a3 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c
@@ -132,7 +132,7 @@ static int ili9806e_dsi_probe(struct mipi_dsi_device *dsi)
 	dsi->format = ctx->desc->format;
 	dsi->lanes = ctx->desc->lanes;
 
-	ret = of_drm_get_panel_orientation(dev->of_node, &ctx->orientation);
+	ret = drm_of_get_panel_orientation(dev->of_node, &ctx->orientation);
 	if (ret)
 		return dev_err_probe(dev, ret, "Failed to get orientation\n");
 
diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
index 0652cdb57d11..a13fe1bb3e46 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
@@ -2571,7 +2571,7 @@ static int ili9881c_dsi_probe(struct mipi_dsi_device *dsi)
 		return dev_err_probe(&dsi->dev, PTR_ERR(ctx->reset),
 				     "Couldn't get our reset GPIO\n");
 
-	ret = of_drm_get_panel_orientation(dsi->dev.of_node, &ctx->orientation);
+	ret = drm_of_get_panel_orientation(dsi->dev.of_node, &ctx->orientation);
 	if (ret) {
 		dev_err(&dsi->dev, "%pOF: failed to get orientation: %d\n",
 			dsi->dev.of_node, ret);
diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c b/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c
index 5f4e0d82ee67..613ecd1fbdd6 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c
@@ -795,7 +795,7 @@ static int ili9882t_add(struct ili9882t *ili)
 
 	gpiod_set_value_cansleep(ili->enable_gpio, 0);
 
-	err = of_drm_get_panel_orientation(dev->of_node, &ili->orientation);
+	err = drm_of_get_panel_orientation(dev->of_node, &ili->orientation);
 	if (err < 0) {
 		dev_err(dev, "%pOF: failed to get orientation %d\n", dev->of_node, err);
 		return err;
diff --git a/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c b/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c
index f6b04de1182e..67ef9e0fea03 100644
--- a/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c
+++ b/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c
@@ -2992,7 +2992,7 @@ static int jadard_dsi_probe(struct mipi_dsi_device *dsi)
 		return dev_err_probe(&dsi->dev, PTR_ERR(jadard->vccio),
 				"failed to get vccio regulator\n");
 
-	ret = of_drm_get_panel_orientation(dev->of_node, &jadard->orientation);
+	ret = drm_of_get_panel_orientation(dev->of_node, &jadard->orientation);
 	if (ret < 0)
 		return dev_err_probe(dev, ret, "failed to get orientation\n");
 
diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c
index 46b07f38559f..37f7498449ec 100644
--- a/drivers/gpu/drm/panel/panel-lvds.c
+++ b/drivers/gpu/drm/panel/panel-lvds.c
@@ -126,7 +126,7 @@ static int panel_lvds_parse_dt(struct panel_lvds *lvds)
 	struct device_node *np = lvds->dev->of_node;
 	int ret;
 
-	ret = of_drm_get_panel_orientation(np, &lvds->orientation);
+	ret = drm_of_get_panel_orientation(np, &lvds->orientation);
 	if (ret < 0) {
 		dev_err(lvds->dev, "%pOF: failed to get orientation %d\n", np, ret);
 		return ret;
diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36523.c b/drivers/gpu/drm/panel/panel-novatek-nt36523.c
index 226d91daf8c7..100816b04c13 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt36523.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt36523.c
@@ -1206,7 +1206,7 @@ static int nt36523_probe(struct mipi_dsi_device *dsi)
 	pinfo->dsi[0] = dsi;
 	mipi_dsi_set_drvdata(dsi, pinfo);
 
-	ret = of_drm_get_panel_orientation(dev->of_node, &pinfo->orientation);
+	ret = drm_of_get_panel_orientation(dev->of_node, &pinfo->orientation);
 	if (ret < 0) {
 		dev_err(dev, "%pOF: failed to get orientation %d\n", dev->of_node, ret);
 		return ret;
diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index c09bf3db5e78..5c169fdf265c 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -693,7 +693,7 @@ static struct panel_simple *panel_simple_probe(struct device *dev)
 		return dev_err_cast_probe(dev, panel->enable_gpio,
 					  "failed to request GPIO\n");
 
-	err = of_drm_get_panel_orientation(dev->of_node, &panel->orientation);
+	err = drm_of_get_panel_orientation(dev->of_node, &panel->orientation);
 	if (err) {
 		dev_err(dev, "%pOF: failed to get orientation %d\n", dev->of_node, err);
 		return ERR_PTR(err);
diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7701.c b/drivers/gpu/drm/panel/panel-sitronix-st7701.c
index 2f79ec4a2063..11c757752cfb 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7701.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7701.c
@@ -1296,7 +1296,7 @@ static int st7701_probe(struct device *dev, int connector_type)
 		return PTR_ERR(st7701->reset);
 	}
 
-	ret = of_drm_get_panel_orientation(dev->of_node, &st7701->orientation);
+	ret = drm_of_get_panel_orientation(dev->of_node, &st7701->orientation);
 	if (ret < 0)
 		return dev_err_probe(dev, ret, "Failed to get orientation\n");
 
diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
index 6c348fe28955..40df2e5b14b2 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
@@ -874,7 +874,7 @@ static int st7703_probe(struct mipi_dsi_device *dsi)
 		return dev_err_probe(dev, PTR_ERR(ctx->iovcc),
 				     "Failed to request iovcc regulator\n");
 
-	ret = of_drm_get_panel_orientation(dsi->dev.of_node, &ctx->orientation);
+	ret = drm_of_get_panel_orientation(dsi->dev.of_node, &ctx->orientation);
 	if (ret < 0)
 		return dev_err_probe(&dsi->dev, ret, "Failed to get orientation\n");
 
diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
index d5f821d6b23c..0502df34746b 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
@@ -646,7 +646,7 @@ static int st7789v_probe(struct spi_device *spi)
 	if (ret)
 		return dev_err_probe(dev, ret, "Failed to get backlight\n");
 
-	ret = of_drm_get_panel_orientation(spi->dev.of_node, &ctx->orientation);
+	ret = drm_of_get_panel_orientation(spi->dev.of_node, &ctx->orientation);
 	if (ret)
 		return dev_err_probe(&spi->dev, ret, "Failed to get orientation\n");
 
diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
index 86b3f9c65c92..b87323443f49 100644
--- a/include/drm/drm_panel.h
+++ b/include/drm/drm_panel.h
@@ -337,19 +337,11 @@ int drm_panel_get_modes(struct drm_panel *panel, struct drm_connector *connector
 
 #if defined(CONFIG_OF) && defined(CONFIG_DRM_PANEL)
 struct drm_panel *of_drm_find_panel(const struct device_node *np);
-int of_drm_get_panel_orientation(const struct device_node *np,
-				 enum drm_panel_orientation *orientation);
 #else
 static inline struct drm_panel *of_drm_find_panel(const struct device_node *np)
 {
 	return ERR_PTR(-ENODEV);
 }
-
-static inline int of_drm_get_panel_orientation(const struct device_node *np,
-					       enum drm_panel_orientation *orientation)
-{
-	return -ENODEV;
-}
 #endif
 
 #if defined(CONFIG_DRM_PANEL)
-- 
2.54.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 7/7] drm/sysfb: simpledrm: Read panel orientation from DT node
  2026-06-25  9:39 ` [PATCH v3 7/7] drm/sysfb: simpledrm: Read panel orientation from DT node Thomas Zimmermann
@ 2026-06-29 12:27   ` Thierry Reding
  0 siblings, 0 replies; 18+ messages in thread
From: Thierry Reding @ 2026-06-29 12:27 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: javierm, maarten.lankhorst, mripard, airlied, simona,
	neil.armstrong, jesszhan0024, rayyan, dri-devel, sashiko-reviews

[-- Attachment #1: Type: text/plain, Size: 585 bytes --]

On Thu, Jun 25, 2026 at 11:39:39AM +0200, Thomas Zimmermann wrote:
> A device-tree panel node can specify the panel's rotation in steps
> of 90 degrees. Set the DRM connector orientation accordingly. Use
> UNKNOWN for the orientation if the field is missing or invalid.
> 
> v3:
> - read the orientation with drm_of_get_panel_orientation() (Thierry)
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/sysfb/simpledrm.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)

Reviewed-by: Thierry Reding <treding@nvidia.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 6/7] drm/of: Implement drm_of_get_panel_orientation()
  2026-06-25  9:39 ` [PATCH v3 6/7] drm/of: Implement drm_of_get_panel_orientation() Thomas Zimmermann
  2026-06-29 12:27   ` Thierry Reding
@ 2026-06-29 12:28   ` Thierry Reding
  1 sibling, 0 replies; 18+ messages in thread
From: Thierry Reding @ 2026-06-29 12:28 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: javierm, maarten.lankhorst, mripard, airlied, simona,
	neil.armstrong, jesszhan0024, rayyan, dri-devel, sashiko-reviews

[-- Attachment #1: Type: text/plain, Size: 693 bytes --]

On Thu, Jun 25, 2026 at 11:39:38AM +0200, Thomas Zimmermann wrote:
> Implement drm_of_get_panel_orientation() to retrieve a panel's
> rotation property as enum drm_panel_orientation. The code has
> been taken from of_drm_get_panel_orientation(), so convert that
> helper over. Callers of the old helper can be converted as well.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/drm_of.c    | 44 +++++++++++++++++++++++++++++++++++++
>  drivers/gpu/drm/drm_panel.c | 26 ++--------------------
>  include/drm/drm_of.h        | 11 ++++++++++
>  3 files changed, 57 insertions(+), 24 deletions(-)

Reviewed-by: Thierry Reding <treding@nvidia.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 6/7] drm/of: Implement drm_of_get_panel_orientation()
  2026-06-29 12:27   ` Thierry Reding
@ 2026-06-29 12:44     ` Thomas Zimmermann
  2026-06-29 13:19       ` Thierry Reding
  2026-06-29 13:29       ` Thierry Reding
  0 siblings, 2 replies; 18+ messages in thread
From: Thomas Zimmermann @ 2026-06-29 12:44 UTC (permalink / raw)
  To: Thierry Reding
  Cc: javierm, maarten.lankhorst, mripard, airlied, simona,
	neil.armstrong, jesszhan0024, rayyan, dri-devel, sashiko-reviews

Hi

Am 29.06.26 um 14:27 schrieb Thierry Reding:
> On Thu, Jun 25, 2026 at 11:39:38AM +0200, Thomas Zimmermann wrote:
>> Implement drm_of_get_panel_orientation() to retrieve a panel's
>> rotation property as enum drm_panel_orientation. The code has
>> been taken from of_drm_get_panel_orientation(), so convert that
>> helper over. Callers of the old helper can be converted as well.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>>   drivers/gpu/drm/drm_of.c    | 44 +++++++++++++++++++++++++++++++++++++
>>   drivers/gpu/drm/drm_panel.c | 26 ++--------------------
>>   include/drm/drm_of.h        | 11 ++++++++++
>>   3 files changed, 57 insertions(+), 24 deletions(-)
> So you're effectively renaming of_drm_get_panel_orientation() to
> drm_of_get_panel_orientation(), while moving it to drm_of.c,  and then
> you keep of_drm_get_panel_orientation() as an alias.
>
> I don't understand the use of this. Maybe if we really need to move this
> out of drm_panel.c to make it more widely available, fine. Maybe we also
> want the drm_of_ prefix instead of of_drm_, also fine, I suppose. But in
> that case we should just go ahead and update all callers of the old
> helper and get rid of it while we're at it. No use in keeping around
> aliases/duplicates.

I'm all for it. i though this would be a different issue.

>
> I've attached a patch to do just that. Feel free to integrate it into
> the series, or we can apply after your series is merged.

Thanks.

Let me split of the  first 5 patches in series and merge them. They are 
the fixes and hardening patches and seem ready to be merged. I'll 
prepare a separate series for the panel orientation with your changes 
and it can go in separately. If we touch all the panel drivers, we 
should make sure that the panel maintainers get another chance of 
looking over it.

Best regards
Thomas

>
> Thierry
>
>  From 2aabb20fd3c8666fd9a8635e28cf6e398de7e717 Mon Sep 17 00:00:00 2001
> From: Thierry Reding <treding@nvidia.com>
> Date: Mon, 29 Jun 2026 14:23:27 +0200
> Subject: [PATCH] drm/panel: Use drm_of_get_panel_orientation()
>
> The old of_drm_get_panel_orientation() function was replaced by the
> drm_of_get_panel_orientation() in the core DRM OF helpers. Replace all
> uses of the old helper and remove it.
>
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---
>   drivers/gpu/drm/drm_panel.c                   | 20 -------------------
>   .../drm/panel/panel-boe-th101mb31ig002-28a.c  |  2 +-
>   .../gpu/drm/panel/panel-boe-tv101wum-nl6.c    |  2 +-
>   .../gpu/drm/panel/panel-chipwealth-ch13726a.c |  2 +-
>   drivers/gpu/drm/panel/panel-edp.c             |  2 +-
>   drivers/gpu/drm/panel/panel-elida-kd35t133.c  |  2 +-
>   .../gpu/drm/panel/panel-focaltech-ota7290b.c  |  2 +-
>   drivers/gpu/drm/panel/panel-himax-hx83102.c   |  2 +-
>   drivers/gpu/drm/panel/panel-himax-hx8394.c    |  2 +-
>   .../gpu/drm/panel/panel-ilitek-ili9806e-dsi.c |  2 +-
>   drivers/gpu/drm/panel/panel-ilitek-ili9881c.c |  2 +-
>   drivers/gpu/drm/panel/panel-ilitek-ili9882t.c |  2 +-
>   .../gpu/drm/panel/panel-jadard-jd9365da-h3.c  |  2 +-
>   drivers/gpu/drm/panel/panel-lvds.c            |  2 +-
>   drivers/gpu/drm/panel/panel-novatek-nt36523.c |  2 +-
>   drivers/gpu/drm/panel/panel-simple.c          |  2 +-
>   drivers/gpu/drm/panel/panel-sitronix-st7701.c |  2 +-
>   drivers/gpu/drm/panel/panel-sitronix-st7703.c |  2 +-
>   .../gpu/drm/panel/panel-sitronix-st7789v.c    |  2 +-
>   include/drm/drm_panel.h                       |  8 --------
>   20 files changed, 18 insertions(+), 46 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
> index eddd13a34c03..d7c6f4824b2d 100644
> --- a/drivers/gpu/drm/drm_panel.c
> +++ b/drivers/gpu/drm/drm_panel.c
> @@ -492,26 +492,6 @@ struct drm_panel *of_drm_find_panel(const struct device_node *np)
>   	return ERR_PTR(-EPROBE_DEFER);
>   }
>   EXPORT_SYMBOL(of_drm_find_panel);
> -
> -/**
> - * of_drm_get_panel_orientation - look up the orientation of the panel through
> - * the "rotation" binding from a device tree node
> - * @np: device tree node of the panel
> - * @orientation: orientation enum to be filled in
> - *
> - * Looks up the rotation of a panel in the device tree. The orientation of the
> - * panel is expressed as a property name "rotation" in the device tree. The
> - * rotation in the device tree is counter clockwise.
> - *
> - * Return: 0 when a valid rotation value (0, 90, 180, or 270) is read or the
> - * rotation property doesn't exist. Return a negative error code on failure.
> - */
> -int of_drm_get_panel_orientation(const struct device_node *np,
> -				 enum drm_panel_orientation *orientation)
> -{
> -	return drm_of_get_panel_orientation(np, orientation);
> -}
> -EXPORT_SYMBOL(of_drm_get_panel_orientation);
>   #endif
>   
>   /* Find panel by fwnode. This should be identical to of_drm_find_panel(). */
> diff --git a/drivers/gpu/drm/panel/panel-boe-th101mb31ig002-28a.c b/drivers/gpu/drm/panel/panel-boe-th101mb31ig002-28a.c
> index 01b4458e55ad..6a77c2256fd5 100644
> --- a/drivers/gpu/drm/panel/panel-boe-th101mb31ig002-28a.c
> +++ b/drivers/gpu/drm/panel/panel-boe-th101mb31ig002-28a.c
> @@ -380,7 +380,7 @@ static int boe_th101mb31ig002_dsi_probe(struct mipi_dsi_device *dsi)
>   		return dev_err_probe(&dsi->dev, PTR_ERR(ctx->reset),
>   				     "Failed to get reset GPIO\n");
>   
> -	ret = of_drm_get_panel_orientation(dsi->dev.of_node,
> +	ret = drm_of_get_panel_orientation(dsi->dev.of_node,
>   					   &ctx->orientation);
>   	if (ret)
>   		return dev_err_probe(&dsi->dev, ret,
> diff --git a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
> index 658ce64c71eb..8f2de17b8b2b 100644
> --- a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
> +++ b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
> @@ -1722,7 +1722,7 @@ static int boe_panel_add(struct boe_panel *boe)
>   
>   	boe->base.prepare_prev_first = true;
>   
> -	err = of_drm_get_panel_orientation(dev->of_node, &boe->orientation);
> +	err = drm_of_get_panel_orientation(dev->of_node, &boe->orientation);
>   	if (err < 0) {
>   		dev_err(dev, "%pOF: failed to get orientation %d\n", dev->of_node, err);
>   		return err;
> diff --git a/drivers/gpu/drm/panel/panel-chipwealth-ch13726a.c b/drivers/gpu/drm/panel/panel-chipwealth-ch13726a.c
> index be76bc825c3f..437ee2294a9a 100644
> --- a/drivers/gpu/drm/panel/panel-chipwealth-ch13726a.c
> +++ b/drivers/gpu/drm/panel/panel-chipwealth-ch13726a.c
> @@ -268,7 +268,7 @@ static int ch13726a_probe(struct mipi_dsi_device *dsi)
>   		return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio),
>   				     "Failed to get reset-gpios\n");
>   
> -	ret = of_drm_get_panel_orientation(dev->of_node, &ctx->orientation);
> +	ret = drm_of_get_panel_orientation(dev->of_node, &ctx->orientation);
>   	if (ret < 0) {
>   		dev_err(dev, "%pOF: failed to get orientation %d\n", dev->of_node, ret);
>   		return ret;
> diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c
> index aa27d6cd932e..9af908811cf7 100644
> --- a/drivers/gpu/drm/panel/panel-edp.c
> +++ b/drivers/gpu/drm/panel/panel-edp.c
> @@ -865,7 +865,7 @@ static int panel_edp_probe(struct device *dev, const struct panel_desc *desc,
>   		return dev_err_probe(dev, PTR_ERR(panel->enable_gpio),
>   				     "failed to request GPIO\n");
>   
> -	err = of_drm_get_panel_orientation(dev->of_node, &panel->orientation);
> +	err = drm_of_get_panel_orientation(dev->of_node, &panel->orientation);
>   	if (err) {
>   		dev_err(dev, "%pOF: failed to get orientation %d\n", dev->of_node, err);
>   		return err;
> diff --git a/drivers/gpu/drm/panel/panel-elida-kd35t133.c b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
> index 1f177834d629..5565f7a63fd5 100644
> --- a/drivers/gpu/drm/panel/panel-elida-kd35t133.c
> +++ b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
> @@ -233,7 +233,7 @@ static int kd35t133_probe(struct mipi_dsi_device *dsi)
>   		return ret;
>   	}
>   
> -	ret = of_drm_get_panel_orientation(dev->of_node, &ctx->orientation);
> +	ret = drm_of_get_panel_orientation(dev->of_node, &ctx->orientation);
>   	if (ret < 0) {
>   		dev_err(dev, "%pOF: failed to get orientation %d\n", dev->of_node, ret);
>   		return ret;
> diff --git a/drivers/gpu/drm/panel/panel-focaltech-ota7290b.c b/drivers/gpu/drm/panel/panel-focaltech-ota7290b.c
> index ed02a8daf96f..b6c5bf3977ee 100644
> --- a/drivers/gpu/drm/panel/panel-focaltech-ota7290b.c
> +++ b/drivers/gpu/drm/panel/panel-focaltech-ota7290b.c
> @@ -181,7 +181,7 @@ static int ota7290b_probe(struct mipi_dsi_device *dsi)
>   		return dev_err_probe(&dsi->dev, PTR_ERR(ctx->vdd),
>   					"Couldn't get our VDD supply\n");
>   
> -	ret = of_drm_get_panel_orientation(dsi->dev.of_node, &ctx->orientation);
> +	ret = drm_of_get_panel_orientation(dsi->dev.of_node, &ctx->orientation);
>   	if (ret) {
>   		dev_err(&dsi->dev, "%pOF: failed to get orientation: %d\n",
>   			dsi->dev.of_node, ret);
> diff --git a/drivers/gpu/drm/panel/panel-himax-hx83102.c b/drivers/gpu/drm/panel/panel-himax-hx83102.c
> index d7e5664a5838..d61d68c1a2e7 100644
> --- a/drivers/gpu/drm/panel/panel-himax-hx83102.c
> +++ b/drivers/gpu/drm/panel/panel-himax-hx83102.c
> @@ -1264,7 +1264,7 @@ static int hx83102_panel_add(struct hx83102 *ctx)
>   
>   	ctx->base.prepare_prev_first = true;
>   
> -	err = of_drm_get_panel_orientation(dev->of_node, &ctx->orientation);
> +	err = drm_of_get_panel_orientation(dev->of_node, &ctx->orientation);
>   	if (err < 0)
>   		return dev_err_probe(dev, err, "failed to get orientation\n");
>   
> diff --git a/drivers/gpu/drm/panel/panel-himax-hx8394.c b/drivers/gpu/drm/panel/panel-himax-hx8394.c
> index bf80354567df..8c830f929d73 100644
> --- a/drivers/gpu/drm/panel/panel-himax-hx8394.c
> +++ b/drivers/gpu/drm/panel/panel-himax-hx8394.c
> @@ -992,7 +992,7 @@ static int hx8394_probe(struct mipi_dsi_device *dsi)
>   		return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio),
>   				     "Failed to get reset gpio\n");
>   
> -	ret = of_drm_get_panel_orientation(dev->of_node, &ctx->orientation);
> +	ret = drm_of_get_panel_orientation(dev->of_node, &ctx->orientation);
>   	if (ret < 0) {
>   		dev_err(dev, "%pOF: failed to get orientation %d\n", dev->of_node, ret);
>   		return ret;
> diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c b/drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c
> index ecdbed8d4a3a..c9241796e1a3 100644
> --- a/drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c
> +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c
> @@ -132,7 +132,7 @@ static int ili9806e_dsi_probe(struct mipi_dsi_device *dsi)
>   	dsi->format = ctx->desc->format;
>   	dsi->lanes = ctx->desc->lanes;
>   
> -	ret = of_drm_get_panel_orientation(dev->of_node, &ctx->orientation);
> +	ret = drm_of_get_panel_orientation(dev->of_node, &ctx->orientation);
>   	if (ret)
>   		return dev_err_probe(dev, ret, "Failed to get orientation\n");
>   
> diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
> index 0652cdb57d11..a13fe1bb3e46 100644
> --- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
> +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
> @@ -2571,7 +2571,7 @@ static int ili9881c_dsi_probe(struct mipi_dsi_device *dsi)
>   		return dev_err_probe(&dsi->dev, PTR_ERR(ctx->reset),
>   				     "Couldn't get our reset GPIO\n");
>   
> -	ret = of_drm_get_panel_orientation(dsi->dev.of_node, &ctx->orientation);
> +	ret = drm_of_get_panel_orientation(dsi->dev.of_node, &ctx->orientation);
>   	if (ret) {
>   		dev_err(&dsi->dev, "%pOF: failed to get orientation: %d\n",
>   			dsi->dev.of_node, ret);
> diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c b/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c
> index 5f4e0d82ee67..613ecd1fbdd6 100644
> --- a/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c
> +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c
> @@ -795,7 +795,7 @@ static int ili9882t_add(struct ili9882t *ili)
>   
>   	gpiod_set_value_cansleep(ili->enable_gpio, 0);
>   
> -	err = of_drm_get_panel_orientation(dev->of_node, &ili->orientation);
> +	err = drm_of_get_panel_orientation(dev->of_node, &ili->orientation);
>   	if (err < 0) {
>   		dev_err(dev, "%pOF: failed to get orientation %d\n", dev->of_node, err);
>   		return err;
> diff --git a/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c b/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c
> index f6b04de1182e..67ef9e0fea03 100644
> --- a/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c
> +++ b/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c
> @@ -2992,7 +2992,7 @@ static int jadard_dsi_probe(struct mipi_dsi_device *dsi)
>   		return dev_err_probe(&dsi->dev, PTR_ERR(jadard->vccio),
>   				"failed to get vccio regulator\n");
>   
> -	ret = of_drm_get_panel_orientation(dev->of_node, &jadard->orientation);
> +	ret = drm_of_get_panel_orientation(dev->of_node, &jadard->orientation);
>   	if (ret < 0)
>   		return dev_err_probe(dev, ret, "failed to get orientation\n");
>   
> diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c
> index 46b07f38559f..37f7498449ec 100644
> --- a/drivers/gpu/drm/panel/panel-lvds.c
> +++ b/drivers/gpu/drm/panel/panel-lvds.c
> @@ -126,7 +126,7 @@ static int panel_lvds_parse_dt(struct panel_lvds *lvds)
>   	struct device_node *np = lvds->dev->of_node;
>   	int ret;
>   
> -	ret = of_drm_get_panel_orientation(np, &lvds->orientation);
> +	ret = drm_of_get_panel_orientation(np, &lvds->orientation);
>   	if (ret < 0) {
>   		dev_err(lvds->dev, "%pOF: failed to get orientation %d\n", np, ret);
>   		return ret;
> diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36523.c b/drivers/gpu/drm/panel/panel-novatek-nt36523.c
> index 226d91daf8c7..100816b04c13 100644
> --- a/drivers/gpu/drm/panel/panel-novatek-nt36523.c
> +++ b/drivers/gpu/drm/panel/panel-novatek-nt36523.c
> @@ -1206,7 +1206,7 @@ static int nt36523_probe(struct mipi_dsi_device *dsi)
>   	pinfo->dsi[0] = dsi;
>   	mipi_dsi_set_drvdata(dsi, pinfo);
>   
> -	ret = of_drm_get_panel_orientation(dev->of_node, &pinfo->orientation);
> +	ret = drm_of_get_panel_orientation(dev->of_node, &pinfo->orientation);
>   	if (ret < 0) {
>   		dev_err(dev, "%pOF: failed to get orientation %d\n", dev->of_node, ret);
>   		return ret;
> diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
> index c09bf3db5e78..5c169fdf265c 100644
> --- a/drivers/gpu/drm/panel/panel-simple.c
> +++ b/drivers/gpu/drm/panel/panel-simple.c
> @@ -693,7 +693,7 @@ static struct panel_simple *panel_simple_probe(struct device *dev)
>   		return dev_err_cast_probe(dev, panel->enable_gpio,
>   					  "failed to request GPIO\n");
>   
> -	err = of_drm_get_panel_orientation(dev->of_node, &panel->orientation);
> +	err = drm_of_get_panel_orientation(dev->of_node, &panel->orientation);
>   	if (err) {
>   		dev_err(dev, "%pOF: failed to get orientation %d\n", dev->of_node, err);
>   		return ERR_PTR(err);
> diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7701.c b/drivers/gpu/drm/panel/panel-sitronix-st7701.c
> index 2f79ec4a2063..11c757752cfb 100644
> --- a/drivers/gpu/drm/panel/panel-sitronix-st7701.c
> +++ b/drivers/gpu/drm/panel/panel-sitronix-st7701.c
> @@ -1296,7 +1296,7 @@ static int st7701_probe(struct device *dev, int connector_type)
>   		return PTR_ERR(st7701->reset);
>   	}
>   
> -	ret = of_drm_get_panel_orientation(dev->of_node, &st7701->orientation);
> +	ret = drm_of_get_panel_orientation(dev->of_node, &st7701->orientation);
>   	if (ret < 0)
>   		return dev_err_probe(dev, ret, "Failed to get orientation\n");
>   
> diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
> index 6c348fe28955..40df2e5b14b2 100644
> --- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c
> +++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
> @@ -874,7 +874,7 @@ static int st7703_probe(struct mipi_dsi_device *dsi)
>   		return dev_err_probe(dev, PTR_ERR(ctx->iovcc),
>   				     "Failed to request iovcc regulator\n");
>   
> -	ret = of_drm_get_panel_orientation(dsi->dev.of_node, &ctx->orientation);
> +	ret = drm_of_get_panel_orientation(dsi->dev.of_node, &ctx->orientation);
>   	if (ret < 0)
>   		return dev_err_probe(&dsi->dev, ret, "Failed to get orientation\n");
>   
> diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> index d5f821d6b23c..0502df34746b 100644
> --- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> +++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> @@ -646,7 +646,7 @@ static int st7789v_probe(struct spi_device *spi)
>   	if (ret)
>   		return dev_err_probe(dev, ret, "Failed to get backlight\n");
>   
> -	ret = of_drm_get_panel_orientation(spi->dev.of_node, &ctx->orientation);
> +	ret = drm_of_get_panel_orientation(spi->dev.of_node, &ctx->orientation);
>   	if (ret)
>   		return dev_err_probe(&spi->dev, ret, "Failed to get orientation\n");
>   
> diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
> index 86b3f9c65c92..b87323443f49 100644
> --- a/include/drm/drm_panel.h
> +++ b/include/drm/drm_panel.h
> @@ -337,19 +337,11 @@ int drm_panel_get_modes(struct drm_panel *panel, struct drm_connector *connector
>   
>   #if defined(CONFIG_OF) && defined(CONFIG_DRM_PANEL)
>   struct drm_panel *of_drm_find_panel(const struct device_node *np);
> -int of_drm_get_panel_orientation(const struct device_node *np,
> -				 enum drm_panel_orientation *orientation);
>   #else
>   static inline struct drm_panel *of_drm_find_panel(const struct device_node *np)
>   {
>   	return ERR_PTR(-ENODEV);
>   }
> -
> -static inline int of_drm_get_panel_orientation(const struct device_node *np,
> -					       enum drm_panel_orientation *orientation)
> -{
> -	return -ENODEV;
> -}
>   #endif
>   
>   #if defined(CONFIG_DRM_PANEL)

-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 6/7] drm/of: Implement drm_of_get_panel_orientation()
  2026-06-29 12:44     ` Thomas Zimmermann
@ 2026-06-29 13:19       ` Thierry Reding
  2026-06-29 13:29       ` Thierry Reding
  1 sibling, 0 replies; 18+ messages in thread
From: Thierry Reding @ 2026-06-29 13:19 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: javierm, maarten.lankhorst, mripard, airlied, simona,
	neil.armstrong, jesszhan0024, rayyan, dri-devel, sashiko-reviews

[-- Attachment #1: Type: text/plain, Size: 2720 bytes --]

On Mon, Jun 29, 2026 at 02:44:57PM +0200, Thomas Zimmermann wrote:
> Hi
> 
> Am 29.06.26 um 14:27 schrieb Thierry Reding:
> > On Thu, Jun 25, 2026 at 11:39:38AM +0200, Thomas Zimmermann wrote:
> > > Implement drm_of_get_panel_orientation() to retrieve a panel's
> > > rotation property as enum drm_panel_orientation. The code has
> > > been taken from of_drm_get_panel_orientation(), so convert that
> > > helper over. Callers of the old helper can be converted as well.
> > > 
> > > Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> > > ---
> > >   drivers/gpu/drm/drm_of.c    | 44 +++++++++++++++++++++++++++++++++++++
> > >   drivers/gpu/drm/drm_panel.c | 26 ++--------------------
> > >   include/drm/drm_of.h        | 11 ++++++++++
> > >   3 files changed, 57 insertions(+), 24 deletions(-)
> > So you're effectively renaming of_drm_get_panel_orientation() to
> > drm_of_get_panel_orientation(), while moving it to drm_of.c,  and then
> > you keep of_drm_get_panel_orientation() as an alias.
> > 
> > I don't understand the use of this. Maybe if we really need to move this
> > out of drm_panel.c to make it more widely available, fine. Maybe we also
> > want the drm_of_ prefix instead of of_drm_, also fine, I suppose. But in
> > that case we should just go ahead and update all callers of the old
> > helper and get rid of it while we're at it. No use in keeping around
> > aliases/duplicates.
> 
> I'm all for it. i though this would be a different issue.

Yeah, understandably. Can't always do everything within one series. In
this case it seems fairly simple to do and we're early in the release
cycle, so there shouldn't be too much in terms of conflicts or new users
yet, so seems like an opportune time.

> > 
> > I've attached a patch to do just that. Feel free to integrate it into
> > the series, or we can apply after your series is merged.
> 
> Thanks.
> 
> Let me split of the  first 5 patches in series and merge them. They are the
> fixes and hardening patches and seem ready to be merged. I'll prepare a
> separate series for the panel orientation with your changes and it can go in
> separately. If we touch all the panel drivers, we should make sure that the
> panel maintainers get another chance of looking over it.

I think I'll need to send a new version which explicitly includes
drm_of.h for all the panels that use the new function. My build tests
were missing some drivers and others include the file implicitly via
some other headers.

Not sure if maintainers really need to look at these since it's
literally just switching out the of_drm prefix for drm_of, but yeah,
can't hurt to send out a series for review.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 6/7] drm/of: Implement drm_of_get_panel_orientation()
  2026-06-29 12:44     ` Thomas Zimmermann
  2026-06-29 13:19       ` Thierry Reding
@ 2026-06-29 13:29       ` Thierry Reding
  1 sibling, 0 replies; 18+ messages in thread
From: Thierry Reding @ 2026-06-29 13:29 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: javierm, maarten.lankhorst, mripard, airlied, simona,
	neil.armstrong, jesszhan0024, rayyan, dri-devel, sashiko-reviews


[-- Attachment #1.1: Type: text/plain, Size: 2170 bytes --]

On Mon, Jun 29, 2026 at 02:44:57PM +0200, Thomas Zimmermann wrote:
> Hi
> 
> Am 29.06.26 um 14:27 schrieb Thierry Reding:
> > On Thu, Jun 25, 2026 at 11:39:38AM +0200, Thomas Zimmermann wrote:
> > > Implement drm_of_get_panel_orientation() to retrieve a panel's
> > > rotation property as enum drm_panel_orientation. The code has
> > > been taken from of_drm_get_panel_orientation(), so convert that
> > > helper over. Callers of the old helper can be converted as well.
> > > 
> > > Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> > > ---
> > >   drivers/gpu/drm/drm_of.c    | 44 +++++++++++++++++++++++++++++++++++++
> > >   drivers/gpu/drm/drm_panel.c | 26 ++--------------------
> > >   include/drm/drm_of.h        | 11 ++++++++++
> > >   3 files changed, 57 insertions(+), 24 deletions(-)
> > So you're effectively renaming of_drm_get_panel_orientation() to
> > drm_of_get_panel_orientation(), while moving it to drm_of.c,  and then
> > you keep of_drm_get_panel_orientation() as an alias.
> > 
> > I don't understand the use of this. Maybe if we really need to move this
> > out of drm_panel.c to make it more widely available, fine. Maybe we also
> > want the drm_of_ prefix instead of of_drm_, also fine, I suppose. But in
> > that case we should just go ahead and update all callers of the old
> > helper and get rid of it while we're at it. No use in keeping around
> > aliases/duplicates.
> 
> I'm all for it. i though this would be a different issue.
> 
> > 
> > I've attached a patch to do just that. Feel free to integrate it into
> > the series, or we can apply after your series is merged.
> 
> Thanks.
> 
> Let me split of the  first 5 patches in series and merge them. They are the
> fixes and hardening patches and seem ready to be merged. I'll prepare a
> separate series for the panel orientation with your changes and it can go in
> separately. If we touch all the panel drivers, we should make sure that the
> panel maintainers get another chance of looking over it.

Here's the updated patch with all the modified drivers build-tested and
checked that the build covers all of them.

Thierry

[-- Attachment #1.2: Type: text/plain, Size: 18494 bytes --]

From 31901850ebf521afc0b24bc90e97dd4af660df9b Mon Sep 17 00:00:00 2001
From: Thierry Reding <treding@nvidia.com>
Date: Mon, 29 Jun 2026 14:23:27 +0200
Subject: [PATCH v2] drm/panel: Use drm_of_get_panel_orientation()

The old of_drm_get_panel_orientation() function was replaced by the
drm_of_get_panel_orientation() in the core DRM OF helpers. Replace all
uses of the old helper and remove it.

Changes in v2:
- include drm_of.h in all drivers to make sure the new symbol is defined

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/gpu/drm/drm_panel.c                   | 20 -------------------
 .../drm/panel/panel-boe-th101mb31ig002-28a.c  |  3 ++-
 .../gpu/drm/panel/panel-boe-tv101wum-nl6.c    |  3 ++-
 .../gpu/drm/panel/panel-chipwealth-ch13726a.c |  3 ++-
 drivers/gpu/drm/panel/panel-edp.c             |  3 ++-
 drivers/gpu/drm/panel/panel-elida-kd35t133.c  |  3 ++-
 .../gpu/drm/panel/panel-focaltech-ota7290b.c  |  3 ++-
 drivers/gpu/drm/panel/panel-himax-hx83102.c   |  3 ++-
 drivers/gpu/drm/panel/panel-himax-hx8394.c    |  3 ++-
 .../gpu/drm/panel/panel-ilitek-ili9806e-dsi.c |  3 ++-
 drivers/gpu/drm/panel/panel-ilitek-ili9881c.c |  3 ++-
 drivers/gpu/drm/panel/panel-ilitek-ili9882t.c |  3 ++-
 .../gpu/drm/panel/panel-jadard-jd9365da-h3.c  |  2 +-
 drivers/gpu/drm/panel/panel-lvds.c            |  2 +-
 drivers/gpu/drm/panel/panel-novatek-nt36523.c |  3 ++-
 drivers/gpu/drm/panel/panel-simple.c          |  2 +-
 drivers/gpu/drm/panel/panel-sitronix-st7701.c |  3 ++-
 drivers/gpu/drm/panel/panel-sitronix-st7703.c |  3 ++-
 .../gpu/drm/panel/panel-sitronix-st7789v.c    |  3 ++-
 include/drm/drm_panel.h                       |  8 --------
 20 files changed, 33 insertions(+), 46 deletions(-)

diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
index eddd13a34c03..d7c6f4824b2d 100644
--- a/drivers/gpu/drm/drm_panel.c
+++ b/drivers/gpu/drm/drm_panel.c
@@ -492,26 +492,6 @@ struct drm_panel *of_drm_find_panel(const struct device_node *np)
 	return ERR_PTR(-EPROBE_DEFER);
 }
 EXPORT_SYMBOL(of_drm_find_panel);
-
-/**
- * of_drm_get_panel_orientation - look up the orientation of the panel through
- * the "rotation" binding from a device tree node
- * @np: device tree node of the panel
- * @orientation: orientation enum to be filled in
- *
- * Looks up the rotation of a panel in the device tree. The orientation of the
- * panel is expressed as a property name "rotation" in the device tree. The
- * rotation in the device tree is counter clockwise.
- *
- * Return: 0 when a valid rotation value (0, 90, 180, or 270) is read or the
- * rotation property doesn't exist. Return a negative error code on failure.
- */
-int of_drm_get_panel_orientation(const struct device_node *np,
-				 enum drm_panel_orientation *orientation)
-{
-	return drm_of_get_panel_orientation(np, orientation);
-}
-EXPORT_SYMBOL(of_drm_get_panel_orientation);
 #endif
 
 /* Find panel by fwnode. This should be identical to of_drm_find_panel(). */
diff --git a/drivers/gpu/drm/panel/panel-boe-th101mb31ig002-28a.c b/drivers/gpu/drm/panel/panel-boe-th101mb31ig002-28a.c
index 01b4458e55ad..a70a2e58f88c 100644
--- a/drivers/gpu/drm/panel/panel-boe-th101mb31ig002-28a.c
+++ b/drivers/gpu/drm/panel/panel-boe-th101mb31ig002-28a.c
@@ -15,6 +15,7 @@
 #include <drm/drm_connector.h>
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_modes.h>
+#include <drm/drm_of.h>
 #include <drm/drm_panel.h>
 #include <drm/drm_probe_helper.h>
 
@@ -380,7 +381,7 @@ static int boe_th101mb31ig002_dsi_probe(struct mipi_dsi_device *dsi)
 		return dev_err_probe(&dsi->dev, PTR_ERR(ctx->reset),
 				     "Failed to get reset GPIO\n");
 
-	ret = of_drm_get_panel_orientation(dsi->dev.of_node,
+	ret = drm_of_get_panel_orientation(dsi->dev.of_node,
 					   &ctx->orientation);
 	if (ret)
 		return dev_err_probe(&dsi->dev, ret,
diff --git a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
index 658ce64c71eb..150dff3ab6c3 100644
--- a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
+++ b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
@@ -13,6 +13,7 @@
 #include <drm/drm_connector.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_mipi_dsi.h>
+#include <drm/drm_of.h>
 #include <drm/drm_panel.h>
 
 #include <video/mipi_display.h>
@@ -1722,7 +1723,7 @@ static int boe_panel_add(struct boe_panel *boe)
 
 	boe->base.prepare_prev_first = true;
 
-	err = of_drm_get_panel_orientation(dev->of_node, &boe->orientation);
+	err = drm_of_get_panel_orientation(dev->of_node, &boe->orientation);
 	if (err < 0) {
 		dev_err(dev, "%pOF: failed to get orientation %d\n", dev->of_node, err);
 		return err;
diff --git a/drivers/gpu/drm/panel/panel-chipwealth-ch13726a.c b/drivers/gpu/drm/panel/panel-chipwealth-ch13726a.c
index be76bc825c3f..562dc573528d 100644
--- a/drivers/gpu/drm/panel/panel-chipwealth-ch13726a.c
+++ b/drivers/gpu/drm/panel/panel-chipwealth-ch13726a.c
@@ -13,6 +13,7 @@
 
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_modes.h>
+#include <drm/drm_of.h>
 #include <drm/drm_panel.h>
 
 #include <video/mipi_display.h>
@@ -268,7 +269,7 @@ static int ch13726a_probe(struct mipi_dsi_device *dsi)
 		return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio),
 				     "Failed to get reset-gpios\n");
 
-	ret = of_drm_get_panel_orientation(dev->of_node, &ctx->orientation);
+	ret = drm_of_get_panel_orientation(dev->of_node, &ctx->orientation);
 	if (ret < 0) {
 		dev_err(dev, "%pOF: failed to get orientation %d\n", dev->of_node, ret);
 		return ret;
diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c
index aa27d6cd932e..3d3865329ece 100644
--- a/drivers/gpu/drm/panel/panel-edp.c
+++ b/drivers/gpu/drm/panel/panel-edp.c
@@ -40,6 +40,7 @@
 #include <drm/drm_crtc.h>
 #include <drm/drm_device.h>
 #include <drm/drm_edid.h>
+#include <drm/drm_of.h>
 #include <drm/drm_panel.h>
 
 /**
@@ -865,7 +866,7 @@ static int panel_edp_probe(struct device *dev, const struct panel_desc *desc,
 		return dev_err_probe(dev, PTR_ERR(panel->enable_gpio),
 				     "failed to request GPIO\n");
 
-	err = of_drm_get_panel_orientation(dev->of_node, &panel->orientation);
+	err = drm_of_get_panel_orientation(dev->of_node, &panel->orientation);
 	if (err) {
 		dev_err(dev, "%pOF: failed to get orientation %d\n", dev->of_node, err);
 		return err;
diff --git a/drivers/gpu/drm/panel/panel-elida-kd35t133.c b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
index 1f177834d629..d23002b5a2d7 100644
--- a/drivers/gpu/drm/panel/panel-elida-kd35t133.c
+++ b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
@@ -21,6 +21,7 @@
 
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_modes.h>
+#include <drm/drm_of.h>
 #include <drm/drm_panel.h>
 
 /* Manufacturer specific Commands send via DSI */
@@ -233,7 +234,7 @@ static int kd35t133_probe(struct mipi_dsi_device *dsi)
 		return ret;
 	}
 
-	ret = of_drm_get_panel_orientation(dev->of_node, &ctx->orientation);
+	ret = drm_of_get_panel_orientation(dev->of_node, &ctx->orientation);
 	if (ret < 0) {
 		dev_err(dev, "%pOF: failed to get orientation %d\n", dev->of_node, ret);
 		return ret;
diff --git a/drivers/gpu/drm/panel/panel-focaltech-ota7290b.c b/drivers/gpu/drm/panel/panel-focaltech-ota7290b.c
index ed02a8daf96f..bbc870b8fda8 100644
--- a/drivers/gpu/drm/panel/panel-focaltech-ota7290b.c
+++ b/drivers/gpu/drm/panel/panel-focaltech-ota7290b.c
@@ -17,6 +17,7 @@
 
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_modes.h>
+#include <drm/drm_of.h>
 #include <drm/drm_panel.h>
 #include <drm/drm_probe_helper.h>
 
@@ -181,7 +182,7 @@ static int ota7290b_probe(struct mipi_dsi_device *dsi)
 		return dev_err_probe(&dsi->dev, PTR_ERR(ctx->vdd),
 					"Couldn't get our VDD supply\n");
 
-	ret = of_drm_get_panel_orientation(dsi->dev.of_node, &ctx->orientation);
+	ret = drm_of_get_panel_orientation(dsi->dev.of_node, &ctx->orientation);
 	if (ret) {
 		dev_err(&dsi->dev, "%pOF: failed to get orientation: %d\n",
 			dsi->dev.of_node, ret);
diff --git a/drivers/gpu/drm/panel/panel-himax-hx83102.c b/drivers/gpu/drm/panel/panel-himax-hx83102.c
index d7e5664a5838..6a0851ccf9bb 100644
--- a/drivers/gpu/drm/panel/panel-himax-hx83102.c
+++ b/drivers/gpu/drm/panel/panel-himax-hx83102.c
@@ -17,6 +17,7 @@
 #include <drm/drm_connector.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_mipi_dsi.h>
+#include <drm/drm_of.h>
 #include <drm/drm_panel.h>
 
 #include <video/mipi_display.h>
@@ -1264,7 +1265,7 @@ static int hx83102_panel_add(struct hx83102 *ctx)
 
 	ctx->base.prepare_prev_first = true;
 
-	err = of_drm_get_panel_orientation(dev->of_node, &ctx->orientation);
+	err = drm_of_get_panel_orientation(dev->of_node, &ctx->orientation);
 	if (err < 0)
 		return dev_err_probe(dev, err, "failed to get orientation\n");
 
diff --git a/drivers/gpu/drm/panel/panel-himax-hx8394.c b/drivers/gpu/drm/panel/panel-himax-hx8394.c
index bf80354567df..b57ccce38cf8 100644
--- a/drivers/gpu/drm/panel/panel-himax-hx8394.c
+++ b/drivers/gpu/drm/panel/panel-himax-hx8394.c
@@ -22,6 +22,7 @@
 
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_modes.h>
+#include <drm/drm_of.h>
 #include <drm/drm_panel.h>
 
 #define DRV_NAME "panel-himax-hx8394"
@@ -992,7 +993,7 @@ static int hx8394_probe(struct mipi_dsi_device *dsi)
 		return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio),
 				     "Failed to get reset gpio\n");
 
-	ret = of_drm_get_panel_orientation(dev->of_node, &ctx->orientation);
+	ret = drm_of_get_panel_orientation(dev->of_node, &ctx->orientation);
 	if (ret < 0) {
 		dev_err(dev, "%pOF: failed to get orientation %d\n", dev->of_node, ret);
 		return ret;
diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c b/drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c
index ecdbed8d4a3a..47b79fac1562 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c
@@ -10,6 +10,7 @@
 
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_modes.h>
+#include <drm/drm_of.h>
 #include <drm/drm_panel.h>
 #include <drm/drm_probe_helper.h>
 
@@ -132,7 +133,7 @@ static int ili9806e_dsi_probe(struct mipi_dsi_device *dsi)
 	dsi->format = ctx->desc->format;
 	dsi->lanes = ctx->desc->lanes;
 
-	ret = of_drm_get_panel_orientation(dev->of_node, &ctx->orientation);
+	ret = drm_of_get_panel_orientation(dev->of_node, &ctx->orientation);
 	if (ret)
 		return dev_err_probe(dev, ret, "Failed to get orientation\n");
 
diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
index 0652cdb57d11..3abdd0870e83 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
@@ -16,6 +16,7 @@
 
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_modes.h>
+#include <drm/drm_of.h>
 #include <drm/drm_panel.h>
 
 #include <video/mipi_display.h>
@@ -2571,7 +2572,7 @@ static int ili9881c_dsi_probe(struct mipi_dsi_device *dsi)
 		return dev_err_probe(&dsi->dev, PTR_ERR(ctx->reset),
 				     "Couldn't get our reset GPIO\n");
 
-	ret = of_drm_get_panel_orientation(dsi->dev.of_node, &ctx->orientation);
+	ret = drm_of_get_panel_orientation(dsi->dev.of_node, &ctx->orientation);
 	if (ret) {
 		dev_err(&dsi->dev, "%pOF: failed to get orientation: %d\n",
 			dsi->dev.of_node, ret);
diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c b/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c
index 5f4e0d82ee67..6d07fe901357 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c
@@ -13,6 +13,7 @@
 #include <drm/drm_connector.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_mipi_dsi.h>
+#include <drm/drm_of.h>
 #include <drm/drm_panel.h>
 
 #include <video/mipi_display.h>
@@ -795,7 +796,7 @@ static int ili9882t_add(struct ili9882t *ili)
 
 	gpiod_set_value_cansleep(ili->enable_gpio, 0);
 
-	err = of_drm_get_panel_orientation(dev->of_node, &ili->orientation);
+	err = drm_of_get_panel_orientation(dev->of_node, &ili->orientation);
 	if (err < 0) {
 		dev_err(dev, "%pOF: failed to get orientation %d\n", dev->of_node, err);
 		return err;
diff --git a/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c b/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c
index f6b04de1182e..67ef9e0fea03 100644
--- a/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c
+++ b/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c
@@ -2992,7 +2992,7 @@ static int jadard_dsi_probe(struct mipi_dsi_device *dsi)
 		return dev_err_probe(&dsi->dev, PTR_ERR(jadard->vccio),
 				"failed to get vccio regulator\n");
 
-	ret = of_drm_get_panel_orientation(dev->of_node, &jadard->orientation);
+	ret = drm_of_get_panel_orientation(dev->of_node, &jadard->orientation);
 	if (ret < 0)
 		return dev_err_probe(dev, ret, "failed to get orientation\n");
 
diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c
index 46b07f38559f..37f7498449ec 100644
--- a/drivers/gpu/drm/panel/panel-lvds.c
+++ b/drivers/gpu/drm/panel/panel-lvds.c
@@ -126,7 +126,7 @@ static int panel_lvds_parse_dt(struct panel_lvds *lvds)
 	struct device_node *np = lvds->dev->of_node;
 	int ret;
 
-	ret = of_drm_get_panel_orientation(np, &lvds->orientation);
+	ret = drm_of_get_panel_orientation(np, &lvds->orientation);
 	if (ret < 0) {
 		dev_err(lvds->dev, "%pOF: failed to get orientation %d\n", np, ret);
 		return ret;
diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36523.c b/drivers/gpu/drm/panel/panel-novatek-nt36523.c
index 226d91daf8c7..34b9123d3fd7 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt36523.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt36523.c
@@ -19,6 +19,7 @@
 #include <drm/drm_crtc.h>
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_modes.h>
+#include <drm/drm_of.h>
 #include <drm/drm_panel.h>
 
 #define DSI_NUM_MIN 1
@@ -1206,7 +1207,7 @@ static int nt36523_probe(struct mipi_dsi_device *dsi)
 	pinfo->dsi[0] = dsi;
 	mipi_dsi_set_drvdata(dsi, pinfo);
 
-	ret = of_drm_get_panel_orientation(dev->of_node, &pinfo->orientation);
+	ret = drm_of_get_panel_orientation(dev->of_node, &pinfo->orientation);
 	if (ret < 0) {
 		dev_err(dev, "%pOF: failed to get orientation %d\n", dev->of_node, ret);
 		return ret;
diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index c09bf3db5e78..5c169fdf265c 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -693,7 +693,7 @@ static struct panel_simple *panel_simple_probe(struct device *dev)
 		return dev_err_cast_probe(dev, panel->enable_gpio,
 					  "failed to request GPIO\n");
 
-	err = of_drm_get_panel_orientation(dev->of_node, &panel->orientation);
+	err = drm_of_get_panel_orientation(dev->of_node, &panel->orientation);
 	if (err) {
 		dev_err(dev, "%pOF: failed to get orientation %d\n", dev->of_node, err);
 		return ERR_PTR(err);
diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7701.c b/drivers/gpu/drm/panel/panel-sitronix-st7701.c
index 2f79ec4a2063..f16e0de1ea60 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7701.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7701.c
@@ -7,6 +7,7 @@
 #include <drm/drm_mipi_dbi.h>
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_modes.h>
+#include <drm/drm_of.h>
 #include <drm/drm_panel.h>
 
 #include <linux/bitfield.h>
@@ -1296,7 +1297,7 @@ static int st7701_probe(struct device *dev, int connector_type)
 		return PTR_ERR(st7701->reset);
 	}
 
-	ret = of_drm_get_panel_orientation(dev->of_node, &st7701->orientation);
+	ret = drm_of_get_panel_orientation(dev->of_node, &st7701->orientation);
 	if (ret < 0)
 		return dev_err_probe(dev, ret, "Failed to get orientation\n");
 
diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
index 6c348fe28955..9916036630b7 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
@@ -21,6 +21,7 @@
 
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_modes.h>
+#include <drm/drm_of.h>
 #include <drm/drm_panel.h>
 
 #define DRV_NAME "panel-sitronix-st7703"
@@ -874,7 +875,7 @@ static int st7703_probe(struct mipi_dsi_device *dsi)
 		return dev_err_probe(dev, PTR_ERR(ctx->iovcc),
 				     "Failed to request iovcc regulator\n");
 
-	ret = of_drm_get_panel_orientation(dsi->dev.of_node, &ctx->orientation);
+	ret = drm_of_get_panel_orientation(dsi->dev.of_node, &ctx->orientation);
 	if (ret < 0)
 		return dev_err_probe(&dsi->dev, ret, "Failed to get orientation\n");
 
diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
index d5f821d6b23c..da6ed31d151e 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
@@ -14,6 +14,7 @@
 
 #include <drm/drm_device.h>
 #include <drm/drm_modes.h>
+#include <drm/drm_of.h>
 #include <drm/drm_panel.h>
 
 #define ST7789V_RAMCTRL_CMD		0xb0
@@ -646,7 +647,7 @@ static int st7789v_probe(struct spi_device *spi)
 	if (ret)
 		return dev_err_probe(dev, ret, "Failed to get backlight\n");
 
-	ret = of_drm_get_panel_orientation(spi->dev.of_node, &ctx->orientation);
+	ret = drm_of_get_panel_orientation(spi->dev.of_node, &ctx->orientation);
 	if (ret)
 		return dev_err_probe(&spi->dev, ret, "Failed to get orientation\n");
 
diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
index 86b3f9c65c92..b87323443f49 100644
--- a/include/drm/drm_panel.h
+++ b/include/drm/drm_panel.h
@@ -337,19 +337,11 @@ int drm_panel_get_modes(struct drm_panel *panel, struct drm_connector *connector
 
 #if defined(CONFIG_OF) && defined(CONFIG_DRM_PANEL)
 struct drm_panel *of_drm_find_panel(const struct device_node *np);
-int of_drm_get_panel_orientation(const struct device_node *np,
-				 enum drm_panel_orientation *orientation);
 #else
 static inline struct drm_panel *of_drm_find_panel(const struct device_node *np)
 {
 	return ERR_PTR(-ENODEV);
 }
-
-static inline int of_drm_get_panel_orientation(const struct device_node *np,
-					       enum drm_panel_orientation *orientation)
-{
-	return -ENODEV;
-}
 #endif
 
 #if defined(CONFIG_DRM_PANEL)
-- 
2.54.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2026-06-29 13:30 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-25  9:39 [PATCH v3 0/7] drm/sysfb: simpledrm: Various improvements Thomas Zimmermann
2026-06-25  9:39 ` [PATCH v3 1/7] drm/sysfb: simpledrm: Improve framebuffer-size validation Thomas Zimmermann
2026-06-25 10:05   ` sashiko-bot
2026-06-25  9:39 ` [PATCH v3 2/7] drm/sysfb: simpledrm: Improve panel-size validation Thomas Zimmermann
2026-06-25  9:39 ` [PATCH v3 3/7] drm/sysfb: simpledrm: Inline simplefb_get_validated_int() Thomas Zimmermann
2026-06-25  9:39 ` [PATCH v3 4/7] drm/sysfb: simpledrm: Improve stride validation Thomas Zimmermann
2026-06-25  9:39 ` [PATCH v3 5/7] drm/sysfb: simpledrm: Validate mmap size against framebuffer size Thomas Zimmermann
2026-06-25 10:27   ` sashiko-bot
2026-06-25  9:39 ` [PATCH v3 6/7] drm/of: Implement drm_of_get_panel_orientation() Thomas Zimmermann
2026-06-29 12:27   ` Thierry Reding
2026-06-29 12:44     ` Thomas Zimmermann
2026-06-29 13:19       ` Thierry Reding
2026-06-29 13:29       ` Thierry Reding
2026-06-29 12:28   ` Thierry Reding
2026-06-25  9:39 ` [PATCH v3 7/7] drm/sysfb: simpledrm: Read panel orientation from DT node Thomas Zimmermann
2026-06-29 12:27   ` Thierry Reding
2026-06-25 10:56 ` [PATCH v3 0/7] drm/sysfb: simpledrm: Various improvements Maxime Ripard
2026-06-29 11:02 ` Javier Martinez Canillas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox