[RFC PATCH 2/8] drm/panel: Add sro_install hook

From: Dario Binacchi

Date: Sun Nov 22 2026 - 10:30:59 EST


The panel bridge assumes the panel is enabled whenever its pipeline
is read out as active, but the panel is left marked as unprepared and
disabled. The following disable is then skipped, and the panel driver
never gets the chance to acquire the resources it will release when
unprepared.

Add the sro_install hook, called when the state read out from the
hardware is installed. On success the panel is marked as prepared and
enabled.

Signed-off-by: Dario Binacchi <dario.binacchi@xxxxxxxxxxxxxxxxxxxx>
---

drivers/gpu/drm/drm_panel.c | 16 ++++++++++++++++
include/drm/drm_panel.h | 10 ++++++++++
2 files changed, 26 insertions(+)

diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
index bef0e6af73ba..daccf98e5513 100644
--- a/drivers/gpu/drm/drm_panel.c
+++ b/drivers/gpu/drm/drm_panel.c
@@ -346,6 +346,21 @@ panel_bridge_connector_readout(struct drm_bridge *bridge,
return 0;
}

+static void panel_bridge_install_state(struct drm_bridge *bridge,
+ struct drm_bridge_state *bridge_state)
+{
+ struct drm_panel *panel = drm_bridge_to_panel(bridge);
+
+ if (!panel->funcs || !panel->funcs->sro_install)
+ return;
+
+ if (panel->funcs->sro_install(panel))
+ return;
+
+ panel->prepared = true;
+ panel->enabled = true;
+}
+
static const struct drm_bridge_funcs panel_bridge_bridge_funcs = {
.attach = panel_bridge_attach,
.detach = panel_bridge_detach,
@@ -360,6 +375,7 @@ static const struct drm_bridge_funcs panel_bridge_bridge_funcs = {
.atomic_get_input_bus_fmts = drm_atomic_helper_bridge_propagate_bus_fmt,
.debugfs_init = panel_bridge_debugfs_init,
.atomic_sro_readout_state = panel_bridge_readout_state,
+ .atomic_sro_install_state = panel_bridge_install_state,
.atomic_sro_compare_state = drm_atomic_helper_bridge_compare_state,
.atomic_sro_connector_readout = panel_bridge_connector_readout,
};
diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
index 58113ea7d63a..66f9fc0828f1 100644
--- a/include/drm/drm_panel.h
+++ b/include/drm/drm_panel.h
@@ -148,6 +148,16 @@ struct drm_panel_funcs {
* Allows panels to create panels-specific debugfs files.
*/
void (*debugfs_init)(struct drm_panel *panel, struct dentry *root);
+
+ /**
+ * @sro_install:
+ *
+ * Acquire the resources of a panel found enabled when the hardware
+ * state was read out, without touching the hardware.
+ *
+ * This function is optional.
+ */
+ int (*sro_install)(struct drm_panel *panel);
};

struct drm_panel_follower_funcs {
--
2.43.0