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

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

Commit Message

Dario Binacchi Nov. 7, 2026, 2:32 p.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>
---

(no changes since v1)

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

-- 
2.43.0
  

Comments

Yannick FERTRE Nov. 27, 2026, 9:45 a.m. UTC | #1
Hi Dario,

thanks for the patch.


Acked-by: Yannick Fertre <yannick.fertre@foss.st.com>

Tested-by: Yannick Fertre <yannick.fertre@foss.st.com>


Best regards

On 11/7/26 15:32, Dario Binacchi wrote:
> 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>
> ---
>
> (no changes since v1)
>
>   drivers/video/stm32/stm32_ltdc.c | 17 +++++++++++------
>   1 file changed, 11 insertions(+), 6 deletions(-)
>
> 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)
  
Patrice CHOTARD Nov. 27, 2026, 1:16 p.m. UTC | #2
On 11/27/26 10:45, Yannick FERTRE wrote:
> Hi Dario,
> 
> thanks for the patch.
> 
> 
> Acked-by: Yannick Fertre <yannick.fertre@foss.st.com>
> 
> Tested-by: Yannick Fertre <yannick.fertre@foss.st.com>
> 
> 
> Best regards
> 
> On 11/7/26 15:32, Dario Binacchi wrote:
>> 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>
>> ---
>>
>> (no changes since v1)
>>
>>   drivers/video/stm32/stm32_ltdc.c | 17 +++++++++++------
>>   1 file changed, 11 insertions(+), 6 deletions(-)
>>
>> 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)
Applied to u-boot-stm32/next

Thanks
Patrice
  

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)