mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-10 21:55:10 -05:00
Onda VX747/VX777: centralise LCD clock en-/disabling.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24168 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
4fdf4ad728
commit
d3bbe51629
3 changed files with 29 additions and 8 deletions
|
|
@ -35,13 +35,24 @@
|
||||||
static volatile bool lcd_is_on = false;
|
static volatile bool lcd_is_on = false;
|
||||||
static struct mutex lcd_mtx;
|
static struct mutex lcd_mtx;
|
||||||
static struct wakeup lcd_wkup;
|
static struct wakeup lcd_wkup;
|
||||||
|
static int lcd_count = 0;
|
||||||
|
|
||||||
|
void lcd_clock_enable(void)
|
||||||
|
{
|
||||||
|
if(++lcd_count == 1)
|
||||||
|
__cpm_start_lcd();
|
||||||
|
}
|
||||||
|
|
||||||
|
void lcd_clock_disable(void)
|
||||||
|
{
|
||||||
|
if(--lcd_count == 0)
|
||||||
|
__cpm_stop_lcd();
|
||||||
|
}
|
||||||
|
|
||||||
/* LCD init */
|
/* LCD init */
|
||||||
void lcd_init_device(void)
|
void lcd_init_device(void)
|
||||||
{
|
{
|
||||||
__cpm_start_lcd();
|
|
||||||
lcd_init_controller();
|
lcd_init_controller();
|
||||||
__cpm_stop_lcd();
|
|
||||||
|
|
||||||
lcd_is_on = true;
|
lcd_is_on = true;
|
||||||
mutex_init(&lcd_mtx);
|
mutex_init(&lcd_mtx);
|
||||||
|
|
@ -55,8 +66,6 @@ void lcd_enable(bool state)
|
||||||
if(lcd_is_on == state)
|
if(lcd_is_on == state)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
__cpm_start_lcd();
|
|
||||||
|
|
||||||
if(state)
|
if(state)
|
||||||
{
|
{
|
||||||
lcd_on();
|
lcd_on();
|
||||||
|
|
@ -65,8 +74,6 @@ void lcd_enable(bool state)
|
||||||
else
|
else
|
||||||
lcd_off();
|
lcd_off();
|
||||||
|
|
||||||
__cpm_stop_lcd();
|
|
||||||
|
|
||||||
lcd_is_on = state;
|
lcd_is_on = state;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -87,7 +94,7 @@ void lcd_update_rect(int x, int y, int width, int height)
|
||||||
|
|
||||||
mutex_lock(&lcd_mtx);
|
mutex_lock(&lcd_mtx);
|
||||||
|
|
||||||
__cpm_start_lcd();
|
lcd_clock_enable();
|
||||||
|
|
||||||
lcd_set_target(x, y, width, height);
|
lcd_set_target(x, y, width, height);
|
||||||
|
|
||||||
|
|
@ -119,7 +126,7 @@ void lcd_update_rect(int x, int y, int width, int height)
|
||||||
while(REG_SLCD_STATE & SLCD_STATE_BUSY);
|
while(REG_SLCD_STATE & SLCD_STATE_BUSY);
|
||||||
REG_SLCD_CTRL &= ~SLCD_CTRL_DMA_EN; /* Disable SLCD DMA support */
|
REG_SLCD_CTRL &= ~SLCD_CTRL_DMA_EN; /* Disable SLCD DMA support */
|
||||||
|
|
||||||
__cpm_stop_lcd();
|
lcd_clock_disable();
|
||||||
|
|
||||||
mutex_unlock(&lcd_mtx);
|
mutex_unlock(&lcd_mtx);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,8 @@
|
||||||
void lcd_enable(bool state);
|
void lcd_enable(bool state);
|
||||||
bool lcd_active(void);
|
bool lcd_active(void);
|
||||||
void lcd_init_device(void);
|
void lcd_init_device(void);
|
||||||
|
void lcd_clock_enable(void);
|
||||||
|
void lcd_clock_disable(void);
|
||||||
|
|
||||||
|
|
||||||
void lcd_init_controller(void);
|
void lcd_init_controller(void);
|
||||||
|
|
|
||||||
|
|
@ -197,6 +197,8 @@ static void _set_lcd_clock(void)
|
||||||
|
|
||||||
void lcd_init_controller(void)
|
void lcd_init_controller(void)
|
||||||
{
|
{
|
||||||
|
lcd_clock_enable();
|
||||||
|
|
||||||
#ifdef USB_BOOT
|
#ifdef USB_BOOT
|
||||||
_display_pin_init();
|
_display_pin_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -204,6 +206,8 @@ void lcd_init_controller(void)
|
||||||
_set_lcd_clock();
|
_set_lcd_clock();
|
||||||
SLEEP(1000);
|
SLEEP(1000);
|
||||||
_display_init();
|
_display_init();
|
||||||
|
|
||||||
|
lcd_clock_disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcd_set_target(int x, int y, int width, int height)
|
void lcd_set_target(int x, int y, int width, int height)
|
||||||
|
|
@ -254,12 +258,20 @@ void lcd_set_flip(bool yesno)
|
||||||
|
|
||||||
void lcd_on(void)
|
void lcd_on(void)
|
||||||
{
|
{
|
||||||
|
lcd_clock_enable();
|
||||||
|
|
||||||
_display_on();
|
_display_on();
|
||||||
|
|
||||||
|
lcd_clock_disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcd_off(void)
|
void lcd_off(void)
|
||||||
{
|
{
|
||||||
|
lcd_clock_enable();
|
||||||
|
|
||||||
_display_off();
|
_display_off();
|
||||||
|
|
||||||
|
lcd_clock_disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcd_set_contrast(int val)
|
void lcd_set_contrast(int val)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue