xref: /openbmc/u-boot/cmd/cls.c (revision 274ccb5b)
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * (C) Copyright 2018
4  * DENX Software Engineering, Anatolij Gustschin <agust@denx.de>
5  *
6  * cls - clear screen command
7  */
8 #include <common.h>
9 #include <command.h>
10 #include <dm.h>
11 #include <lcd.h>
12 #include <video.h>
13 
14 static int do_video_clear(cmd_tbl_t *cmdtp, int flag, int argc,
15 			  char *const argv[])
16 {
17 #if defined(CONFIG_DM_VIDEO)
18 	struct udevice *dev;
19 
20 	if (uclass_first_device_err(UCLASS_VIDEO, &dev))
21 		return CMD_RET_FAILURE;
22 
23 	if (video_clear(dev))
24 		return CMD_RET_FAILURE;
25 #elif defined(CONFIG_CFB_CONSOLE)
26 	video_clear();
27 #elif defined(CONFIG_LCD)
28 	lcd_clear();
29 #else
30 	return CMD_RET_FAILURE;
31 #endif
32 	return CMD_RET_SUCCESS;
33 }
34 
35 U_BOOT_CMD(cls,	1, 1, do_video_clear, "clear screen", "");
36