[adm5120] add USB drivers for the NFS-101U/WU profiles
[openwrt.git] / target / linux / s3c24xx / patches-2.6.24 / 1142-s3c24xx-pwm-platform-driver.patch.patch
1 From 966a29020932751ba6a1a137b0e1e25ac0708be7 Mon Sep 17 00:00:00 2001
2 From: matt_hsu <matt_hsu@openmoko.org>
3 Date: Thu, 8 May 2008 10:23:07 +0100
4 Subject: [PATCH] s3c24xx-pwm-platform-driver.patch
5
6 This patch is to register pwm as platform driver to keep the PWM-related
7 config when system is in suspend/resume. This could fix the following
8 issue after resume:
9
10 - HDQ read timeout
11 - LEDs blinked abnormally(if LEDs is driven by PWM)
12
13 Signed-off-by: Matt Hsu <matt_hsu@openmoko.org>
14 ---
15 arch/arm/mach-s3c2410/pwm.c | 63 ++++++++++++++++++++++++++++++++++++
16 arch/arm/mach-s3c2440/mach-gta02.c | 6 +++
17 2 files changed, 69 insertions(+), 0 deletions(-)
18
19 diff --git a/arch/arm/mach-s3c2410/pwm.c b/arch/arm/mach-s3c2410/pwm.c
20 index 23738c1..86a4faa 100644
21 --- a/arch/arm/mach-s3c2410/pwm.c
22 +++ b/arch/arm/mach-s3c2410/pwm.c
23 @@ -20,10 +20,17 @@
24 #include <linux/kernel.h>
25 #include <linux/init.h>
26 #include <linux/clk.h>
27 +#include <linux/device.h>
28 #include <asm/hardware.h>
29 #include <asm/plat-s3c/regs-timer.h>
30 #include <asm/arch/pwm.h>
31
32 +#ifdef CONFIG_PM
33 + static unsigned long standby_reg_tcon;
34 + static unsigned long standby_reg_tcfg0;
35 + static unsigned long standby_reg_tcfg1;
36 +#endif
37 +
38 int s3c2410_pwm_disable(struct s3c2410_pwm *pwm)
39 {
40 unsigned long tcon;
41 @@ -212,3 +219,59 @@ int s3c2410_pwm_dumpregs(void)
42 return 0;
43 }
44 EXPORT_SYMBOL_GPL(s3c2410_pwm_dumpregs);
45 +
46 +static int __init s3c24xx_pwm_probe(struct platform_device *pdev)
47 +{
48 + dev_info(&pdev->dev, "s3c24xx_pwm is registered \n");
49 +
50 + return 0;
51 +}
52 +
53 +#ifdef CONFIG_PM
54 +static int s3c24xx_pwm_suspend(struct platform_device *pdev, pm_message_t state)
55 +{
56 + /* PWM config should be kept in suspending */
57 + standby_reg_tcon = __raw_readl(S3C2410_TCON);
58 + standby_reg_tcfg0 = __raw_readl(S3C2410_TCFG0);
59 + standby_reg_tcfg1 = __raw_readl(S3C2410_TCFG1);
60 +
61 + return 0;
62 +}
63 +
64 +static int s3c24xx_pwm_resume(struct platform_device *pdev)
65 +{
66 + __raw_writel(standby_reg_tcon, S3C2410_TCON);
67 + __raw_writel(standby_reg_tcfg0, S3C2410_TCFG0);
68 + __raw_writel(standby_reg_tcfg1, S3C2410_TCFG1);
69 +
70 + return 0;
71 +}
72 +#else
73 +#define sc32440_pwm_suspend NULL
74 +#define sc32440_pwm_resume NULL
75 +#endif
76 +
77 +static struct platform_driver s3c24xx_pwm_driver = {
78 + .driver = {
79 + .name = "s3c24xx_pwm",
80 + .owner = THIS_MODULE,
81 + },
82 + .probe = s3c24xx_pwm_probe,
83 + .suspend = s3c24xx_pwm_suspend,
84 + .resume = s3c24xx_pwm_resume,
85 +};
86 +
87 +static int __init s3c24xx_pwm_init(void)
88 +{
89 + return platform_driver_register(&s3c24xx_pwm_driver);
90 +}
91 +
92 +static void __exit s3c24xx_pwm_exit(void)
93 +{
94 +}
95 +
96 +MODULE_AUTHOR("Javi Roman <javiroman@kernel-labs.org>");
97 +MODULE_LICENSE("GPL");
98 +
99 +module_init(s3c24xx_pwm_init);
100 +module_exit(s3c24xx_pwm_exit);
101 diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c
102 index 27babc9..1954121 100644
103 --- a/arch/arm/mach-s3c2440/mach-gta02.c
104 +++ b/arch/arm/mach-s3c2440/mach-gta02.c
105 @@ -719,6 +719,11 @@ static struct platform_device gta02_sdio_dev = {
106 .num_resources = ARRAY_SIZE(gta02_sdio_resources),
107 };
108
109 +struct platform_device s3c24xx_pwm_device = {
110 + .name = "s3c24xx_pwm",
111 + .num_resources = 0,
112 +};
113 +
114 static struct platform_device *gta02_devices[] __initdata = {
115 &s3c_device_usb,
116 &s3c_device_wdt,
117 @@ -731,6 +736,7 @@ static struct platform_device *gta02_devices[] __initdata = {
118 &gta02_nor_flash,
119 &sc32440_fiq_device,
120 &gta02_version_device,
121 + &s3c24xx_pwm_device,
122 };
123
124 static struct s3c2410_nand_set gta02_nand_sets[] = {
125 --
126 1.5.6.5
127
This page took 0.051244 seconds and 5 git commands to generate.