[RFC,v2,1/6] drm/panel: Add sro_enable_resources hook

Message ID 20261202103901.577431-2-dario.binacchi@amarulasolutions.com
State New
Headers
Series drm: State readout for the i.MX8MN display pipeline |

Commit Message

Dario Binacchi Dec. 2, 2026, 10:38 a.m. UTC
When a panel is read out as active, the panel bridge prepares and
enables it, so that its driver holds the resources it releases when
the panel is unprepared. Doing so also resets and initializes a panel
that is already displaying an image.

Add the sro_enable_resources hook, for a panel driver to acquire its
resources without touching the hardware. On success the panel is
marked as prepared and enabled.

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

---

Changes in v2:
- Rename the hook to sro_enable_resources
- Call the hook from the panel bridge install state added by the
  state readout series

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

Patch

diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
index ad521b6894ca..0286934de676 100644
--- a/drivers/gpu/drm/drm_panel.c
+++ b/drivers/gpu/drm/drm_panel.c
@@ -360,6 +360,14 @@  panel_bridge_install_state(struct drm_bridge *bridge,
 {
 	struct drm_panel *panel = drm_bridge_to_panel(bridge);
 
+	/* Take over the running panel without reprogramming it */
+	if (panel->funcs && panel->funcs->sro_enable_resources &&
+	    !panel->funcs->sro_enable_resources(panel)) {
+		panel->prepared = true;
+		panel->enabled = true;
+		return;
+	}
+
 	if (!panel->prepared)
 		drm_panel_prepare(panel);
 
diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
index d9059a9606fc..f64b4771a54a 100644
--- a/include/drm/drm_panel.h
+++ b/include/drm/drm_panel.h
@@ -136,6 +136,16 @@  struct drm_panel_funcs {
 	 * Allows panels to create panels-specific debugfs files.
 	 */
 	void (*debugfs_init)(struct drm_panel *panel, struct dentry *root);
+
+	/**
+	 * @sro_enable_resources:
+	 *
+	 * 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_enable_resources)(struct drm_panel *panel);
 };
 
 struct drm_panel_follower_funcs {