mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-24 20:53:07 +02:00
a95f9f92e2
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@13619 3c298f89-4303-0410-b956-a3cf2f4a3e73
128 lines
3.4 KiB
Diff
Executable File
128 lines
3.4 KiB
Diff
Executable File
From 6563c08a68d30e3b53b6a3a2b1916b129f4afc68 Mon Sep 17 00:00:00 2001
|
|
From: matt_hsu <matt_hsu@openmoko.org>
|
|
Date: Fri, 25 Jul 2008 23:06:08 +0100
|
|
Subject: [PATCH] s3c24xx-pwm-platform-driver.patch
|
|
|
|
This patch is to register pwm as platform driver to keep the PWM-related
|
|
config when system is in suspend/resume. This could fix the following
|
|
issue after resume:
|
|
|
|
- HDQ read timeout
|
|
- LEDs blinked abnormally(if LEDs is driven by PWM)
|
|
|
|
Signed-off-by: Matt Hsu <matt_hsu@openmoko.org>
|
|
---
|
|
arch/arm/mach-s3c2410/pwm.c | 63 ++++++++++++++++++++++++++++++++++++
|
|
arch/arm/mach-s3c2440/mach-gta02.c | 6 +++
|
|
2 files changed, 69 insertions(+), 0 deletions(-)
|
|
|
|
diff --git a/arch/arm/mach-s3c2410/pwm.c b/arch/arm/mach-s3c2410/pwm.c
|
|
index 23738c1..86a4faa 100644
|
|
--- a/arch/arm/mach-s3c2410/pwm.c
|
|
+++ b/arch/arm/mach-s3c2410/pwm.c
|
|
@@ -20,10 +20,17 @@
|
|
#include <linux/kernel.h>
|
|
#include <linux/init.h>
|
|
#include <linux/clk.h>
|
|
+#include <linux/device.h>
|
|
#include <asm/hardware.h>
|
|
#include <asm/plat-s3c/regs-timer.h>
|
|
#include <asm/arch/pwm.h>
|
|
|
|
+#ifdef CONFIG_PM
|
|
+ static unsigned long standby_reg_tcon;
|
|
+ static unsigned long standby_reg_tcfg0;
|
|
+ static unsigned long standby_reg_tcfg1;
|
|
+#endif
|
|
+
|
|
int s3c2410_pwm_disable(struct s3c2410_pwm *pwm)
|
|
{
|
|
unsigned long tcon;
|
|
@@ -212,3 +219,59 @@ int s3c2410_pwm_dumpregs(void)
|
|
return 0;
|
|
}
|
|
EXPORT_SYMBOL_GPL(s3c2410_pwm_dumpregs);
|
|
+
|
|
+static int __init s3c24xx_pwm_probe(struct platform_device *pdev)
|
|
+{
|
|
+ dev_info(&pdev->dev, "s3c24xx_pwm is registered \n");
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+#ifdef CONFIG_PM
|
|
+static int s3c24xx_pwm_suspend(struct platform_device *pdev, pm_message_t state)
|
|
+{
|
|
+ /* PWM config should be kept in suspending */
|
|
+ standby_reg_tcon = __raw_readl(S3C2410_TCON);
|
|
+ standby_reg_tcfg0 = __raw_readl(S3C2410_TCFG0);
|
|
+ standby_reg_tcfg1 = __raw_readl(S3C2410_TCFG1);
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+static int s3c24xx_pwm_resume(struct platform_device *pdev)
|
|
+{
|
|
+ __raw_writel(standby_reg_tcon, S3C2410_TCON);
|
|
+ __raw_writel(standby_reg_tcfg0, S3C2410_TCFG0);
|
|
+ __raw_writel(standby_reg_tcfg1, S3C2410_TCFG1);
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+#else
|
|
+#define sc32440_pwm_suspend NULL
|
|
+#define sc32440_pwm_resume NULL
|
|
+#endif
|
|
+
|
|
+static struct platform_driver s3c24xx_pwm_driver = {
|
|
+ .driver = {
|
|
+ .name = "s3c24xx_pwm",
|
|
+ .owner = THIS_MODULE,
|
|
+ },
|
|
+ .probe = s3c24xx_pwm_probe,
|
|
+ .suspend = s3c24xx_pwm_suspend,
|
|
+ .resume = s3c24xx_pwm_resume,
|
|
+};
|
|
+
|
|
+static int __init s3c24xx_pwm_init(void)
|
|
+{
|
|
+ return platform_driver_register(&s3c24xx_pwm_driver);
|
|
+}
|
|
+
|
|
+static void __exit s3c24xx_pwm_exit(void)
|
|
+{
|
|
+}
|
|
+
|
|
+MODULE_AUTHOR("Javi Roman <javiroman@kernel-labs.org>");
|
|
+MODULE_LICENSE("GPL");
|
|
+
|
|
+module_init(s3c24xx_pwm_init);
|
|
+module_exit(s3c24xx_pwm_exit);
|
|
diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c
|
|
index 27babc9..1954121 100644
|
|
--- a/arch/arm/mach-s3c2440/mach-gta02.c
|
|
+++ b/arch/arm/mach-s3c2440/mach-gta02.c
|
|
@@ -719,6 +719,11 @@ static struct platform_device gta02_sdio_dev = {
|
|
.num_resources = ARRAY_SIZE(gta02_sdio_resources),
|
|
};
|
|
|
|
+struct platform_device s3c24xx_pwm_device = {
|
|
+ .name = "s3c24xx_pwm",
|
|
+ .num_resources = 0,
|
|
+};
|
|
+
|
|
static struct platform_device *gta02_devices[] __initdata = {
|
|
&s3c_device_usb,
|
|
&s3c_device_wdt,
|
|
@@ -731,6 +736,7 @@ static struct platform_device *gta02_devices[] __initdata = {
|
|
>a02_nor_flash,
|
|
&sc32440_fiq_device,
|
|
>a02_version_device,
|
|
+ &s3c24xx_pwm_device,
|
|
};
|
|
|
|
static struct s3c2410_nand_set gta02_nand_sets[] = {
|
|
--
|
|
1.5.6.3
|
|
|