openwrt/target/linux/bcm27xx/patches-5.15/950-0688-drm-panel-Add-and-initialise-an-orientation-field-to.patch

90 lines
2.7 KiB
Diff
Raw Normal View History

From a2ce322776832848b320ece1aa7e3485bfe4b5f3 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Tue, 1 Feb 2022 12:20:20 +0000
Subject: [PATCH] drm/panel: Add and initialise an orientation field to
drm_panel
Current usage of drm_connector_set_panel_orientation is from a panel's
get_modes call. However if the panel orientation property doesn't
exist on the connector at this point, then drm_mode_object triggers
WARNs as the connector is already registered.
Add an orientation variable to struct drm_panel and initialise it from
drm_panel_init.
panel_bridge_attach can then create the property before the connector
is registered.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/gpu/drm/bridge/panel.c | 4 ++++
drivers/gpu/drm/drm_panel.c | 15 ++++++++++-----
include/drm/drm_panel.h | 8 ++++++++
3 files changed, 22 insertions(+), 5 deletions(-)
--- a/drivers/gpu/drm/bridge/panel.c
+++ b/drivers/gpu/drm/bridge/panel.c
kernel: bump 5.15 to 5.15.62 Deleted following upstreamed patches: bcm27xx: 950-0006-drm-vc4-hdmi-Fix-HPD-GPIO-detection.patch bcm27xx: 950-0420-drm-vc4-Adopt-the-dma-configuration-from-the-HVS-or-.patch bcm27xx: 950-0425-drm-vc4-A-present-but-empty-dmas-disables-audio.patch bcm27xx: 950-0432-vc4-drm-Avoid-full-hdmi-audio-fifo-writes.patch bcm27xx: 950-0433-vc4-drm-vc4_plane-Remove-subpixel-positioning-check.patch bcm27xx: 950-0435-drm-vc4-Correct-pixel-order-for-DSI0.patch bcm27xx: 950-0436-drm-vc4-Register-dsi0-as-the-correct-vc4-encoder-typ.patch bcm27xx: 950-0437-drm-vc4-Fix-dsi0-interrupt-support.patch bcm27xx: 950-0438-drm-vc4-Add-correct-stop-condition-to-vc4_dsi_encode.patch bcm27xx: 950-0443-drm-vc4-Fix-timings-for-interlaced-modes.patch bcm27xx: 950-0445-drm-vc4-Fix-margin-calculations-for-the-right-bottom.patch bcm27xx: 950-0475-drm-vc4-Reset-HDMI-MISC_CONTROL-register.patch bcm27xx: 950-0476-drm-vc4-Release-workaround-buffer-and-DMA-in-error-p.patch bcm27xx: 950-0477-drm-vc4-Correct-DSI-divider-calculations.patch bcm27xx: 950-0664-drm-vc4-dsi-Correct-max-divider-to-255-not-7.patch bcm53xx: 072-next-ARM_dts_BCM53015-add-mr26.patch mediatek: 920-linux-next-dts-mt7622-bpi-r64-fix-wps-button.patch Manually rebased following patches: bcm27xx: 950-0004-drm-vc4-hdmi-Remove-the-DDC-probing-for-status-detec.patch bcm27xx: 950-0700-net-phy-lan87xx-Decrease-phy-polling-rate.patch bcm27xx: 950-0711-drm-vc4-Rename-bridge-to-out_bridge.patch bcm27xx: 950-0713-drm-vc4-Remove-splitting-the-bridge-chain-from-the-d.patch bcm27xx: 950-0715-drm-vc4-Convert-vc4_dsi-to-using-a-bridge-instead-of.patch bcm27xx: 950-0787-vc4-drm-vc4_plane-Keep-fractional-source-coords-insi.patch bcm27xx: 950-0914-mmc-block-Don-t-do-single-sector-reads-during-recove.patch Runtime tested on turris-omnia and glinet-b1300. Tested-by: John Audia <therealgraysky@proton.me> [bcm2711/RPi4B, mt7622/RT3200] Signed-off-by: Petr Štetiar <ynezz@true.cz>
2022-08-22 12:02:36 +00:00
@@ -80,6 +80,10 @@ static int panel_bridge_attach(struct dr
return ret;
}
+ /* set up connector's "panel orientation" property */
+ drm_connector_set_panel_orientation(&panel_bridge->connector,
+ panel_bridge->panel->orientation);
+
drm_connector_attach_encoder(&panel_bridge->connector,
bridge->encoder);
--- a/drivers/gpu/drm/drm_panel.c
+++ b/drivers/gpu/drm/drm_panel.c
@@ -61,6 +61,9 @@ void drm_panel_init(struct drm_panel *pa
panel->dev = dev;
panel->funcs = funcs;
panel->connector_type = connector_type;
+
+ panel->orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
+ of_drm_get_panel_orientation(dev->of_node, &panel->orientation);
}
EXPORT_SYMBOL(drm_panel_init);
@@ -289,16 +292,18 @@ int of_drm_get_panel_orientation(const s
if (ret < 0)
return ret;
- if (rotation == 0)
+ if (rotation == 0) {
*orientation = DRM_MODE_PANEL_ORIENTATION_NORMAL;
- else if (rotation == 90)
+ } else if (rotation == 90) {
*orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP;
- else if (rotation == 180)
+ } else if (rotation == 180) {
*orientation = DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP;
- else if (rotation == 270)
+ } else if (rotation == 270) {
*orientation = DRM_MODE_PANEL_ORIENTATION_LEFT_UP;
- else
+ } else {
+ DRM_ERROR("%pOF: invalid orientation %d\n", np, ret);
return -EINVAL;
+ }
return 0;
}
--- a/include/drm/drm_panel.h
+++ b/include/drm/drm_panel.h
@@ -166,6 +166,14 @@ struct drm_panel {
int connector_type;
/**
+ * @orientation:
+ *
+ * Panel orientation at initialisation. This is used to initialise the
+ * drm_connector property for panel orientation.
+ */
+ enum drm_panel_orientation orientation;
+
+ /**
* @list:
*
* Panel entry in registry.