2 * MPC823 and PXA LCD Controller
4 * Modeled after video interface by Paolo Scaffardi
8 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
10 * SPDX-License-Identifier: GPL-2.0+
15 #include <lcd_console.h>
17 extern char lcd_is_enabled;
19 extern int lcd_line_length;
21 extern struct vidinfo panel_info;
23 void lcd_ctrl_init(void *lcdbase);
24 void lcd_enable(void);
26 /* setcolreg used in 8bpp/16bpp; initcolregs used in monochrome */
27 void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue);
28 void lcd_initcolregs(void);
30 /* gunzip_bmp used if CONFIG_VIDEO_BMP_GZIP */
31 struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp,
33 int bmp_display(ulong addr, int x, int y);
36 * Set whether we need to flush the dcache when changing the LCD image. This
39 * @param flush non-zero to flush cache after update, 0 to skip
41 void lcd_set_flush_dcache(int flush);
43 #if defined CONFIG_MPC823
44 #include <mpc823_lcd.h>
45 #elif defined(CONFIG_CPU_PXA25X) || defined(CONFIG_CPU_PXA27X) || \
46 defined CONFIG_CPU_MONAHANS
48 #elif defined(CONFIG_ATMEL_LCD) || defined(CONFIG_ATMEL_HLCD)
49 #include <atmel_lcd.h>
50 #elif defined(CONFIG_EXYNOS_FB)
51 #include <exynos_lcd.h>
53 typedef struct vidinfo {
54 ushort vl_col; /* Number of columns (i.e. 160) */
55 ushort vl_row; /* Number of rows (i.e. 100) */
57 u_char vl_bpix; /* Bits per pixel, 0 = 1 */
59 ushort *cmap; /* Pointer to the colormap */
61 void *priv; /* Pointer to driver-specific data */
65 extern vidinfo_t panel_info;
69 void lcd_putc(const char c);
70 void lcd_puts(const char *s);
71 void lcd_printf(const char *fmt, ...);
73 int lcd_display_bitmap(ulong bmp_image, int x, int y);
76 * Get the width of the LCD in pixels
78 * @return width of LCD in pixels
80 int lcd_get_pixel_width(void);
83 * Get the height of the LCD in pixels
85 * @return height of LCD in pixels
87 int lcd_get_pixel_height(void);
90 * Get the number of text lines/rows on the LCD
92 * @return number of rows
94 int lcd_get_screen_rows(void);
97 * Get the number of text columns on the LCD
99 * @return number of columns
101 int lcd_get_screen_columns(void);
104 * Get the background color of the LCD
106 * @return background color value
108 int lcd_getbgcolor(void);
111 * Get the foreground color of the LCD
113 * @return foreground color value
115 int lcd_getfgcolor(void);
118 * Set the position of the text cursor
120 * @param col Column to place cursor (0 = left side)
121 * @param row Row to place cursor (0 = top line)
123 void lcd_position_cursor(unsigned col, unsigned row);
125 /* Allow boards to customize the information displayed */
126 void lcd_show_board_info(void);
128 /* Return the size of the LCD frame buffer, and the line length */
129 int lcd_get_size(int *line_length);
131 int lcd_dt_simplefb_add_node(void *blob);
132 int lcd_dt_simplefb_enable_existing_node(void *blob);
134 /* Update the LCD / flush the cache */
137 /************************************************************************/
138 /* ** BITMAP DISPLAY SUPPORT */
139 /************************************************************************/
140 #if defined(CONFIG_CMD_BMP) || defined(CONFIG_SPLASH_SCREEN)
141 # include <bmp_layout.h>
142 # include <asm/byteorder.h>
146 * Information about displays we are using. This is for configuring
147 * the LCD controller and memory allocation. Someone has to know what
148 * is connected, as we can't autodetect anything.
150 #define CONFIG_SYS_HIGH 0 /* Pins are active high */
151 #define CONFIG_SYS_LOW 1 /* Pins are active low */
153 #define LCD_MONOCHROME 0
157 #define LCD_COLOR16 4
158 #define LCD_COLOR32 5
159 /*----------------------------------------------------------------------*/
160 #if defined(CONFIG_LCD_INFO_BELOW_LOGO)
161 # define LCD_INFO_X 0
162 # define LCD_INFO_Y (BMP_LOGO_HEIGHT + VIDEO_FONT_HEIGHT)
163 #elif defined(CONFIG_LCD_LOGO)
164 # define LCD_INFO_X (BMP_LOGO_WIDTH + 4 * VIDEO_FONT_WIDTH)
165 # define LCD_INFO_Y VIDEO_FONT_HEIGHT
167 # define LCD_INFO_X VIDEO_FONT_WIDTH
168 # define LCD_INFO_Y VIDEO_FONT_HEIGHT
171 /* Default to 8bpp if bit depth not specified */
173 # define LCD_BPP LCD_COLOR8
179 /* Calculate nr. of bits per pixel and nr. of colors */
180 #define NBITS(bit_code) (1 << (bit_code))
181 #define NCOLORS(bit_code) (1 << NBITS(bit_code))
183 /************************************************************************/
184 /* ** CONSOLE CONSTANTS */
185 /************************************************************************/
186 #if LCD_BPP == LCD_COLOR8
189 * 8bpp color definitions
191 # define CONSOLE_COLOR_BLACK 0
192 # define CONSOLE_COLOR_RED 1
193 # define CONSOLE_COLOR_GREEN 2
194 # define CONSOLE_COLOR_YELLOW 3
195 # define CONSOLE_COLOR_BLUE 4
196 # define CONSOLE_COLOR_MAGENTA 5
197 # define CONSOLE_COLOR_CYAN 6
198 # define CONSOLE_COLOR_GREY 14
199 # define CONSOLE_COLOR_WHITE 15 /* Must remain last / highest */
201 #elif LCD_BPP == LCD_COLOR32
203 * 32bpp color definitions
205 # define CONSOLE_COLOR_RED 0x00ff0000
206 # define CONSOLE_COLOR_GREEN 0x0000ff00
207 # define CONSOLE_COLOR_YELLOW 0x00ffff00
208 # define CONSOLE_COLOR_BLUE 0x000000ff
209 # define CONSOLE_COLOR_MAGENTA 0x00ff00ff
210 # define CONSOLE_COLOR_CYAN 0x0000ffff
211 # define CONSOLE_COLOR_GREY 0x00aaaaaa
212 # define CONSOLE_COLOR_BLACK 0x00000000
213 # define CONSOLE_COLOR_WHITE 0x00ffffff /* Must remain last / highest*/
214 # define NBYTES(bit_code) (NBITS(bit_code) >> 3)
219 * 16bpp color definitions
221 # define CONSOLE_COLOR_BLACK 0x0000
222 # define CONSOLE_COLOR_WHITE 0xffff /* Must remain last / highest */
224 #endif /* color definitions */
226 /************************************************************************/
228 # define PAGE_SIZE 4096
231 /************************************************************************/