summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/export/config-iaudiox5.h5
-rw-r--r--firmware/powermgmt.c2
-rwxr-xr-xfirmware/target/coldfire/iaudio/x5/lcd-x5.c17
3 files changed, 17 insertions, 7 deletions
diff --git a/firmware/export/config-iaudiox5.h b/firmware/export/config-iaudiox5.h
index 21fa636..ae48eb6 100644
--- a/firmware/export/config-iaudiox5.h
+++ b/firmware/export/config-iaudiox5.h
@@ -22,6 +22,7 @@
#define LCD_HEIGHT 128
#define LCD_DEPTH 16 /* pseudo 262.144 colors */
#define LCD_PIXELFORMAT RGB565 /* rgb565 */
+#define HAVE_LCD_CONTRAST
/* remote LCD */
#define LCD_REMOTE_WIDTH 128
@@ -40,6 +41,10 @@
#define CONFIG_LCD LCD_X5
+#define MIN_CONTRAST_SETTING 1
+#define MAX_CONTRAST_SETTING 30
+#define DEFAULT_CONTRAST_SETTING 19 /* Match boot contrast */
+
/* Define this for LCD backlight available */
#define CONFIG_BACKLIGHT BL_IRIVER_H100 /* port controlled !?!? */
#define HAVE_BACKLIGHT_BRIGHTNESS
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c
index ee01fd8..4bccd4e 100644
--- a/firmware/powermgmt.c
+++ b/firmware/powermgmt.c
@@ -1045,7 +1045,9 @@ void shutdown_hw(void)
lcd_update();
sleep(HZ/16);
#endif
+#ifndef IAUDIO_X5
lcd_set_contrast(0);
+#endif
#ifdef HAVE_REMOTE_LCD
remote_backlight_off();
lcd_remote_set_contrast(0);
diff --git a/firmware/target/coldfire/iaudio/x5/lcd-x5.c b/firmware/target/coldfire/iaudio/x5/lcd-x5.c
index 7c155ea..c06521e 100755
--- a/firmware/target/coldfire/iaudio/x5/lcd-x5.c
+++ b/firmware/target/coldfire/iaudio/x5/lcd-x5.c
@@ -139,17 +139,20 @@ inline void lcd_write_data(const unsigned short* p_bytes, int count)
int lcd_default_contrast(void)
{
- return 16;
+ return DEFAULT_CONTRAST_SETTING;
}
void lcd_set_contrast(int val)
{
- if (val >= 15) // val must'nt be 15 or 31
- ++val;
- if (val > 30)
- return;
-
- lcd_write_reg(0x0e, 0x201e + (val << 8));
+ /* Clamp val in range 0-14, 16-30 */
+ if (val < 1)
+ val = 0;
+ else if (val <= 15)
+ --val;
+ else if (val > 30)
+ val = 30;
+
+ lcd_write_reg(0x0e, 0x2018 + (val << 8));
}
void lcd_set_invert_display(bool yesno)