[v2,07/10] drm: bridge: samsung-dsim: don't re-activate the bridge if already setup

Message ID 20240911151555.2915258-7-dario.binacchi@amarulasolutions.com
State New
Headers show
Series
  • [v2,01/10] pmdomain: core: fix "sd_count" field setting
Related show

Commit Message

Dario Binacchi Sept. 11, 2024, 3:15 p.m. UTC
The patch does not re-execute the hardware initialization/activation
procedure for the bridge if it is already operational.
This feature is crucial when supporting the simple framebuffer, as the
controller has already been initialized by the bootloader.

Co-Developed-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---
 drivers/gpu/drm/bridge/samsung-dsim.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

Patch

diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c
index 95fedc68b0ae..bcf1746bfb6b 100644
--- a/drivers/gpu/drm/bridge/samsung-dsim.c
+++ b/drivers/gpu/drm/bridge/samsung-dsim.c
@@ -1912,6 +1912,7 @@  int samsung_dsim_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct samsung_dsim *dsi;
+	bool initialized;
 	int ret, i;
 
 	dsi = devm_kzalloc(dev, sizeof(*dsi), GFP_KERNEL);
@@ -1989,6 +1990,13 @@  int samsung_dsim_probe(struct platform_device *pdev)
 	dsi->bridge.funcs = &samsung_dsim_bridge_funcs;
 	dsi->bridge.of_node = dev->of_node;
 	dsi->bridge.type = DRM_MODE_CONNECTOR_DSI;
+	initialized = of_property_read_bool(dev->of_node, "samsung,boot-on");
+	if (initialized) {
+		dsi->state = DSIM_STATE_INITIALIZED | DSIM_STATE_ENABLED;
+		ret = pm_runtime_resume_and_get(dev);
+		if (ret)
+			goto err_disable_runtime;
+	}
 
 	/* DE_LOW: i.MX8M Mini/Nano LCDIF-DSIM glue logic inverts HS/VS/DE */
 	if (dsi->plat_data->hw_type == DSIM_TYPE_IMX8MM)
@@ -1999,11 +2007,14 @@  int samsung_dsim_probe(struct platform_device *pdev)
 	if (dsi->plat_data->host_ops && dsi->plat_data->host_ops->register_host) {
 		ret = dsi->plat_data->host_ops->register_host(dsi);
 		if (ret)
-			goto err_disable_runtime;
+			goto err_put_runtime;
 	}
 
 	return 0;
 
+err_put_runtime:
+	if (initialized)
+		pm_runtime_put_sync(dev);
 err_disable_runtime:
 	pm_runtime_disable(dev);