summaryrefslogtreecommitdiffstats
path: root/firmware
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 /firmware
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
Diffstat (limited to 'firmware')
-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;
#endif
static unsigned lcd_yuv_options = 0;
static int lcd_dcp_channel = -1;
+#ifdef HAVE_LCD_INVERT
+static int lcd_reg_0x61_val = 1; /* used to invert display */
+#endif
+#ifdef HAVE_LCD_FLIP
+static int lcd_reg_3_val = 0x1030; /* controls to flip display */
+#endif
static enum lcd_kind_t
{
@@ -367,6 +373,16 @@ static void lcd_init_seq_9325(void)
_end_seq()
}
+static void lcd_sync_settings(void)
+{
+#ifdef HAVE_LCD_INVERT
+ lcd_write_reg(0x61, lcd_reg_0x61_val);
+#endif
+#ifdef HAVE_LCD_FLIP
+ lcd_write_reg(3, lcd_reg_3_val);
+#endif
+}
+
void lcd_init_device(void)
{
lcd_dcp_channel = imx233_dcp_acquire_channel(TIMEOUT_NOBLOCK);
@@ -398,6 +414,8 @@ void lcd_init_device(void)
lcd_init_seq_7783(); break;
}
+ lcd_sync_settings();
+
#ifdef HAVE_LCD_ENABLE
lcd_on = true;
#endif
@@ -502,22 +520,36 @@ void lcd_enable(bool enable)
}
if(!enable)
common_lcd_enable(false);
+ else
+ {
+ lcd_sync_settings();
+ }
}
#endif
#ifdef HAVE_LCD_INVERT
void lcd_set_invert_display(bool yesno)
{
+ lcd_reg_0x61_val = yesno ? 0 : 1;
+ #ifdef HAVE_LCD_ENABLE
+ if(!lcd_on)
+ return;
+ #endif
/* same for both kinds */
- lcd_write_reg(0x61, yesno ? 0 : 1);
+ lcd_write_reg(0x61, lcd_reg_0x61_val);
}
#endif
#ifdef HAVE_LCD_FLIP
void lcd_set_flip(bool yesno)
{
+ lcd_reg_3_val = yesno ? 0x1000 : 0x1030;
+ #ifdef HAVE_LCD_ENABLE
+ if(!lcd_on)
+ return;
+ #endif
/* same for both kinds */
- lcd_write_reg(3, yesno ? 0x1000 : 0x1030);
+ lcd_write_reg(3, lcd_reg_3_val);
}
#endif