diff mbox series

[U-Boot] video: add command cls

Message ID 1541697872-23945-1-git-send-email-patrick.delaunay@st.com
State Superseded
Delegated to: Anatolij Gustschin
Headers show
Series [U-Boot] video: add command cls | expand

Commit Message

Patrick DELAUNAY Nov. 8, 2018, 5:24 p.m. UTC
Implement the existing command cls, for clear screen,
when CONFIG_DM_VIDEO is activated.

This command was defined for old LCD framework (not dm) in
  common/lcd.c:251
  U_BOOT_CMD(cls,	1, 1, do_lcd_clear, "clear screen", "");

This command is useful to clear existing output (vidconsole) before
to display splashscreen with bmp command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---
Example of simple splashscreen in DISTRO script: boot.scr.uimg

if load ${devtype} ${devnum}:${distro_bootpart} ${splashimage} splash.bmp
then
   env set stdout "serial"
   env set stderr "serial"
   cls
   bmp display ${splashimage}
fi

 drivers/video/video-uclass.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Anatolij Gustschin Nov. 17, 2018, 1:50 p.m. UTC | #1
Hi Patrick,

On Thu, 8 Nov 2018 18:24:32 +0100
Patrick Delaunay patrick.delaunay@st.com wrote:

> Implement the existing command cls, for clear screen,
> when CONFIG_DM_VIDEO is activated.
> 
> This command was defined for old LCD framework (not dm) in
>   common/lcd.c:251
>   U_BOOT_CMD(cls,	1, 1, do_lcd_clear, "clear screen", "");
> 
> This command is useful to clear existing output (vidconsole) before
> to display splashscreen with bmp command.

Thanks for the patch! But I think we should remove this existing
lcd specific cls and add a common command under cmd/cls.c. I'll
submit a path for this.

--
Anatolij
Anatolij Gustschin Nov. 17, 2018, 2:36 p.m. UTC | #2
Hi Patrick,

On Sat, 17 Nov 2018 14:50:26 +0100
Anatolij Gustschin agust@denx.de wrote:
...
> Thanks for the patch! But I think we should remove this existing
> lcd specific cls and add a common command under cmd/cls.c. I'll
> submit a path for this.

Please test using this patch [1].

[1] http://patchwork.ozlabs.org/patch/999320/

--
Anatolij
Patrick DELAUNAY Nov. 19, 2018, 5:50 p.m. UTC | #3
Hi Anatolij,

> From: Anatolij Gustschin <agust@denx.de> 
> Sent: samedi 17 novembre 2018 15:37
> 
Hi Patrick,
> 
> On Sat, 17 Nov 2018 14:50:26 +0100
> Anatolij Gustschin agust@denx.de wrote:
> ...
>> Thanks for the patch! But I think we should remove this existing lcd 
>> specific cls and add a common command under cmd/cls.c. I'll submit a 
>> path for this.
>>
>> Please test using this patch [1].
>> 
>> [1] http://patchwork.ozlabs.org/patch/999320/

I agree, that adding a new command file in cmd directory is cleaner.
I hesitate to do the same when I prepare my patch.

This patchset is superseded by (1), tested on my side for DM_VIDEO configuration (stm32mp157 board).

> --
>Anatolij

Regards
Patrick
diff mbox series

Patch

diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
index 44dfa71..5fe49a5 100644
--- a/drivers/video/video-uclass.c
+++ b/drivers/video/video-uclass.c
@@ -300,3 +300,17 @@  UCLASS_DRIVER(video) = {
 	.per_device_auto_alloc_size	= sizeof(struct video_priv),
 	.per_device_platdata_auto_alloc_size = sizeof(struct video_uc_platdata),
 };
+
+static int do_video_clear(cmd_tbl_t *cmdtp, int flag, int argc,
+			  char *const argv[])
+{
+	struct udevice *dev;
+
+	if (uclass_first_device_err(UCLASS_VIDEO, &dev))
+		return CMD_RET_FAILURE;
+	video_clear(dev);
+
+	return 0;
+}
+
+U_BOOT_CMD(cls,	1, 1, do_video_clear, "clear screen", "");