1 // SPDX-License-Identifier: GPL-2.0+
5 * Copyright 2022 Google LLC
6 * Written by Simon Glass <sjg@chromium.org>
13 #include <video_console.h>
15 static int do_font_list(struct cmd_tbl *cmdtp, int flag, int argc,
18 vidconsole_list_fonts();
23 static int do_font_select(struct cmd_tbl *cmdtp, int flag, int argc,
34 if (uclass_first_device_err(UCLASS_VIDEO_CONSOLE, &dev))
35 return CMD_RET_FAILURE;
38 size = dectoul(argv[2], NULL);
39 ret = vidconsole_select_font(dev, name, size);
41 printf("Failed (error %d)\n", ret);
42 return CMD_RET_FAILURE;
47 static int do_font_size(struct cmd_tbl *cmdtp, int flag, int argc,
57 if (uclass_first_device_err(UCLASS_VIDEO_CONSOLE, &dev))
58 return CMD_RET_FAILURE;
60 size = dectoul(argv[1], NULL);
61 ret = vidconsole_select_font(dev, NULL, size);
63 printf("Failed (error %d)\n", ret);
64 return CMD_RET_FAILURE;
71 #ifdef CONFIG_SYS_LONGHELP
72 static char font_help_text[] =
73 "list - list available fonts\n"
74 "font select <name> [<size>] - select font to use\n"
75 "font size <size> - select font size to";
78 U_BOOT_CMD_WITH_SUBCMDS(font, "Fonts", font_help_text,
79 U_BOOT_SUBCMD_MKENT(list, 1, 1, do_font_list),
80 U_BOOT_SUBCMD_MKENT(select, 3, 1, do_font_select),
81 U_BOOT_SUBCMD_MKENT(size, 2, 1, do_font_size));