[ar71xx] preliminary support for the Ubiquiti RouterStation Pro
[openwrt.git] / target / linux / s3c24xx / patches-2.6.24 / 1113-Fix-the-firing-of-Jack-Interrupts-after-resume-whe.patch
1 From d6c8d6b85864edd5bb616f9fda0d2e9c1f74de42 Mon Sep 17 00:00:00 2001
2 From: Holger Freyther <zecke@openmoko.org>
3 Date: Sun, 13 Apr 2008 07:25:54 +0100
4 Subject: [PATCH] Fix the firing of "Jack"-Interrupts after resume when the modem is powered on.
5
6 GTA02_GPIO_nDL_GSM defaults to high/1. On resume do not enable the DL_GSM if
7 it was not enabled before. This is stopping the storm of interrupts.
8
9 Fix the logic in the download file handling. Downloads are disabled (0) when
10 the GTA02_GPIO_nDL_GSM is high (1). To enable downloading set
11 GTA02_GPIO_nDL_GSM to low (0, !on). Disable the jack interrupt while download
12 the is active. When disabling download we will get a couple of jack interrupts
13 but this is hardly avoidable.
14
15 Avoid reading the GPIO value if we do not even have a console set.
16
17 Signed-Off-by: Holger Freyther <zecke@openmoko.org>
18 ---
19 arch/arm/plat-s3c24xx/neo1973_pm_gsm.c | 35 +++++++++++++++++++++++--------
20 1 files changed, 26 insertions(+), 9 deletions(-)
21
22 diff --git a/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c b/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c
23 index 1123d7d..b4ea8ba 100644
24 --- a/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c
25 +++ b/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c
26 @@ -17,8 +17,9 @@
27 #include <linux/platform_device.h>
28 #include <linux/console.h>
29 #include <linux/errno.h>
30 +#include <linux/interrupt.h>
31
32 -#include <asm/hardware.h>
33 +#include <asm/gpio.h>
34 #include <asm/mach-types.h>
35 #include <asm/arch/gta01.h>
36
37 @@ -30,6 +31,7 @@
38
39 struct gta01pm_priv {
40 int gpio_ngsm_en;
41 + int gpio_ndl_gsm;
42 struct console *con;
43 };
44
45 @@ -68,7 +70,7 @@ static ssize_t gsm_read(struct device *dev, struct device_attribute *attr,
46 #endif
47 #ifdef CONFIG_MACH_NEO1973_GTA02
48 if (machine_is_neo1973_gta02())
49 - if (s3c2410_gpio_getpin(GTA02_GPIO_nDL_GSM))
50 + if (!s3c2410_gpio_getpin(GTA02_GPIO_nDL_GSM))
51 goto out_1;
52 #endif
53 }
54 @@ -143,8 +145,18 @@ static ssize_t gsm_write(struct device *dev, struct device_attribute *attr,
55 s3c2410_gpio_setpin(GTA01_GPIO_MODEM_DNLOAD, on);
56 #endif
57 #ifdef CONFIG_MACH_NEO1973_GTA02
58 - if (machine_is_neo1973_gta02())
59 - s3c2410_gpio_setpin(GTA02_GPIO_nDL_GSM, on);
60 + if (machine_is_neo1973_gta02()) {
61 + /* FIXME: Layering violation, we know how this relates to
62 + * the Jack-IRQ. And we assume the keyboard driver to be
63 + * around. */
64 + if (on)
65 + disable_irq(gpio_to_irq(GTA02_GPIO_JACK_INSERT));
66 + else
67 + enable_irq(gpio_to_irq(GTA02_GPIO_JACK_INSERT));
68 +
69 + gta01_gsm.gpio_ndl_gsm = !on;
70 + s3c2410_gpio_setpin(GTA02_GPIO_nDL_GSM, !on);
71 + }
72 #endif
73 }
74
75 @@ -159,26 +171,29 @@ static DEVICE_ATTR(download, 0644, gsm_read, gsm_write);
76 static int gta01_gsm_suspend(struct platform_device *pdev, pm_message_t state)
77 {
78 /* GPIO state is saved/restored by S3C2410 core GPIO driver, so we
79 - * don't need to do anything here */
80 + * don't need to do much here. */
81 +
82
83 - /* disable DL GSM to prevent jack_insert becoming floating */
84 + /* disable DL GSM to prevent jack_insert becoming 'floating' */
85 if (machine_is_neo1973_gta02())
86 s3c2410_gpio_setpin(GTA02_GPIO_nDL_GSM, 1);
87 +
88 return 0;
89 }
90
91 static int gta01_gsm_resume(struct platform_device *pdev)
92 {
93 /* GPIO state is saved/restored by S3C2410 core GPIO driver, so we
94 - * don't need to do anything here */
95 + * don't need to do much here. */
96
97 /* Make sure that the kernel console on the serial port is still
98 * disabled. FIXME: resume ordering race with serial driver! */
99 - if (s3c2410_gpio_getpin(GTA01_GPIO_MODEM_ON) && gta01_gsm.con)
100 + if (gta01_gsm.con && s3c2410_gpio_getpin(GTA01_GPIO_MODEM_ON))
101 console_stop(gta01_gsm.con);
102
103 if (machine_is_neo1973_gta02())
104 - s3c2410_gpio_setpin(GTA02_GPIO_nDL_GSM, 0);
105 + s3c2410_gpio_setpin(GTA02_GPIO_nDL_GSM, gta01_gsm.gpio_ndl_gsm);
106 +
107 return 0;
108 }
109 #else
110 @@ -248,6 +263,8 @@ static int __init gta01_gsm_probe(struct platform_device *pdev)
111 } else
112 gta01_gsm.con = NULL;
113
114 + gta01_gsm.gpio_ndl_gsm = 1;
115 +
116 return sysfs_create_group(&pdev->dev.kobj, &gta01_gsm_attr_group);
117 }
118
119 --
120 1.5.6.5
121
This page took 0.056947 seconds and 5 git commands to generate.