HDD1630: implement lcd_enable (display on/off).

Change-Id: I8b72a9c333d8a9dbcb62c366a9af298f1dd9b2f7
This commit is contained in:
Szymon Dziok 2014-01-13 23:50:40 +01:00
parent b25cd9792f
commit 518d9ecb35
3 changed files with 50 additions and 1 deletions

View file

@ -56,7 +56,7 @@
#ifndef BOOTLOADER
/* 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.

View file

@ -22,6 +22,7 @@
#include "backlight-target.h"
#include "system.h"
#include "backlight.h"
#include "lcd.h"
#include "synaptics-mep.h"
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
@ -36,6 +37,10 @@ void _backlight_set_brightness(int brightness)
void _backlight_on(void)
{
#ifdef HAVE_LCD_ENABLE
lcd_enable(true);
#endif
GPO32_ENABLE |= 0x400;
GPO32_VAL |= 0x400;
}
@ -44,6 +49,10 @@ void _backlight_off(void)
{
GPO32_ENABLE |= 0x400;
GPO32_VAL &=~0x400;
#ifdef HAVE_LCD_ENABLE
lcd_enable(false);
#endif
}
#ifdef HAVE_BUTTON_LIGHT

View file

@ -77,6 +77,9 @@
#define RDEV 0xd4
#define RDRR 0xd5
/* Whether the lcd is currently enabled or not */
static bool lcd_enabled;
/* Display status */
static unsigned lcd_yuv_options SHAREDBSS_ATTR = 0;
static unsigned mad_ctrl = 0;
@ -239,8 +242,45 @@ void lcd_init_device(void)
lcd_send_cmd(DISPON);
#endif
lcd_enabled = true;
}
#ifdef HAVE_LCD_ENABLE
/* enable / disable lcd */
void lcd_enable(bool on)
{
if (on == lcd_enabled)
return;
if (on) /* lcd_display_on() */
{
/* from the OF */
lcd_send_cmd(SLPOUT);
sleep(HZ/5); /* 200ms */
/* Probably out of sync and we don't wanna pepper the code with
lcd_update() calls for this. */
lcd_update();
send_event(LCD_EVENT_ACTIVATION, NULL);
lcd_enabled = true;
}
else /* lcd_display_off() */
{
/* from the OF */
lcd_send_cmd(SLPIN);
lcd_enabled = false;
}
}
bool lcd_active(void)
{
return lcd_enabled;
}
#endif /* HAVE_LCD_ENABLE */
/*** hardware configuration ***/
int lcd_default_contrast(void)
{