From 4c5a2e0a5457a92ee5aa7b715c96b574a85f1284 Mon Sep 17 00:00:00 2001 From: MyungJoo Ham Date: Tue, 5 Jan 2010 19:57:19 +0900 Subject: [PATCH] s5pc1xx: reduce u-boot-sleep current. (16.8 -> 12.2 mA) Done by turning sound codec off. Applies to u-boot sleep only (kernel does it already) 1 less mili-amps to match kernel. --- board/samsung/universal/universal.c | 57 +++++++++++-------------------------- cpu/arm_cortexa8/s5pc1xx/sleep.c | 5 ++-- 2 files changed, 19 insertions(+), 43 deletions(-) diff --git a/board/samsung/universal/universal.c b/board/samsung/universal/universal.c index be3a1cd..0d29722 100644 --- a/board/samsung/universal/universal.c +++ b/board/samsung/universal/universal.c @@ -1835,7 +1835,22 @@ int dram_init(void) /* Used for sleep test */ static unsigned char saved_val[4][2]; -static unsigned int gpio_CP, gpio_T_FLASH, gpio_XTAL; +void board_sleep_init_late(void) +{ + /* CODEC_LDO_EN: GPF3[4] */ + gpio_direction_output(&s5pc110_gpio->gpio_f3, 4, 0); + /* CODEC_XTAL_EN: GPH3[2] */ + gpio_direction_output(&s5pc110_gpio->gpio_h3, 2, 0); + + /* MMC T_FLASH off */ + gpio_direction_output(&s5pc110_gpio->gpio_mp0_5, 4, 0); + /* MHL off */ + gpio_direction_output(&s5pc110_gpio->gpio_j2, 2, 0); + gpio_direction_output(&s5pc110_gpio->gpio_mp0_4, 7, 0); + gpio_direction_output(&s5pc110_gpio->gpio_j2, 3, 0); /* MHL_ON for REV02 or higher */ + + +} void board_sleep_init(void) { unsigned int value; @@ -1844,18 +1859,6 @@ void board_sleep_init(void) struct s5pc110_gpio *gpio = (struct s5pc110_gpio *)S5PC110_GPIO_BASE; - /* Set wakeup mask register */ - value = 0xFFFF; - value &= ~(1 << 4); /* Keypad */ - value &= ~(1 << 3); /* RTC */ - value &= ~(1 << 2); /* RTC Alarm */ - writel(value, S5PC110_WAKEUP_MASK); - - /* Set external wakeup mask register */ - value = 0xFFFFFFFF; - value &= ~(1 << 18); /* T-Flash */ - writel(value, S5PC110_EINT_WAKEUP_MASK); - i2c_set_bus_num(I2C_PMIC); addr = 0xCC >> 1; if (i2c_probe(addr)) { @@ -1863,24 +1866,6 @@ void board_sleep_init(void) return; } - /* TOUCH SCREEN ? */ - /* CODEC_XTAL_EN */ - gpio_XTAL = gpio_get_value(&gpio->gpio_h3, 2); - gpio_set_value(&gpio->gpio_h3, 2, 0); - value = gpio_get_value(&gpio->gpio_h3, 2); - /* CP off */ - gpio_CP = gpio_get_value(&gpio->gpio_h3, 7); - gpio_set_value(&gpio->gpio_h3, 7, 0); - value = gpio_get_value(&gpio->gpio_h3, 7); - /* MMC T_FLASH off */ - gpio_T_FLASH = gpio_get_value(&gpio->gpio_mp0_5, 4); - gpio_set_value(&gpio->gpio_mp0_5, 4, 0); - value = gpio_get_value(&gpio->gpio_mp0_5, 4); - /* MHL off */ - gpio_set_value(&gpio->gpio_j2, 2, 0); - gpio_set_value(&gpio->gpio_mp0_4, 7, 0); - gpio_set_value(&gpio->gpio_j2, 3, 0); /* MHL_ON for REV02 or higher */ - /* Set ONOFF1 */ i2c_read(addr, MAX8998_REG_ONOFF1, 1, val, 1); saved_val[0][0] = val[0]; @@ -1947,16 +1932,6 @@ void board_sleep_resume(void) i2c_read(addr, MAX8998_REG_ONOFF3+1, 1, val, 1); printf("Waked up.\n"); - /* CP */ - gpio_set_value(&gpio->gpio_h3, 7, gpio_CP); - value = gpio_get_value(&gpio->gpio_h3, 7); - /* MMC T_FLASH */ - gpio_set_value(&gpio->gpio_mp0_5, 4, gpio_T_FLASH); - value = gpio_get_value(&gpio->gpio_mp0_5, 4); - /* CODEC_XTAL_EN */ - gpio_set_value(&gpio->gpio_h3, 2, gpio_XTAL); - value = gpio_get_value(&gpio->gpio_h3, 2); - /* check max17040 */ check_battery(); diff --git a/cpu/arm_cortexa8/s5pc1xx/sleep.c b/cpu/arm_cortexa8/s5pc1xx/sleep.c index 6523b58..47ec48b 100644 --- a/cpu/arm_cortexa8/s5pc1xx/sleep.c +++ b/cpu/arm_cortexa8/s5pc1xx/sleep.c @@ -308,7 +308,6 @@ void s5pc110_wakeup(void) static int s5pc110_sleep(int mode) { - static int counter; unsigned long regs_save[16]; unsigned int value; int i; @@ -350,6 +349,9 @@ static int s5pc110_sleep(int mode) } s5pc110_save_regs(); + + board_sleep_init_late(); + writel((unsigned long) s5pc110_cpu_resume, S5PC110_INFORM0); if (s5pc1xx_get_cpu_rev() == 0) { @@ -462,7 +464,6 @@ static int s5pc110_sleep(int mode) printf("Wakeup Source: 0x%08x\n", value); value = readl(S5PC110_WAKEUP_STAT); - counter++; board_sleep_resume(); return 0; } -- 2.7.4