diff options
author | Andy Green <andy@openmoko.com> | 2008-11-19 17:09:56 +0000 |
---|---|---|
committer | Andy Green <agreen@pads.home.warmcat.com> | 2008-11-19 17:09:56 +0000 |
commit | 94a4decac11b8c88f74dc03992db4a562b1083f0 (patch) | |
tree | 5dc00aca8c0b9d94e807ef0d33f6bdf3cc37b82b | |
parent | 5ae81eed14630f05a6793214690f56da94a4e874 (diff) |
fix-no-uart-leak-when-gps-off.patch
During the suspend current reduction campaign on suspend I
forced the GPS UART to be GPIO and to drive 0 into the GPS
unit so we would not burn current there. On resume it lets
the pins act as UARTs again. But really, we should do this
all the time that the GPS unit is off, lest we leak it
enough power to hold internal state and make trouble.
Signed-off-by: Andy Green <andy@openmoko.com>
-rw-r--r-- | arch/arm/plat-s3c24xx/neo1973_pm_gps.c | 57 |
1 files changed, 24 insertions, 33 deletions
diff --git a/arch/arm/plat-s3c24xx/neo1973_pm_gps.c b/arch/arm/plat-s3c24xx/neo1973_pm_gps.c index 9c6adfad774..8cd583d75fa 100644 --- a/arch/arm/plat-s3c24xx/neo1973_pm_gps.c +++ b/arch/arm/plat-s3c24xx/neo1973_pm_gps.c @@ -272,9 +272,23 @@ static void gps_pwron_set(int on) #ifdef CONFIG_MACH_NEO1973_GTA02 if (machine_is_neo1973_gta02()) { - if (on) + if (on) { pcf50633_voltage_set(pcf50633_global, PCF50633_REGULATOR_LDO5, 3000); + /* return UART pins to being UART pins */ + s3c2410_gpio_cfgpin(S3C2410_GPH4, S3C2410_GPH4_TXD1); + /* remove pulldown now it won't be floating any more */ + s3c2410_gpio_pullup(S3C2410_GPH5, 0); + } else { + /* + * take care not to power unpowered GPS from UART TX + * return them to GPIO and force low + */ + s3c2410_gpio_cfgpin(S3C2410_GPH4, S3C2410_GPH4_OUTP); + s3c2410_gpio_setpin(S3C2410_GPH4, 0); + /* don't let RX from unpowered GPS float */ + s3c2410_gpio_pullup(S3C2410_GPH5, 1); + } pcf50633_onoff_set(pcf50633_global, PCF50633_REGULATOR_LDO5, on); } @@ -284,21 +298,14 @@ static void gps_pwron_set(int on) static int gps_pwron_get(void) { #ifdef CONFIG_MACH_NEO1973_GTA01 - if (machine_is_neo1973_gta01()) { - if (s3c2410_gpio_getpin(GTA01_GPIO_GPS_PWRON)) - return 1; - else - return 0; - } + if (machine_is_neo1973_gta01()) + return !!s3c2410_gpio_getpin(GTA01_GPIO_GPS_PWRON); #endif /* CONFIG_MACH_NEO1973_GTA01 */ #ifdef CONFIG_MACH_NEO1973_GTA02 - if (machine_is_neo1973_gta02()) { - if (pcf50633_onoff_get(pcf50633_global, PCF50633_REGULATOR_LDO5)) - return 1; - else - return 0; - } + if (machine_is_neo1973_gta02()) + return !!pcf50633_onoff_get(pcf50633_global, + PCF50633_REGULATOR_LDO5); #endif /* CONFIG_MACH_NEO1973_GTA02 */ return -1; } @@ -496,15 +503,8 @@ static int gta01_pm_gps_suspend(struct platform_device *pdev, #endif /* CONFIG_MACH_NEO1973_GTA01 */ #ifdef CONFIG_MACH_NEO1973_GTA02 - if (machine_is_neo1973_gta02()) { - /* take care not to power unpowered GPS from GPIO */ - s3c2410_gpio_cfgpin(S3C2410_GPH4, S3C2410_GPH4_OUTP); - s3c2410_gpio_setpin(S3C2410_GPH4, 0); - /* don't let RX from unpowered GPS float */ - s3c2410_gpio_pullup(S3C2410_GPH5, 1); - + if (machine_is_neo1973_gta02()) gps_pwron_set(0); - } #endif /* CONFIG_MACH_NEO1973_GTA02 */ return 0; @@ -513,26 +513,17 @@ static int gta01_pm_gps_suspend(struct platform_device *pdev, static int gta01_pm_gps_resume(struct platform_device *pdev) { #ifdef CONFIG_MACH_NEO1973_GTA01 - if (machine_is_neo1973_gta01()) { + if (machine_is_neo1973_gta01()) if (neo1973_gps.power_was_on) gps_power_sequence_up(); - } #endif /* CONFIG_MACH_NEO1973_GTA01 */ #ifdef CONFIG_MACH_NEO1973_GTA02 - if (machine_is_neo1973_gta02()) { - /* - * resume TXD1 function since we power GPS now... er.. - * WTF? FIXME We always power GPS on resume ?? - */ - s3c2410_gpio_cfgpin(S3C2410_GPH4, S3C2410_GPH4_TXD1); - /* remove pulldown now it won't be floating any more */ - s3c2410_gpio_pullup(S3C2410_GPH5, 0); - + if (machine_is_neo1973_gta02()) if (neo1973_gps.power_was_on) gps_pwron_set(1); #endif /* CONFIG_MACH_NEO1973_GTA02 */ - } + return 0; } #else |