diff options
Diffstat (limited to 'firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c')
-rw-r--r-- | firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c b/firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c index bc8a20d2ff..dba54373be 100644 --- a/firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c +++ b/firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c | |||
@@ -29,6 +29,16 @@ | |||
29 | 29 | ||
30 | #define logf(...) | 30 | #define logf(...) |
31 | 31 | ||
32 | /* Copies a rectangle from one framebuffer to another. Can be used in | ||
33 | single transfer mode with width = num pixels, and height = 1 which | ||
34 | allows a full-width rectangle to be copied more efficiently. */ | ||
35 | extern void lcd_copy_buffer_rect(fb_data *dst, const fb_data *src, | ||
36 | int width, int height); | ||
37 | |||
38 | #ifdef HAVE_LCD_ENABLE | ||
39 | static bool lcd_on = false; | ||
40 | #endif | ||
41 | |||
32 | static enum lcd_kind_t | 42 | static enum lcd_kind_t |
33 | { | 43 | { |
34 | LCD_KIND_7783 = 0x7783, | 44 | LCD_KIND_7783 = 0x7783, |
@@ -375,7 +385,7 @@ void lcd_init_device(void) | |||
375 | } | 385 | } |
376 | } | 386 | } |
377 | 387 | ||
378 | 388 | #ifdef HAVE_LCD_ENABLE | |
379 | static void lcd_enable_7783(bool enable) | 389 | static void lcd_enable_7783(bool enable) |
380 | { | 390 | { |
381 | if(!enable) | 391 | if(!enable) |
@@ -454,6 +464,10 @@ static void lcd_enable_9325(bool enable) | |||
454 | 464 | ||
455 | void lcd_enable(bool enable) | 465 | void lcd_enable(bool enable) |
456 | { | 466 | { |
467 | if(lcd_on == enable) | ||
468 | return; | ||
469 | lcd_on = enable; | ||
470 | |||
457 | if(enable) | 471 | if(enable) |
458 | common_lcd_enable(true); | 472 | common_lcd_enable(true); |
459 | switch(lcd_kind) | 473 | switch(lcd_kind) |
@@ -466,8 +480,19 @@ void lcd_enable(bool enable) | |||
466 | common_lcd_enable(false); | 480 | common_lcd_enable(false); |
467 | } | 481 | } |
468 | 482 | ||
483 | bool lcd_active(void) | ||
484 | { | ||
485 | return lcd_on; | ||
486 | } | ||
487 | #endif | ||
488 | |||
469 | void lcd_update(void) | 489 | void lcd_update(void) |
470 | { | 490 | { |
491 | #ifdef HAVE_LCD_ENABLE | ||
492 | if(!lcd_on) | ||
493 | return; | ||
494 | #endif | ||
495 | imx233_lcdif_wait_ready(); | ||
471 | lcd_write_reg(0x50, 0); | 496 | lcd_write_reg(0x50, 0); |
472 | lcd_write_reg(0x51, LCD_WIDTH - 1); | 497 | lcd_write_reg(0x51, LCD_WIDTH - 1); |
473 | lcd_write_reg(0x52, 0); | 498 | lcd_write_reg(0x52, 0); |
@@ -479,8 +504,9 @@ void lcd_update(void) | |||
479 | imx233_lcdif_set_word_length(HW_LCDIF_CTRL__WORD_LENGTH_16_BIT); | 504 | imx233_lcdif_set_word_length(HW_LCDIF_CTRL__WORD_LENGTH_16_BIT); |
480 | imx233_lcdif_set_byte_packing_format(0xf); /* two pixels per 32-bit word */ | 505 | imx233_lcdif_set_byte_packing_format(0xf); /* two pixels per 32-bit word */ |
481 | imx233_lcdif_set_data_format(false, false, false); /* RGB565, don't care, don't care */ | 506 | imx233_lcdif_set_data_format(false, false, false); /* RGB565, don't care, don't care */ |
482 | imx233_lcdif_dma_send(lcd_framebuffer, LCD_WIDTH, LCD_HEIGHT); | 507 | lcd_copy_buffer_rect((fb_data *)FRAME, &lcd_framebuffer[0][0], |
483 | imx233_lcdif_wait_ready(); | 508 | LCD_WIDTH * LCD_HEIGHT, 1); |
509 | imx233_lcdif_dma_send(FRAME, LCD_WIDTH, LCD_HEIGHT); | ||
484 | } | 510 | } |
485 | 511 | ||
486 | void lcd_update_rect(int x, int y, int width, int height) | 512 | void lcd_update_rect(int x, int y, int width, int height) |