aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-s3c24xx
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2011-04-22 16:03:21 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2011-04-24 13:16:10 -0400
commitbb072c3cf21d1c9a5a2eeb5a00679ee7bf39675b (patch)
tree8b9b425422e11c5cb5012adf68e9e2a3e957358f /arch/arm/plat-s3c24xx
parent2eaa03b5bebd1e80014f780d7bf27c3e66daefd6 (diff)
ARM / Samsung: Use struct syscore_ops for "core" power management
Replace sysdev classes and struct sys_device objects used for "core" power management by Samsung platforms with struct syscore_ops objects that are simpler. This generally reduces the code size and the kernel memory footprint. It also is necessary for removing sysdevs entirely from the kernel in the future. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Diffstat (limited to 'arch/arm/plat-s3c24xx')
-rw-r--r--arch/arm/plat-s3c24xx/dma.c68
-rw-r--r--arch/arm/plat-s3c24xx/irq-pm.c7
2 files changed, 28 insertions, 47 deletions
diff --git a/arch/arm/plat-s3c24xx/dma.c b/arch/arm/plat-s3c24xx/dma.c
index 27ea852e3370..c10d10c56e2e 100644
--- a/arch/arm/plat-s3c24xx/dma.c
+++ b/arch/arm/plat-s3c24xx/dma.c
@@ -22,7 +22,7 @@
22#include <linux/sched.h> 22#include <linux/sched.h>
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/sysdev.h> 25#include <linux/syscore_ops.h>
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/errno.h> 27#include <linux/errno.h>
28#include <linux/io.h> 28#include <linux/io.h>
@@ -1195,19 +1195,12 @@ int s3c2410_dma_getposition(unsigned int channel, dma_addr_t *src, dma_addr_t *d
1195 1195
1196EXPORT_SYMBOL(s3c2410_dma_getposition); 1196EXPORT_SYMBOL(s3c2410_dma_getposition);
1197 1197
1198static inline struct s3c2410_dma_chan *to_dma_chan(struct sys_device *dev) 1198/* system core operations */
1199{
1200 return container_of(dev, struct s3c2410_dma_chan, dev);
1201}
1202
1203/* system device class */
1204 1199
1205#ifdef CONFIG_PM 1200#ifdef CONFIG_PM
1206 1201
1207static int s3c2410_dma_suspend(struct sys_device *dev, pm_message_t state) 1202static void s3c2410_dma_suspend_chan(s3c2410_dma_chan *cp)
1208{ 1203{
1209 struct s3c2410_dma_chan *cp = to_dma_chan(dev);
1210
1211 printk(KERN_DEBUG "suspending dma channel %d\n", cp->number); 1204 printk(KERN_DEBUG "suspending dma channel %d\n", cp->number);
1212 1205
1213 if (dma_rdreg(cp, S3C2410_DMA_DMASKTRIG) & S3C2410_DMASKTRIG_ON) { 1206 if (dma_rdreg(cp, S3C2410_DMA_DMASKTRIG) & S3C2410_DMASKTRIG_ON) {
@@ -1222,13 +1215,21 @@ static int s3c2410_dma_suspend(struct sys_device *dev, pm_message_t state)
1222 1215
1223 s3c2410_dma_dostop(cp); 1216 s3c2410_dma_dostop(cp);
1224 } 1217 }
1218}
1219
1220static int s3c2410_dma_suspend(void)
1221{
1222 struct s3c2410_dma_chan *cp = s3c2410_chans;
1223 int channel;
1224
1225 for (channel = 0; channel < dma_channels; cp++, channel++)
1226 s3c2410_dma_suspend_chan(cp);
1225 1227
1226 return 0; 1228 return 0;
1227} 1229}
1228 1230
1229static int s3c2410_dma_resume(struct sys_device *dev) 1231static void s3c2410_dma_resume_chan(struct s3c2410_dma_chan *cp)
1230{ 1232{
1231 struct s3c2410_dma_chan *cp = to_dma_chan(dev);
1232 unsigned int no = cp->number | DMACH_LOW_LEVEL; 1233 unsigned int no = cp->number | DMACH_LOW_LEVEL;
1233 1234
1234 /* restore channel's hardware configuration */ 1235 /* restore channel's hardware configuration */
@@ -1249,13 +1250,21 @@ static int s3c2410_dma_resume(struct sys_device *dev)
1249 return 0; 1250 return 0;
1250} 1251}
1251 1252
1253static void s3c2410_dma_resume(void)
1254{
1255 struct s3c2410_dma_chan *cp = s3c2410_chans + dma_channels - 1;
1256 int channel;
1257
1258 for (channel = dma_channels - 1; channel >= 0; cp++, channel--)
1259 s3c2410_dma_resume_chan(cp);
1260}
1261
1252#else 1262#else
1253#define s3c2410_dma_suspend NULL 1263#define s3c2410_dma_suspend NULL
1254#define s3c2410_dma_resume NULL 1264#define s3c2410_dma_resume NULL
1255#endif /* CONFIG_PM */ 1265#endif /* CONFIG_PM */
1256 1266
1257struct sysdev_class dma_sysclass = { 1267struct syscore_ops dma_syscore_ops = {
1258 .name = "s3c24xx-dma",
1259 .suspend = s3c2410_dma_suspend, 1268 .suspend = s3c2410_dma_suspend,
1260 .resume = s3c2410_dma_resume, 1269 .resume = s3c2410_dma_resume,
1261}; 1270};
@@ -1269,39 +1278,14 @@ static void s3c2410_dma_cache_ctor(void *p)
1269 1278
1270/* initialisation code */ 1279/* initialisation code */
1271 1280
1272static int __init s3c24xx_dma_sysclass_init(void) 1281static int __init s3c24xx_dma_syscore_init(void)
1273{ 1282{
1274 int ret = sysdev_class_register(&dma_sysclass); 1283 register_syscore_ops(&dma_syscore_ops);
1275
1276 if (ret != 0)
1277 printk(KERN_ERR "dma sysclass registration failed\n");
1278
1279 return ret;
1280}
1281
1282core_initcall(s3c24xx_dma_sysclass_init);
1283
1284static int __init s3c24xx_dma_sysdev_register(void)
1285{
1286 struct s3c2410_dma_chan *cp = s3c2410_chans;
1287 int channel, ret;
1288
1289 for (channel = 0; channel < dma_channels; cp++, channel++) {
1290 cp->dev.cls = &dma_sysclass;
1291 cp->dev.id = channel;
1292 ret = sysdev_register(&cp->dev);
1293
1294 if (ret) {
1295 printk(KERN_ERR "error registering dev for dma %d\n",
1296 channel);
1297 return ret;
1298 }
1299 }
1300 1284
1301 return 0; 1285 return 0;
1302} 1286}
1303 1287
1304late_initcall(s3c24xx_dma_sysdev_register); 1288late_initcall(s3c24xx_dma_syscore_init);
1305 1289
1306int __init s3c24xx_dma_init(unsigned int channels, unsigned int irq, 1290int __init s3c24xx_dma_init(unsigned int channels, unsigned int irq,
1307 unsigned int stride) 1291 unsigned int stride)
diff --git a/arch/arm/plat-s3c24xx/irq-pm.c b/arch/arm/plat-s3c24xx/irq-pm.c
index c3624d898630..0efb2e2848c8 100644
--- a/arch/arm/plat-s3c24xx/irq-pm.c
+++ b/arch/arm/plat-s3c24xx/irq-pm.c
@@ -14,7 +14,6 @@
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/sysdev.h>
18#include <linux/irq.h> 17#include <linux/irq.h>
19 18
20#include <plat/cpu.h> 19#include <plat/cpu.h>
@@ -65,7 +64,7 @@ static unsigned long save_extint[3];
65static unsigned long save_eintflt[4]; 64static unsigned long save_eintflt[4];
66static unsigned long save_eintmask; 65static unsigned long save_eintmask;
67 66
68int s3c24xx_irq_suspend(struct sys_device *dev, pm_message_t state) 67int s3c24xx_irq_suspend(void)
69{ 68{
70 unsigned int i; 69 unsigned int i;
71 70
@@ -81,7 +80,7 @@ int s3c24xx_irq_suspend(struct sys_device *dev, pm_message_t state)
81 return 0; 80 return 0;
82} 81}
83 82
84int s3c24xx_irq_resume(struct sys_device *dev) 83void s3c24xx_irq_resume(void)
85{ 84{
86 unsigned int i; 85 unsigned int i;
87 86
@@ -93,6 +92,4 @@ int s3c24xx_irq_resume(struct sys_device *dev)
93 92
94 s3c_pm_do_restore(irq_save, ARRAY_SIZE(irq_save)); 93 s3c_pm_do_restore(irq_save, ARRAY_SIZE(irq_save));
95 __raw_writel(save_eintmask, S3C24XX_EINTMASK); 94 __raw_writel(save_eintmask, S3C24XX_EINTMASK);
96
97 return 0;
98} 95}