From b073f0cfc1ebf0d939a6992612f176298b930dac Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Wed, 2 Apr 2008 19:01:16 +0000 Subject: LCD driver tweaks for greyscale iPods: * Use 1/7 bias, 5x step-up and the highest step-up frequency on all 1st..3rd gen iPods, simplifying the driver this way. The default contrast for those iPods has changed - reset settings in case the display becomes unreadable. * Set n-line inversion drive to 9 lines, improving image quality on 1st..3rd gen iPods somewhat. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16932 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/arm/ipod/lcd-gray.c | 54 +++++++++---------------------------- 1 file changed, 13 insertions(+), 41 deletions(-) diff --git a/firmware/target/arm/ipod/lcd-gray.c b/firmware/target/arm/ipod/lcd-gray.c index e36a7efc1d..9538d277af 100644 --- a/firmware/target/arm/ipod/lcd-gray.c +++ b/firmware/target/arm/ipod/lcd-gray.c @@ -57,18 +57,12 @@ static void invert_display(void); #endif #if defined(IPOD_1G2G) || defined(IPOD_3G) -static unsigned short power_reg_h; -#define POWER_REG_H power_reg_h +#define POWER_REG_H 0x1120 /* 1/7 Bias, 5x step-up @ clk/8 */ #else -#define POWER_REG_H 0x1200 +#define POWER_REG_H 0x1200 /* 1/7 Bias, 6x step-up @ clk/32 */ #endif -#ifdef IPOD_1G2G -static unsigned short contrast_reg_h; -#define CONTRAST_REG_H contrast_reg_h -#else #define CONTRAST_REG_H 0x400 -#endif /* needed for flip */ static int addr_offset; @@ -118,43 +112,19 @@ static void lcd_cmd_and_data(unsigned cmd, unsigned data) /* LCD init */ void lcd_init_device(void) { -#ifdef IPOD_1G2G - if ((IPOD_HW_REVISION >> 16) == 1) - { - power_reg_h = 0x1500; - contrast_reg_h = 0x700; - } - else /* 2nd gen */ - { - if (inl(0xcf00404c) & 0x01) /* check bit 0 */ - { - power_reg_h = 0x1520; /* Set step-up frequency to f/8 instead of - * f/32, for better blacklevel stability */ - contrast_reg_h = 0x400; - } - else - { - power_reg_h = 0x1100; - contrast_reg_h = 0x300; - } - } -#elif defined IPOD_3G - if (inl(0xcf00404c) & 0x01) /* check bit 0 */ - power_reg_h = 0x1520; /* Set step-up frequency to f/8 instead of - * f/32, for better blacklevel stability */ - else - power_reg_h = 0x1100; -#endif #ifdef IPOD_MINI2G /* serial LCD hookup */ lcd_wait_write(); LCD1_CONTROL = 0x01730084; /* fastest setting */ #elif defined(IPOD_1G2G) || defined(IPOD_3G) - LCD1_CONTROL = (LCD1_CONTROL & 0x0002) | 0x0084; /* fastest setting, keep backlight bit */ + LCD1_CONTROL = (LCD1_CONTROL & 0x0002) | 0x0084; + /* fastest setting, keep backlight bit */ #else LCD1_CONTROL = 0x0084; /* fastest setting */ #endif + lcd_cmd_and_data(R_DRV_WAVEFORM_CONTROL, 0x48); + /* C waveform, no EOR, 9 lines inversion */ lcd_cmd_and_data(R_POWER_CONTROL, POWER_REG_H | 0xc); #ifdef HAVE_BACKLIGHT_INVERSION invert_display(); @@ -169,9 +139,11 @@ void lcd_init_device(void) int lcd_default_contrast(void) { -#ifdef IPOD_1G2G - return 28; -#elif defined(IPOD_MINI) || defined(IPOD_MINI2G) || defined(IPOD_3G) +#if defined(IPOD_1G2G) + return 45; +#elif defined(IPOD_3G) + return 55; +#elif defined(IPOD_MINI) || defined(IPOD_MINI2G) return 42; #elif defined(IPOD_4G) return 35; @@ -354,7 +326,7 @@ void lcd_update(void) /* LCD powerdown */ void lcd_shutdown(void) { - lcd_cmd_and_data(R_POWER_CONTROL, 0x1500); /* Turn off op amp power */ - lcd_cmd_and_data(R_POWER_CONTROL, 0x1502); /* Put LCD driver in standby */ + lcd_cmd_and_data(R_POWER_CONTROL, POWER_REG_H | 0x00); /* Turn off op amp power */ + lcd_cmd_and_data(R_POWER_CONTROL, POWER_REG_H | 0x02); /* Put LCD driver in standby */ } #endif -- cgit v1.2.3