From 30f3333d8860fd97e131e24ad33a80f4d46e98b1 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 6 Jan 2023 08:52:28 -0600 Subject: image: Move common image code to image_board and command We should use the cmd/ directory for commands rather than for common code used elsewhere in U-Boot. Move the common 'source' code into image-board.c to achieve this. The image_source_script() function needs to call run_command_list() so seems to belong better in the command library. Move and rename it. Signed-off-by: Simon Glass --- drivers/usb/gadget/f_sdp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/usb/gadget/f_sdp.c b/drivers/usb/gadget/f_sdp.c index 5ae5b62741a..9ea43f29cfb 100644 --- a/drivers/usb/gadget/f_sdp.c +++ b/drivers/usb/gadget/f_sdp.c @@ -868,7 +868,7 @@ static int sdp_handle_in_ep(struct spl_image_info *spl_image, jump_to_image_no_args(&spl_image); #else /* In U-Boot, allow jumps to scripts */ - image_source_script(sdp_func->jmp_address, NULL, NULL); + cmd_source_script(sdp_func->jmp_address, NULL, NULL); #endif } -- cgit v1.2.3 From 72a0dd8bed010bef78028ae528763f9807758e6b Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 6 Jan 2023 08:52:29 -0600 Subject: video: Enable VIDEO_ANSI by default only with EFI This is not generally needed unless EFI_LOADER is used. Adjust the default setting to reduce the size of the U-Boot build. Signed-off-by: Simon Glass --- drivers/video/Kconfig | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index f539977d9b7..440b161b842 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -112,10 +112,13 @@ config VIDEO_BPP32 config VIDEO_ANSI bool "Support ANSI escape sequences in video console" - default y + default y if EFI_LOADER help Enable ANSI escape sequence decoding for a more fully functional - console. + console. Functionality includes changing the text colour and moving + the cursor. These date from the 1970s and are still widely used today + to control a text terminal. U-Boot implements these by decoding the + sequences and performing the appropriate operation. config VIDEO_MIPI_DSI bool "Support MIPI DSI interface" -- cgit v1.2.3 From 7abe73fc147198320ce684b6613dc434eaebd71e Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 6 Jan 2023 08:52:30 -0600 Subject: video: truetype: Rename the metrics function This should really have a 'truetype' prefix. Fix it. Signed-off-by: Simon Glass --- drivers/video/console_truetype.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers') diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index 6859c9fa116..4abc0bc2ff1 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -595,7 +595,7 @@ void vidconsole_list_fonts(void) } /** - * vidconsole_add_metrics() - Add a new font/size combination + * truetype_add_metrics() - Add a new font/size combination * * @dev: Video console device to update * @font_name: Name of font @@ -604,8 +604,8 @@ void vidconsole_list_fonts(void) * @return 0 if OK, -EPERM if stbtt failed, -E2BIG if the the metrics table is * full */ -static int vidconsole_add_metrics(struct udevice *dev, const char *font_name, - uint font_size, const void *font_data) +static int truetype_add_metrics(struct udevice *dev, const char *font_name, + uint font_size, const void *font_data) { struct console_tt_priv *priv = dev_get_priv(dev); struct console_tt_metrics *met; @@ -693,7 +693,7 @@ int vidconsole_select_font(struct udevice *dev, const char *name, uint size) !strcmp(name, tab->name)) { int ret; - ret = vidconsole_add_metrics(dev, + ret = truetype_add_metrics(dev, tab->name, size, tab->begin); if (ret < 0) return log_msg_ret("add", ret); @@ -745,7 +745,7 @@ static int console_truetype_probe(struct udevice *dev) return -EBFONT; } - ret = vidconsole_add_metrics(dev, tab->name, font_size, tab->begin); + ret = truetype_add_metrics(dev, tab->name, font_size, tab->begin); if (ret < 0) return log_msg_ret("add", ret); priv->cur_met = &priv->metrics[ret]; -- cgit v1.2.3 From 0e38bd848d41bcfc7a113603ee37805016a09a42 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 6 Jan 2023 08:52:32 -0600 Subject: video: Add font functions to the vidconsole API Support for fonts currently depends on the type of vidconsole in use. Add two new methods to enumerate fonts and to set the font. Fix a few other method comments while we are here. Signed-off-by: Simon Glass --- drivers/video/console_truetype.c | 27 +++++++++++++++++++-------- drivers/video/vidconsole-uclass.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 8 deletions(-) (limited to 'drivers') diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index 4abc0bc2ff1..9cac9a6de4d 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -584,14 +584,20 @@ static struct font_info *console_truetype_find_font(void) return NULL; } -void vidconsole_list_fonts(void) +int console_truetype_get_font(struct udevice *dev, int seq, + struct vidfont_info *info) { struct font_info *tab; + int i; - for (tab = font_table; tab->begin; tab++) { - if (abs(tab->begin - tab->end) > 4) - printf("%s\n", tab->name); + for (i = 0, tab = font_table; tab->begin; tab++, i++) { + if (i == seq && font_valid(tab)) { + info->name = tab->name; + return 0; + } } + + return -ENOENT; } /** @@ -674,7 +680,8 @@ static void select_metrics(struct udevice *dev, struct console_tt_metrics *met) vc_priv->tab_width_frac = VID_TO_POS(met->font_size) * 8 / 2; } -int vidconsole_select_font(struct udevice *dev, const char *name, uint size) +static int truetype_select_font(struct udevice *dev, const char *name, + uint size) { struct console_tt_priv *priv = dev_get_priv(dev); struct console_tt_metrics *met; @@ -684,7 +691,7 @@ int vidconsole_select_font(struct udevice *dev, const char *name, uint size) if (!size) size = CONFIG_CONSOLE_TRUETYPE_SIZE; if (!name) - name = priv->cur_met->font_name; + name = font_table->name; met = find_metrics(dev, name, size); if (!met) { @@ -694,7 +701,9 @@ int vidconsole_select_font(struct udevice *dev, const char *name, uint size) int ret; ret = truetype_add_metrics(dev, - tab->name, size, tab->begin); + tab->name, + size, + tab->begin); if (ret < 0) return log_msg_ret("add", ret); @@ -715,7 +724,7 @@ int vidconsole_select_font(struct udevice *dev, const char *name, uint size) return 0; } -const char *vidconsole_get_font(struct udevice *dev, uint *sizep) +const char *vidconsole_get_font_size(struct udevice *dev, uint *sizep) { struct console_tt_priv *priv = dev_get_priv(dev); struct console_tt_metrics *met = priv->cur_met; @@ -763,6 +772,8 @@ struct vidconsole_ops console_truetype_ops = { .set_row = console_truetype_set_row, .backspace = console_truetype_backspace, .entry_start = console_truetype_entry_start, + .get_font = console_truetype_get_font, + .select_font = truetype_select_font, }; U_BOOT_DRIVER(vidconsole_truetype) = { diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index 6bdfb6e37dd..aadd54bfd4f 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -557,6 +557,39 @@ static void vidconsole_puts(struct stdio_dev *sdev, const char *s) } } +void vidconsole_list_fonts(struct udevice *dev) +{ + struct vidfont_info info; + int ret, i; + + for (i = 0, ret = 0; !ret; i++) { + ret = vidconsole_get_font(dev, i, &info); + if (!ret) + printf("%s\n", info.name); + } +} + +int vidconsole_get_font(struct udevice *dev, int seq, + struct vidfont_info *info) +{ + struct vidconsole_ops *ops = vidconsole_get_ops(dev); + + if (!ops->get_font) + return -ENOSYS; + + return ops->get_font(dev, seq, info); +} + +int vidconsole_select_font(struct udevice *dev, const char *name, uint size) +{ + struct vidconsole_ops *ops = vidconsole_get_ops(dev); + + if (!ops->select_font) + return -ENOSYS; + + return ops->select_font(dev, name, size); +} + /* Set up the number of rows and colours (rotated drivers override this) */ static int vidconsole_pre_probe(struct udevice *dev) { -- cgit v1.2.3