summaryrefslogtreecommitdiff
path: root/firmware/target/arm
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm')
-rw-r--r--firmware/target/arm/imx31/gigabeat-s/backlight-imx31.c4
-rw-r--r--firmware/target/arm/imx31/gigabeat-s/lcd-imx31.c35
2 files changed, 30 insertions, 9 deletions
diff --git a/firmware/target/arm/imx31/gigabeat-s/backlight-imx31.c b/firmware/target/arm/imx31/gigabeat-s/backlight-imx31.c
index 8b4459c3a9..8f75b72f58 100644
--- a/firmware/target/arm/imx31/gigabeat-s/backlight-imx31.c
+++ b/firmware/target/arm/imx31/gigabeat-s/backlight-imx31.c
@@ -23,6 +23,7 @@
23#include "backlight.h" 23#include "backlight.h"
24#include "mc13783.h" 24#include "mc13783.h"
25#include "backlight-target.h" 25#include "backlight-target.h"
26#include "lcd.h"
26 27
27#ifdef HAVE_BACKLIGHT_BRIGHTNESS 28#ifdef HAVE_BACKLIGHT_BRIGHTNESS
28/* Table that uses combinations of current level and pwm fraction to get 29/* Table that uses combinations of current level and pwm fraction to get
@@ -129,6 +130,9 @@ void _backlight_on(void)
129#ifdef HAVE_LCD_SLEEP 130#ifdef HAVE_LCD_SLEEP
130 backlight_lcd_sleep_countdown(false); /* stop counter */ 131 backlight_lcd_sleep_countdown(false); /* stop counter */
131#endif 132#endif
133#ifdef HAVE_LCD_ENABLE
134 lcd_enable(true);
135#endif
132 136
133 /* Set/clear LEDRAMPUP bit, clear LEDRAMPDOWN bit, 137 /* Set/clear LEDRAMPUP bit, clear LEDRAMPDOWN bit,
134 * Ensure LED supply is on. */ 138 * Ensure LED supply is on. */
diff --git a/firmware/target/arm/imx31/gigabeat-s/lcd-imx31.c b/firmware/target/arm/imx31/gigabeat-s/lcd-imx31.c
index c353380221..47834b3b19 100644
--- a/firmware/target/arm/imx31/gigabeat-s/lcd-imx31.c
+++ b/firmware/target/arm/imx31/gigabeat-s/lcd-imx31.c
@@ -30,8 +30,8 @@
30#define MAIN_LCD_IDMAC_CHANNEL 14 30#define MAIN_LCD_IDMAC_CHANNEL 14
31#define LCDADDR(x, y) (&lcd_framebuffer[(y)][(x)]) 31#define LCDADDR(x, y) (&lcd_framebuffer[(y)][(x)])
32 32
33static volatile bool lcd_on = true; 33static bool lcd_on = true;
34volatile bool lcd_poweroff = false; 34static bool lcd_powered = true;
35static unsigned lcd_yuv_options = 0; 35static unsigned lcd_yuv_options = 0;
36/* 36/*
37** This is imported from lcd-16bit.c 37** This is imported from lcd-16bit.c
@@ -98,24 +98,41 @@ void lcd_update_rect(int x, int y, int width, int height)
98 } 98 }
99} 99}
100 100
101#ifdef HAVE_LCD_SLEEP
102void lcd_sleep(void) 101void lcd_sleep(void)
103{ 102{
104 _backlight_lcd_sleep(); 103 if (lcd_powered)
104 {
105 lcd_enable(false);
106 lcd_powered = false;
107 IPU_IDMAC_CHA_EN &= ~(1ul << MAIN_LCD_IDMAC_CHANNEL);
108 _backlight_lcd_sleep();
109 }
105} 110}
106#endif /* HAVE_LCD_SLEEP */
107 111
108#if 0
109void lcd_enable(bool state) 112void lcd_enable(bool state)
110{ 113{
111 (void)state; 114 if (state == lcd_on)
115 return;
116
117 if (state)
118 {
119 IPU_IDMAC_CHA_EN |= 1ul << MAIN_LCD_IDMAC_CHANNEL;
120 sleep(HZ/50);
121 lcd_powered = true;
122 lcd_on = true;
123 lcd_update();
124 lcd_call_enable_hook();
125 }
126 else
127 {
128 lcd_on = false;
129 }
112} 130}
113 131
114bool lcd_enabled(void) 132bool lcd_enabled(void)
115{ 133{
116 return true; 134 return lcd_on;
117} 135}
118#endif
119 136
120/* Update the display. 137/* Update the display.
121 This must be called after all other LCD functions that change the display. */ 138 This must be called after all other LCD functions that change the display. */