blob: eab4e6993bbc9f0a2427e692a4428db976c01d4c [file] [log] [blame]
Anatolij Gustschin4e92e602018-12-01 10:47:20 +01001// 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
Simon Glass09140112020-05-10 11:40:03 -060014static int do_video_clear(struct cmd_tbl *cmdtp, int flag, int argc,
Anatolij Gustschin4e92e602018-12-01 10:47:20 +010015 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
35U_BOOT_CMD(cls, 1, 1, do_video_clear, "clear screen", "");