summaryrefslogtreecommitdiff
path: root/firmware/target/arm/rk27xx/lcd-hifiman.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/rk27xx/lcd-hifiman.c')
-rw-r--r--firmware/target/arm/rk27xx/lcd-hifiman.c43
1 files changed, 24 insertions, 19 deletions
diff --git a/firmware/target/arm/rk27xx/lcd-hifiman.c b/firmware/target/arm/rk27xx/lcd-hifiman.c
index 03b488548e..1adc6e36ed 100644
--- a/firmware/target/arm/rk27xx/lcd-hifiman.c
+++ b/firmware/target/arm/rk27xx/lcd-hifiman.c
@@ -159,15 +159,17 @@ static void lcd_v1_enable (bool on)
159 159
160 LCDC_CTRL &= ~RGB24B; 160 LCDC_CTRL &= ~RGB24B;
161} 161}
162static void lcd_v1_set_gram_area(int x, int y, int width, int height) 162
163static void lcd_v1_set_gram_area(int x_start, int y_start,
164 int x_end, int y_end)
163{ 165{
164 lcdctrl_bypass(1); 166 lcdctrl_bypass(1);
165 LCDC_CTRL |= RGB24B; 167 LCDC_CTRL |= RGB24B;
166 168
167 lcd_write_reg(0x03, x); 169 lcd_write_reg(0x03, x_start);
168 lcd_write_reg(0x05, width-1); 170 lcd_write_reg(0x05, x_end);
169 lcd_write_reg(0x07, y); 171 lcd_write_reg(0x07, y_start);
170 lcd_write_reg(0x09, height-1); 172 lcd_write_reg(0x09, y_end);
171 173
172 lcd_cmd(0x22); 174 lcd_cmd(0x22);
173 LCDC_CTRL &= ~RGB24B; 175 LCDC_CTRL &= ~RGB24B;
@@ -178,7 +180,7 @@ static void lcd_v1_update_rect(int x, int y, int width, int height)
178 int px = x, py = y; 180 int px = x, py = y;
179 int pxmax = x + width, pymax = y + height; 181 int pxmax = x + width, pymax = y + height;
180 182
181 lcd_v1_set_gram_area(x, y, pxmax, pymax); 183 lcd_v1_set_gram_area(x, y, pxmax-1, pymax-1);
182 184
183 for (py=y; py<pymax; py++) 185 for (py=y; py<pymax; py++)
184 for (px=x; px<pxmax; px++) 186 for (px=x; px<pxmax; px++)
@@ -291,19 +293,20 @@ static void lcd_v2_enable (bool on)
291 293
292} 294}
293 295
294static void lcd_v2_set_gram_area(int x, int y, int width, int height) 296static void lcd_v2_set_gram_area(int x_start, int y_start,
297 int x_end, int y_end)
295{ 298{
296 lcdctrl_bypass(1); 299 lcdctrl_bypass(1);
297 LCDC_CTRL |= RGB24B; 300 LCDC_CTRL |= RGB24B;
298 301
299 lcd_write_reg(0x36, height-1); 302 lcd_write_reg(0x36, y_end);
300 lcd_write_reg(0x37, y); 303 lcd_write_reg(0x37, y_start);
301 lcd_write_reg(0x38, width-1); 304 lcd_write_reg(0x38, x_end);
302 lcd_write_reg(0x39, x); 305 lcd_write_reg(0x39, x_start);
303 306
304 /* set GRAM address */ 307 /* set GRAM address */
305 lcd_write_reg(0x20, y); 308 lcd_write_reg(0x20, y_start);
306 lcd_write_reg(0x21, x); 309 lcd_write_reg(0x21, x_start);
307 310
308 lcd_cmd(0x22); 311 lcd_cmd(0x22);
309 LCDC_CTRL &= ~RGB24B; 312 LCDC_CTRL &= ~RGB24B;
@@ -314,7 +317,7 @@ static void lcd_v2_update_rect(int x, int y, int width, int height)
314 int px = x, py = y; 317 int px = x, py = y;
315 int pxmax = x + width, pymax = y + height; 318 int pxmax = x + width, pymax = y + height;
316 319
317 lcd_v2_set_gram_area(x, y, pxmax, pymax); 320 lcd_v2_set_gram_area(x, y, pxmax-1, pymax-1);
318 321
319 for (py=y; py<pymax; py++) 322 for (py=y; py<pymax; py++)
320 for (px=x; px<pxmax; px++) 323 for (px=x; px<pxmax; px++)
@@ -340,12 +343,13 @@ void lcd_enable (bool on)
340 lcd_v2_enable(on); 343 lcd_v2_enable(on);
341} 344}
342 345
343void lcd_set_gram_area(int x, int y, int width, int height) 346void lcd_set_gram_area(int x_start, int y_start,
347 int x_end, int y_end)
344{ 348{
345 if (lcd_type == LCD_V1) 349 if (lcd_type == LCD_V1)
346 lcd_v1_set_gram_area(x, y, width, height); 350 lcd_v1_set_gram_area(x_start, y_start, x_end, y_end);
347 else 351 else
348 lcd_v2_set_gram_area(x, y, width, height); 352 lcd_v2_set_gram_area(x_start, y_start, x_end, y_end);
349} 353}
350 354
351void lcd_update_rect(int x, int y, int width, int height) 355void lcd_update_rect(int x, int y, int width, int height)
@@ -371,9 +375,10 @@ void lcd_enable (bool on)
371 lcd_v1_enable(on); 375 lcd_v1_enable(on);
372} 376}
373 377
374void lcd_set_gram_area(int x, int y, int width, int height) 378void lcd_set_gram_area(int x_start, int y_start,
379 int x_end, int y_end)
375{ 380{
376 lcd_v1_set_gram_area(x, y, width, height); 381 lcd_v1_set_gram_area(x_start, y_start, x_end, y_end);
377} 382}
378 383
379void lcd_update_rect(int x, int y, int width, int height) 384void lcd_update_rect(int x, int y, int width, int height)