From 55a4520f076ffa5190aac1f24f584e759ffc62cf Mon Sep 17 00:00:00 2001 From: Bertrik Sikken Date: Thu, 22 Jul 2010 15:31:24 +0000 Subject: Sansa clip+: fix display brightness for players with newer OLED controller type (and reorganise the variant detection a bit in the process) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27522 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/arm/as3525/lcd-ssd1303.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'firmware/target/arm/as3525/lcd-ssd1303.c') diff --git a/firmware/target/arm/as3525/lcd-ssd1303.c b/firmware/target/arm/as3525/lcd-ssd1303.c index e0e0715311..213f12a424 100644 --- a/firmware/target/arm/as3525/lcd-ssd1303.c +++ b/firmware/target/arm/as3525/lcd-ssd1303.c @@ -44,7 +44,6 @@ #define LCD_SET_REVERSE_DISPLAY ((char)0xA7) #define LCD_SET_MULTIPLEX_RATIO ((char)0xA8) #define LCD_SET_DC_DC ((char)0xAD) -#define LCD_SET_DC_DC_PART2 ((char)0x8A) #define LCD_SET_DISPLAY_OFF ((char)0xAE) #define LCD_SET_DISPLAY_ON ((char)0xAF) #define LCD_SET_PAGE_ADDRESS ((char)0xB0) @@ -68,6 +67,13 @@ /** globals **/ static bool display_on; /* used by lcd_enable */ + +/* Display variant, always 0 in clipv1, clipv2, can be 0 or 1 in clip+ + * variant 0: has 132 pixel wide framebuffer, max brightness about 50 + * variant 1: has 128 pixel wide framebuffer, max brightness about 128 + */ +static int variant; + static int offset; /* column offset */ /*** hardware configuration ***/ @@ -80,6 +86,9 @@ int lcd_default_contrast(void) void lcd_set_contrast(int val) { lcd_write_command(LCD_CNTL_CONTRAST); + if (variant == 1) { + val = val * 5 / 2; + } lcd_write_command(val); } @@ -137,7 +146,8 @@ void lcd_init_device(void) { int i; - lcd_hw_init(&offset); + variant = lcd_hw_init(); + offset = (variant == 0) ? 2 : 0; /* Set display clock (divide ratio = 1) and oscillator frequency (1) */ lcd_write_command(LCD_SET_DISPLAY_CLOCK_AND_OSC_FREQ); @@ -154,9 +164,9 @@ void lcd_init_device(void) /* Set contrast register to 12% */ lcd_set_contrast(lcd_default_contrast()); - /* Disable DC-DC */ + /* Configure DC-DC */ lcd_write_command(LCD_SET_DC_DC); - lcd_write_command(LCD_SET_DC_DC_PART2/*|0*/); + lcd_write_command((variant == 0) ? 0x8A : 0x10); /* Set starting line as 0 */ lcd_write_command(LCD_SET_DISPLAY_START_LINE /*|(0 & 0x3f)*/); -- cgit v1.2.3