summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorPeng Fan <peng.fan@nxp.com>2016-02-23 10:14:34 +0800
committerYe Li <ye.li@nxp.com>2022-04-06 15:58:25 +0800
commit628b6dc3a049d114866e78cad144ad477b2e1062 (patch)
tree50f729731b257c548d6fabe424a860e0396bf0f0 /common
parent4c9db8b127aa09fed18f7a7d4ac457ad3ed42206 (diff)
MLK-12425-2 video: epdc: introduce epdc support
Support EPDC. E-Ink feature is supported by i.MX6DL/SL/SLL/ULL and i.MX7D. This driver supports user defined logo file, if there is no logo file, it will draw a black border around a white screen. If need to enable EPDC, a waveform file is required to let all work. Since we need LCD_MONOCHROME mode for EPDC, we introduce LCD_MONOCHROME support. Please refer to Linux Reference Manual for how to flash WAVEFORM file. Signed-off-by: Peng Fan <peng.fan@nxp.com> Signed-off-by: Robby Cai <R63905@freescale.com> Signed-off-by: Nitin Garg <nitin.garg@freescale.com> Signed-off-by: Ye.Li <B37916@freescale.com> (cherry picked from commit a7244f279cc3c3994bcd103f5e9a183b1075ae71) (cherry picked from commit 21bf1c38b7d75c31875fb02a972c458f25d9c33a) (cherry picked from commit 237742f73998b35dd896592e19f1e119e72baa71) (cherry picked from commit 3e788604343274e806510261aea407a9d916755b) (cherry picked from commit 23f3d6499e05e82c462a6238970923d72c3e1465) (cherry picked from commit eb91e772b346d437a075d9554b2c6831a4ca5156)
Diffstat (limited to 'common')
-rw-r--r--common/lcd.c21
-rw-r--r--common/lcd_console.c21
2 files changed, 28 insertions, 14 deletions
diff --git a/common/lcd.c b/common/lcd.c
index 16a0a7cea8..9fc8ceba8c 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -39,11 +39,6 @@
#define CONFIG_LCD_ALIGNMENT PAGE_SIZE
#endif
-#if (LCD_BPP != LCD_COLOR8) && (LCD_BPP != LCD_COLOR16) && \
- (LCD_BPP != LCD_COLOR32)
-#error Unsupported LCD BPP.
-#endif
-
DECLARE_GLOBAL_DATA_PTR;
static int lcd_init(void *lcdbase);
@@ -175,10 +170,13 @@ int drv_lcd_init(void)
void lcd_clear(void)
{
- int bg_color;
__maybe_unused ulong addr;
static int do_splash = 1;
-#if LCD_BPP == LCD_COLOR8
+#if LCD_BPP == LCD_MONOCHROME
+ /* Setting the palette */
+ lcd_initcolregs();
+
+#elif LCD_BPP == LCD_COLOR8
/* Setting the palette */
lcd_setcolreg(CONSOLE_COLOR_BLACK, 0, 0, 0);
lcd_setcolreg(CONSOLE_COLOR_RED, 0xFF, 0, 0);
@@ -194,11 +192,9 @@ void lcd_clear(void)
#ifndef CONFIG_SYS_WHITE_ON_BLACK
lcd_setfgcolor(CONSOLE_COLOR_BLACK);
lcd_setbgcolor(CONSOLE_COLOR_WHITE);
- bg_color = CONSOLE_COLOR_WHITE;
#else
lcd_setfgcolor(CONSOLE_COLOR_WHITE);
lcd_setbgcolor(CONSOLE_COLOR_BLACK);
- bg_color = CONSOLE_COLOR_BLACK;
#endif /* CONFIG_SYS_WHITE_ON_BLACK */
#ifdef LCD_TEST_PATTERN
@@ -206,14 +202,15 @@ void lcd_clear(void)
#else
/* set framebuffer to background color */
#if (LCD_BPP != LCD_COLOR32)
- memset((char *)lcd_base, bg_color, lcd_line_length * panel_info.vl_row);
+ memset((char *)lcd_base, COLOR_MASK(lcd_getbgcolor()),
+ lcd_line_length * panel_info.vl_row);
#else
u32 *ppix = lcd_base;
u32 i;
for (i = 0;
i < (lcd_line_length * panel_info.vl_row)/NBYTES(panel_info.vl_bpix);
i++) {
- *ppix++ = bg_color;
+ *ppix++ = COLOR_MASK(lcd_getbgcolor());
}
#endif
#endif
@@ -286,7 +283,7 @@ ulong lcd_setmem(ulong addr)
ulong size;
int line_length;
- debug("LCD panel info: %d x %d, %d bit/pix\n", panel_info.vl_col,
+ debug("LCD panel info: %lu x %lu, %d bit/pix\n", panel_info.vl_col,
panel_info.vl_row, NBITS(panel_info.vl_bpix));
size = lcd_get_size(&line_length);
diff --git a/common/lcd_console.c b/common/lcd_console.c
index ed36c78440..2a08992d9a 100644
--- a/common/lcd_console.c
+++ b/common/lcd_console.c
@@ -48,17 +48,34 @@ static void lcd_putc_xy0(struct console_t *pcons, ushort x, ushort y, char c)
{
int fg_color = lcd_getfgcolor();
int bg_color = lcd_getbgcolor();
- int i, row;
+ int row;
+#if LCD_BPP == LCD_MONOCHROME
+ ushort off = x * (1 << LCD_BPP) % 8;
+#else
+ int i;
+#endif
+
fbptr_t *dst = (fbptr_t *)pcons->fbbase +
y * pcons->lcdsizex +
x;
for (row = 0; row < VIDEO_FONT_HEIGHT; row++) {
uchar bits = video_fontdata[c * VIDEO_FONT_HEIGHT + row];
+#if LCD_BPP == LCD_MONOCHROME
+ uchar rest = *dst & -(1 << (8 - off));
+ uchar sym;
+
+ sym = (COLOR_MASK(fg_color) & bits) |
+ (COLOR_MASK(bg_color) & ~bits);
+ *dst++ = rest | (sym >> off);
+ rest = sym << (8 - off);
+ *dst = rest | (*dst & ((1 << (8 - off)) - 1));
+#else /* LCD_BPP == LCD_COLOR8 or LCD_COLOR16 or LCD_COLOR32 */
for (i = 0; i < VIDEO_FONT_WIDTH; ++i) {
*dst++ = (bits & 0x80) ? fg_color : bg_color;
bits <<= 1;
}
+#endif
dst += (pcons->lcdsizex - VIDEO_FONT_WIDTH);
}
}
@@ -116,7 +133,7 @@ static inline void console_newline(void)
for (i = 0; i < cons.rows-rows; i++)
cons.fp_console_moverow(&cons, i, i+rows);
for (i = 0; i < rows; i++)
- cons.fp_console_setrow(&cons, cons.rows-i-1, bg_color);
+ cons.fp_console_setrow(&cons, cons.rows-i-1, COLOR_MASK(bg_color));
cons.curr_row -= rows;
}
lcd_sync();