summaryrefslogtreecommitdiff
path: root/firmware/target/arm
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm')
-rw-r--r--firmware/target/arm/imx233/creative-zen/lcd-target.h5
-rw-r--r--firmware/target/arm/imx233/creative-zen/lcd-zen.c41
-rw-r--r--firmware/target/arm/imx233/creative-zen/lcd-zenmozaic.c2
-rw-r--r--firmware/target/arm/imx233/creative-zen/lcd-zenv.c2
4 files changed, 14 insertions, 36 deletions
diff --git a/firmware/target/arm/imx233/creative-zen/lcd-target.h b/firmware/target/arm/imx233/creative-zen/lcd-target.h
index b28bda347a..299ffa3dfb 100644
--- a/firmware/target/arm/imx233/creative-zen/lcd-target.h
+++ b/firmware/target/arm/imx233/creative-zen/lcd-target.h
@@ -23,4 +23,9 @@
23 23
24bool lcd_debug_screen(void); 24bool lcd_debug_screen(void);
25 25
26#if defined(CREATIVE_ZEN) || defined(CREATIVE_ZENXFI)
27#define LCD_FRAMEBUF_ADDR(col, row) (row*LCD_WIDTH + col + (fb_data *)FRAME)
28extern void lcd_set_active(bool active);
29#endif
30
26#endif /* LCD_TARGET_H */ 31#endif /* LCD_TARGET_H */
diff --git a/firmware/target/arm/imx233/creative-zen/lcd-zen.c b/firmware/target/arm/imx233/creative-zen/lcd-zen.c
index 6482c58787..c594209db9 100644
--- a/firmware/target/arm/imx233/creative-zen/lcd-zen.c
+++ b/firmware/target/arm/imx233/creative-zen/lcd-zen.c
@@ -30,16 +30,14 @@
30#include "clkctrl-imx233.h" 30#include "clkctrl-imx233.h"
31#include "pinctrl-imx233.h" 31#include "pinctrl-imx233.h"
32#include "dma-imx233.h" 32#include "dma-imx233.h"
33#include "regs/regs-uartdbg.h"
34#include "logf.h" 33#include "logf.h"
34#include "lcd-target.h"
35#ifndef BOOTLOADER 35#ifndef BOOTLOADER
36#include "button.h" 36#include "button.h"
37#include "font.h" 37#include "font.h"
38#include "action.h" 38#include "action.h"
39#endif 39#endif
40 40
41static bool lcd_on;
42
43/** 41/**
44 * DMA 42 * DMA
45 */ 43 */
@@ -170,7 +168,7 @@ static void lcd_power_seq(void)
170static void lcd_init_seq(void) 168static void lcd_init_seq(void)
171{ 169{
172 /* NOTE I don't understand why I have to use BGR, logic would say I should not */ 170 /* NOTE I don't understand why I have to use BGR, logic would say I should not */
173 spi_write_reg(0x1, 0x2b1d);// inversion 171 spi_write_reg(0x1, 0x231d);// no inversion
174 spi_write_reg(0x2, 0x300); 172 spi_write_reg(0x2, 0x300);
175 /* NOTE by default stmp3700 has vsync/hsync active low and data launch 173 /* NOTE by default stmp3700 has vsync/hsync active low and data launch
176 * at negative edge of dotclk, reflect this in the polarity settings */ 174 * at negative edge of dotclk, reflect this in the polarity settings */
@@ -225,18 +223,13 @@ static void lcd_display_off_seq(void)
225 * Rockbox 223 * Rockbox
226 */ 224 */
227 225
228bool lcd_active(void)
229{
230 return lcd_on;
231}
232
233void lcd_enable(bool enable) 226void lcd_enable(bool enable)
234{ 227{
235 if(lcd_on == enable) 228 if(lcd_active() == enable)
236 return; 229 return;
237 230
238 lcd_on = enable; 231 lcd_set_active(enable);
239 if(lcd_on) 232 if(lcd_active())
240 { 233 {
241 // enable spi 234 // enable spi
242 spi_enable(true); 235 spi_enable(true);
@@ -341,27 +334,3 @@ void lcd_init_device(void)
341 // enable 334 // enable
342 lcd_enable(true); 335 lcd_enable(true);
343} 336}
344
345void lcd_update(void)
346{
347 lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT);
348}
349
350void lcd_update_rect(int x, int y, int w, int h)
351{
352 #ifdef HAVE_LCD_ENABLE
353 if(!lcd_on)
354 return;
355 #endif
356 for(int yy = y; yy < y + h; yy++)
357 {
358 uint16_t *pix = FBADDR(x, yy);
359 uint8_t *p = 3 * (yy * LCD_WIDTH + x) + (uint8_t *)FRAME;
360 for(int xx = 0; xx < w; xx++, pix++)
361 {
362 *p++ = RGB_UNPACK_RED(*pix);
363 *p++ = RGB_UNPACK_GREEN(*pix);
364 *p++ = RGB_UNPACK_BLUE(*pix);
365 }
366 }
367}
diff --git a/firmware/target/arm/imx233/creative-zen/lcd-zenmozaic.c b/firmware/target/arm/imx233/creative-zen/lcd-zenmozaic.c
index eac36676ae..c1bc379a49 100644
--- a/firmware/target/arm/imx233/creative-zen/lcd-zenmozaic.c
+++ b/firmware/target/arm/imx233/creative-zen/lcd-zenmozaic.c
@@ -127,6 +127,8 @@ void lcd_enable(bool enable)
127 return; 127 return;
128 128
129 lcd_on = enable; 129 lcd_on = enable;
130 if(enable)
131 send_event(LCD_EVENT_ACTIVATION, NULL);
130} 132}
131#endif 133#endif
132 134
diff --git a/firmware/target/arm/imx233/creative-zen/lcd-zenv.c b/firmware/target/arm/imx233/creative-zen/lcd-zenv.c
index 3bc8e67e5d..06b0f158f3 100644
--- a/firmware/target/arm/imx233/creative-zen/lcd-zenv.c
+++ b/firmware/target/arm/imx233/creative-zen/lcd-zenv.c
@@ -138,6 +138,8 @@ void lcd_enable(bool enable)
138 return; 138 return;
139 139
140 lcd_on = enable; 140 lcd_on = enable;
141 if(enable)
142 send_event(LCD_EVENT_ACTIVATION, NULL);
141} 143}
142#endif 144#endif
143 145