[22/33] video: stm32: ltdc: fall back to a panel when no bridge is connected

Message ID 20261104085036.4012238-23-dario.binacchi@amarulasolutions.com
State New
Headers
Series Add Engicam MicroGEA-STM32MP257D-RMM board support |

Commit Message

Dario Binacchi Nov. 4, 2026, 8:49 a.m. UTC
With CONFIG_VIDEO_BRIDGE enabled, only bridges are looked up on the LTDC
endpoints, so a panel directly connected to the LTDC, as the RGB one on
the Engicam MicroGEA-STM32MP257D-RMM board, is never found.

Look up a panel when no bridge is connected to the endpoint. Also, reset
the bridge and the panel when no panel is found behind the bridge, so
that the next endpoint is not affected by the failed lookup.

Fixes: 35be94614733 ("video: stm32: ltdc: properly search the first available panel")
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---

 drivers/video/stm32/stm32_ltdc.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

-- 
2.43.0
  

Patch

diff --git a/drivers/video/stm32/stm32_ltdc.c b/drivers/video/stm32/stm32_ltdc.c
index 267da5debe4e..7bd6724bc2a7 100644
--- a/drivers/video/stm32/stm32_ltdc.c
+++ b/drivers/video/stm32/stm32_ltdc.c
@@ -593,16 +593,21 @@  static int stm32_ltdc_display_init(struct udevice *dev, ofnode *ep_node,
 
 	if (IS_ENABLED(CONFIG_VIDEO_BRIDGE)) {
 		ret = stm32_ltdc_get_remote_device(dev, *ep_node, UCLASS_VIDEO_BRIDGE, bridge);
-		if (ret)
+		if (!ret) {
+			ret = stm32_ltdc_get_panel(*bridge, panel);
+			if (ret) {
+				*bridge = NULL;
+				*panel = NULL;
+			}
+
 			return ret;
+		}
 
-		ret = stm32_ltdc_get_panel(*bridge, panel);
-	} else {
-		/* no bridge, search a panel from display controller node */
-		ret = stm32_ltdc_get_remote_device(dev, *ep_node, UCLASS_PANEL, panel);
+		*bridge = NULL;
 	}
 
-	return ret;
+	/* no bridge, search a panel from display controller node */
+	return stm32_ltdc_get_remote_device(dev, *ep_node, UCLASS_PANEL, panel);
 }
 
 #if IS_ENABLED(CONFIG_TARGET_STM32F469_DISCOVERY)