lcd.c 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284
  1. /*
  2. * Common LCD routines for supported CPUs
  3. *
  4. * (C) Copyright 2001-2002
  5. * Wolfgang Denk, DENX Software Engineering -- wd@denx.de
  6. *
  7. * SPDX-License-Identifier: GPL-2.0+
  8. */
  9. /************************************************************************/
  10. /* ** HEADER FILES */
  11. /************************************************************************/
  12. /* #define DEBUG */
  13. #include <config.h>
  14. #include <common.h>
  15. #include <command.h>
  16. #include <stdarg.h>
  17. #include <search.h>
  18. #include <env_callback.h>
  19. #include <linux/types.h>
  20. #include <stdio_dev.h>
  21. #if defined(CONFIG_POST)
  22. #include <post.h>
  23. #endif
  24. #include <lcd.h>
  25. #include <watchdog.h>
  26. #include <asm/unaligned.h>
  27. #include <splash.h>
  28. #include <asm/io.h>
  29. #include <asm/unaligned.h>
  30. #if defined(CONFIG_CPU_PXA25X) || defined(CONFIG_CPU_PXA27X) || \
  31. defined(CONFIG_CPU_MONAHANS)
  32. #define CONFIG_CPU_PXA
  33. #include <asm/byteorder.h>
  34. #endif
  35. #if defined(CONFIG_MPC823)
  36. #include <lcdvideo.h>
  37. #endif
  38. #if defined(CONFIG_ATMEL_LCD)
  39. #include <atmel_lcdc.h>
  40. #endif
  41. #if defined(CONFIG_LCD_DT_SIMPLEFB)
  42. #include <libfdt.h>
  43. #endif
  44. /************************************************************************/
  45. /* ** FONT DATA */
  46. /************************************************************************/
  47. #include <video_font.h> /* Get font data, width and height */
  48. /************************************************************************/
  49. /* ** LOGO DATA */
  50. /************************************************************************/
  51. #ifdef CONFIG_LCD_LOGO
  52. # include <bmp_logo.h> /* Get logo data, width and height */
  53. # include <bmp_logo_data.h>
  54. # if (CONSOLE_COLOR_WHITE >= BMP_LOGO_OFFSET) && (LCD_BPP != LCD_COLOR16)
  55. # error Default Color Map overlaps with Logo Color Map
  56. # endif
  57. #endif
  58. #ifdef CONFIG_SANDBOX
  59. #include <asm/sdl.h>
  60. #endif
  61. #ifndef CONFIG_LCD_ALIGNMENT
  62. #define CONFIG_LCD_ALIGNMENT PAGE_SIZE
  63. #endif
  64. /* By default we scroll by a single line */
  65. #ifndef CONFIG_CONSOLE_SCROLL_LINES
  66. #define CONFIG_CONSOLE_SCROLL_LINES 1
  67. #endif
  68. /************************************************************************/
  69. /* ** CONSOLE DEFINITIONS & FUNCTIONS */
  70. /************************************************************************/
  71. #if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO)
  72. # define CONSOLE_ROWS ((panel_info.vl_row-BMP_LOGO_HEIGHT) \
  73. / VIDEO_FONT_HEIGHT)
  74. #else
  75. # define CONSOLE_ROWS (panel_info.vl_row / VIDEO_FONT_HEIGHT)
  76. #endif
  77. #define CONSOLE_COLS (panel_info.vl_col / VIDEO_FONT_WIDTH)
  78. #define CONSOLE_ROW_SIZE (VIDEO_FONT_HEIGHT * lcd_line_length)
  79. #define CONSOLE_ROW_FIRST lcd_console_address
  80. #define CONSOLE_ROW_SECOND (lcd_console_address + CONSOLE_ROW_SIZE)
  81. #define CONSOLE_ROW_LAST (lcd_console_address + CONSOLE_SIZE \
  82. - CONSOLE_ROW_SIZE)
  83. #define CONSOLE_SIZE (CONSOLE_ROW_SIZE * CONSOLE_ROWS)
  84. #define CONSOLE_SCROLL_SIZE (CONSOLE_SIZE - CONSOLE_ROW_SIZE)
  85. #if LCD_BPP == LCD_MONOCHROME
  86. # define COLOR_MASK(c) ((c) | (c) << 1 | (c) << 2 | (c) << 3 | \
  87. (c) << 4 | (c) << 5 | (c) << 6 | (c) << 7)
  88. #elif (LCD_BPP == LCD_COLOR8) || (LCD_BPP == LCD_COLOR16) || \
  89. (LCD_BPP == LCD_COLOR32)
  90. # define COLOR_MASK(c) (c)
  91. #else
  92. # error Unsupported LCD BPP.
  93. #endif
  94. DECLARE_GLOBAL_DATA_PTR;
  95. static void lcd_drawchars(ushort x, ushort y, uchar *str, int count);
  96. static inline void lcd_puts_xy(ushort x, ushort y, uchar *s);
  97. static inline void lcd_putc_xy(ushort x, ushort y, uchar c);
  98. static int lcd_init(void *lcdbase);
  99. static void *lcd_logo(void);
  100. static int lcd_getbgcolor(void);
  101. static void lcd_setfgcolor(int color);
  102. static void lcd_setbgcolor(int color);
  103. static int lcd_color_fg;
  104. static int lcd_color_bg;
  105. int lcd_line_length;
  106. char lcd_is_enabled = 0;
  107. static short console_col;
  108. static short console_row;
  109. static void *lcd_console_address;
  110. static void *lcd_base; /* Start of framebuffer memory */
  111. static char lcd_flush_dcache; /* 1 to flush dcache after each lcd update */
  112. /************************************************************************/
  113. /* Flush LCD activity to the caches */
  114. void lcd_sync(void)
  115. {
  116. /*
  117. * flush_dcache_range() is declared in common.h but it seems that some
  118. * architectures do not actually implement it. Is there a way to find
  119. * out whether it exists? For now, ARM is safe.
  120. */
  121. #if defined(CONFIG_ARM) && !defined(CONFIG_SYS_DCACHE_OFF)
  122. int line_length;
  123. if (lcd_flush_dcache)
  124. flush_dcache_range((u32)lcd_base,
  125. (u32)(lcd_base + lcd_get_size(&line_length)));
  126. #elif defined(CONFIG_SANDBOX) && defined(CONFIG_VIDEO_SANDBOX_SDL)
  127. static ulong last_sync;
  128. if (get_timer(last_sync) > 10) {
  129. sandbox_sdl_sync(lcd_base);
  130. last_sync = get_timer(0);
  131. }
  132. #endif
  133. }
  134. void lcd_set_flush_dcache(int flush)
  135. {
  136. lcd_flush_dcache = (flush != 0);
  137. }
  138. /*----------------------------------------------------------------------*/
  139. static void console_scrollup(void)
  140. {
  141. const int rows = CONFIG_CONSOLE_SCROLL_LINES;
  142. /* Copy up rows ignoring those that will be overwritten */
  143. memcpy(CONSOLE_ROW_FIRST,
  144. lcd_console_address + CONSOLE_ROW_SIZE * rows,
  145. CONSOLE_SIZE - CONSOLE_ROW_SIZE * rows);
  146. /* Clear the last rows */
  147. #if (LCD_BPP != LCD_COLOR32)
  148. memset(lcd_console_address + CONSOLE_SIZE - CONSOLE_ROW_SIZE * rows,
  149. COLOR_MASK(lcd_color_bg),
  150. CONSOLE_ROW_SIZE * rows);
  151. #else
  152. u32 *ppix = lcd_console_address +
  153. CONSOLE_SIZE - CONSOLE_ROW_SIZE * rows;
  154. u32 i;
  155. for (i = 0;
  156. i < (CONSOLE_ROW_SIZE * rows) / NBYTES(panel_info.vl_bpix);
  157. i++) {
  158. *ppix++ = COLOR_MASK(lcd_color_bg);
  159. }
  160. #endif
  161. lcd_sync();
  162. console_row -= rows;
  163. }
  164. /*----------------------------------------------------------------------*/
  165. static inline void console_back(void)
  166. {
  167. if (--console_col < 0) {
  168. console_col = CONSOLE_COLS-1 ;
  169. if (--console_row < 0)
  170. console_row = 0;
  171. }
  172. lcd_putc_xy(console_col * VIDEO_FONT_WIDTH,
  173. console_row * VIDEO_FONT_HEIGHT, ' ');
  174. }
  175. /*----------------------------------------------------------------------*/
  176. static inline void console_newline(void)
  177. {
  178. console_col = 0;
  179. /* Check if we need to scroll the terminal */
  180. if (++console_row >= CONSOLE_ROWS)
  181. console_scrollup();
  182. else
  183. lcd_sync();
  184. }
  185. /*----------------------------------------------------------------------*/
  186. static void lcd_stub_putc(struct stdio_dev *dev, const char c)
  187. {
  188. lcd_putc(c);
  189. }
  190. void lcd_putc(const char c)
  191. {
  192. if (!lcd_is_enabled) {
  193. serial_putc(c);
  194. return;
  195. }
  196. switch (c) {
  197. case '\r':
  198. console_col = 0;
  199. return;
  200. case '\n':
  201. console_newline();
  202. return;
  203. case '\t': /* Tab (8 chars alignment) */
  204. console_col += 8;
  205. console_col &= ~7;
  206. if (console_col >= CONSOLE_COLS)
  207. console_newline();
  208. return;
  209. case '\b':
  210. console_back();
  211. return;
  212. default:
  213. lcd_putc_xy(console_col * VIDEO_FONT_WIDTH,
  214. console_row * VIDEO_FONT_HEIGHT, c);
  215. if (++console_col >= CONSOLE_COLS)
  216. console_newline();
  217. }
  218. }
  219. /*----------------------------------------------------------------------*/
  220. static void lcd_stub_puts(struct stdio_dev *dev, const char *s)
  221. {
  222. lcd_puts(s);
  223. }
  224. void lcd_puts(const char *s)
  225. {
  226. if (!lcd_is_enabled) {
  227. serial_puts(s);
  228. return;
  229. }
  230. while (*s)
  231. lcd_putc(*s++);
  232. lcd_sync();
  233. }
  234. /*----------------------------------------------------------------------*/
  235. void lcd_printf(const char *fmt, ...)
  236. {
  237. va_list args;
  238. char buf[CONFIG_SYS_PBSIZE];
  239. va_start(args, fmt);
  240. vsprintf(buf, fmt, args);
  241. va_end(args);
  242. lcd_puts(buf);
  243. }
  244. /************************************************************************/
  245. /* ** Low-Level Graphics Routines */
  246. /************************************************************************/
  247. static void lcd_drawchars(ushort x, ushort y, uchar *str, int count)
  248. {
  249. uchar *dest;
  250. ushort row;
  251. #if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO)
  252. y += BMP_LOGO_HEIGHT;
  253. #endif
  254. #if LCD_BPP == LCD_MONOCHROME
  255. ushort off = x * (1 << LCD_BPP) % 8;
  256. #endif
  257. dest = (uchar *)(lcd_base + y * lcd_line_length + x * NBITS(LCD_BPP)/8);
  258. for (row = 0; row < VIDEO_FONT_HEIGHT; ++row, dest += lcd_line_length) {
  259. uchar *s = str;
  260. int i;
  261. #if LCD_BPP == LCD_COLOR16
  262. ushort *d = (ushort *)dest;
  263. #elif LCD_BPP == LCD_COLOR32
  264. u32 *d = (u32 *)dest;
  265. #else
  266. uchar *d = dest;
  267. #endif
  268. #if LCD_BPP == LCD_MONOCHROME
  269. uchar rest = *d & -(1 << (8 - off));
  270. uchar sym;
  271. #endif
  272. for (i = 0; i < count; ++i) {
  273. uchar c, bits;
  274. c = *s++;
  275. bits = video_fontdata[c * VIDEO_FONT_HEIGHT + row];
  276. #if LCD_BPP == LCD_MONOCHROME
  277. sym = (COLOR_MASK(lcd_color_fg) & bits) |
  278. (COLOR_MASK(lcd_color_bg) & ~bits);
  279. *d++ = rest | (sym >> off);
  280. rest = sym << (8-off);
  281. #elif LCD_BPP == LCD_COLOR8
  282. for (c = 0; c < 8; ++c) {
  283. *d++ = (bits & 0x80) ?
  284. lcd_color_fg : lcd_color_bg;
  285. bits <<= 1;
  286. }
  287. #elif LCD_BPP == LCD_COLOR16
  288. for (c = 0; c < 8; ++c) {
  289. *d++ = (bits & 0x80) ?
  290. lcd_color_fg : lcd_color_bg;
  291. bits <<= 1;
  292. }
  293. #elif LCD_BPP == LCD_COLOR32
  294. for (c = 0; c < 8; ++c) {
  295. *d++ = (bits & 0x80) ?
  296. lcd_color_fg : lcd_color_bg;
  297. bits <<= 1;
  298. }
  299. #endif
  300. }
  301. #if LCD_BPP == LCD_MONOCHROME
  302. *d = rest | (*d & ((1 << (8 - off)) - 1));
  303. #endif
  304. }
  305. }
  306. /*----------------------------------------------------------------------*/
  307. static inline void lcd_puts_xy(ushort x, ushort y, uchar *s)
  308. {
  309. lcd_drawchars(x, y, s, strlen((char *)s));
  310. }
  311. /*----------------------------------------------------------------------*/
  312. static inline void lcd_putc_xy(ushort x, ushort y, uchar c)
  313. {
  314. lcd_drawchars(x, y, &c, 1);
  315. }
  316. /************************************************************************/
  317. /** Small utility to check that you got the colours right */
  318. /************************************************************************/
  319. #ifdef LCD_TEST_PATTERN
  320. #define N_BLK_VERT 2
  321. #define N_BLK_HOR 3
  322. static int test_colors[N_BLK_HOR * N_BLK_VERT] = {
  323. CONSOLE_COLOR_RED, CONSOLE_COLOR_GREEN, CONSOLE_COLOR_YELLOW,
  324. CONSOLE_COLOR_BLUE, CONSOLE_COLOR_MAGENTA, CONSOLE_COLOR_CYAN,
  325. };
  326. static void test_pattern(void)
  327. {
  328. ushort v_max = panel_info.vl_row;
  329. ushort h_max = panel_info.vl_col;
  330. ushort v_step = (v_max + N_BLK_VERT - 1) / N_BLK_VERT;
  331. ushort h_step = (h_max + N_BLK_HOR - 1) / N_BLK_HOR;
  332. ushort v, h;
  333. uchar *pix = (uchar *)lcd_base;
  334. printf("[LCD] Test Pattern: %d x %d [%d x %d]\n",
  335. h_max, v_max, h_step, v_step);
  336. /* WARNING: Code silently assumes 8bit/pixel */
  337. for (v = 0; v < v_max; ++v) {
  338. uchar iy = v / v_step;
  339. for (h = 0; h < h_max; ++h) {
  340. uchar ix = N_BLK_HOR * iy + h / h_step;
  341. *pix++ = test_colors[ix];
  342. }
  343. }
  344. }
  345. #endif /* LCD_TEST_PATTERN */
  346. /************************************************************************/
  347. /* ** GENERIC Initialization Routines */
  348. /************************************************************************/
  349. /*
  350. * With most lcd drivers the line length is set up
  351. * by calculating it from panel_info parameters. Some
  352. * drivers need to calculate the line length differently,
  353. * so make the function weak to allow overriding it.
  354. */
  355. __weak int lcd_get_size(int *line_length)
  356. {
  357. *line_length = (panel_info.vl_col * NBITS(panel_info.vl_bpix)) / 8;
  358. return *line_length * panel_info.vl_row;
  359. }
  360. int drv_lcd_init(void)
  361. {
  362. struct stdio_dev lcddev;
  363. int rc;
  364. lcd_base = map_sysmem(gd->fb_base, 0);
  365. lcd_init(lcd_base); /* LCD initialization */
  366. /* Device initialization */
  367. memset(&lcddev, 0, sizeof(lcddev));
  368. strcpy(lcddev.name, "lcd");
  369. lcddev.ext = 0; /* No extensions */
  370. lcddev.flags = DEV_FLAGS_OUTPUT; /* Output only */
  371. lcddev.putc = lcd_stub_putc; /* 'putc' function */
  372. lcddev.puts = lcd_stub_puts; /* 'puts' function */
  373. rc = stdio_register(&lcddev);
  374. return (rc == 0) ? 1 : rc;
  375. }
  376. /*----------------------------------------------------------------------*/
  377. void lcd_clear(void)
  378. {
  379. #if LCD_BPP == LCD_MONOCHROME
  380. /* Setting the palette */
  381. lcd_initcolregs();
  382. #elif LCD_BPP == LCD_COLOR8
  383. /* Setting the palette */
  384. lcd_setcolreg(CONSOLE_COLOR_BLACK, 0, 0, 0);
  385. lcd_setcolreg(CONSOLE_COLOR_RED, 0xFF, 0, 0);
  386. lcd_setcolreg(CONSOLE_COLOR_GREEN, 0, 0xFF, 0);
  387. lcd_setcolreg(CONSOLE_COLOR_YELLOW, 0xFF, 0xFF, 0);
  388. lcd_setcolreg(CONSOLE_COLOR_BLUE, 0, 0, 0xFF);
  389. lcd_setcolreg(CONSOLE_COLOR_MAGENTA, 0xFF, 0, 0xFF);
  390. lcd_setcolreg(CONSOLE_COLOR_CYAN, 0, 0xFF, 0xFF);
  391. lcd_setcolreg(CONSOLE_COLOR_GREY, 0xAA, 0xAA, 0xAA);
  392. lcd_setcolreg(CONSOLE_COLOR_WHITE, 0xFF, 0xFF, 0xFF);
  393. #endif
  394. #ifndef CONFIG_SYS_WHITE_ON_BLACK
  395. lcd_setfgcolor(CONSOLE_COLOR_BLACK);
  396. lcd_setbgcolor(CONSOLE_COLOR_WHITE);
  397. #else
  398. lcd_setfgcolor(CONSOLE_COLOR_WHITE);
  399. lcd_setbgcolor(CONSOLE_COLOR_BLACK);
  400. #endif /* CONFIG_SYS_WHITE_ON_BLACK */
  401. #ifdef LCD_TEST_PATTERN
  402. test_pattern();
  403. #else
  404. /* set framebuffer to background color */
  405. #if (LCD_BPP != LCD_COLOR32)
  406. memset((char *)lcd_base,
  407. COLOR_MASK(lcd_getbgcolor()),
  408. lcd_line_length * panel_info.vl_row);
  409. #else
  410. u32 *ppix = lcd_base;
  411. u32 i;
  412. for (i = 0;
  413. i < (lcd_line_length * panel_info.vl_row)/NBYTES(panel_info.vl_bpix);
  414. i++) {
  415. *ppix++ = COLOR_MASK(lcd_color_bg);
  416. }
  417. #endif
  418. #endif
  419. /* Paint the logo and retrieve LCD base address */
  420. debug("[LCD] Drawing the logo...\n");
  421. lcd_console_address = lcd_logo();
  422. console_col = 0;
  423. console_row = 0;
  424. lcd_sync();
  425. }
  426. static int do_lcd_clear(cmd_tbl_t *cmdtp, int flag, int argc,
  427. char *const argv[])
  428. {
  429. lcd_clear();
  430. return 0;
  431. }
  432. U_BOOT_CMD(
  433. cls, 1, 1, do_lcd_clear,
  434. "clear screen",
  435. ""
  436. );
  437. /*----------------------------------------------------------------------*/
  438. static int lcd_init(void *lcdbase)
  439. {
  440. /* Initialize the lcd controller */
  441. debug("[LCD] Initializing LCD frambuffer at %p\n", lcdbase);
  442. lcd_ctrl_init(lcdbase);
  443. /*
  444. * lcd_ctrl_init() of some drivers (i.e. bcm2835 on rpi_b) ignores
  445. * the 'lcdbase' argument and uses custom lcd base address
  446. * by setting up gd->fb_base. Check for this condition and fixup
  447. * 'lcd_base' address.
  448. */
  449. if (map_to_sysmem(lcdbase) != gd->fb_base)
  450. lcd_base = map_sysmem(gd->fb_base, 0);
  451. debug("[LCD] Using LCD frambuffer at %p\n", lcd_base);
  452. lcd_get_size(&lcd_line_length);
  453. lcd_is_enabled = 1;
  454. lcd_clear();
  455. lcd_enable();
  456. /* Initialize the console */
  457. console_col = 0;
  458. #ifdef CONFIG_LCD_INFO_BELOW_LOGO
  459. console_row = 7 + BMP_LOGO_HEIGHT / VIDEO_FONT_HEIGHT;
  460. #else
  461. console_row = 1; /* leave 1 blank line below logo */
  462. #endif
  463. return 0;
  464. }
  465. /************************************************************************/
  466. /* ** ROM capable initialization part - needed to reserve FB memory */
  467. /************************************************************************/
  468. /*
  469. * This is called early in the system initialization to grab memory
  470. * for the LCD controller.
  471. * Returns new address for monitor, after reserving LCD buffer memory
  472. *
  473. * Note that this is running from ROM, so no write access to global data.
  474. */
  475. ulong lcd_setmem(ulong addr)
  476. {
  477. ulong size;
  478. int line_length;
  479. debug("LCD panel info: %d x %d, %d bit/pix\n", panel_info.vl_col,
  480. panel_info.vl_row, NBITS(panel_info.vl_bpix));
  481. size = lcd_get_size(&line_length);
  482. /* Round up to nearest full page, or MMU section if defined */
  483. size = ALIGN(size, CONFIG_LCD_ALIGNMENT);
  484. addr = ALIGN(addr - CONFIG_LCD_ALIGNMENT + 1, CONFIG_LCD_ALIGNMENT);
  485. /* Allocate pages for the frame buffer. */
  486. addr -= size;
  487. debug("Reserving %ldk for LCD Framebuffer at: %08lx\n",
  488. size >> 10, addr);
  489. return addr;
  490. }
  491. /*----------------------------------------------------------------------*/
  492. static void lcd_setfgcolor(int color)
  493. {
  494. lcd_color_fg = color;
  495. }
  496. /*----------------------------------------------------------------------*/
  497. static void lcd_setbgcolor(int color)
  498. {
  499. lcd_color_bg = color;
  500. }
  501. /*----------------------------------------------------------------------*/
  502. int lcd_getfgcolor(void)
  503. {
  504. return lcd_color_fg;
  505. }
  506. /*----------------------------------------------------------------------*/
  507. static int lcd_getbgcolor(void)
  508. {
  509. return lcd_color_bg;
  510. }
  511. /************************************************************************/
  512. /* ** Chipset depending Bitmap / Logo stuff... */
  513. /************************************************************************/
  514. static inline ushort *configuration_get_cmap(void)
  515. {
  516. #if defined CONFIG_CPU_PXA
  517. struct pxafb_info *fbi = &panel_info.pxa;
  518. return (ushort *)fbi->palette;
  519. #elif defined(CONFIG_MPC823)
  520. immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
  521. cpm8xx_t *cp = &(immr->im_cpm);
  522. return (ushort *)&(cp->lcd_cmap[255 * sizeof(ushort)]);
  523. #elif defined(CONFIG_ATMEL_LCD)
  524. return (ushort *)(panel_info.mmio + ATMEL_LCDC_LUT(0));
  525. #elif !defined(CONFIG_ATMEL_HLCD) && !defined(CONFIG_EXYNOS_FB)
  526. return panel_info.cmap;
  527. #elif defined(CONFIG_LCD_LOGO)
  528. return bmp_logo_palette;
  529. #else
  530. return NULL;
  531. #endif
  532. }
  533. #ifdef CONFIG_LCD_LOGO
  534. void bitmap_plot(int x, int y)
  535. {
  536. #ifdef CONFIG_ATMEL_LCD
  537. uint *cmap = (uint *)bmp_logo_palette;
  538. #else
  539. ushort *cmap = (ushort *)bmp_logo_palette;
  540. #endif
  541. ushort i, j;
  542. uchar *bmap;
  543. uchar *fb;
  544. ushort *fb16;
  545. #if defined(CONFIG_MPC823)
  546. immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
  547. cpm8xx_t *cp = &(immr->im_cpm);
  548. #endif
  549. unsigned bpix = NBITS(panel_info.vl_bpix);
  550. debug("Logo: width %d height %d colors %d cmap %d\n",
  551. BMP_LOGO_WIDTH, BMP_LOGO_HEIGHT, BMP_LOGO_COLORS,
  552. ARRAY_SIZE(bmp_logo_palette));
  553. bmap = &bmp_logo_bitmap[0];
  554. fb = (uchar *)(lcd_base + y * lcd_line_length + x * bpix / 8);
  555. if (bpix < 12) {
  556. /* Leave room for default color map
  557. * default case: generic system with no cmap (most likely 16bpp)
  558. * cmap was set to the source palette, so no change is done.
  559. * This avoids even more ifdefs in the next stanza
  560. */
  561. #if defined(CONFIG_MPC823)
  562. cmap = (ushort *) &(cp->lcd_cmap[BMP_LOGO_OFFSET * sizeof(ushort)]);
  563. #elif defined(CONFIG_ATMEL_LCD)
  564. cmap = (uint *)configuration_get_cmap();
  565. #else
  566. cmap = configuration_get_cmap();
  567. #endif
  568. WATCHDOG_RESET();
  569. /* Set color map */
  570. for (i = 0; i < ARRAY_SIZE(bmp_logo_palette); ++i) {
  571. ushort colreg = bmp_logo_palette[i];
  572. #ifdef CONFIG_ATMEL_LCD
  573. uint lut_entry;
  574. #ifdef CONFIG_ATMEL_LCD_BGR555
  575. lut_entry = ((colreg & 0x000F) << 11) |
  576. ((colreg & 0x00F0) << 2) |
  577. ((colreg & 0x0F00) >> 7);
  578. #else /* CONFIG_ATMEL_LCD_RGB565 */
  579. lut_entry = ((colreg & 0x000F) << 1) |
  580. ((colreg & 0x00F0) << 3) |
  581. ((colreg & 0x0F00) << 4);
  582. #endif
  583. *(cmap + BMP_LOGO_OFFSET) = lut_entry;
  584. cmap++;
  585. #else /* !CONFIG_ATMEL_LCD */
  586. #ifdef CONFIG_SYS_INVERT_COLORS
  587. *cmap++ = 0xffff - colreg;
  588. #else
  589. *cmap++ = colreg;
  590. #endif
  591. #endif /* CONFIG_ATMEL_LCD */
  592. }
  593. WATCHDOG_RESET();
  594. for (i = 0; i < BMP_LOGO_HEIGHT; ++i) {
  595. memcpy(fb, bmap, BMP_LOGO_WIDTH);
  596. bmap += BMP_LOGO_WIDTH;
  597. fb += panel_info.vl_col;
  598. }
  599. }
  600. else { /* true color mode */
  601. u16 col16;
  602. fb16 = (ushort *)fb;
  603. for (i = 0; i < BMP_LOGO_HEIGHT; ++i) {
  604. for (j = 0; j < BMP_LOGO_WIDTH; j++) {
  605. col16 = bmp_logo_palette[(bmap[j]-16)];
  606. fb16[j] =
  607. ((col16 & 0x000F) << 1) |
  608. ((col16 & 0x00F0) << 3) |
  609. ((col16 & 0x0F00) << 4);
  610. }
  611. bmap += BMP_LOGO_WIDTH;
  612. fb16 += panel_info.vl_col;
  613. }
  614. }
  615. WATCHDOG_RESET();
  616. lcd_sync();
  617. }
  618. #else
  619. static inline void bitmap_plot(int x, int y) {}
  620. #endif /* CONFIG_LCD_LOGO */
  621. /*----------------------------------------------------------------------*/
  622. #if defined(CONFIG_CMD_BMP) || defined(CONFIG_SPLASH_SCREEN)
  623. /*
  624. * Display the BMP file located at address bmp_image.
  625. * Only uncompressed.
  626. */
  627. #ifdef CONFIG_SPLASH_SCREEN_ALIGN
  628. #define BMP_ALIGN_CENTER 0x7FFF
  629. static void splash_align_axis(int *axis, unsigned long panel_size,
  630. unsigned long picture_size)
  631. {
  632. unsigned long panel_picture_delta = panel_size - picture_size;
  633. unsigned long axis_alignment;
  634. if (*axis == BMP_ALIGN_CENTER)
  635. axis_alignment = panel_picture_delta / 2;
  636. else if (*axis < 0)
  637. axis_alignment = panel_picture_delta + *axis + 1;
  638. else
  639. return;
  640. *axis = max(0, axis_alignment);
  641. }
  642. #endif
  643. #ifdef CONFIG_LCD_BMP_RLE8
  644. #define BMP_RLE8_ESCAPE 0
  645. #define BMP_RLE8_EOL 0
  646. #define BMP_RLE8_EOBMP 1
  647. #define BMP_RLE8_DELTA 2
  648. static void draw_unencoded_bitmap(ushort **fbp, uchar *bmap, ushort *cmap,
  649. int cnt)
  650. {
  651. while (cnt > 0) {
  652. *(*fbp)++ = cmap[*bmap++];
  653. cnt--;
  654. }
  655. }
  656. static void draw_encoded_bitmap(ushort **fbp, ushort c, int cnt)
  657. {
  658. ushort *fb = *fbp;
  659. int cnt_8copy = cnt >> 3;
  660. cnt -= cnt_8copy << 3;
  661. while (cnt_8copy > 0) {
  662. *fb++ = c;
  663. *fb++ = c;
  664. *fb++ = c;
  665. *fb++ = c;
  666. *fb++ = c;
  667. *fb++ = c;
  668. *fb++ = c;
  669. *fb++ = c;
  670. cnt_8copy--;
  671. }
  672. while (cnt > 0) {
  673. *fb++ = c;
  674. cnt--;
  675. }
  676. *fbp = fb;
  677. }
  678. /*
  679. * Do not call this function directly, must be called from lcd_display_bitmap.
  680. */
  681. static void lcd_display_rle8_bitmap(bmp_image_t *bmp, ushort *cmap, uchar *fb,
  682. int x_off, int y_off)
  683. {
  684. uchar *bmap;
  685. ulong width, height;
  686. ulong cnt, runlen;
  687. int x, y;
  688. int decode = 1;
  689. width = get_unaligned_le32(&bmp->header.width);
  690. height = get_unaligned_le32(&bmp->header.height);
  691. bmap = (uchar *)bmp + get_unaligned_le32(&bmp->header.data_offset);
  692. x = 0;
  693. y = height - 1;
  694. while (decode) {
  695. if (bmap[0] == BMP_RLE8_ESCAPE) {
  696. switch (bmap[1]) {
  697. case BMP_RLE8_EOL:
  698. /* end of line */
  699. bmap += 2;
  700. x = 0;
  701. y--;
  702. /* 16bpix, 2-byte per pixel, width should *2 */
  703. fb -= (width * 2 + lcd_line_length);
  704. break;
  705. case BMP_RLE8_EOBMP:
  706. /* end of bitmap */
  707. decode = 0;
  708. break;
  709. case BMP_RLE8_DELTA:
  710. /* delta run */
  711. x += bmap[2];
  712. y -= bmap[3];
  713. /* 16bpix, 2-byte per pixel, x should *2 */
  714. fb = (uchar *) (lcd_base + (y + y_off - 1)
  715. * lcd_line_length + (x + x_off) * 2);
  716. bmap += 4;
  717. break;
  718. default:
  719. /* unencoded run */
  720. runlen = bmap[1];
  721. bmap += 2;
  722. if (y < height) {
  723. if (x < width) {
  724. if (x + runlen > width)
  725. cnt = width - x;
  726. else
  727. cnt = runlen;
  728. draw_unencoded_bitmap(
  729. (ushort **)&fb,
  730. bmap, cmap, cnt);
  731. }
  732. x += runlen;
  733. }
  734. bmap += runlen;
  735. if (runlen & 1)
  736. bmap++;
  737. }
  738. } else {
  739. /* encoded run */
  740. if (y < height) {
  741. runlen = bmap[0];
  742. if (x < width) {
  743. /* aggregate the same code */
  744. while (bmap[0] == 0xff &&
  745. bmap[2] != BMP_RLE8_ESCAPE &&
  746. bmap[1] == bmap[3]) {
  747. runlen += bmap[2];
  748. bmap += 2;
  749. }
  750. if (x + runlen > width)
  751. cnt = width - x;
  752. else
  753. cnt = runlen;
  754. draw_encoded_bitmap((ushort **)&fb,
  755. cmap[bmap[1]], cnt);
  756. }
  757. x += runlen;
  758. }
  759. bmap += 2;
  760. }
  761. }
  762. }
  763. #endif
  764. #if defined(CONFIG_MPC823) || defined(CONFIG_MCC200)
  765. #define FB_PUT_BYTE(fb, from) *(fb)++ = (255 - *(from)++)
  766. #else
  767. #define FB_PUT_BYTE(fb, from) *(fb)++ = *(from)++
  768. #endif
  769. #if defined(CONFIG_BMP_16BPP)
  770. #if defined(CONFIG_ATMEL_LCD_BGR555)
  771. static inline void fb_put_word(uchar **fb, uchar **from)
  772. {
  773. *(*fb)++ = (((*from)[0] & 0x1f) << 2) | ((*from)[1] & 0x03);
  774. *(*fb)++ = ((*from)[0] & 0xe0) | (((*from)[1] & 0x7c) >> 2);
  775. *from += 2;
  776. }
  777. #else
  778. static inline void fb_put_word(uchar **fb, uchar **from)
  779. {
  780. *(*fb)++ = *(*from)++;
  781. *(*fb)++ = *(*from)++;
  782. }
  783. #endif
  784. #endif /* CONFIG_BMP_16BPP */
  785. int lcd_display_bitmap(ulong bmp_image, int x, int y)
  786. {
  787. #if !defined(CONFIG_MCC200)
  788. ushort *cmap = NULL;
  789. #endif
  790. ushort *cmap_base = NULL;
  791. ushort i, j;
  792. uchar *fb;
  793. bmp_image_t *bmp = (bmp_image_t *)map_sysmem(bmp_image, 0);
  794. uchar *bmap;
  795. ushort padded_width;
  796. unsigned long width, height, byte_width;
  797. unsigned long pwidth = panel_info.vl_col;
  798. unsigned colors, bpix, bmp_bpix;
  799. if (!bmp || !(bmp->header.signature[0] == 'B' &&
  800. bmp->header.signature[1] == 'M')) {
  801. printf("Error: no valid bmp image at %lx\n", bmp_image);
  802. return 1;
  803. }
  804. width = get_unaligned_le32(&bmp->header.width);
  805. height = get_unaligned_le32(&bmp->header.height);
  806. bmp_bpix = get_unaligned_le16(&bmp->header.bit_count);
  807. colors = 1 << bmp_bpix;
  808. bpix = NBITS(panel_info.vl_bpix);
  809. if (bpix != 1 && bpix != 8 && bpix != 16 && bpix != 32) {
  810. printf ("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n",
  811. bpix, bmp_bpix);
  812. return 1;
  813. }
  814. /* We support displaying 8bpp BMPs on 16bpp LCDs */
  815. if (bpix != bmp_bpix && !(bmp_bpix == 8 && bpix == 16)) {
  816. printf ("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n",
  817. bpix, get_unaligned_le16(&bmp->header.bit_count));
  818. return 1;
  819. }
  820. debug("Display-bmp: %d x %d with %d colors\n",
  821. (int)width, (int)height, (int)colors);
  822. #if !defined(CONFIG_MCC200)
  823. /* MCC200 LCD doesn't need CMAP, supports 1bpp b&w only */
  824. if (bmp_bpix == 8) {
  825. cmap = configuration_get_cmap();
  826. cmap_base = cmap;
  827. /* Set color map */
  828. for (i = 0; i < colors; ++i) {
  829. bmp_color_table_entry_t cte = bmp->color_table[i];
  830. #if !defined(CONFIG_ATMEL_LCD)
  831. ushort colreg =
  832. ( ((cte.red) << 8) & 0xf800) |
  833. ( ((cte.green) << 3) & 0x07e0) |
  834. ( ((cte.blue) >> 3) & 0x001f) ;
  835. #ifdef CONFIG_SYS_INVERT_COLORS
  836. *cmap = 0xffff - colreg;
  837. #else
  838. *cmap = colreg;
  839. #endif
  840. #if defined(CONFIG_MPC823)
  841. cmap--;
  842. #else
  843. cmap++;
  844. #endif
  845. #else /* CONFIG_ATMEL_LCD */
  846. lcd_setcolreg(i, cte.red, cte.green, cte.blue);
  847. #endif
  848. }
  849. }
  850. #endif
  851. /*
  852. * BMP format for Monochrome assumes that the state of a
  853. * pixel is described on a per Bit basis, not per Byte.
  854. * So, in case of Monochrome BMP we should align widths
  855. * on a byte boundary and convert them from Bit to Byte
  856. * units.
  857. * Probably, PXA250 and MPC823 process 1bpp BMP images in
  858. * their own ways, so make the converting to be MCC200
  859. * specific.
  860. */
  861. #if defined(CONFIG_MCC200)
  862. if (bpix == 1) {
  863. width = ((width + 7) & ~7) >> 3;
  864. x = ((x + 7) & ~7) >> 3;
  865. pwidth= ((pwidth + 7) & ~7) >> 3;
  866. }
  867. #endif
  868. padded_width = (width & 0x3 ? (width & ~0x3) + 4 : width);
  869. #ifdef CONFIG_SPLASH_SCREEN_ALIGN
  870. splash_align_axis(&x, pwidth, width);
  871. splash_align_axis(&y, panel_info.vl_row, height);
  872. #endif /* CONFIG_SPLASH_SCREEN_ALIGN */
  873. if ((x + width) > pwidth)
  874. width = pwidth - x;
  875. if ((y + height) > panel_info.vl_row)
  876. height = panel_info.vl_row - y;
  877. bmap = (uchar *)bmp + get_unaligned_le32(&bmp->header.data_offset);
  878. fb = (uchar *)(lcd_base +
  879. (y + height - 1) * lcd_line_length + x * bpix / 8);
  880. switch (bmp_bpix) {
  881. case 1: /* pass through */
  882. case 8:
  883. #ifdef CONFIG_LCD_BMP_RLE8
  884. u32 compression = get_unaligned_le32(&bmp->header.compression);
  885. if (compression == BMP_BI_RLE8) {
  886. if (bpix != 16) {
  887. /* TODO implement render code for bpix != 16 */
  888. printf("Error: only support 16 bpix");
  889. return 1;
  890. }
  891. lcd_display_rle8_bitmap(bmp, cmap_base, fb, x, y);
  892. break;
  893. }
  894. #endif
  895. if (bpix != 16)
  896. byte_width = width;
  897. else
  898. byte_width = width * 2;
  899. for (i = 0; i < height; ++i) {
  900. WATCHDOG_RESET();
  901. for (j = 0; j < width; j++) {
  902. if (bpix != 16) {
  903. FB_PUT_BYTE(fb, bmap);
  904. } else {
  905. *(uint16_t *)fb = cmap_base[*(bmap++)];
  906. fb += sizeof(uint16_t) / sizeof(*fb);
  907. }
  908. }
  909. bmap += (padded_width - width);
  910. fb -= byte_width + lcd_line_length;
  911. }
  912. break;
  913. #if defined(CONFIG_BMP_16BPP)
  914. case 16:
  915. for (i = 0; i < height; ++i) {
  916. WATCHDOG_RESET();
  917. for (j = 0; j < width; j++)
  918. fb_put_word(&fb, &bmap);
  919. bmap += (padded_width - width) * 2;
  920. fb -= width * 2 + lcd_line_length;
  921. }
  922. break;
  923. #endif /* CONFIG_BMP_16BPP */
  924. #if defined(CONFIG_BMP_32BPP)
  925. case 32:
  926. for (i = 0; i < height; ++i) {
  927. for (j = 0; j < width; j++) {
  928. *(fb++) = *(bmap++);
  929. *(fb++) = *(bmap++);
  930. *(fb++) = *(bmap++);
  931. *(fb++) = *(bmap++);
  932. }
  933. fb -= lcd_line_length + width * (bpix / 8);
  934. }
  935. break;
  936. #endif /* CONFIG_BMP_32BPP */
  937. default:
  938. break;
  939. };
  940. lcd_sync();
  941. return 0;
  942. }
  943. #endif
  944. static void *lcd_logo(void)
  945. {
  946. #ifdef CONFIG_SPLASH_SCREEN
  947. char *s;
  948. ulong addr;
  949. static int do_splash = 1;
  950. if (do_splash && (s = getenv("splashimage")) != NULL) {
  951. int x = 0, y = 0;
  952. do_splash = 0;
  953. if (splash_screen_prepare())
  954. return (void *)lcd_base;
  955. addr = simple_strtoul (s, NULL, 16);
  956. splash_get_pos(&x, &y);
  957. if (bmp_display(addr, x, y) == 0)
  958. return (void *)lcd_base;
  959. }
  960. #endif /* CONFIG_SPLASH_SCREEN */
  961. bitmap_plot(0, 0);
  962. #ifdef CONFIG_LCD_INFO
  963. console_col = LCD_INFO_X / VIDEO_FONT_WIDTH;
  964. console_row = LCD_INFO_Y / VIDEO_FONT_HEIGHT;
  965. lcd_show_board_info();
  966. #endif /* CONFIG_LCD_INFO */
  967. #if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO)
  968. return (void *)((ulong)lcd_base + BMP_LOGO_HEIGHT * lcd_line_length);
  969. #else
  970. return (void *)lcd_base;
  971. #endif /* CONFIG_LCD_LOGO && !defined(CONFIG_LCD_INFO_BELOW_LOGO) */
  972. }
  973. #ifdef CONFIG_SPLASHIMAGE_GUARD
  974. static int on_splashimage(const char *name, const char *value, enum env_op op,
  975. int flags)
  976. {
  977. ulong addr;
  978. int aligned;
  979. if (op == env_op_delete)
  980. return 0;
  981. addr = simple_strtoul(value, NULL, 16);
  982. /* See README.displaying-bmps */
  983. aligned = (addr % 4 == 2);
  984. if (!aligned) {
  985. printf("Invalid splashimage value. Value must be 16 bit aligned, but not 32 bit aligned\n");
  986. return -1;
  987. }
  988. return 0;
  989. }
  990. U_BOOT_ENV_CALLBACK(splashimage, on_splashimage);
  991. #endif
  992. void lcd_position_cursor(unsigned col, unsigned row)
  993. {
  994. console_col = min(col, CONSOLE_COLS - 1);
  995. console_row = min(row, CONSOLE_ROWS - 1);
  996. }
  997. int lcd_get_pixel_width(void)
  998. {
  999. return panel_info.vl_col;
  1000. }
  1001. int lcd_get_pixel_height(void)
  1002. {
  1003. return panel_info.vl_row;
  1004. }
  1005. int lcd_get_screen_rows(void)
  1006. {
  1007. return CONSOLE_ROWS;
  1008. }
  1009. int lcd_get_screen_columns(void)
  1010. {
  1011. return CONSOLE_COLS;
  1012. }
  1013. #if defined(CONFIG_LCD_DT_SIMPLEFB)
  1014. static int lcd_dt_simplefb_configure_node(void *blob, int off)
  1015. {
  1016. u32 stride;
  1017. fdt32_t cells[2];
  1018. int ret;
  1019. static const char format[] =
  1020. #if LCD_BPP == LCD_COLOR16
  1021. "r5g6b5";
  1022. #else
  1023. "";
  1024. #endif
  1025. if (!format[0])
  1026. return -1;
  1027. stride = panel_info.vl_col * 2;
  1028. cells[0] = cpu_to_fdt32(gd->fb_base);
  1029. cells[1] = cpu_to_fdt32(stride * panel_info.vl_row);
  1030. ret = fdt_setprop(blob, off, "reg", cells, sizeof(cells[0]) * 2);
  1031. if (ret < 0)
  1032. return -1;
  1033. cells[0] = cpu_to_fdt32(panel_info.vl_col);
  1034. ret = fdt_setprop(blob, off, "width", cells, sizeof(cells[0]));
  1035. if (ret < 0)
  1036. return -1;
  1037. cells[0] = cpu_to_fdt32(panel_info.vl_row);
  1038. ret = fdt_setprop(blob, off, "height", cells, sizeof(cells[0]));
  1039. if (ret < 0)
  1040. return -1;
  1041. cells[0] = cpu_to_fdt32(stride);
  1042. ret = fdt_setprop(blob, off, "stride", cells, sizeof(cells[0]));
  1043. if (ret < 0)
  1044. return -1;
  1045. ret = fdt_setprop(blob, off, "format", format, strlen(format) + 1);
  1046. if (ret < 0)
  1047. return -1;
  1048. ret = fdt_delprop(blob, off, "status");
  1049. if (ret < 0)
  1050. return -1;
  1051. return 0;
  1052. }
  1053. int lcd_dt_simplefb_add_node(void *blob)
  1054. {
  1055. static const char compat[] = "simple-framebuffer";
  1056. static const char disabled[] = "disabled";
  1057. int off, ret;
  1058. off = fdt_add_subnode(blob, 0, "framebuffer");
  1059. if (off < 0)
  1060. return -1;
  1061. ret = fdt_setprop(blob, off, "status", disabled, sizeof(disabled));
  1062. if (ret < 0)
  1063. return -1;
  1064. ret = fdt_setprop(blob, off, "compatible", compat, sizeof(compat));
  1065. if (ret < 0)
  1066. return -1;
  1067. return lcd_dt_simplefb_configure_node(blob, off);
  1068. }
  1069. int lcd_dt_simplefb_enable_existing_node(void *blob)
  1070. {
  1071. int off;
  1072. off = fdt_node_offset_by_compatible(blob, -1, "simple-framebuffer");
  1073. if (off < 0)
  1074. return -1;
  1075. return lcd_dt_simplefb_configure_node(blob, off);
  1076. }
  1077. #endif