[Uboot-stm32] [PATCH 4/7] video: Add video_is_active function
Patrice CHOTARD
patrice.chotard at foss.st.com
Mon Nov 22 08:31:15 CET 2021
Hi Patrick
On 11/15/21 4:32 PM, Patrick Delaunay wrote:
> Add the helper function video_is_active() to test if one video device
> is active.
>
> This function can be used in board code to execute operation
> only when the display is probed / really used.
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay at foss.st.com>
> ---
>
> drivers/video/video-uclass.c | 14 ++++++++++++++
> include/video.h | 7 +++++++
> 2 files changed, 21 insertions(+)
>
> diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
> index 9f8cf6ef2a..43ebb3c565 100644
> --- a/drivers/video/video-uclass.c
> +++ b/drivers/video/video-uclass.c
> @@ -228,6 +228,20 @@ void video_sync_all(void)
> }
> }
>
> +bool video_is_active(void)
> +{
> + struct udevice *dev;
> +
> + for (uclass_find_first_device(UCLASS_VIDEO, &dev);
> + dev;
> + uclass_find_next_device(&dev)) {
> + if (device_active(dev))
> + return true;
> + }
> +
> + return false;
> +}
> +
> int video_get_xsize(struct udevice *dev)
> {
> struct video_priv *priv = dev_get_uclass_priv(dev);
> diff --git a/include/video.h b/include/video.h
> index f14fb15f84..5ac1387a39 100644
> --- a/include/video.h
> +++ b/include/video.h
> @@ -276,6 +276,13 @@ static inline int video_sync_copy_all(struct udevice *dev)
>
> #endif
>
> +/**
> + * video_is_active() - Test if one video device it active
> + *
> + * @return true if at least one video device is active, else false.
> + */
> +bool video_is_active(void);
> +
> #ifndef CONFIG_DM_VIDEO
>
> /* Video functions */
>
Reviewed-by: Patrice Chotard <patrice.chotard at foss.st.com>
Thanks
Patrice
More information about the U-Boot
mailing list