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 static void test_pattern(void)
158 ushort v_max = panel_info.vl_row;
159 ushort h_max = panel_info.vl_col;
160 ushort v_step = (v_max + N_BLK_VERT - 1) / N_BLK_VERT;
161 ushort h_step = (h_max + N_BLK_HOR - 1) / N_BLK_HOR;
163 uchar *pix = (uchar *)lcd_base;
165 printf("[LCD] Test Pattern: %d x %d [%d x %d]\n",
166 h_max, v_max, h_step, v_step);
168 /* WARNING: Code silently assumes 8bit/pixel */
169 for (v = 0; v < v_max; ++v) {
170 uchar iy = v / v_step;
171 for (h = 0; h < h_max; ++h) {
172 uchar ix = N_BLK_HOR * iy + h / h_step;
173 *pix++ = test_colors[ix];
177 #endif /* LCD_TEST_PATTERN */
180 /************************************************************************/
181 /* ** GENERIC Initialization Routines */
182 /************************************************************************/
184 * With most lcd drivers the line length is set up
185 * by calculating it from panel_info parameters. Some
186 * drivers need to calculate the line length differently,
187 * so make the function weak to allow overriding it.
189 __weak int lcd_get_size(int *line_length)
191 *line_length = (panel_info.vl_col * NBITS(panel_info.vl_bpix)) / 8;
192 return *line_length * panel_info.vl_row;
195 int drv_lcd_init(void)
197 struct stdio_dev lcddev;
200 lcd_base = map_sysmem(gd->fb_base, 0);
202 lcd_init(lcd_base); /* LCD initialization */
204 /* Device initialization */
205 memset(&lcddev, 0, sizeof(lcddev));
207 strcpy(lcddev.name, "lcd");
208 lcddev.ext = 0; /* No extensions */
209 lcddev.flags = DEV_FLAGS_OUTPUT; /* Output only */
210 lcddev.putc = lcd_stub_putc; /* 'putc' function */
211 lcddev.puts = lcd_stub_puts; /* 'puts' function */
213 rc = stdio_register(&lcddev);
215 return (rc == 0) ? 1 : rc;
218 /*----------------------------------------------------------------------*/
221 short console_rows, console_cols;
223 #if LCD_BPP == LCD_COLOR8
224 /* Setting the palette */
225 lcd_setcolreg(CONSOLE_COLOR_BLACK, 0, 0, 0);
226 lcd_setcolreg(CONSOLE_COLOR_RED, 0xFF, 0, 0);
227 lcd_setcolreg(CONSOLE_COLOR_GREEN, 0, 0xFF, 0);
228 lcd_setcolreg(CONSOLE_COLOR_YELLOW, 0xFF, 0xFF, 0);
229 lcd_setcolreg(CONSOLE_COLOR_BLUE, 0, 0, 0xFF);
230 lcd_setcolreg(CONSOLE_COLOR_MAGENTA, 0xFF, 0, 0xFF);
231 lcd_setcolreg(CONSOLE_COLOR_CYAN, 0, 0xFF, 0xFF);
232 lcd_setcolreg(CONSOLE_COLOR_GREY, 0xAA, 0xAA, 0xAA);
233 lcd_setcolreg(CONSOLE_COLOR_WHITE, 0xFF, 0xFF, 0xFF);
236 #ifndef CONFIG_SYS_WHITE_ON_BLACK
237 lcd_setfgcolor(CONSOLE_COLOR_BLACK);
238 lcd_setbgcolor(CONSOLE_COLOR_WHITE);
239 bg_color = CONSOLE_COLOR_WHITE;
241 lcd_setfgcolor(CONSOLE_COLOR_WHITE);
242 lcd_setbgcolor(CONSOLE_COLOR_BLACK);
243 bg_color = CONSOLE_COLOR_BLACK;
244 #endif /* CONFIG_SYS_WHITE_ON_BLACK */
246 #ifdef LCD_TEST_PATTERN
249 /* set framebuffer to background color */
250 #if (LCD_BPP != LCD_COLOR32)
251 memset((char *)lcd_base, bg_color, lcd_line_length * panel_info.vl_row);
253 u32 *ppix = lcd_base;
256 i < (lcd_line_length * panel_info.vl_row)/NBYTES(panel_info.vl_bpix);
262 /* Paint the logo and retrieve LCD base address */
263 debug("[LCD] Drawing the logo...\n");
264 #if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO)
265 console_rows = (panel_info.vl_row - BMP_LOGO_HEIGHT);
266 console_rows /= VIDEO_FONT_HEIGHT;
268 console_rows = panel_info.vl_row / VIDEO_FONT_HEIGHT;
270 console_cols = panel_info.vl_col / VIDEO_FONT_WIDTH;
271 lcd_init_console(lcd_logo(), console_rows, console_cols);
275 static int do_lcd_clear(cmd_tbl_t *cmdtp, int flag, int argc,
283 cls, 1, 1, do_lcd_clear,
288 /*----------------------------------------------------------------------*/
290 static int lcd_init(void *lcdbase)
292 /* Initialize the lcd controller */
293 debug("[LCD] Initializing LCD frambuffer at %p\n", lcdbase);
295 lcd_ctrl_init(lcdbase);
298 * lcd_ctrl_init() of some drivers (i.e. bcm2835 on rpi) ignores
299 * the 'lcdbase' argument and uses custom lcd base address
300 * by setting up gd->fb_base. Check for this condition and fixup
301 * 'lcd_base' address.
303 if (map_to_sysmem(lcdbase) != gd->fb_base)
304 lcd_base = map_sysmem(gd->fb_base, 0);
306 debug("[LCD] Using LCD frambuffer at %p\n", lcd_base);
308 lcd_get_size(&lcd_line_length);
313 /* Initialize the console */
315 #ifdef CONFIG_LCD_INFO_BELOW_LOGO
316 lcd_set_row(7 + BMP_LOGO_HEIGHT / VIDEO_FONT_HEIGHT);
318 lcd_set_row(1); /* leave 1 blank line below logo */
325 /************************************************************************/
326 /* ** ROM capable initialization part - needed to reserve FB memory */
327 /************************************************************************/
329 * This is called early in the system initialization to grab memory
330 * for the LCD controller.
331 * Returns new address for monitor, after reserving LCD buffer memory
333 * Note that this is running from ROM, so no write access to global data.
335 ulong lcd_setmem(ulong addr)
340 debug("LCD panel info: %d x %d, %d bit/pix\n", panel_info.vl_col,
341 panel_info.vl_row, NBITS(panel_info.vl_bpix));
343 size = lcd_get_size(&line_length);
345 /* Round up to nearest full page, or MMU section if defined */
346 size = ALIGN(size, CONFIG_LCD_ALIGNMENT);
347 addr = ALIGN(addr - CONFIG_LCD_ALIGNMENT + 1, CONFIG_LCD_ALIGNMENT);
349 /* Allocate pages for the frame buffer. */
352 debug("Reserving %ldk for LCD Framebuffer at: %08lx\n",
358 /*----------------------------------------------------------------------*/
360 static void lcd_setfgcolor(int color)
362 lcd_color_fg = color;
365 int lcd_getfgcolor(void)
370 /*----------------------------------------------------------------------*/
372 static void lcd_setbgcolor(int color)
374 lcd_color_bg = color;
377 int lcd_getbgcolor(void)
382 /************************************************************************/
383 /* ** Chipset depending Bitmap / Logo stuff... */
384 /************************************************************************/
385 static inline ushort *configuration_get_cmap(void)
387 #if defined CONFIG_CPU_PXA
388 struct pxafb_info *fbi = &panel_info.pxa;
389 return (ushort *)fbi->palette;
390 #elif defined(CONFIG_MPC823)
391 immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
392 cpm8xx_t *cp = &(immr->im_cpm);
393 return (ushort *)&(cp->lcd_cmap[255 * sizeof(ushort)]);
394 #elif defined(CONFIG_ATMEL_LCD)
395 return (ushort *)(panel_info.mmio + ATMEL_LCDC_LUT(0));
396 #elif !defined(CONFIG_ATMEL_HLCD) && !defined(CONFIG_EXYNOS_FB)
397 return panel_info.cmap;
398 #elif defined(CONFIG_LCD_LOGO)
399 return bmp_logo_palette;
405 #ifdef CONFIG_LCD_LOGO
406 void bitmap_plot(int x, int y)
408 #ifdef CONFIG_ATMEL_LCD
409 uint *cmap = (uint *)bmp_logo_palette;
411 ushort *cmap = (ushort *)bmp_logo_palette;
417 #if defined(CONFIG_MPC823)
418 immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
419 cpm8xx_t *cp = &(immr->im_cpm);
421 unsigned bpix = NBITS(panel_info.vl_bpix);
423 debug("Logo: width %d height %d colors %d cmap %d\n",
424 BMP_LOGO_WIDTH, BMP_LOGO_HEIGHT, BMP_LOGO_COLORS,
425 ARRAY_SIZE(bmp_logo_palette));
427 bmap = &bmp_logo_bitmap[0];
428 fb = (uchar *)(lcd_base + y * lcd_line_length + x * bpix / 8);
431 /* Leave room for default color map
432 * default case: generic system with no cmap (most likely 16bpp)
433 * cmap was set to the source palette, so no change is done.
434 * This avoids even more ifdefs in the next stanza
436 #if defined(CONFIG_MPC823)
437 cmap = (ushort *) &(cp->lcd_cmap[BMP_LOGO_OFFSET * sizeof(ushort)]);
438 #elif defined(CONFIG_ATMEL_LCD)
439 cmap = (uint *)configuration_get_cmap();
441 cmap = configuration_get_cmap();
447 for (i = 0; i < ARRAY_SIZE(bmp_logo_palette); ++i) {
448 ushort colreg = bmp_logo_palette[i];
449 #ifdef CONFIG_ATMEL_LCD
451 #ifdef CONFIG_ATMEL_LCD_BGR555
452 lut_entry = ((colreg & 0x000F) << 11) |
453 ((colreg & 0x00F0) << 2) |
454 ((colreg & 0x0F00) >> 7);
455 #else /* CONFIG_ATMEL_LCD_RGB565 */
456 lut_entry = ((colreg & 0x000F) << 1) |
457 ((colreg & 0x00F0) << 3) |
458 ((colreg & 0x0F00) << 4);
460 *(cmap + BMP_LOGO_OFFSET) = lut_entry;
462 #else /* !CONFIG_ATMEL_LCD */
464 #endif /* CONFIG_ATMEL_LCD */
469 for (i = 0; i < BMP_LOGO_HEIGHT; ++i) {
470 memcpy(fb, bmap, BMP_LOGO_WIDTH);
471 bmap += BMP_LOGO_WIDTH;
472 fb += panel_info.vl_col;
475 else { /* true color mode */
478 for (i = 0; i < BMP_LOGO_HEIGHT; ++i) {
479 for (j = 0; j < BMP_LOGO_WIDTH; j++) {
480 col16 = bmp_logo_palette[(bmap[j]-16)];
482 ((col16 & 0x000F) << 1) |
483 ((col16 & 0x00F0) << 3) |
484 ((col16 & 0x0F00) << 4);
486 bmap += BMP_LOGO_WIDTH;
487 fb16 += panel_info.vl_col;
495 static inline void bitmap_plot(int x, int y) {}
496 #endif /* CONFIG_LCD_LOGO */
498 /*----------------------------------------------------------------------*/
499 #if defined(CONFIG_CMD_BMP) || defined(CONFIG_SPLASH_SCREEN)
501 * Display the BMP file located at address bmp_image.
505 #ifdef CONFIG_SPLASH_SCREEN_ALIGN
506 #define BMP_ALIGN_CENTER 0x7FFF
508 static void splash_align_axis(int *axis, unsigned long panel_size,
509 unsigned long picture_size)
511 unsigned long panel_picture_delta = panel_size - picture_size;
512 unsigned long axis_alignment;
514 if (*axis == BMP_ALIGN_CENTER)
515 axis_alignment = panel_picture_delta / 2;
517 axis_alignment = panel_picture_delta + *axis + 1;
521 *axis = max(0, (int)axis_alignment);
526 #ifdef CONFIG_LCD_BMP_RLE8
528 #define BMP_RLE8_ESCAPE 0
529 #define BMP_RLE8_EOL 0
530 #define BMP_RLE8_EOBMP 1
531 #define BMP_RLE8_DELTA 2
533 static void draw_unencoded_bitmap(ushort **fbp, uchar *bmap, ushort *cmap,
537 *(*fbp)++ = cmap[*bmap++];
542 static void draw_encoded_bitmap(ushort **fbp, ushort c, int cnt)
545 int cnt_8copy = cnt >> 3;
547 cnt -= cnt_8copy << 3;
548 while (cnt_8copy > 0) {
567 * Do not call this function directly, must be called from lcd_display_bitmap.
569 static void lcd_display_rle8_bitmap(bmp_image_t *bmp, ushort *cmap, uchar *fb,
570 int x_off, int y_off)
578 width = get_unaligned_le32(&bmp->header.width);
579 height = get_unaligned_le32(&bmp->header.height);
580 bmap = (uchar *)bmp + get_unaligned_le32(&bmp->header.data_offset);
586 if (bmap[0] == BMP_RLE8_ESCAPE) {
593 /* 16bpix, 2-byte per pixel, width should *2 */
594 fb -= (width * 2 + lcd_line_length);
604 /* 16bpix, 2-byte per pixel, x should *2 */
605 fb = (uchar *) (lcd_base + (y + y_off - 1)
606 * lcd_line_length + (x + x_off) * 2);
615 if (x + runlen > width)
619 draw_unencoded_bitmap(
634 /* aggregate the same code */
635 while (bmap[0] == 0xff &&
636 bmap[2] != BMP_RLE8_ESCAPE &&
637 bmap[1] == bmap[3]) {
641 if (x + runlen > width)
645 draw_encoded_bitmap((ushort **)&fb,
656 #if defined(CONFIG_MPC823)
657 #define FB_PUT_BYTE(fb, from) *(fb)++ = (255 - *(from)++)
659 #define FB_PUT_BYTE(fb, from) *(fb)++ = *(from)++
662 #if defined(CONFIG_BMP_16BPP)
663 #if defined(CONFIG_ATMEL_LCD_BGR555)
664 static inline void fb_put_word(uchar **fb, uchar **from)
666 *(*fb)++ = (((*from)[0] & 0x1f) << 2) | ((*from)[1] & 0x03);
667 *(*fb)++ = ((*from)[0] & 0xe0) | (((*from)[1] & 0x7c) >> 2);
671 static inline void fb_put_word(uchar **fb, uchar **from)
673 *(*fb)++ = *(*from)++;
674 *(*fb)++ = *(*from)++;
677 #endif /* CONFIG_BMP_16BPP */
679 int lcd_display_bitmap(ulong bmp_image, int x, int y)
682 ushort *cmap_base = NULL;
685 bmp_image_t *bmp = (bmp_image_t *)map_sysmem(bmp_image, 0);
688 unsigned long width, height, byte_width;
689 unsigned long pwidth = panel_info.vl_col;
690 unsigned colors, bpix, bmp_bpix;
692 if (!bmp || !(bmp->header.signature[0] == 'B' &&
693 bmp->header.signature[1] == 'M')) {
694 printf("Error: no valid bmp image at %lx\n", bmp_image);
699 width = get_unaligned_le32(&bmp->header.width);
700 height = get_unaligned_le32(&bmp->header.height);
701 bmp_bpix = get_unaligned_le16(&bmp->header.bit_count);
703 colors = 1 << bmp_bpix;
705 bpix = NBITS(panel_info.vl_bpix);
707 if (bpix != 1 && bpix != 8 && bpix != 16 && bpix != 32) {
708 printf ("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n",
715 * We support displaying 8bpp BMPs on 16bpp LCDs
716 * and displaying 24bpp BMPs on 32bpp LCDs
718 if (bpix != bmp_bpix &&
719 !(bmp_bpix == 8 && bpix == 16) &&
720 !(bmp_bpix == 24 && bpix == 32)) {
721 printf ("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n",
722 bpix, get_unaligned_le16(&bmp->header.bit_count));
726 debug("Display-bmp: %d x %d with %d colors\n",
727 (int)width, (int)height, (int)colors);
730 cmap = configuration_get_cmap();
734 for (i = 0; i < colors; ++i) {
735 bmp_color_table_entry_t cte = bmp->color_table[i];
736 #if !defined(CONFIG_ATMEL_LCD)
738 ( ((cte.red) << 8) & 0xf800) |
739 ( ((cte.green) << 3) & 0x07e0) |
740 ( ((cte.blue) >> 3) & 0x001f) ;
742 #if defined(CONFIG_MPC823)
747 #else /* CONFIG_ATMEL_LCD */
748 lcd_setcolreg(i, cte.red, cte.green, cte.blue);
753 padded_width = (width & 0x3 ? (width & ~0x3) + 4 : width);
755 #ifdef CONFIG_SPLASH_SCREEN_ALIGN
756 splash_align_axis(&x, pwidth, width);
757 splash_align_axis(&y, panel_info.vl_row, height);
758 #endif /* CONFIG_SPLASH_SCREEN_ALIGN */
760 if ((x + width) > pwidth)
762 if ((y + height) > panel_info.vl_row)
763 height = panel_info.vl_row - y;
765 bmap = (uchar *)bmp + get_unaligned_le32(&bmp->header.data_offset);
766 fb = (uchar *)(lcd_base +
767 (y + height - 1) * lcd_line_length + x * bpix / 8);
770 case 1: /* pass through */
772 #ifdef CONFIG_LCD_BMP_RLE8
773 u32 compression = get_unaligned_le32(&bmp->header.compression);
774 if (compression == BMP_BI_RLE8) {
776 /* TODO implement render code for bpix != 16 */
777 printf("Error: only support 16 bpix");
780 lcd_display_rle8_bitmap(bmp, cmap_base, fb, x, y);
788 byte_width = width * 2;
790 for (i = 0; i < height; ++i) {
792 for (j = 0; j < width; j++) {
794 FB_PUT_BYTE(fb, bmap);
796 *(uint16_t *)fb = cmap_base[*(bmap++)];
797 fb += sizeof(uint16_t) / sizeof(*fb);
800 bmap += (padded_width - width);
801 fb -= byte_width + lcd_line_length;
805 #if defined(CONFIG_BMP_16BPP)
807 for (i = 0; i < height; ++i) {
809 for (j = 0; j < width; j++)
810 fb_put_word(&fb, &bmap);
812 bmap += (padded_width - width) * 2;
813 fb -= width * 2 + lcd_line_length;
816 #endif /* CONFIG_BMP_16BPP */
817 #if defined(CONFIG_BMP_24BMP)
819 for (i = 0; i < height; ++i) {
820 for (j = 0; j < width; j++) {
826 fb -= lcd_line_length + width * (bpix / 8);
829 #endif /* CONFIG_BMP_24BMP */
830 #if defined(CONFIG_BMP_32BPP)
832 for (i = 0; i < height; ++i) {
833 for (j = 0; j < width; j++) {
839 fb -= lcd_line_length + width * (bpix / 8);
842 #endif /* CONFIG_BMP_32BPP */
852 static void *lcd_logo(void)
854 #ifdef CONFIG_SPLASH_SCREEN
857 static int do_splash = 1;
859 if (do_splash && (s = getenv("splashimage")) != NULL) {
863 if (splash_screen_prepare())
864 return (void *)lcd_base;
866 addr = simple_strtoul (s, NULL, 16);
868 splash_get_pos(&x, &y);
870 if (bmp_display(addr, x, y) == 0)
871 return (void *)lcd_base;
873 #endif /* CONFIG_SPLASH_SCREEN */
877 #ifdef CONFIG_LCD_INFO
878 lcd_set_col(LCD_INFO_X / VIDEO_FONT_WIDTH);
879 lcd_set_row(LCD_INFO_Y / VIDEO_FONT_HEIGHT);
880 lcd_show_board_info();
881 #endif /* CONFIG_LCD_INFO */
883 #if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO)
884 return (void *)((ulong)lcd_base + BMP_LOGO_HEIGHT * lcd_line_length);
886 return (void *)lcd_base;
887 #endif /* CONFIG_LCD_LOGO && !defined(CONFIG_LCD_INFO_BELOW_LOGO) */
890 #ifdef CONFIG_SPLASHIMAGE_GUARD
891 static int on_splashimage(const char *name, const char *value, enum env_op op,
897 if (op == env_op_delete)
900 addr = simple_strtoul(value, NULL, 16);
901 /* See README.displaying-bmps */
902 aligned = (addr % 4 == 2);
904 printf("Invalid splashimage value. Value must be 16 bit aligned, but not 32 bit aligned\n");
911 U_BOOT_ENV_CALLBACK(splashimage, on_splashimage);
914 int lcd_get_pixel_width(void)
916 return panel_info.vl_col;
919 int lcd_get_pixel_height(void)
921 return panel_info.vl_row;
924 #if defined(CONFIG_LCD_DT_SIMPLEFB)
925 static int lcd_dt_simplefb_configure_node(void *blob, int off)
927 #if LCD_BPP == LCD_COLOR16
928 return fdt_setup_simplefb_node(blob, off, gd->fb_base,
929 panel_info.vl_col, panel_info.vl_row,
930 panel_info.vl_col * 2, "r5g6b5");
936 int lcd_dt_simplefb_add_node(void *blob)
938 static const char compat[] = "simple-framebuffer";
939 static const char disabled[] = "disabled";
942 off = fdt_add_subnode(blob, 0, "framebuffer");
946 ret = fdt_setprop(blob, off, "status", disabled, sizeof(disabled));
950 ret = fdt_setprop(blob, off, "compatible", compat, sizeof(compat));
954 return lcd_dt_simplefb_configure_node(blob, off);
957 int lcd_dt_simplefb_enable_existing_node(void *blob)
961 off = fdt_node_offset_by_compatible(blob, -1, "simple-framebuffer");
965 return lcd_dt_simplefb_configure_node(blob, off);