disable IMQ on 2.6.28 as well -- people should use IFB..
[openwrt.git] / target / linux / s3c24xx / patches / 0210-fix-no-uart-leak-when-gps-off.patch.patch
1 From 75c6d53772b66d6d4237745a5d3185f836e05b70 Mon Sep 17 00:00:00 2001
2 From: Andy Green <andy@openmoko.com>
3 Date: Fri, 25 Jul 2008 23:06:19 +0100
4 Subject: [PATCH] fix-no-uart-leak-when-gps-off.patch
5
6 During the suspend current reduction campaign on suspend I
7 forced the GPS UART to be GPIO and to drive 0 into the GPS
8 unit so we would not burn current there.  On resume it lets
9 the pins act as UARTs again.  But really, we should do this
10 all the time that the GPS unit is off, lest we leak it
11 enough power to hold internal state and make trouble.
12
13 Signed-off-by: Andy Green <andy@openmoko.com>
14 ---
15  arch/arm/plat-s3c24xx/neo1973_pm_gps.c |   57 +++++++++++++------------------
16  1 files changed, 24 insertions(+), 33 deletions(-)
17
18 diff --git a/arch/arm/plat-s3c24xx/neo1973_pm_gps.c b/arch/arm/plat-s3c24xx/neo1973_pm_gps.c
19 index 9c6adfa..8cd583d 100644
20 --- a/arch/arm/plat-s3c24xx/neo1973_pm_gps.c
21 +++ b/arch/arm/plat-s3c24xx/neo1973_pm_gps.c
22 @@ -272,9 +272,23 @@ static void gps_pwron_set(int on)
23  
24  #ifdef CONFIG_MACH_NEO1973_GTA02
25         if (machine_is_neo1973_gta02()) {
26 -               if (on)
27 +               if (on) {
28                         pcf50633_voltage_set(pcf50633_global,
29                                 PCF50633_REGULATOR_LDO5, 3000);
30 +                       /* return UART pins to being UART pins */
31 +                       s3c2410_gpio_cfgpin(S3C2410_GPH4, S3C2410_GPH4_TXD1);
32 +                       /* remove pulldown now it won't be floating any more */
33 +                       s3c2410_gpio_pullup(S3C2410_GPH5, 0);
34 +               } else {
35 +                       /*
36 +                        * take care not to power unpowered GPS from UART TX
37 +                        * return them to GPIO and force low
38 +                        */
39 +                       s3c2410_gpio_cfgpin(S3C2410_GPH4, S3C2410_GPH4_OUTP);
40 +                       s3c2410_gpio_setpin(S3C2410_GPH4, 0);
41 +                       /* don't let RX from unpowered GPS float */
42 +                       s3c2410_gpio_pullup(S3C2410_GPH5, 1);
43 +               }
44                 pcf50633_onoff_set(pcf50633_global,
45                         PCF50633_REGULATOR_LDO5, on);
46         }
47 @@ -284,21 +298,14 @@ static void gps_pwron_set(int on)
48  static int gps_pwron_get(void)
49  {
50  #ifdef CONFIG_MACH_NEO1973_GTA01
51 -       if (machine_is_neo1973_gta01()) {
52 -               if (s3c2410_gpio_getpin(GTA01_GPIO_GPS_PWRON))
53 -                       return 1;
54 -               else
55 -                       return 0;
56 -       }
57 +       if (machine_is_neo1973_gta01())
58 +               return !!s3c2410_gpio_getpin(GTA01_GPIO_GPS_PWRON);
59  #endif /* CONFIG_MACH_NEO1973_GTA01 */
60  
61  #ifdef CONFIG_MACH_NEO1973_GTA02
62 -       if (machine_is_neo1973_gta02()) {
63 -               if (pcf50633_onoff_get(pcf50633_global, PCF50633_REGULATOR_LDO5))
64 -                       return 1;
65 -               else
66 -                       return 0;
67 -       }
68 +       if (machine_is_neo1973_gta02())
69 +               return !!pcf50633_onoff_get(pcf50633_global,
70 +                                                      PCF50633_REGULATOR_LDO5);
71  #endif /* CONFIG_MACH_NEO1973_GTA02 */
72         return -1;
73  }
74 @@ -496,15 +503,8 @@ static int gta01_pm_gps_suspend(struct platform_device *pdev,
75  #endif /* CONFIG_MACH_NEO1973_GTA01 */
76  
77  #ifdef CONFIG_MACH_NEO1973_GTA02
78 -       if (machine_is_neo1973_gta02()) {
79 -               /* take care not to power unpowered GPS from GPIO */
80 -               s3c2410_gpio_cfgpin(S3C2410_GPH4, S3C2410_GPH4_OUTP);
81 -               s3c2410_gpio_setpin(S3C2410_GPH4, 0);
82 -               /* don't let RX from unpowered GPS float */
83 -               s3c2410_gpio_pullup(S3C2410_GPH5, 1);
84 -
85 +       if (machine_is_neo1973_gta02())
86                 gps_pwron_set(0);
87 -       }
88  #endif /* CONFIG_MACH_NEO1973_GTA02 */
89  
90         return 0;
91 @@ -513,26 +513,17 @@ static int gta01_pm_gps_suspend(struct platform_device *pdev,
92  static int gta01_pm_gps_resume(struct platform_device *pdev)
93  {
94  #ifdef CONFIG_MACH_NEO1973_GTA01
95 -       if (machine_is_neo1973_gta01()) {
96 +       if (machine_is_neo1973_gta01())
97                 if (neo1973_gps.power_was_on)
98                         gps_power_sequence_up();
99 -       }
100  #endif /* CONFIG_MACH_NEO1973_GTA01 */
101  
102  #ifdef CONFIG_MACH_NEO1973_GTA02
103 -       if (machine_is_neo1973_gta02()) {
104 -               /*
105 -                * resume TXD1 function since we power GPS now... er..
106 -                * WTF?  FIXME We always power GPS on resume ??
107 -                */
108 -               s3c2410_gpio_cfgpin(S3C2410_GPH4, S3C2410_GPH4_TXD1);
109 -               /* remove pulldown now it won't be floating any more */
110 -               s3c2410_gpio_pullup(S3C2410_GPH5, 0);
111 -
112 +       if (machine_is_neo1973_gta02())
113                 if (neo1973_gps.power_was_on)
114                     gps_pwron_set(1);
115  #endif /* CONFIG_MACH_NEO1973_GTA02 */
116 -       }
117 +
118         return 0;
119  }
120  #else
121 -- 
122 1.5.6.3
123