1 // SPDX-License-Identifier: GPL-2.0+
5 * Copyright 2022 Google LLC
12 #include <video_console.h>
14 static int do_font_list(struct cmd_tbl *cmdtp, int flag, int argc,
19 if (uclass_first_device_err(UCLASS_VIDEO_CONSOLE, &dev))
20 return CMD_RET_FAILURE;
21 vidconsole_list_fonts(dev);
26 static int do_font_select(struct cmd_tbl *cmdtp, int flag, int argc,
37 if (uclass_first_device_err(UCLASS_VIDEO_CONSOLE, &dev))
38 return CMD_RET_FAILURE;
41 size = dectoul(argv[2], NULL);
42 ret = vidconsole_select_font(dev, name, size);
44 printf("Failed (error %d)\n", ret);
45 return CMD_RET_FAILURE;
50 static int do_font_size(struct cmd_tbl *cmdtp, int flag, int argc,
53 const char *font_name;
58 if (uclass_first_device_err(UCLASS_VIDEO_CONSOLE, &dev))
59 return CMD_RET_FAILURE;
60 ret = vidconsole_get_font_size(dev, &font_name, &size);
62 printf("Failed (error %d)\n", ret);
63 return CMD_RET_FAILURE;
69 size = dectoul(argv[1], NULL);
71 ret = vidconsole_select_font(dev, font_name, size);
73 printf("Failed (error %d)\n", ret);
74 return CMD_RET_FAILURE;
82 "list - list available fonts\n"
83 "font select <name> [<size>] - select font to use\n"
84 "font size <size> - select font size to");
86 U_BOOT_CMD_WITH_SUBCMDS(font, "Fonts", font_help_text,
87 U_BOOT_SUBCMD_MKENT(list, 1, 1, do_font_list),
88 U_BOOT_SUBCMD_MKENT(select, 3, 1, do_font_select),
89 U_BOOT_SUBCMD_MKENT(size, 2, 1, do_font_size));