create firmware image for the Ubiquiti LS-SR71 board
[openwrt/openwrt.git] / target / linux / s3c24xx / patches-2.6.26 / 1144-add-gta01-resume-sysfs.patch.patch
1 From e570a61a0baa6d85e3a576e296443f5c35f6842e Mon Sep 17 00:00:00 2001
2 From: Andy Green <andy@openmoko.com>
3 Date: Fri, 25 Jul 2008 23:06:10 +0100
4 Subject: [PATCH] add-gta01-resume-sysfs.patch
5
6 Adds the somewhat simpler resume source support for GTA01
7 since PMU is not a wake source
8
9 Signed-off-by: Andy Green <andy@openmoko.com>
10 ---
11 arch/arm/plat-s3c24xx/neo1973_pm_resume_reason.c | 53 +++++++++++++--------
12 1 files changed, 33 insertions(+), 20 deletions(-)
13
14 diff --git a/arch/arm/plat-s3c24xx/neo1973_pm_resume_reason.c b/arch/arm/plat-s3c24xx/neo1973_pm_resume_reason.c
15 index cca42dc..145556b 100644
16 --- a/arch/arm/plat-s3c24xx/neo1973_pm_resume_reason.c
17 +++ b/arch/arm/plat-s3c24xx/neo1973_pm_resume_reason.c
18 @@ -23,10 +23,28 @@
19 #ifdef CONFIG_MACH_NEO1973_GTA02
20 #include <asm/arch/gta02.h>
21 #include <linux/pcf50633.h>
22 -
23 +#endif
24
25 static unsigned int *gstatus4_mapped;
26 -static char *resume_reasons[] = {
27 +static char *resume_reasons[][17] = { { /* GTA01 */
28 + "EINT00_NULL",
29 + "EINT01_GSM",
30 + "EINT02_NULL",
31 + "EINT03_NULL",
32 + "EINT04_JACK",
33 + "EINT05_SDCARD",
34 + "EINT06_AUXKEY",
35 + "EINT07_HOLDKEY",
36 + "EINT08_NULL",
37 + "EINT09_NULL",
38 + "EINT10_NULL",
39 + "EINT11_NULL",
40 + "EINT12_NULL",
41 + "EINT13_NULL",
42 + "EINT14_NULL",
43 + "EINT15_NULL",
44 + NULL
45 +}, { /* GTA02 */
46 "EINT00_ACCEL1",
47 "EINT01_GSM",
48 "EINT02_BLUETOOTH",
49 @@ -44,7 +62,7 @@ static char *resume_reasons[] = {
50 "EINT14_NULL",
51 "EINT15_NULL",
52 NULL
53 -};
54 +} };
55
56 static ssize_t resume_reason_read(struct device *dev,
57 struct device_attribute *attr,
58 @@ -52,15 +70,18 @@ static ssize_t resume_reason_read(struct device *dev,
59 {
60 int bit = 0;
61 char *end = buf;
62 + int gta = !!machine_is_neo1973_gta02();
63
64 - for (bit = 0; resume_reasons[bit]; bit++) {
65 + for (bit = 0; resume_reasons[gta][bit]; bit++) {
66 if ((*gstatus4_mapped) & (1 << bit))
67 - end += sprintf(end, "* %s\n", resume_reasons[bit]);
68 + end += sprintf(end, "* %s\n", resume_reasons[gta][bit]);
69 else
70 - end += sprintf(end, " %s\n", resume_reasons[bit]);
71 + end += sprintf(end, " %s\n", resume_reasons[gta][bit]);
72
73 - if (bit == 9) /* PMU */
74 +#ifdef CONFIG_MACH_NEO1973_GTA02
75 + if ((gta) && (bit == 9)) /* PMU */
76 end += pcf50633_report_resumers(pcf50633_global, end);
77 +#endif
78 }
79
80 return end - buf;
81 @@ -83,21 +104,14 @@ static int __init neo1973_resume_reason_probe(struct platform_device *pdev)
82 {
83 dev_info(&pdev->dev, "starting\n");
84
85 - switch (machine_arch_type) {
86 -#ifdef CONFIG_MACH_NEO1973_GTA01
87 - case MACH_TYPE_NEO1973_GTA01:
88 + gstatus4_mapped = ioremap(0x560000BC /* GSTATUS4 */, 0x4);
89 + if (!gstatus4_mapped) {
90 + dev_err(&pdev->dev, "failed to ioremap() memory region\n");
91 return -EINVAL;
92 -#endif /* CONFIG_MACH_NEO1973_GTA01 */
93 - default:
94 - gstatus4_mapped = ioremap(0x560000BC, 0x4);
95 - if (!gstatus4_mapped) {
96 - dev_err(&pdev->dev, "failed to ioremap() memory region\n");
97 - return -EINVAL;
98 - }
99 - break;
100 }
101
102 - return sysfs_create_group(&pdev->dev.kobj, &neo1973_resume_reason_attr_group);
103 + return sysfs_create_group(&pdev->dev.kobj,
104 + &neo1973_resume_reason_attr_group);
105 }
106
107 static int neo1973_resume_reason_remove(struct platform_device *pdev)
108 @@ -131,4 +145,3 @@ module_exit(neo1973_resume_reason_exit);
109 MODULE_LICENSE("GPL");
110 MODULE_AUTHOR("Andy Green <andy@openmoko.com>");
111 MODULE_DESCRIPTION("Neo1973 resume_reason");
112 -#endif
113 --
114 1.5.6.3
115