summaryrefslogtreecommitdiff
path: root/firmware/target/arm
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm')
-rw-r--r--firmware/target/arm/rk27xx/lcd-hifiman.c43
-rw-r--r--firmware/target/arm/rk27xx/lcdif-rk27xx.c2
-rw-r--r--firmware/target/arm/rk27xx/lcdif-rk27xx.h2
-rw-r--r--firmware/target/arm/rk27xx/ma/lcd-ma.c21
-rw-r--r--firmware/target/arm/rk27xx/rk27generic/lcd-rk27generic.c17
5 files changed, 46 insertions, 39 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)
diff --git a/firmware/target/arm/rk27xx/lcdif-rk27xx.c b/firmware/target/arm/rk27xx/lcdif-rk27xx.c
index 314838f2c1..560ab4708e 100644
--- a/firmware/target/arm/rk27xx/lcdif-rk27xx.c
+++ b/firmware/target/arm/rk27xx/lcdif-rk27xx.c
@@ -246,7 +246,7 @@ void lcd_init_device(void)
246 246
247void lcd_update() 247void lcd_update()
248{ 248{
249 lcd_set_gram_area(0, 0, LCD_WIDTH, LCD_HEIGHT); 249 lcd_set_gram_area(0, 0, LCD_WIDTH-1, LCD_HEIGHT-1);
250 lcdctrl_bypass(0); 250 lcdctrl_bypass(0);
251 251
252 commit_discard_dcache_range(FBADDR(0,0), 2*LCD_WIDTH*LCD_HEIGHT); 252 commit_discard_dcache_range(FBADDR(0,0), 2*LCD_WIDTH*LCD_HEIGHT);
diff --git a/firmware/target/arm/rk27xx/lcdif-rk27xx.h b/firmware/target/arm/rk27xx/lcdif-rk27xx.h
index 7af27bbe8a..4961863504 100644
--- a/firmware/target/arm/rk27xx/lcdif-rk27xx.h
+++ b/firmware/target/arm/rk27xx/lcdif-rk27xx.h
@@ -10,6 +10,6 @@ void lcd_write_reg(unsigned int reg, unsigned int val);
10void lcdctrl_bypass(unsigned int on_off); 10void lcdctrl_bypass(unsigned int on_off);
11void lcd_display_init(void); 11void lcd_display_init(void);
12 12
13void lcd_set_gram_area(int x, int y, int width, int height); 13void lcd_set_gram_area(int x_start, int y_start, int x_end, int y_end);
14 14
15#endif /* _LCDIF_RK27XX_H */ 15#endif /* _LCDIF_RK27XX_H */
diff --git a/firmware/target/arm/rk27xx/ma/lcd-ma.c b/firmware/target/arm/rk27xx/ma/lcd-ma.c
index ad67352eb7..3c3d9fb097 100644
--- a/firmware/target/arm/rk27xx/ma/lcd-ma.c
+++ b/firmware/target/arm/rk27xx/ma/lcd-ma.c
@@ -151,21 +151,22 @@ void lcd_enable (bool on)
151 LCDC_CTRL &= ~RGB24B; 151 LCDC_CTRL &= ~RGB24B;
152} 152}
153 153
154void lcd_set_gram_area(int x, int y, int width, int height) 154void lcd_set_gram_area(int x_start, int y_start,
155 int x_end, int y_end)
155{ 156{
156 lcdctrl_bypass(1); 157 lcdctrl_bypass(1);
157 LCDC_CTRL |= RGB24B; 158 LCDC_CTRL |= RGB24B;
158 159
159 lcd_cmd(0x002A); 160 lcd_cmd(0x002A);
160 lcd_data((x&0xff00)>>8); 161 lcd_data((x_start&0xff00)>>8);
161 lcd_data(x&0x00ff); 162 lcd_data(x_start&0x00ff);
162 lcd_data(((width-1)&0xff00)>>8); 163 lcd_data((x_end&0xff00)>>8);
163 lcd_data((width-1)&0x00ff); 164 lcd_data(x_end&0x00ff);
164 lcd_cmd(0x002B); 165 lcd_cmd(0x002B);
165 lcd_data((y&0xff00)>>8); 166 lcd_data((y_start&0xff00)>>8);
166 lcd_data(y&0x00ff); 167 lcd_data(y_start&0x00ff);
167 lcd_data(((height-1)&0xff00)>>8); 168 lcd_data((y_end&0xff00)>>8);
168 lcd_data((height-1)&0x00ff); 169 lcd_data(y_end&0x00ff);
169 170
170 lcd_cmd(0x2c); 171 lcd_cmd(0x2c);
171 LCDC_CTRL &= ~RGB24B; 172 LCDC_CTRL &= ~RGB24B;
@@ -176,7 +177,7 @@ void lcd_update_rect(int x, int y, int width, int height)
176 int px = x, py = y; 177 int px = x, py = y;
177 int pxmax = x + width, pymax = y + height; 178 int pxmax = x + width, pymax = y + height;
178 179
179 lcd_set_gram_area(x, y, pxmax, pymax); 180 lcd_set_gram_area(x, y, pxmax-1, pymax-1);
180 181
181 for (py = y; py < pymax; py++) 182 for (py = y; py < pymax; py++)
182 for (px = x; px < pxmax; px++) 183 for (px = x; px < pxmax; px++)
diff --git a/firmware/target/arm/rk27xx/rk27generic/lcd-rk27generic.c b/firmware/target/arm/rk27xx/rk27generic/lcd-rk27generic.c
index 988f710660..75911614ab 100644
--- a/firmware/target/arm/rk27xx/rk27generic/lcd-rk27generic.c
+++ b/firmware/target/arm/rk27xx/rk27generic/lcd-rk27generic.c
@@ -161,18 +161,19 @@ void lcd_display_init(void)
161 lcd_sleep(false); 161 lcd_sleep(false);
162} 162}
163 163
164void lcd_set_gram_area(int x, int y, int width, int height) 164void lcd_set_gram_area(int x_start, int y_start,
165 int x_end, int y_end)
165{ 166{
166 lcdctrl_bypass(1); 167 lcdctrl_bypass(1);
167 LCDC_CTRL |= RGB24B; 168 LCDC_CTRL |= RGB24B;
168 169
169 /* addresses setup */ 170 /* addresses setup */
170 lcd_write_reg(WINDOW_H_START, y); 171 lcd_write_reg(WINDOW_H_START, y_start);
171 lcd_write_reg(WINDOW_H_END, height-1); 172 lcd_write_reg(WINDOW_H_END, y_end);
172 lcd_write_reg(WINDOW_V_START, x); 173 lcd_write_reg(WINDOW_V_START, x_start);
173 lcd_write_reg(WINDOW_V_END, width-1); 174 lcd_write_reg(WINDOW_V_END, x_end);
174 lcd_write_reg(GRAM_H_ADDR, y); 175 lcd_write_reg(GRAM_H_ADDR, y_start);
175 lcd_write_reg(GRAM_V_ADDR, x); 176 lcd_write_reg(GRAM_V_ADDR, x_start);
176 177
177 lcd_cmd(GRAM_WRITE); 178 lcd_cmd(GRAM_WRITE);
178 LCDC_CTRL &= ~RGB24B; 179 LCDC_CTRL &= ~RGB24B;
@@ -183,7 +184,7 @@ void lcd_update_rect(int x, int y, int width, int height)
183 int px = x, py = y; 184 int px = x, py = y;
184 int pxmax = x + width, pymax = y + height; 185 int pxmax = x + width, pymax = y + height;
185 186
186 lcd_set_gram_area(x, y, pxmax, pymax); 187 lcd_set_gram_area(x, y, pxmax-1, pymax-1);
187 188
188 for (py=y; py<pymax; py++) 189 for (py=y; py<pymax; py++)
189 { 190 {