]>
Commit | Line | Data |
---|---|---|
83d290c5 | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
fe8c2806 | 2 | /* |
8655b6f8 | 3 | * MPC823 and PXA LCD Controller |
fe8c2806 WD |
4 | * |
5 | * Modeled after video interface by Paolo Scaffardi | |
6 | * | |
7 | * | |
8 | * (C) Copyright 2001 | |
9 | * Wolfgang Denk, DENX Software Engineering, [email protected]. | |
fe8c2806 WD |
10 | */ |
11 | ||
12 | #ifndef _LCD_H_ | |
13 | #define _LCD_H_ | |
904672ee | 14 | #include <lcd_console.h> |
c8d2febc NK |
15 | #if defined(CONFIG_CMD_BMP) || defined(CONFIG_SPLASH_SCREEN) |
16 | #include <bmp_layout.h> | |
17 | #include <asm/byteorder.h> | |
18 | #endif | |
fe8c2806 | 19 | |
6cbf5de7 SG |
20 | int bmp_display(ulong addr, int x, int y); |
21 | struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp, | |
22 | void **alloc_addr); | |
23 | ||
24 | #ifndef CONFIG_DM_VIDEO | |
25 | ||
682011ff | 26 | extern char lcd_is_enabled; |
8655b6f8 | 27 | extern int lcd_line_length; |
6111722a AR |
28 | extern struct vidinfo panel_info; |
29 | ||
6b035141 JH |
30 | void lcd_ctrl_init(void *lcdbase); |
31 | void lcd_enable(void); | |
6b035141 | 32 | void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue); |
6111722a | 33 | |
9a8efc46 SG |
34 | /** |
35 | * Set whether we need to flush the dcache when changing the LCD image. This | |
36 | * defaults to off. | |
37 | * | |
38 | * @param flush non-zero to flush cache after update, 0 to skip | |
39 | */ | |
40 | void lcd_set_flush_dcache(int flush); | |
41 | ||
5b8e76c3 | 42 | #if defined(CONFIG_CPU_PXA25X) || defined(CONFIG_CPU_PXA27X) || \ |
abc20aba | 43 | defined CONFIG_CPU_MONAHANS |
baaa7dd7 | 44 | #include <pxa_lcd.h> |
f6b690e6 | 45 | #elif defined(CONFIG_ATMEL_LCD) || defined(CONFIG_ATMEL_HLCD) |
baaa7dd7 | 46 | #include <atmel_lcd.h> |
559a05cc | 47 | #elif defined(CONFIG_EXYNOS_FB) |
baaa7dd7 | 48 | #include <exynos_lcd.h> |
b245e65e | 49 | #else |
b245e65e GL |
50 | typedef struct vidinfo { |
51 | ushort vl_col; /* Number of columns (i.e. 160) */ | |
52 | ushort vl_row; /* Number of rows (i.e. 100) */ | |
604c7d4a | 53 | ushort vl_rot; /* Rotation of Display (0, 1, 2, 3) */ |
b245e65e | 54 | u_char vl_bpix; /* Bits per pixel, 0 = 1 */ |
b245e65e | 55 | ushort *cmap; /* Pointer to the colormap */ |
b245e65e GL |
56 | void *priv; /* Pointer to driver-specific data */ |
57 | } vidinfo_t; | |
38b55087 NK |
58 | |
59 | static __maybe_unused ushort *configuration_get_cmap(void) | |
60 | { | |
61 | return panel_info.cmap; | |
62 | } | |
baaa7dd7 | 63 | #endif |
8655b6f8 | 64 | |
38b55087 NK |
65 | ushort *configuration_get_cmap(void); |
66 | ||
60e97419 AR |
67 | extern vidinfo_t panel_info; |
68 | ||
c8d2febc NK |
69 | void lcd_putc(const char c); |
70 | void lcd_puts(const char *s); | |
71 | void lcd_printf(const char *fmt, ...); | |
72 | void lcd_clear(void); | |
73 | int lcd_display_bitmap(ulong bmp_image, int x, int y); | |
fe8c2806 | 74 | |
395166cf VB |
75 | /** |
76 | * Get the width of the LCD in pixels | |
77 | * | |
78 | * @return width of LCD in pixels | |
79 | */ | |
80 | int lcd_get_pixel_width(void); | |
81 | ||
82 | /** | |
83 | * Get the height of the LCD in pixels | |
84 | * | |
85 | * @return height of LCD in pixels | |
86 | */ | |
87 | int lcd_get_pixel_height(void); | |
88 | ||
89 | /** | |
90 | * Get the number of text lines/rows on the LCD | |
91 | * | |
92 | * @return number of rows | |
93 | */ | |
94 | int lcd_get_screen_rows(void); | |
95 | ||
96 | /** | |
97 | * Get the number of text columns on the LCD | |
98 | * | |
99 | * @return number of columns | |
100 | */ | |
101 | int lcd_get_screen_columns(void); | |
102 | ||
4d03634e NK |
103 | /** |
104 | * Get the background color of the LCD | |
105 | * | |
106 | * @return background color value | |
107 | */ | |
108 | int lcd_getbgcolor(void); | |
109 | ||
110 | /** | |
111 | * Get the foreground color of the LCD | |
112 | * | |
113 | * @return foreground color value | |
114 | */ | |
115 | int lcd_getfgcolor(void); | |
116 | ||
395166cf VB |
117 | /** |
118 | * Set the position of the text cursor | |
119 | * | |
120 | * @param col Column to place cursor (0 = left side) | |
121 | * @param row Row to place cursor (0 = top line) | |
122 | */ | |
123 | void lcd_position_cursor(unsigned col, unsigned row); | |
124 | ||
6b59e03e HS |
125 | /* Allow boards to customize the information displayed */ |
126 | void lcd_show_board_info(void); | |
8655b6f8 | 127 | |
676d319e SG |
128 | /* Return the size of the LCD frame buffer, and the line length */ |
129 | int lcd_get_size(int *line_length); | |
130 | ||
7d95f2a3 SG |
131 | /* Update the LCD / flush the cache */ |
132 | void lcd_sync(void); | |
133 | ||
8655b6f8 WD |
134 | /* |
135 | * Information about displays we are using. This is for configuring | |
136 | * the LCD controller and memory allocation. Someone has to know what | |
137 | * is connected, as we can't autodetect anything. | |
138 | */ | |
6d0f6bcf | 139 | #define CONFIG_SYS_HIGH 0 /* Pins are active high */ |
6b035141 | 140 | #define CONFIG_SYS_LOW 1 /* Pins are active low */ |
8655b6f8 WD |
141 | |
142 | #define LCD_MONOCHROME 0 | |
143 | #define LCD_COLOR2 1 | |
144 | #define LCD_COLOR4 2 | |
145 | #define LCD_COLOR8 3 | |
146 | #define LCD_COLOR16 4 | |
57d76a89 | 147 | #define LCD_COLOR32 5 |
c8d2febc | 148 | |
88804d19 | 149 | #if defined(CONFIG_LCD_INFO_BELOW_LOGO) |
c8d2febc NK |
150 | #define LCD_INFO_X 0 |
151 | #define LCD_INFO_Y (BMP_LOGO_HEIGHT + VIDEO_FONT_HEIGHT) | |
8655b6f8 | 152 | #elif defined(CONFIG_LCD_LOGO) |
c8d2febc NK |
153 | #define LCD_INFO_X (BMP_LOGO_WIDTH + 4 * VIDEO_FONT_WIDTH) |
154 | #define LCD_INFO_Y VIDEO_FONT_HEIGHT | |
8655b6f8 | 155 | #else |
c8d2febc NK |
156 | #define LCD_INFO_X VIDEO_FONT_WIDTH |
157 | #define LCD_INFO_Y VIDEO_FONT_HEIGHT | |
8655b6f8 WD |
158 | #endif |
159 | ||
160 | /* Default to 8bpp if bit depth not specified */ | |
161 | #ifndef LCD_BPP | |
c8d2febc | 162 | #define LCD_BPP LCD_COLOR8 |
8655b6f8 | 163 | #endif |
c8d2febc | 164 | |
8655b6f8 | 165 | #ifndef LCD_DF |
c8d2febc | 166 | #define LCD_DF 1 |
8655b6f8 WD |
167 | #endif |
168 | ||
169 | /* Calculate nr. of bits per pixel and nr. of colors */ | |
170 | #define NBITS(bit_code) (1 << (bit_code)) | |
171 | #define NCOLORS(bit_code) (1 << NBITS(bit_code)) | |
172 | ||
f4469f50 | 173 | #if LCD_BPP == LCD_COLOR8 |
8655b6f8 WD |
174 | # define CONSOLE_COLOR_BLACK 0 |
175 | # define CONSOLE_COLOR_RED 1 | |
176 | # define CONSOLE_COLOR_GREEN 2 | |
177 | # define CONSOLE_COLOR_YELLOW 3 | |
178 | # define CONSOLE_COLOR_BLUE 4 | |
179 | # define CONSOLE_COLOR_MAGENTA 5 | |
180 | # define CONSOLE_COLOR_CYAN 6 | |
181 | # define CONSOLE_COLOR_GREY 14 | |
c8d2febc | 182 | # define CONSOLE_COLOR_WHITE 15 /* Must remain last / highest */ |
57d76a89 | 183 | #elif LCD_BPP == LCD_COLOR32 |
c8d2febc NK |
184 | #define CONSOLE_COLOR_RED 0x00ff0000 |
185 | #define CONSOLE_COLOR_GREEN 0x0000ff00 | |
186 | #define CONSOLE_COLOR_YELLOW 0x00ffff00 | |
187 | #define CONSOLE_COLOR_BLUE 0x000000ff | |
188 | #define CONSOLE_COLOR_MAGENTA 0x00ff00ff | |
189 | #define CONSOLE_COLOR_CYAN 0x0000ffff | |
190 | #define CONSOLE_COLOR_GREY 0x00aaaaaa | |
191 | #define CONSOLE_COLOR_BLACK 0x00000000 | |
192 | #define CONSOLE_COLOR_WHITE 0x00ffffff /* Must remain last / highest */ | |
193 | #define NBYTES(bit_code) (NBITS(bit_code) >> 3) | |
194 | #else /* 16bpp color definitions */ | |
e32951b5 AN |
195 | # define CONSOLE_COLOR_BLACK 0x0000 |
196 | # define CONSOLE_COLOR_RED 0xF800 | |
197 | # define CONSOLE_COLOR_GREEN 0x07E0 | |
198 | # define CONSOLE_COLOR_YELLOW 0xFFE0 | |
199 | # define CONSOLE_COLOR_BLUE 0x001F | |
200 | # define CONSOLE_COLOR_MAGENTA 0xF81F | |
201 | # define CONSOLE_COLOR_CYAN 0x07FF | |
202 | # define CONSOLE_COLOR_GREY 0xC618 | |
203 | # define CONSOLE_COLOR_WHITE 0xffff /* Must remain last / highest */ | |
8655b6f8 WD |
204 | #endif /* color definitions */ |
205 | ||
604c7d4a HP |
206 | #if LCD_BPP == LCD_COLOR16 |
207 | #define fbptr_t ushort | |
208 | #elif LCD_BPP == LCD_COLOR32 | |
209 | #define fbptr_t u32 | |
210 | #else | |
211 | #define fbptr_t uchar | |
212 | #endif | |
213 | ||
8655b6f8 | 214 | #ifndef PAGE_SIZE |
c8d2febc | 215 | #define PAGE_SIZE 4096 |
8655b6f8 WD |
216 | #endif |
217 | ||
6cbf5de7 SG |
218 | #endif /* !CONFIG_DM_VIDEO */ |
219 | ||
8655b6f8 | 220 | #endif /* _LCD_H_ */ |