2 * Common LCD routines for supported CPUs
4 * (C) Copyright 2001-2002
5 * Wolfgang Denk, DENX Software Engineering -- wd@denx.de
7 * SPDX-License-Identifier: GPL-2.0+
10 /************************************************************************/
12 /************************************************************************/
21 #include <env_callback.h>
22 #include <linux/types.h>
23 #include <stdio_dev.h>
24 #if defined(CONFIG_POST)
29 #include <asm/unaligned.h>
32 #include <asm/unaligned.h>
33 #include <fdt_support.h>
35 #if defined(CONFIG_CPU_PXA25X) || defined(CONFIG_CPU_PXA27X) || \
36 defined(CONFIG_CPU_MONAHANS)
37 #include <asm/byteorder.h>
40 #if defined(CONFIG_MPC823)
44 #if defined(CONFIG_ATMEL_LCD)
45 #include <atmel_lcdc.h>
48 #if defined(CONFIG_LCD_DT_SIMPLEFB)
52 /************************************************************************/
54 /************************************************************************/
55 #include <video_font.h> /* Get font data, width and height */
57 /************************************************************************/
59 /************************************************************************/
60 #ifdef CONFIG_LCD_LOGO
61 # include <bmp_logo.h> /* Get logo data, width and height */
62 # include <bmp_logo_data.h>
63 # if (CONSOLE_COLOR_WHITE >= BMP_LOGO_OFFSET) && (LCD_BPP < LCD_COLOR16)
64 # error Default Color Map overlaps with Logo Color Map
72 #ifndef CONFIG_LCD_ALIGNMENT
73 #define CONFIG_LCD_ALIGNMENT PAGE_SIZE
76 #if (LCD_BPP != LCD_COLOR8) && (LCD_BPP != LCD_COLOR16) && \
77 (LCD_BPP != LCD_COLOR32)
78 # error Unsupported LCD BPP.
81 DECLARE_GLOBAL_DATA_PTR;
83 static int lcd_init(void *lcdbase);
85 static void *lcd_logo(void);
87 static void lcd_setfgcolor(int color);
88 static void lcd_setbgcolor(int color);
90 static int lcd_color_fg;
91 static int lcd_color_bg;
94 char lcd_is_enabled = 0;
96 static void *lcd_base; /* Start of framebuffer memory */
98 static char lcd_flush_dcache; /* 1 to flush dcache after each lcd update */
100 /************************************************************************/
102 /* Flush LCD activity to the caches */
106 * flush_dcache_range() is declared in common.h but it seems that some
107 * architectures do not actually implement it. Is there a way to find
108 * out whether it exists? For now, ARM is safe.
110 #if defined(CONFIG_ARM) && !defined(CONFIG_SYS_DCACHE_OFF)
113 if (lcd_flush_dcache)
114 flush_dcache_range((u32)lcd_base,
115 (u32)(lcd_base + lcd_get_size(&line_length)));
116 #elif defined(CONFIG_SANDBOX) && defined(CONFIG_VIDEO_SANDBOX_SDL)
117 static ulong last_sync;
119 if (get_timer(last_sync) > 10) {
120 sandbox_sdl_sync(lcd_base);
121 last_sync = get_timer(0);
126 void lcd_set_flush_dcache(int flush)
128 lcd_flush_dcache = (flush != 0);
131 /*----------------------------------------------------------------------*/
133 static void lcd_stub_putc(struct stdio_dev *dev, const char c)
138 static void lcd_stub_puts(struct stdio_dev *dev, const char *s)
143 /************************************************************************/
144 /** Small utility to check that you got the colours right */
145 /************************************************************************/
146 #ifdef LCD_TEST_PATTERN
151 static int test_colors[N_BLK_HOR * N_BLK_VERT] = {
152 CONSOLE_COLOR_RED, CONSOLE_COLOR_GREEN, CONSOLE_COLOR_YELLOW,
153 CONSOLE_COLOR_BLUE, CONSOLE_COLOR_MAGENTA, CONSOLE_COLOR_CYAN,
156 #if LCD_BPP == LCD_COLOR8
158 #elif LCD_BPP == LCD_COLOR16
159 typedef ushort pix_t;
160 #elif LCD_BPP == LCD_COLOR32
163 #error Unsupported pixelformat
166 static void test_pattern(void)
168 ushort v_max = panel_info.vl_row;
169 ushort h_max = panel_info.vl_col;
170 ushort v_step = (v_max + N_BLK_VERT - 1) / N_BLK_VERT;
171 ushort h_step = (h_max + N_BLK_HOR - 1) / N_BLK_HOR;
173 pix_t *pix = lcd_base;
175 printf("[LCD] Test Pattern: %d x %d [%d x %d]\n",
176 h_max, v_max, h_step, v_step);
178 /* WARNING: Code silently assumes 8bit/pixel */
179 for (v = 0; v < v_max; ++v) {
180 uchar iy = v / v_step;
181 for (h = 0; h < h_max; ++h) {
182 uchar ix = N_BLK_HOR * iy + h / h_step;
183 *pix++ = test_colors[ix];
187 #endif /* LCD_TEST_PATTERN */
190 /************************************************************************/
191 /* ** GENERIC Initialization Routines */
192 /************************************************************************/
194 * With most lcd drivers the line length is set up
195 * by calculating it from panel_info parameters. Some
196 * drivers need to calculate the line length differently,
197 * so make the function weak to allow overriding it.
199 __weak int lcd_get_size(int *line_length)
201 *line_length = (panel_info.vl_col * NBITS(panel_info.vl_bpix)) / 8;
202 return *line_length * panel_info.vl_row;
205 int drv_lcd_init(void)
207 struct stdio_dev lcddev;
210 lcd_base = map_sysmem(gd->fb_base, 0);
212 lcd_init(lcd_base); /* LCD initialization */
214 /* Device initialization */
215 memset(&lcddev, 0, sizeof(lcddev));
217 strcpy(lcddev.name, "lcd");
218 lcddev.ext = 0; /* No extensions */
219 lcddev.flags = DEV_FLAGS_OUTPUT; /* Output only */
220 lcddev.putc = lcd_stub_putc; /* 'putc' function */
221 lcddev.puts = lcd_stub_puts; /* 'puts' function */
223 rc = stdio_register(&lcddev);
225 return (rc == 0) ? 1 : rc;
228 /*----------------------------------------------------------------------*/
231 short console_rows, console_cols;
233 #if LCD_BPP == LCD_COLOR8
234 /* Setting the palette */
235 lcd_setcolreg(CONSOLE_COLOR_BLACK, 0, 0, 0);
236 lcd_setcolreg(CONSOLE_COLOR_RED, 0xFF, 0, 0);
237 lcd_setcolreg(CONSOLE_COLOR_GREEN, 0, 0xFF, 0);
238 lcd_setcolreg(CONSOLE_COLOR_YELLOW, 0xFF, 0xFF, 0);
239 lcd_setcolreg(CONSOLE_COLOR_BLUE, 0, 0, 0xFF);
240 lcd_setcolreg(CONSOLE_COLOR_MAGENTA, 0xFF, 0, 0xFF);
241 lcd_setcolreg(CONSOLE_COLOR_CYAN, 0, 0xFF, 0xFF);
242 lcd_setcolreg(CONSOLE_COLOR_GREY, 0xAA, 0xAA, 0xAA);
243 lcd_setcolreg(CONSOLE_COLOR_WHITE, 0xFF, 0xFF, 0xFF);
246 #ifndef CONFIG_SYS_WHITE_ON_BLACK
247 lcd_setfgcolor(CONSOLE_COLOR_BLACK);
248 lcd_setbgcolor(CONSOLE_COLOR_WHITE);
249 bg_color = CONSOLE_COLOR_WHITE;
251 lcd_setfgcolor(CONSOLE_COLOR_WHITE);
252 lcd_setbgcolor(CONSOLE_COLOR_BLACK);
253 bg_color = CONSOLE_COLOR_BLACK;
254 #endif /* CONFIG_SYS_WHITE_ON_BLACK */
256 #ifdef LCD_TEST_PATTERN
259 /* set framebuffer to background color */
260 #if (LCD_BPP != LCD_COLOR32)
261 memset((char *)lcd_base, bg_color, lcd_line_length * panel_info.vl_row);
263 u32 *ppix = lcd_base;
266 i < (lcd_line_length * panel_info.vl_row)/NBYTES(panel_info.vl_bpix);
272 /* Paint the logo and retrieve LCD base address */
273 debug("[LCD] Drawing the logo @ %p...\n", lcd_base);
274 #if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO)
275 console_rows = (panel_info.vl_row - BMP_LOGO_HEIGHT);
276 console_rows /= VIDEO_FONT_HEIGHT;
278 console_rows = panel_info.vl_row / VIDEO_FONT_HEIGHT;
280 console_cols = panel_info.vl_col / VIDEO_FONT_WIDTH;
281 lcd_init_console(lcd_base, console_rows, console_cols);
282 lcd_init_console(lcd_logo(), console_rows, console_cols);
286 static int do_lcd_clear(cmd_tbl_t *cmdtp, int flag, int argc,
294 cls, 1, 1, do_lcd_clear,
299 /*----------------------------------------------------------------------*/
301 static int lcd_init(void *lcdbase)
303 /* Initialize the lcd controller */
304 debug("[LCD] Initializing %ux%ux%u LCD framebuffer at %p\n",
305 panel_info.vl_col, panel_info.vl_row, NBITS(panel_info.vl_bpix),
308 lcd_ctrl_init(lcdbase);
311 * lcd_ctrl_init() of some drivers (i.e. bcm2835 on rpi) ignores
312 * the 'lcdbase' argument and uses custom lcd base address
313 * by setting up gd->fb_base. Check for this condition and fixup
314 * 'lcd_base' address.
316 if (map_to_sysmem(lcdbase) != gd->fb_base)
317 lcd_base = map_sysmem(gd->fb_base, 0);
319 debug("[LCD] Using LCD frambuffer at %p\n", lcd_base);
321 lcd_get_size(&lcd_line_length);
326 /* Initialize the console */
328 #ifdef CONFIG_LCD_INFO_BELOW_LOGO
329 lcd_set_row(7 + BMP_LOGO_HEIGHT / VIDEO_FONT_HEIGHT);
331 lcd_set_row(1); /* leave 1 blank line below logo */
338 /************************************************************************/
339 /* ** ROM capable initialization part - needed to reserve FB memory */
340 /************************************************************************/
342 * This is called early in the system initialization to grab memory
343 * for the LCD controller.
344 * Returns new address for monitor, after reserving LCD buffer memory
346 * Note that this is running from ROM, so no write access to global data.
348 ulong lcd_setmem(ulong addr)
353 debug("LCD panel info: %d x %d, %d bit/pix\n", panel_info.vl_col,
354 panel_info.vl_row, NBITS(panel_info.vl_bpix));
356 size = lcd_get_size(&line_length);
358 /* Round up to nearest full page, or MMU section if defined */
359 size = ALIGN(size, CONFIG_LCD_ALIGNMENT);
360 addr = ALIGN(addr - CONFIG_LCD_ALIGNMENT + 1, CONFIG_LCD_ALIGNMENT);
362 /* Allocate pages for the frame buffer. */
365 debug("Reserving %ldk for LCD Framebuffer at: %08lx\n",
371 /*----------------------------------------------------------------------*/
373 static void lcd_setfgcolor(int color)
375 lcd_color_fg = color;
378 int lcd_getfgcolor(void)
383 /*----------------------------------------------------------------------*/
385 static void lcd_setbgcolor(int color)
387 lcd_color_bg = color;
390 int lcd_getbgcolor(void)
395 /************************************************************************/
396 /* ** Chipset depending Bitmap / Logo stuff... */
397 /************************************************************************/
399 #ifdef CONFIG_LCD_LOGO
400 void bitmap_plot(int x, int y)
402 #ifdef CONFIG_ATMEL_LCD
403 uint *cmap = (uint *)bmp_logo_palette;
405 ushort *cmap = (ushort *)bmp_logo_palette;
411 #if defined(CONFIG_MPC823)
412 immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
413 cpm8xx_t *cp = &(immr->im_cpm);
415 unsigned bpix = NBITS(panel_info.vl_bpix);
417 debug("Logo: width %d height %d colors %d cmap %d\n",
418 BMP_LOGO_WIDTH, BMP_LOGO_HEIGHT, BMP_LOGO_COLORS,
419 ARRAY_SIZE(bmp_logo_palette));
421 bmap = &bmp_logo_bitmap[0];
422 fb = (uchar *)(lcd_base + y * lcd_line_length + x * bpix / 8);
425 /* Leave room for default color map
426 * default case: generic system with no cmap (most likely 16bpp)
427 * cmap was set to the source palette, so no change is done.
428 * This avoids even more ifdefs in the next stanza
430 #if defined(CONFIG_MPC823)
431 cmap = (ushort *) &(cp->lcd_cmap[BMP_LOGO_OFFSET * sizeof(ushort)]);
432 #elif defined(CONFIG_ATMEL_LCD)
433 cmap = (uint *)configuration_get_cmap();
435 cmap = configuration_get_cmap();
441 for (i = 0; i < ARRAY_SIZE(bmp_logo_palette); ++i) {
442 ushort colreg = bmp_logo_palette[i];
443 #ifdef CONFIG_ATMEL_LCD
445 #ifdef CONFIG_ATMEL_LCD_BGR555
446 lut_entry = ((colreg & 0x000F) << 11) |
447 ((colreg & 0x00F0) << 2) |
448 ((colreg & 0x0F00) >> 7);
449 #else /* CONFIG_ATMEL_LCD_RGB565 */
450 lut_entry = ((colreg & 0x000F) << 1) |
451 ((colreg & 0x00F0) << 3) |
452 ((colreg & 0x0F00) << 4);
454 *(cmap + BMP_LOGO_OFFSET) = lut_entry;
456 #else /* !CONFIG_ATMEL_LCD */
458 #endif /* CONFIG_ATMEL_LCD */
463 for (i = 0; i < BMP_LOGO_HEIGHT; ++i) {
464 memcpy(fb, bmap, BMP_LOGO_WIDTH);
465 bmap += BMP_LOGO_WIDTH;
466 fb += panel_info.vl_col;
468 } else if (NBITS(panel_info.vl_bpix) == 16) {
471 for (i = 0; i < BMP_LOGO_HEIGHT; ++i) {
472 for (j = 0; j < BMP_LOGO_WIDTH; j++) {
473 col16 = bmp_logo_palette[(bmap[j]-16)];
475 ((col16 & 0x000F) << 1) |
476 ((col16 & 0x00F0) << 3) |
477 ((col16 & 0x0F00) << 4);
479 bmap += BMP_LOGO_WIDTH;
480 fb16 += panel_info.vl_col;
482 } else { /* true color mode */
484 u32 *fb32 = lcd_base + y * lcd_line_length + x;
486 for (i = 0; i < BMP_LOGO_HEIGHT; i++) {
487 for (j = 0; j < BMP_LOGO_WIDTH; j++) {
488 col16 = bmp_logo_palette[bmap[j] - 16];
490 ((col16 & 0x000F) << 4) |
491 ((col16 & 0x00F0) << 8) |
492 ((col16 & 0x0F00) << 12);
494 bmap += BMP_LOGO_WIDTH;
495 fb32 += panel_info.vl_col;
503 static inline void bitmap_plot(int x, int y) {}
504 #endif /* CONFIG_LCD_LOGO */
506 /*----------------------------------------------------------------------*/
507 #if defined(CONFIG_CMD_BMP) || defined(CONFIG_SPLASH_SCREEN)
509 * Display the BMP file located at address bmp_image.
513 #ifdef CONFIG_SPLASH_SCREEN_ALIGN
514 #define BMP_ALIGN_CENTER 0x7FFF
516 static void splash_align_axis(int *axis, unsigned long panel_size,
517 unsigned long picture_size)
519 unsigned long panel_picture_delta = panel_size - picture_size;
520 unsigned long axis_alignment;
522 if (*axis == BMP_ALIGN_CENTER)
523 axis_alignment = panel_picture_delta / 2;
525 axis_alignment = panel_picture_delta + *axis + 1;
529 *axis = max(0, (int)axis_alignment);
534 #ifdef CONFIG_LCD_BMP_RLE8
536 #define BMP_RLE8_ESCAPE 0
537 #define BMP_RLE8_EOL 0
538 #define BMP_RLE8_EOBMP 1
539 #define BMP_RLE8_DELTA 2
541 static void draw_unencoded_bitmap(ushort **fbp, uchar *bmap, ushort *cmap,
545 *(*fbp)++ = cmap[*bmap++];
550 static void draw_encoded_bitmap(ushort **fbp, ushort c, int cnt)
553 int cnt_8copy = cnt >> 3;
555 cnt -= cnt_8copy << 3;
556 while (cnt_8copy > 0) {
575 * Do not call this function directly, must be called from lcd_display_bitmap.
577 static void lcd_display_rle8_bitmap(bmp_image_t *bmp, ushort *cmap, uchar *fb,
578 int x_off, int y_off)
586 width = get_unaligned_le32(&bmp->header.width);
587 height = get_unaligned_le32(&bmp->header.height);
588 bmap = (uchar *)bmp + get_unaligned_le32(&bmp->header.data_offset);
594 if (bmap[0] == BMP_RLE8_ESCAPE) {
601 /* 16bpix, 2-byte per pixel, width should *2 */
602 fb -= (width * 2 + lcd_line_length);
612 /* 16bpix, 2-byte per pixel, x should *2 */
613 fb = (uchar *) (lcd_base + (y + y_off - 1)
614 * lcd_line_length + (x + x_off) * 2);
623 if (x + runlen > width)
627 draw_unencoded_bitmap(
642 /* aggregate the same code */
643 while (bmap[0] == 0xff &&
644 bmap[2] != BMP_RLE8_ESCAPE &&
645 bmap[1] == bmap[3]) {
649 if (x + runlen > width)
653 draw_encoded_bitmap((ushort **)&fb,
664 #if defined(CONFIG_MPC823)
665 #define FB_PUT_BYTE(fb, from) *(fb)++ = (255 - *(from)++)
667 #define FB_PUT_BYTE(fb, from) *(fb)++ = *(from)++
670 #if defined(CONFIG_BMP_16BPP)
671 #if defined(CONFIG_ATMEL_LCD_BGR555)
672 static inline void fb_put_word(uchar **fb, uchar **from)
674 *(*fb)++ = (((*from)[0] & 0x1f) << 2) | ((*from)[1] & 0x03);
675 *(*fb)++ = ((*from)[0] & 0xe0) | (((*from)[1] & 0x7c) >> 2);
679 static inline void fb_put_word(uchar **fb, uchar **from)
681 *(*fb)++ = *(*from)++;
682 *(*fb)++ = *(*from)++;
685 #endif /* CONFIG_BMP_16BPP */
687 static inline bmp_color_table_entry_t *get_color_table(bmp_image_t *bmp)
689 bmp_header_t *bh = &bmp->header;
690 return (void *)bmp + offsetof(bmp_header_t, size) + bh->size;
693 int lcd_display_bitmap(ulong bmp_image, int x, int y)
696 ushort *cmap_base = NULL;
699 bmp_image_t *bmp = (bmp_image_t *)map_sysmem(bmp_image, 0);
702 unsigned long width, height;
703 unsigned long pwidth = panel_info.vl_col;
704 unsigned long long colors;
705 unsigned bpix, bmp_bpix;
706 bmp_color_table_entry_t *cte;
708 if (!bmp || !(bmp->header.signature[0] == 'B' &&
709 bmp->header.signature[1] == 'M')) {
710 printf("Error: no valid bmp image at %lx\n", bmp_image);
715 width = get_unaligned_le32(&bmp->header.width);
716 height = get_unaligned_le32(&bmp->header.height);
717 bmp_bpix = get_unaligned_le16(&bmp->header.bit_count);
719 colors = 1 << bmp_bpix;
721 bpix = NBITS(panel_info.vl_bpix);
723 if (bpix != 1 && bpix != 8 && bpix != 16 && bpix != 32) {
724 printf ("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n",
731 * We support displaying 8bpp BMPs on 16bpp LCDs
732 * and displaying 24bpp BMPs on 32bpp LCDs
734 if (bpix != bmp_bpix &&
735 !(bmp_bpix == 8 && bpix == 16) &&
736 !(bmp_bpix == 24 && bpix == 32)) {
737 printf ("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n",
738 bpix, get_unaligned_le16(&bmp->header.bit_count));
742 debug("Display-bmp: %lu x %lu with %llu colors\n",
743 width, height, colors);
745 cte = get_color_table(bmp);
747 cmap = configuration_get_cmap();
751 for (i = 0; i < colors; ++i) {
752 #if !defined(CONFIG_ATMEL_LCD)
754 ( ((cte[i].red) << 8) & 0xf800) |
755 ( ((cte[i].green) << 3) & 0x07e0) |
756 ( ((cte[i].blue) >> 3) & 0x001f) ;
758 #if defined(CONFIG_MPC823)
763 #else /* CONFIG_ATMEL_LCD */
764 lcd_setcolreg(i, cte[i].red, cte[i].green, cte[i].blue);
769 padded_width = ALIGN(width, 4);
771 #ifdef CONFIG_SPLASH_SCREEN_ALIGN
772 splash_align_axis(&x, pwidth, width);
773 splash_align_axis(&y, panel_info.vl_row, height);
774 #endif /* CONFIG_SPLASH_SCREEN_ALIGN */
775 bmap = (uchar *)bmp + get_unaligned_le32(&bmp->header.data_offset);
777 if ((x + width) > pwidth)
779 if ((y + height) > panel_info.vl_row) {
780 height = panel_info.vl_row - y;
781 bmap += (panel_info.vl_row - y) * padded_width;
784 fb = (uchar *)(lcd_base +
785 (y + height - 1) * lcd_line_length + x * bpix / 8);
788 case 1: /* pass through */
790 #ifdef CONFIG_LCD_BMP_RLE8
791 u32 compression = get_unaligned_le32(&bmp->header.compression);
792 if (compression == BMP_BI_RLE8) {
794 /* TODO implement render code for bpix != 16 */
795 printf("Error: only support 16 bpix");
798 lcd_display_rle8_bitmap(bmp, cmap_base, fb, x, y);
803 for (i = 0; i < height; ++i) {
805 for (j = 0; j < width; j++) {
811 fb[1] = cte[i].green;
813 fb += sizeof(uint32_t) / sizeof(*fb);
814 } else if (bpix == 16) {
815 *(uint16_t *)fb = cmap_base[*(bmap++)];
816 fb += sizeof(uint16_t) / sizeof(*fb);
818 FB_PUT_BYTE(fb, bmap);
822 bmap += padded_width - width;
823 fb -= width * bpix / 8 + lcd_line_length;
825 bmap += padded_width;
826 fb -= lcd_line_length;
831 #if defined(CONFIG_BMP_16BPP)
833 for (i = 0; i < height; ++i) {
835 for (j = 0; j < width; j++)
836 fb_put_word(&fb, &bmap);
838 bmap += (padded_width - width) * 2;
839 fb -= width * 2 + lcd_line_length;
842 #endif /* CONFIG_BMP_16BPP */
843 #if defined(CONFIG_BMP_24BMP)
845 for (i = 0; i < height; ++i) {
846 for (j = 0; j < width; j++) {
852 fb -= lcd_line_length + width * (bpix / 8);
855 #endif /* CONFIG_BMP_24BPP */
856 #if defined(CONFIG_BMP_32BPP)
858 for (i = 0; i < height; ++i) {
860 for (j = 0; j < width; j++) {
861 fb[3] = *bmap++; /* T */
862 fb[0] = *bmap++; /* B */
863 fb[1] = *bmap++; /* G */
864 fb[2] = *bmap++; /* R */
867 bmap += (padded_width - width) * 4;
868 fb -= lcd_line_length + width * (bpix / 8);
871 #endif /* CONFIG_BMP_32BPP */
878 static void *lcd_logo(void)
880 #ifdef CONFIG_SPLASH_SCREEN
883 static int do_splash = 1;
885 if (do_splash && (s = getenv("splashimage")) != NULL) {
891 if (splash_screen_prepare())
892 return (void *)lcd_base;
894 addr = simple_strtoul (s, &end, 16);
895 if (addr == 0 || *end != '\0')
898 splash_get_pos(&x, &y);
900 if (bmp_display(addr, x, y) == 0)
901 return (void *)lcd_base;
903 #endif /* CONFIG_SPLASH_SCREEN */
907 #ifdef CONFIG_LCD_INFO
908 lcd_set_col(LCD_INFO_X / VIDEO_FONT_WIDTH);
909 lcd_set_row(LCD_INFO_Y / VIDEO_FONT_HEIGHT);
910 lcd_show_board_info();
911 #endif /* CONFIG_LCD_INFO */
913 #if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO)
914 return lcd_base + BMP_LOGO_HEIGHT * lcd_line_length;
917 #endif /* CONFIG_LCD_LOGO && !CONFIG_LCD_INFO_BELOW_LOGO */
920 #ifdef CONFIG_SPLASHIMAGE_GUARD
921 static int on_splashimage(const char *name, const char *value, enum env_op op,
927 if (op == env_op_delete)
930 addr = simple_strtoul(value, NULL, 16);
931 /* See README.displaying-bmps */
932 aligned = (addr % 4 == 2);
934 printf("Invalid splashimage value. Value must be 16 bit aligned, but not 32 bit aligned\n");
941 U_BOOT_ENV_CALLBACK(splashimage, on_splashimage);
944 int lcd_get_pixel_width(void)
946 return panel_info.vl_col;
949 int lcd_get_pixel_height(void)
951 return panel_info.vl_row;
954 #if defined(CONFIG_LCD_DT_SIMPLEFB)
955 static int lcd_dt_simplefb_configure_node(void *blob, int off)
957 #if LCD_BPP == LCD_COLOR16
958 return fdt_setup_simplefb_node(blob, off, gd->fb_base,
959 panel_info.vl_col, panel_info.vl_row,
960 panel_info.vl_col * 2, "r5g6b5");
966 int lcd_dt_simplefb_add_node(void *blob)
968 static const char compat[] = "simple-framebuffer";
969 static const char disabled[] = "disabled";
972 off = fdt_add_subnode(blob, 0, "framebuffer");
976 ret = fdt_setprop(blob, off, "status", disabled, sizeof(disabled));
980 ret = fdt_setprop(blob, off, "compatible", compat, sizeof(compat));
984 return lcd_dt_simplefb_configure_node(blob, off);
987 int lcd_dt_simplefb_enable_existing_node(void *blob)
991 off = fdt_node_offset_by_compatible(blob, -1, "simple-framebuffer");
995 return lcd_dt_simplefb_configure_node(blob, off);