mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-08 12:45:26 -05:00
HiFiMAN: Implement lcd powersave mode.
Change-Id: I0a22b436549047ac0c2f9e2c203cbe8b31cfc1cd
This commit is contained in:
parent
cac98a5ebf
commit
7b99318710
4 changed files with 49 additions and 9 deletions
|
|
@ -75,7 +75,7 @@
|
|||
/* #define HAVE_LCD_SHUTDOWN */
|
||||
|
||||
/* Define this if your LCD can be enabled/disabled */
|
||||
/* #define HAVE_LCD_ENABLE */
|
||||
#define HAVE_LCD_ENABLE
|
||||
|
||||
/* Define this if your LCD can be put to sleep. HAVE_LCD_ENABLE
|
||||
should be defined as well. */
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@
|
|||
/* #define HAVE_LCD_SHUTDOWN */
|
||||
|
||||
/* Define this if your LCD can be enabled/disabled */
|
||||
/* #define HAVE_LCD_ENABLE */
|
||||
#define HAVE_LCD_ENABLE
|
||||
|
||||
/* Define this if your LCD can be put to sleep. HAVE_LCD_ENABLE
|
||||
should be defined as well. */
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#include "backlight.h"
|
||||
#include "backlight-target.h"
|
||||
#include "system.h"
|
||||
#include "lcd.h"
|
||||
|
||||
static int brightness = DEFAULT_BRIGHTNESS_SETTING;
|
||||
|
||||
|
|
@ -76,6 +77,9 @@ bool _backlight_init(void)
|
|||
|
||||
void _backlight_on(void)
|
||||
{
|
||||
#ifdef HAVE_LCD_ENABLE
|
||||
lcd_enable(true);
|
||||
#endif
|
||||
/* enable PWM clock */
|
||||
SCU_CLKCFG &= ~(1<<29);
|
||||
|
||||
|
|
@ -96,6 +100,9 @@ void _backlight_off(void)
|
|||
|
||||
/* disable PWM clock */
|
||||
SCU_CLKCFG |= (1<<29);
|
||||
#ifdef HAVE_LCD_ENABLE
|
||||
lcd_enable(false);
|
||||
#endif
|
||||
}
|
||||
|
||||
void _backlight_set_brightness(int val)
|
||||
|
|
|
|||
|
|
@ -27,12 +27,7 @@
|
|||
#include "cpu.h"
|
||||
#include "lcdif-rk27xx.h"
|
||||
|
||||
|
||||
/* TODO */
|
||||
static void lcd_sleep(unsigned int sleep)
|
||||
{
|
||||
(void)sleep;
|
||||
}
|
||||
static bool display_on = false;
|
||||
|
||||
void lcd_display_init()
|
||||
{
|
||||
|
|
@ -110,9 +105,47 @@ void lcd_display_init()
|
|||
for(y=0; y<LCD_HEIGHT; y++)
|
||||
lcd_data(0x00);
|
||||
|
||||
lcd_sleep(0);
|
||||
display_on = true;
|
||||
}
|
||||
|
||||
void lcd_enable (bool on)
|
||||
{
|
||||
if (on)
|
||||
{
|
||||
lcd_write_reg(0x18, 0x44);
|
||||
lcd_write_reg(0x21, 0x01);
|
||||
lcd_write_reg(0x01, 0x00);
|
||||
lcd_write_reg(0x1C, 0x03);
|
||||
lcd_write_reg(0x19, 0x06);
|
||||
udelay(5);
|
||||
lcd_write_reg(0x26, 0x84);
|
||||
udelay(40);
|
||||
lcd_write_reg(0x26, 0xB8);
|
||||
udelay(40);
|
||||
lcd_write_reg(0x26, 0xBC);
|
||||
}
|
||||
else
|
||||
{
|
||||
lcd_write_reg(0x26, 0xB8);
|
||||
udelay(40);
|
||||
lcd_write_reg(0x19, 0x01);
|
||||
udelay(40);
|
||||
lcd_write_reg(0x26, 0xA4);
|
||||
udelay(40);
|
||||
lcd_write_reg(0x26, 0x84);
|
||||
udelay(40);
|
||||
lcd_write_reg(0x1C, 0x00);
|
||||
lcd_write_reg(0x01, 0x02);
|
||||
lcd_write_reg(0x21, 0x00);
|
||||
}
|
||||
display_on = on;
|
||||
|
||||
}
|
||||
|
||||
bool lcd_active()
|
||||
{
|
||||
return display_on;
|
||||
}
|
||||
|
||||
|
||||
void lcd_update_rect(int x, int y, int width, int height)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue