summaryrefslogtreecommitdiff
path: root/firmware/target/arm/imx233/creative-zen/lcd-zen.c
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2014-06-22 12:55:41 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2014-06-24 18:07:55 +0200
commitd5591a2b28c4052c9cb7688ce09e66aa6add05bf (patch)
tree32957239734f2d44d456c51acb99864a7b67a460 /firmware/target/arm/imx233/creative-zen/lcd-zen.c
parentcd4fb9ee798ccb11863aa98531852c2405bb6f8c (diff)
downloadrockbox-d5591a2b28c4052c9cb7688ce09e66aa6add05bf.tar.gz
rockbox-d5591a2b28c4052c9cb7688ce09e66aa6add05bf.zip
zen/zenxfi: switch lcd driver to 24-bit mode
Change-Id: I2c42f0e422130bcdaf1aaf92c7b56776752f4f64
Diffstat (limited to 'firmware/target/arm/imx233/creative-zen/lcd-zen.c')
-rw-r--r--firmware/target/arm/imx233/creative-zen/lcd-zen.c41
1 files changed, 5 insertions, 36 deletions
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}