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 <mich...@amarulasolutions.com>
Signed-off-by: Michael Trimarchi <mich...@amarulasolutions.com>
Signed-off-by: Dario Binacchi <dario.binac...@amarulasolutions.com>
---

 drivers/gpu/drm/bridge/samsung-dsim.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c 
b/drivers/gpu/drm/bridge/samsung-dsim.c
index 430f8adebf9c..7c03215bb004 100644
--- a/drivers/gpu/drm/bridge/samsung-dsim.c
+++ b/drivers/gpu/drm/bridge/samsung-dsim.c
@@ -1933,6 +1933,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);
@@ -2010,6 +2011,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)
@@ -2020,11 +2028,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);
 
-- 
2.43.0

Reply via email to