1 From d685e208663ffc9bd454af6698cb2945e60a3ba8 Mon Sep 17 00:00:00 2001
2 From: Holger Freyther <zecke@openmoko.org>
3 Date: Sun, 13 Apr 2008 07:25:55 +0100
4 Subject: [PATCH] Enable GPS only if it was powered on before suspending the device
6 Similar to the neo1974_pm_gsm.c keep a static struct around. On suspend
7 we will save the current power state, on resume we will use this
8 information to enable power of the GPS only when it was powered on before.
9 This is passing basic tests with screen /dev/ttySAC1 on suspend and resume.
11 Only do this for the GTA02 as I don't have a gllin setup for the GTA01
13 I wonder why the suspend and resume code is not using gps_pwron_set and why
14 for the GTA02 we need to keep the state of the GPIOs, this should be done
17 Signed-Off-by: Holger Frether <zecke@openmoko.org>
19 arch/arm/plat-s3c24xx/neo1973_pm_gps.c | 22 ++++++++++++++--------
20 1 files changed, 14 insertions(+), 8 deletions(-)
22 diff --git a/arch/arm/plat-s3c24xx/neo1973_pm_gps.c b/arch/arm/plat-s3c24xx/neo1973_pm_gps.c
23 index e8cfb96..b12f7bc 100644
24 --- a/arch/arm/plat-s3c24xx/neo1973_pm_gps.c
25 +++ b/arch/arm/plat-s3c24xx/neo1973_pm_gps.c
27 #include <linux/pcf50633.h>
30 +struct neo1973_pm_gps_data {
34 +static struct neo1973_pm_gps_data neo1973_gps;
36 /* This is the 2.8V supply for the RTC crystal, the mail clock crystal and
37 * the input to VDD_RF */
38 static void gps_power_2v8_set(int on)
39 @@ -266,8 +272,8 @@ static void gps_pwron_set(int on)
41 pcf50633_voltage_set(pcf50633_global,
42 PCF50633_REGULATOR_LDO5, 3000);
43 - pcf50633_onoff_set(pcf50633_global,
44 - PCF50633_REGULATOR_LDO5, on);
45 + pcf50633_onoff_set(pcf50633_global,
46 + PCF50633_REGULATOR_LDO5, on);
48 #endif /* CONFIG_MACH_NEO1973_GTA02 */
50 @@ -476,6 +482,9 @@ static DEVICE_ATTR(power_sequence, 0644, power_sequence_read,
51 static int gta01_pm_gps_suspend(struct platform_device *pdev,
55 + neo1973_gps.power_was_on = gps_pwron_get();
57 #ifdef CONFIG_MACH_NEO1973_GTA01
58 if (machine_is_neo1973_gta01()) {
60 @@ -491,9 +500,7 @@ static int gta01_pm_gps_suspend(struct platform_device *pdev,
61 /* don't let RX from unpowered GPS float */
62 s3c2410_gpio_pullup(S3C2410_GPH5, 1);
65 - pcf50633_onoff_set(pcf50633_global,
66 - PCF50633_REGULATOR_LDO5, 0);
69 #endif /* CONFIG_MACH_NEO1973_GTA02 */
71 @@ -519,9 +526,8 @@ static int gta01_pm_gps_resume(struct platform_device *pdev)
72 /* remove pulldown now it won't be floating any more */
73 s3c2410_gpio_pullup(S3C2410_GPH5, 0);
76 - pcf50633_onoff_set(pcf50633_global,
77 - PCF50633_REGULATOR_LDO5, 1);
78 + if (neo1973_gps.power_was_on)
80 #endif /* CONFIG_MACH_NEO1973_GTA02 */