summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2026-07-01 14:03:19 +0200
committerThomas Zimmermann <tzimmermann@suse.de>2026-07-08 13:44:40 +0200
commitd131fadc933de446f9bd7f689fa03d7e95cb5ceb (patch)
treeae0c3344f4a2308ebaadb005ee0c020fc9db06d3
parentf3117a847ad82b4b54a0e62f430228da16420be6 (diff)
drm/sysfb: simpledrm: Read panel orientation from DT node
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> Reviewed-by: Thierry Reding <treding@nvidia.com> Reviewed-by: Maxime Ripard <mripard@kernel.org> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://patch.msgid.link/20260701121055.192475-3-tzimmermann@suse.de
-rw-r--r--drivers/gpu/drm/sysfb/simpledrm.c11
1 files 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);