From 75c6d53772b66d6d4237745a5d3185f836e05b70 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Fri, 25 Jul 2008 23:06:19 +0100 Subject: [PATCH] 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 --- 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 9c6adfa..8cd583d 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 -- 1.5.6.3