diff options
author | Andrew Ryabinin <ryabinin.a.a@gmail.com> | 2012-06-23 22:35:04 +0400 |
---|---|---|
committer | Andrew Ryabinin <ryabinin.a.a@gmail.com> | 2012-06-30 21:01:25 +0400 |
commit | 052b5f1da916ac931ea6afebb232839fc913aaba (patch) | |
tree | b05bf65a5491be7ca8ded4b7c11b37f0382cc1fc | |
parent | bed847a655763925311029acd7080543b7fcf352 (diff) | |
download | rockbox-052b5f1da916ac931ea6afebb232839fc913aaba.tar.gz rockbox-052b5f1da916ac931ea6afebb232839fc913aaba.zip |
hm60x: Add support for HM-601 slims with new lcds.bootloader_hifimanhm60x_v2
Change-Id: I02d5c85e70686c842f1379aba24ff045b260a4ff
-rw-r--r-- | firmware/target/arm/rk27xx/lcd-hifiman.c | 187 |
1 files changed, 167 insertions, 20 deletions
diff --git a/firmware/target/arm/rk27xx/lcd-hifiman.c b/firmware/target/arm/rk27xx/lcd-hifiman.c index d98ed5a1c3..b97766c840 100644 --- a/firmware/target/arm/rk27xx/lcd-hifiman.c +++ b/firmware/target/arm/rk27xx/lcd-hifiman.c | |||
@@ -29,7 +29,7 @@ | |||
29 | 29 | ||
30 | static bool display_on = false; | 30 | static bool display_on = false; |
31 | 31 | ||
32 | static void lcd_display_init(void) | 32 | static void lcd_v1_display_init(void) |
33 | { | 33 | { |
34 | unsigned int x, y; | 34 | unsigned int x, y; |
35 | 35 | ||
@@ -108,13 +108,7 @@ static void lcd_display_init(void) | |||
108 | display_on = true; | 108 | display_on = true; |
109 | } | 109 | } |
110 | 110 | ||
111 | void lcd_init_device(void) | 111 | static void lcd_v1_enable (bool on) |
112 | { | ||
113 | lcdif_init(LCDIF_16BIT); | ||
114 | lcd_display_init(); | ||
115 | } | ||
116 | |||
117 | void lcd_enable (bool on) | ||
118 | { | 112 | { |
119 | if (on) | 113 | if (on) |
120 | { | 114 | { |
@@ -145,32 +139,185 @@ void lcd_enable (bool on) | |||
145 | lcd_write_reg(0x21, 0x00); | 139 | lcd_write_reg(0x21, 0x00); |
146 | } | 140 | } |
147 | display_on = on; | 141 | display_on = on; |
148 | |||
149 | } | 142 | } |
150 | 143 | ||
151 | bool lcd_active() | 144 | static void lcd_v1_update_rect(int x, int y, int width, int height) |
152 | { | 145 | { |
153 | return display_on; | 146 | int px = x, py = y; |
147 | int pxmax = x + width, pymax = y + height; | ||
148 | |||
149 | lcd_write_reg(0x03, y); | ||
150 | lcd_write_reg(0x05, pymax-1); | ||
151 | lcd_write_reg(0x07, x); | ||
152 | lcd_write_reg(0x09, pxmax-1); | ||
153 | |||
154 | lcd_cmd(0x22); | ||
155 | |||
156 | for (px=x; px<pxmax; px++) | ||
157 | for (py=y; py<pymax; py++) | ||
158 | lcd_data(*FBADDR(px, py)); | ||
154 | } | 159 | } |
155 | 160 | ||
156 | 161 | ||
157 | void lcd_update_rect(int x, int y, int width, int height) | 162 | #ifdef HM60X |
163 | |||
164 | enum lcd_type_t | ||
158 | { | 165 | { |
159 | int px = x, py = y; | 166 | LCD_V1, |
160 | int pxmax = x + width, pymax = y + height; | 167 | LCD_v2 |
168 | } lcd_type; | ||
169 | |||
170 | static void identify_lcd(void) | ||
171 | { | ||
172 | SCU_IOMUXB_CON &= ~(1<<2); | ||
173 | GPIO_PCCON |= (1<<4); | ||
174 | if (GPIO_PCDR & (1<<4)) | ||
175 | { | ||
176 | lcd_type = LCD_V1; | ||
177 | } | ||
178 | else | ||
179 | { | ||
180 | lcd_type = LCD_v2; | ||
181 | } | ||
182 | } | ||
183 | |||
184 | static void lcd_v2_display_init(void) | ||
185 | { | ||
186 | unsigned int x, y; | ||
161 | 187 | ||
162 | lcd_write_reg(0x03, y); | 188 | lcd_write_reg(0xD0, 0x0003); |
163 | lcd_write_reg(0x05, pymax-1); | 189 | lcd_write_reg(0xEB, 0x0B00); |
164 | lcd_write_reg(0x07, x); | 190 | lcd_write_reg(0xEC, 0x00CF); |
165 | lcd_write_reg(0x09, pxmax-1); | 191 | lcd_write_reg(0xC7, 0x030F); |
192 | |||
193 | lcd_write_reg(0x01, 0x001C); | ||
194 | lcd_write_reg(0x02, 0x0100); | ||
195 | lcd_write_reg(0x03, 0x1038); | ||
196 | lcd_write_reg(0x07, 0x0000); | ||
197 | lcd_write_reg(0x08, 0x0808); | ||
198 | lcd_write_reg(0x0F, 0x0901); | ||
199 | lcd_write_reg(0x10, 0x0000); | ||
200 | lcd_write_reg(0x11, 0x1B41); | ||
201 | lcd_write_reg(0x12, 0x2010); | ||
202 | lcd_write_reg(0x13, 0x0009); | ||
203 | lcd_write_reg(0x14, 0x4C65); | ||
204 | |||
205 | lcd_write_reg(0x30, 0x0000); | ||
206 | lcd_write_reg(0x31, 0x00DB); | ||
207 | lcd_write_reg(0x32, 0x0000); | ||
208 | lcd_write_reg(0x33, 0x0000); | ||
209 | lcd_write_reg(0x34, 0x00DB); | ||
210 | lcd_write_reg(0x35, 0x0000); | ||
211 | lcd_write_reg(0x36, 0x00AF); | ||
212 | lcd_write_reg(0x37, 0x0000); | ||
213 | lcd_write_reg(0x38, 0x00DB); | ||
214 | lcd_write_reg(0x39, 0x0000); | ||
215 | |||
216 | lcd_write_reg(0x50, 0x0000); | ||
217 | lcd_write_reg(0x51, 0x0705); | ||
218 | lcd_write_reg(0x52, 0x0C0A); | ||
219 | lcd_write_reg(0x53, 0x0401); | ||
220 | lcd_write_reg(0x54, 0x040C); | ||
221 | lcd_write_reg(0x55, 0x0608); | ||
222 | lcd_write_reg(0x56, 0x0000); | ||
223 | lcd_write_reg(0x57, 0x0104); | ||
224 | lcd_write_reg(0x58, 0x0E06); | ||
225 | lcd_write_reg(0x59, 0x060E); | ||
226 | |||
227 | lcd_write_reg(0x20, 0x0000); | ||
228 | lcd_write_reg(0x21, 0x0000); | ||
229 | |||
230 | lcd_write_reg(0x07, 0x1017); | ||
231 | |||
232 | lcd_write_reg(0x20, 0x00AF); | ||
233 | lcd_write_reg(0x21, 0x0000); | ||
166 | 234 | ||
167 | lcd_cmd(0x22); | 235 | lcd_cmd(0x22); |
168 | 236 | ||
169 | for (px=x; px<pxmax; px++) | 237 | for (x=0; x<LCD_WIDTH; x++) |
170 | for (py=y; py<pymax; py++) | 238 | for(y=0; y<LCD_HEIGHT; y++) |
239 | lcd_data(0x00); | ||
240 | |||
241 | display_on = true; | ||
242 | } | ||
243 | |||
244 | static void lcd_v2_enable (bool on) | ||
245 | { | ||
246 | display_on = on; | ||
247 | } | ||
248 | |||
249 | static void lcd_v2_update_rect(int x, int y, int width, int height) | ||
250 | { | ||
251 | int px, py; | ||
252 | (void) x; | ||
253 | (void) y; | ||
254 | (void) width; | ||
255 | (void)height; | ||
256 | |||
257 | lcd_cmd(0x22); | ||
258 | |||
259 | for (py=0; py<LCD_HEIGHT; py++) | ||
260 | for (px=0; px<LCD_WIDTH; px++) | ||
171 | lcd_data(*FBADDR(px, py)); | 261 | lcd_data(*FBADDR(px, py)); |
172 | } | 262 | } |
173 | 263 | ||
264 | void lcd_init_device(void) | ||
265 | { | ||
266 | lcdif_init(LCDIF_16BIT); | ||
267 | |||
268 | identify_lcd(); | ||
269 | if (lcd_type == LCD_V1) | ||
270 | lcd_v1_display_init(); | ||
271 | else | ||
272 | lcd_v2_display_init(); | ||
273 | |||
274 | } | ||
275 | |||
276 | void lcd_enable (bool on) | ||
277 | { | ||
278 | if (lcd_type == LCD_V1) | ||
279 | lcd_v1_enable(on); | ||
280 | else | ||
281 | lcd_v2_enable(on); | ||
282 | } | ||
283 | |||
284 | void lcd_update_rect(int x, int y, int width, int height) | ||
285 | { | ||
286 | if (lcd_type == LCD_V1) | ||
287 | lcd_v1_update_rect(x, y, width, height); | ||
288 | else | ||
289 | lcd_v2_update_rect(x, y, width, height); | ||
290 | } | ||
291 | |||
292 | |||
293 | |||
294 | #else /* HM801 */ | ||
295 | |||
296 | void lcd_init_device(void) | ||
297 | { | ||
298 | lcdif_init(LCDIF_16BIT); | ||
299 | lcd_v1_display_init(); | ||
300 | } | ||
301 | |||
302 | void lcd_enable (bool on) | ||
303 | { | ||
304 | lcd_v1_enable(on); | ||
305 | } | ||
306 | |||
307 | void lcd_update_rect(int x, int y, int width, int height) | ||
308 | { | ||
309 | lcd_v1_update_rect(x, y, width, height); | ||
310 | } | ||
311 | |||
312 | #endif | ||
313 | |||
314 | |||
315 | |||
316 | bool lcd_active() | ||
317 | { | ||
318 | return display_on; | ||
319 | } | ||
320 | |||
174 | /* Blit a YUV bitmap directly to the LCD */ | 321 | /* Blit a YUV bitmap directly to the LCD */ |
175 | void lcd_blit_yuv(unsigned char * const src[3], | 322 | void lcd_blit_yuv(unsigned char * const src[3], |
176 | int src_x, int src_y, int stride, | 323 | int src_x, int src_y, int stride, |