summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2013-01-12 19:04:20 +0000
committerAmaury Pouly <amaury.pouly@gmail.com>2013-01-12 19:04:20 +0000
commit5e7bd97e041b16cda86e762b7dc947f86a7d8176 (patch)
tree3e308bd25eed13e8ccb2ebb9b1b60401db941262
parent0946a1e0f2c7c6491f87276cfadab5e9492313c6 (diff)
downloadrockbox-5e7bd97e041b16cda86e762b7dc947f86a7d8176.tar.gz
rockbox-5e7bd97e041b16cda86e762b7dc947f86a7d8176.zip
fuze+: correctly handle settings (flip and invert) accross enable
The flip and invert settings can potentially be reset to their value accross a disable/enable cycle, so save the value of the impacted registers and apply it after each enable. Also avoid poking registers when the lcd is not on. Change-Id: Ica98f166c060aade7eb205f5628b58aae692024f
-rw-r--r--firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c36
1 files changed, 34 insertions, 2 deletions
diff --git a/firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c b/firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c
index 5f54c72b5e..8f0efdf671 100644
--- a/firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c
+++ b/firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c
@@ -40,6 +40,12 @@ static bool lcd_on;
40#endif 40#endif
41static unsigned lcd_yuv_options = 0; 41static unsigned lcd_yuv_options = 0;
42static int lcd_dcp_channel = -1; 42static int lcd_dcp_channel = -1;
43#ifdef HAVE_LCD_INVERT
44static int lcd_reg_0x61_val = 1; /* used to invert display */
45#endif
46#ifdef HAVE_LCD_FLIP
47static int lcd_reg_3_val = 0x1030; /* controls to flip display */
48#endif
43 49
44static enum lcd_kind_t 50static enum lcd_kind_t
45{ 51{
@@ -367,6 +373,16 @@ static void lcd_init_seq_9325(void)
367 _end_seq() 373 _end_seq()
368} 374}
369 375
376static void lcd_sync_settings(void)
377{
378#ifdef HAVE_LCD_INVERT
379 lcd_write_reg(0x61, lcd_reg_0x61_val);
380#endif
381#ifdef HAVE_LCD_FLIP
382 lcd_write_reg(3, lcd_reg_3_val);
383#endif
384}
385
370void lcd_init_device(void) 386void lcd_init_device(void)
371{ 387{
372 lcd_dcp_channel = imx233_dcp_acquire_channel(TIMEOUT_NOBLOCK); 388 lcd_dcp_channel = imx233_dcp_acquire_channel(TIMEOUT_NOBLOCK);
@@ -398,6 +414,8 @@ void lcd_init_device(void)
398 lcd_init_seq_7783(); break; 414 lcd_init_seq_7783(); break;
399 } 415 }
400 416
417 lcd_sync_settings();
418
401#ifdef HAVE_LCD_ENABLE 419#ifdef HAVE_LCD_ENABLE
402 lcd_on = true; 420 lcd_on = true;
403#endif 421#endif
@@ -502,22 +520,36 @@ void lcd_enable(bool enable)
502 } 520 }
503 if(!enable) 521 if(!enable)
504 common_lcd_enable(false); 522 common_lcd_enable(false);
523 else
524 {
525 lcd_sync_settings();
526 }
505} 527}
506#endif 528#endif
507 529
508#ifdef HAVE_LCD_INVERT 530#ifdef HAVE_LCD_INVERT
509void lcd_set_invert_display(bool yesno) 531void lcd_set_invert_display(bool yesno)
510{ 532{
533 lcd_reg_0x61_val = yesno ? 0 : 1;
534 #ifdef HAVE_LCD_ENABLE
535 if(!lcd_on)
536 return;
537 #endif
511 /* same for both kinds */ 538 /* same for both kinds */
512 lcd_write_reg(0x61, yesno ? 0 : 1); 539 lcd_write_reg(0x61, lcd_reg_0x61_val);
513} 540}
514#endif 541#endif
515 542
516#ifdef HAVE_LCD_FLIP 543#ifdef HAVE_LCD_FLIP
517void lcd_set_flip(bool yesno) 544void lcd_set_flip(bool yesno)
518{ 545{
546 lcd_reg_3_val = yesno ? 0x1000 : 0x1030;
547 #ifdef HAVE_LCD_ENABLE
548 if(!lcd_on)
549 return;
550 #endif
519 /* same for both kinds */ 551 /* same for both kinds */
520 lcd_write_reg(3, yesno ? 0x1000 : 0x1030); 552 lcd_write_reg(3, lcd_reg_3_val);
521} 553}
522#endif 554#endif
523 555