[brcm63xx] resync kernel configuration
[openwrt.git] / target / linux / s3c24xx / patches-2.6.26 / 1240-gta0x-add-minimal-GSM-flowcontrol.patch.patch
1 From 5a0021aed270b0d98a902d9c8eb19b395dc186ae Mon Sep 17 00:00:00 2001
2 From: Mike Westerhof <mwester@dls.net>
3 Date: Sun, 10 Aug 2008 09:12:55 +0100
4 Subject: [PATCH] gta0x-add-minimal-GSM-flowcontrol.patch
5
6 Add the basic GSM flowcontrol code.
7
8 Signed-off-by: Mike Westerhof <mwester@dls.net>
9 ---
10 arch/arm/mach-s3c2410/mach-gta01.c | 3 ++
11 arch/arm/mach-s3c2440/mach-gta02.c | 3 ++
12 arch/arm/plat-s3c24xx/neo1973_pm_gsm.c | 36 ++++++++++++++++++++++++++++++++
13 3 files changed, 42 insertions(+), 0 deletions(-)
14
15 diff --git a/arch/arm/mach-s3c2410/mach-gta01.c b/arch/arm/mach-s3c2410/mach-gta01.c
16 index e518de7..f3f87cf 100644
17 --- a/arch/arm/mach-s3c2410/mach-gta01.c
18 +++ b/arch/arm/mach-s3c2410/mach-gta01.c
19 @@ -657,9 +657,12 @@ static void __init gta01_map_io(void)
20 s3c24xx_init_uarts(gta01_uartcfgs, ARRAY_SIZE(gta01_uartcfgs));
21 }
22
23 +extern int gta_gsm_interrupts;
24 +
25 static irqreturn_t gta01_modem_irq(int irq, void *param)
26 {
27 printk(KERN_DEBUG "GSM wakeup interrupt (IRQ %d)\n", irq);
28 + gta_gsm_interrupts++;
29 return IRQ_HANDLED;
30 }
31
32 diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c
33 index aeedd42..b37d1c4 100644
34 --- a/arch/arm/mach-s3c2440/mach-gta02.c
35 +++ b/arch/arm/mach-s3c2440/mach-gta02.c
36 @@ -1531,9 +1531,12 @@ static void __init gta02_map_io(void)
37 s3c24xx_init_uarts(gta02_uartcfgs, ARRAY_SIZE(gta02_uartcfgs));
38 }
39
40 +extern int gta_gsm_interrupts;
41 +
42 static irqreturn_t gta02_modem_irq(int irq, void *param)
43 {
44 printk(KERN_DEBUG "modem wakeup interrupt\n");
45 + gta_gsm_interrupts++;
46 return IRQ_HANDLED;
47 }
48
49 diff --git a/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c b/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c
50 index de83939..901f8fb 100644
51 --- a/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c
52 +++ b/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c
53 @@ -34,6 +34,9 @@
54 extern void s3c24xx_serial_register_resume_dependency(struct resume_dependency *
55 resume_dependency, int uart_index);
56
57 +int gta_gsm_interrupts;
58 +EXPORT_SYMBOL(gta_gsm_interrupts);
59 +
60 struct gta01pm_priv {
61 int gpio_ngsm_en;
62 int gpio_ndl_gsm;
63 @@ -80,6 +83,9 @@ static ssize_t gsm_read(struct device *dev, struct device_attribute *attr,
64 if (!s3c2410_gpio_getpin(GTA02_GPIO_nDL_GSM))
65 goto out_1;
66 }
67 + } else if (!strcmp(attr->attr.name, "flowcontrolled")) {
68 + if (s3c2410_gpio_getcfg(S3C2410_GPH1) == S3C2410_GPIO_OUTPUT)
69 + goto out_1;
70 }
71
72 return strlcpy(buf, "0\n", 3);
73 @@ -176,6 +182,13 @@ static ssize_t gsm_write(struct device *dev, struct device_attribute *attr,
74 gta01_gsm.gpio_ndl_gsm = !on;
75 s3c2410_gpio_setpin(GTA02_GPIO_nDL_GSM, !on);
76 }
77 + } else if (!strcmp(attr->attr.name, "flowcontrolled")) {
78 + if (on) {
79 + gta_gsm_interrupts = 0;
80 + s3c2410_gpio_setpin(S3C2410_GPH1, 1);
81 + s3c2410_gpio_cfgpin(S3C2410_GPH1, S3C2410_GPH1_OUTP);
82 + } else
83 + s3c2410_gpio_cfgpin(S3C2410_GPH1, S3C2410_GPH1_nRTS0);
84 }
85
86 return count;
87 @@ -184,6 +197,7 @@ static ssize_t gsm_write(struct device *dev, struct device_attribute *attr,
88 static DEVICE_ATTR(power_on, 0644, gsm_read, gsm_write);
89 static DEVICE_ATTR(reset, 0644, gsm_read, gsm_write);
90 static DEVICE_ATTR(download, 0644, gsm_read, gsm_write);
91 +static DEVICE_ATTR(flowcontrolled, 0644, gsm_read, gsm_write);
92
93 #ifdef CONFIG_PM
94
95 @@ -193,6 +207,11 @@ static int gta01_gsm_suspend(struct platform_device *pdev, pm_message_t state)
96 /* GPIO state is saved/restored by S3C2410 core GPIO driver, so we
97 * don't need to do much here. */
98
99 + /* If flowcontrol asserted, abort if GSM already interrupted */
100 + if (s3c2410_gpio_getcfg(S3C2410_GPH1) == S3C2410_GPIO_OUTPUT) {
101 + if (gta_gsm_interrupts)
102 + goto busy;
103 + }
104
105 /* disable DL GSM to prevent jack_insert becoming 'floating' */
106 if (machine_is_neo1973_gta02())
107 @@ -205,6 +224,20 @@ static int gta01_gsm_suspend(struct platform_device *pdev, pm_message_t state)
108 s3c24xx_serial_register_resume_dependency(&resume_dep_gsm_uart, 0);
109
110 return 0;
111 +
112 +busy:
113 + return -EBUSY;
114 +}
115 +
116 +static int
117 +gta01_gsm_suspend_late(struct platform_device *pdev, pm_message_t state)
118 +{
119 + /* Last chance: abort if GSM already interrupted */
120 + if (s3c2410_gpio_getcfg(S3C2410_GPH1) == S3C2410_GPIO_OUTPUT) {
121 + if (gta_gsm_interrupts)
122 + return -EBUSY;
123 + }
124 + return 0;
125 }
126
127 static int gta01_gsm_resume(struct platform_device *pdev)
128 @@ -229,6 +262,7 @@ static int gta01_gsm_resume(struct platform_device *pdev)
129 }
130 #else
131 #define gta01_gsm_suspend NULL
132 +#define gta01_gsm_suspend_late NULL
133 #define gta01_gsm_resume NULL
134 #endif
135
136 @@ -236,6 +270,7 @@ static struct attribute *gta01_gsm_sysfs_entries[] = {
137 &dev_attr_power_on.attr,
138 &dev_attr_reset.attr,
139 &dev_attr_download.attr,
140 + &dev_attr_flowcontrolled.attr,
141 NULL
142 };
143
144 @@ -315,6 +350,7 @@ static struct platform_driver gta01_gsm_driver = {
145 .probe = gta01_gsm_probe,
146 .remove = gta01_gsm_remove,
147 .suspend = gta01_gsm_suspend,
148 + .suspend_late = gta01_gsm_suspend_late,
149 .resume = gta01_gsm_resume,
150 .driver = {
151 .name = "neo1973-pm-gsm",
152 --
153 1.5.6.3
154
This page took 0.056414 seconds and 5 git commands to generate.