mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 21:22:39 -05:00
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
This commit is contained in:
parent
0946a1e0f2
commit
5e7bd97e04
1 changed files with 34 additions and 2 deletions
|
|
@ -40,6 +40,12 @@ static bool lcd_on;
|
||||||
#endif
|
#endif
|
||||||
static unsigned lcd_yuv_options = 0;
|
static unsigned lcd_yuv_options = 0;
|
||||||
static int lcd_dcp_channel = -1;
|
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
|
static enum lcd_kind_t
|
||||||
{
|
{
|
||||||
|
|
@ -367,6 +373,16 @@ static void lcd_init_seq_9325(void)
|
||||||
_end_seq()
|
_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)
|
void lcd_init_device(void)
|
||||||
{
|
{
|
||||||
lcd_dcp_channel = imx233_dcp_acquire_channel(TIMEOUT_NOBLOCK);
|
lcd_dcp_channel = imx233_dcp_acquire_channel(TIMEOUT_NOBLOCK);
|
||||||
|
|
@ -398,6 +414,8 @@ void lcd_init_device(void)
|
||||||
lcd_init_seq_7783(); break;
|
lcd_init_seq_7783(); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lcd_sync_settings();
|
||||||
|
|
||||||
#ifdef HAVE_LCD_ENABLE
|
#ifdef HAVE_LCD_ENABLE
|
||||||
lcd_on = true;
|
lcd_on = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -502,22 +520,36 @@ void lcd_enable(bool enable)
|
||||||
}
|
}
|
||||||
if(!enable)
|
if(!enable)
|
||||||
common_lcd_enable(false);
|
common_lcd_enable(false);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lcd_sync_settings();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_LCD_INVERT
|
#ifdef HAVE_LCD_INVERT
|
||||||
void lcd_set_invert_display(bool yesno)
|
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 */
|
/* same for both kinds */
|
||||||
lcd_write_reg(0x61, yesno ? 0 : 1);
|
lcd_write_reg(0x61, lcd_reg_0x61_val);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_LCD_FLIP
|
#ifdef HAVE_LCD_FLIP
|
||||||
void lcd_set_flip(bool yesno)
|
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 */
|
/* same for both kinds */
|
||||||
lcd_write_reg(3, yesno ? 0x1000 : 0x1030);
|
lcd_write_reg(3, lcd_reg_3_val);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue