[adm5120] add USB drivers for the NFS-101U/WU profiles
[openwrt.git] / target / linux / s3c24xx / patches-2.6.24 / 1114-Enable-GPS-only-if-it-was-powered-on-before-suspendi.patch
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
5
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.
10
11 Only do this for the GTA02 as I don't have a gllin setup for the GTA01
12
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
15 by the s3c code.
16
17 Signed-Off-by: Holger Frether <zecke@openmoko.org>
18 ---
19 arch/arm/plat-s3c24xx/neo1973_pm_gps.c | 22 ++++++++++++++--------
20 1 files changed, 14 insertions(+), 8 deletions(-)
21
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
26 @@ -30,6 +30,12 @@
27 #include <linux/pcf50633.h>
28 #endif
29
30 +struct neo1973_pm_gps_data {
31 + int power_was_on;
32 +};
33 +
34 +static struct neo1973_pm_gps_data neo1973_gps;
35 +
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)
40 if (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);
47 }
48 #endif /* CONFIG_MACH_NEO1973_GTA02 */
49 }
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,
52 pm_message_t state)
53 {
54 +
55 + neo1973_gps.power_was_on = gps_pwron_get();
56 +
57 #ifdef CONFIG_MACH_NEO1973_GTA01
58 if (machine_is_neo1973_gta01()) {
59 /* FIXME */
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);
63
64 - /* FIXME */
65 - pcf50633_onoff_set(pcf50633_global,
66 - PCF50633_REGULATOR_LDO5, 0);
67 + gps_pwron_set(0);
68 }
69 #endif /* CONFIG_MACH_NEO1973_GTA02 */
70
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);
74
75 - /* FIXME */
76 - pcf50633_onoff_set(pcf50633_global,
77 - PCF50633_REGULATOR_LDO5, 1);
78 + if (neo1973_gps.power_was_on)
79 + gps_pwron_set(1);
80 #endif /* CONFIG_MACH_NEO1973_GTA02 */
81 }
82 return 0;
83 --
84 1.5.6.5
85
This page took 0.050783 seconds and 5 git commands to generate.