diff options
author | lars <lars@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2009-09-21 18:29:46 +0000 |
---|---|---|
committer | lars <lars@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2009-09-21 18:29:46 +0000 |
commit | e2813918b96b7e6d5f5a37811e507246e604747f (patch) | |
tree | c656b15f93b7b083730061833ec95619662ce47a /target/linux/s3c24xx/files-2.6.31/drivers/misc | |
parent | dac1d868d3131c0a9b579ccc07833faa208d2d08 (diff) |
[s3c24xx] Add 2.6.31 patches
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@17665 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/s3c24xx/files-2.6.31/drivers/misc')
-rw-r--r-- | target/linux/s3c24xx/files-2.6.31/drivers/misc/gta02_pm_host.c | 97 | ||||
-rw-r--r-- | target/linux/s3c24xx/files-2.6.31/drivers/misc/gta02_pm_resume_reason.c | 118 |
2 files changed, 215 insertions, 0 deletions
diff --git a/target/linux/s3c24xx/files-2.6.31/drivers/misc/gta02_pm_host.c b/target/linux/s3c24xx/files-2.6.31/drivers/misc/gta02_pm_host.c new file mode 100644 index 0000000000..ad7cfd8826 --- /dev/null +++ b/target/linux/s3c24xx/files-2.6.31/drivers/misc/gta02_pm_host.c @@ -0,0 +1,97 @@ +/* + * Bluetooth PM code for the FIC gta02 GSM Phone + * + * (C) 2007 by Openmoko Inc. + * Author: Harald Welte <laforge@openmoko.org> + * 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 version 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 <mach/hardware.h> +#include <asm/mach-types.h> + +#include <mach/gta02.h> +#include <linux/mfd/pcf50633/gpio.h> + +static ssize_t pm_host_read(struct device *dev, struct device_attribute *attr, + char *buf) +{ + return sprintf(buf, "%d\n", + pcf50633_gpio_get(gta02_pcf, PCF50633_GPO) + == PCF50633_GPOCFG_GPOSEL_1); +} + +static ssize_t pm_host_write(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long on = simple_strtoul(buf, NULL, 10); + u8 val; + + if (on) + val = PCF50633_GPOCFG_GPOSEL_1; + else + val = PCF50633_GPOCFG_GPOSEL_0; + + + pcf50633_gpio_set(gta02_pcf, PCF50633_GPO, val); + + return count; +} + +static DEVICE_ATTR(hostmode, 0644, pm_host_read, pm_host_write); + +static struct attribute *gta02_pm_host_sysfs_entries[] = { + &dev_attr_hostmode.attr, + NULL +}; + +static struct attribute_group gta02_pm_host_attr_group = { + .name = NULL, + .attrs = gta02_pm_host_sysfs_entries, +}; + +static int __init gta02_pm_host_probe(struct platform_device *pdev) +{ + dev_info(&pdev->dev, "starting\n"); + return sysfs_create_group(&pdev->dev.kobj, >a02_pm_host_attr_group); +} + +static int gta02_pm_host_remove(struct platform_device *pdev) +{ + sysfs_remove_group(&pdev->dev.kobj, >a02_pm_host_attr_group); + return 0; +} + +static struct platform_driver gta02_pm_host_driver = { + .probe = gta02_pm_host_probe, + .remove = gta02_pm_host_remove, + .driver = { + .name = "gta02-pm-host", + }, +}; + +static int __devinit gta02_pm_host_init(void) +{ + return platform_driver_register(>a02_pm_host_driver); +} + +static void gta02_pm_host_exit(void) +{ + platform_driver_unregister(>a02_pm_host_driver); +} + +module_init(gta02_pm_host_init); +module_exit(gta02_pm_host_exit); + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Andy Green <andy@openmoko.com>"); +MODULE_DESCRIPTION("Openmoko Freerunner USB Host Power Management"); diff --git a/target/linux/s3c24xx/files-2.6.31/drivers/misc/gta02_pm_resume_reason.c b/target/linux/s3c24xx/files-2.6.31/drivers/misc/gta02_pm_resume_reason.c new file mode 100644 index 0000000000..3820d7c66d --- /dev/null +++ b/target/linux/s3c24xx/files-2.6.31/drivers/misc/gta02_pm_resume_reason.c @@ -0,0 +1,118 @@ +/* + * Resume reason sysfs for the Openmoko Freerunner 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 <mach/regs-gpio.h> + +static unsigned int *gstatus4_mapped; +static char *resume_reasons[17] = { + "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]); + + } + + return end - buf; +} + + +static DEVICE_ATTR(resume_reason, 0644, resume_reason_read, NULL); + +static struct attribute *gta02_resume_reason_sysfs_entries[] = { + &dev_attr_resume_reason.attr, + NULL +}; + +static struct attribute_group gta02_resume_reason_attr_group = { + .name = NULL, + .attrs = gta02_resume_reason_sysfs_entries, +}; + +static int __init gta02_resume_reason_probe(struct platform_device *pdev) +{ + dev_info(&pdev->dev, "starting\n"); + + gstatus4_mapped = ioremap(S3C24XX_GSTATUS4, 0x4); + if (!gstatus4_mapped) { + dev_err(&pdev->dev, "failed to ioremap() memory region\n"); + return -EINVAL; + } + + return sysfs_create_group(&pdev->dev.kobj, + >a02_resume_reason_attr_group); +} + +static int gta02_resume_reason_remove(struct platform_device *pdev) +{ + sysfs_remove_group(&pdev->dev.kobj, >a02_resume_reason_attr_group); + iounmap(gstatus4_mapped); + return 0; +} + +static struct platform_driver gta02_resume_reason_driver = { + .probe = gta02_resume_reason_probe, + .remove = gta02_resume_reason_remove, + .driver = { + .name = "gta02-resume-reason", + }, +}; + +static int __devinit gta02_resume_reason_init(void) +{ + return platform_driver_register(>a02_resume_reason_driver); +} + +static void gta02_resume_reason_exit(void) +{ + platform_driver_unregister(>a02_resume_reason_driver); +} + +module_init(gta02_resume_reason_init); +module_exit(gta02_resume_reason_exit); + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Andy Green <andy@openmoko.com>"); +MODULE_DESCRIPTION("GTA02 resume_reason"); |