diff options
author | Andy Green <andy@openmoko.com> | 2008-11-19 17:09:43 +0000 |
---|---|---|
committer | Andy Green <agreen@pads.home.warmcat.com> | 2008-11-19 17:09:43 +0000 |
commit | f2934eead77af67c0294989fbee252f3b41e3f82 (patch) | |
tree | c98e53aa57b331e9ed18dc0a75ab06bc6ba7b911 /arch/arm/plat-s3c24xx | |
parent | aa958cfab3d9994c2b34ad8de77c2f2f620d001a (diff) |
add-resume-reason-sysfs.patch
If you have U-Boot with uboot-add-find-wake-reason.patch, this
patch will get you a wake reason report from
cat /sys/devices/platform/neo1973-resume.0/resume_reason
it looks like this:
EINT00_ACCEL1
EINT01_GSM
EINT02_BLUETOOTH
EINT03_DEBUGBRD
EINT04_JACK
EINT05_WLAN
EINT06_AUXKEY
EINT07_HOLDKEY
EINT08_ACCEL2
* EINT09_PMU
adpins
adprem
usbins
usbrem
rtcalarm
second
onkeyr
onkeyf
exton1r
exton1f
exton2r
exton2f
exton3r
exton3f
* batfull
chghalt
thlimon
thlimoff
usblimon
usblimoff
adcrdy
onkey1s
lowsys
lowbat
hightmp
autopwrfail
dwn1pwrfail
dwn2pwrfail
ledpwrfail
ledovp
ldo1pwrfail
ldo2pwrfail
ldo3pwrfail
ldo4pwrfail
ldo5pwrfail
ldo6pwrfail
hcidopwrfail
hcidoovl
EINT10_NULL
EINT11_NULL
EINT12_GLAMO
EINT13_NULL
EINT14_NULL
EINT15_NULL
This shows a problem, false wake from suspend due to battery full
Signed-off-by: Andy Green <andy@openmoko.com>
Diffstat (limited to 'arch/arm/plat-s3c24xx')
-rw-r--r-- | arch/arm/plat-s3c24xx/Makefile | 4 | ||||
-rw-r--r-- | arch/arm/plat-s3c24xx/neo1973_pm_resume_reason.c | 134 |
2 files changed, 136 insertions, 2 deletions
diff --git a/arch/arm/plat-s3c24xx/Makefile b/arch/arm/plat-s3c24xx/Makefile index 40de6052b89..0a56561a975 100644 --- a/arch/arm/plat-s3c24xx/Makefile +++ b/arch/arm/plat-s3c24xx/Makefile @@ -48,5 +48,5 @@ obj-$(CONFIG_MACH_NEO1973) += neo1973_version.o \ neo1973_pm_gsm.o \ neo1973_pm_gps.o \ neo1973_pm_bt.o \ - neo1973_shadow.o - + neo1973_shadow.o \ + neo1973_pm_resume_reason.o diff --git a/arch/arm/plat-s3c24xx/neo1973_pm_resume_reason.c b/arch/arm/plat-s3c24xx/neo1973_pm_resume_reason.c new file mode 100644 index 00000000000..cca42dc7047 --- /dev/null +++ b/arch/arm/plat-s3c24xx/neo1973_pm_resume_reason.c @@ -0,0 +1,134 @@ +/* + * Resume reason sysfs for the FIC Neo1973 GSM Phone + * + * (C) 2008 by Openmoko Inc. + * Author: Andy Green <andy@openmoko.com> + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License resume_reason 2 as + * published by the Free Software Foundation + * + */ + +#include <linux/module.h> +#include <linux/init.h> +#include <linux/kernel.h> +#include <linux/platform_device.h> +#include <linux/io.h> + +#include <asm/hardware.h> +#include <asm/mach-types.h> + +#ifdef CONFIG_MACH_NEO1973_GTA02 +#include <asm/arch/gta02.h> +#include <linux/pcf50633.h> + + +static unsigned int *gstatus4_mapped; +static char *resume_reasons[] = { + "EINT00_ACCEL1", + "EINT01_GSM", + "EINT02_BLUETOOTH", + "EINT03_DEBUGBRD", + "EINT04_JACK", + "EINT05_WLAN", + "EINT06_AUXKEY", + "EINT07_HOLDKEY", + "EINT08_ACCEL2", + "EINT09_PMU", + "EINT10_NULL", + "EINT11_NULL", + "EINT12_GLAMO", + "EINT13_NULL", + "EINT14_NULL", + "EINT15_NULL", + NULL +}; + +static ssize_t resume_reason_read(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + int bit = 0; + char *end = buf; + + for (bit = 0; resume_reasons[bit]; bit++) { + if ((*gstatus4_mapped) & (1 << bit)) + end += sprintf(end, "* %s\n", resume_reasons[bit]); + else + end += sprintf(end, " %s\n", resume_reasons[bit]); + + if (bit == 9) /* PMU */ + end += pcf50633_report_resumers(pcf50633_global, end); + } + + return end - buf; +} + + +static DEVICE_ATTR(resume_reason, 0644, resume_reason_read, NULL); + +static struct attribute *neo1973_resume_reason_sysfs_entries[] = { + &dev_attr_resume_reason.attr, + NULL +}; + +static struct attribute_group neo1973_resume_reason_attr_group = { + .name = NULL, + .attrs = neo1973_resume_reason_sysfs_entries, +}; + +static int __init neo1973_resume_reason_probe(struct platform_device *pdev) +{ + dev_info(&pdev->dev, "starting\n"); + + switch (machine_arch_type) { +#ifdef CONFIG_MACH_NEO1973_GTA01 + case MACH_TYPE_NEO1973_GTA01: + return -EINVAL; +#endif /* CONFIG_MACH_NEO1973_GTA01 */ + default: + gstatus4_mapped = ioremap(0x560000BC, 0x4); + if (!gstatus4_mapped) { + dev_err(&pdev->dev, "failed to ioremap() memory region\n"); + return -EINVAL; + } + break; + } + + return sysfs_create_group(&pdev->dev.kobj, &neo1973_resume_reason_attr_group); +} + +static int neo1973_resume_reason_remove(struct platform_device *pdev) +{ + sysfs_remove_group(&pdev->dev.kobj, &neo1973_resume_reason_attr_group); + iounmap(gstatus4_mapped); + return 0; +} + +static struct platform_driver neo1973_resume_reason_driver = { + .probe = neo1973_resume_reason_probe, + .remove = neo1973_resume_reason_remove, + .driver = { + .name = "neo1973-resume", + }, +}; + +static int __devinit neo1973_resume_reason_init(void) +{ + return platform_driver_register(&neo1973_resume_reason_driver); +} + +static void neo1973_resume_reason_exit(void) +{ + platform_driver_unregister(&neo1973_resume_reason_driver); +} + +module_init(neo1973_resume_reason_init); +module_exit(neo1973_resume_reason_exit); + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Andy Green <andy@openmoko.com>"); +MODULE_DESCRIPTION("Neo1973 resume_reason"); +#endif |