Linux kernel & device driver programming

Cross-Referenced Linux and Device Driver Code

[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ]
Version: [ 2.6.11.8 ] [ 2.6.25 ] [ 2.6.25.8 ] [ 2.6.31.13 ] Architecture: [ i386 ]
  1 /* linux/arch/arm/mach-s3c2412/pm.c
  2  *
  3  * Copyright (c) 2006 Simtec Electronics
  4  *      Ben Dooks <ben@simtec.co.uk>
  5  *
  6  * http://armlinux.simtec.co.uk/.
  7  *
  8  * This program is free software; you can redistribute it and/or modify
  9  * it under the terms of the GNU General Public License version 2 as
 10  * published by the Free Software Foundation.
 11 */
 12 
 13 #include <linux/kernel.h>
 14 #include <linux/types.h>
 15 #include <linux/interrupt.h>
 16 #include <linux/list.h>
 17 #include <linux/timer.h>
 18 #include <linux/init.h>
 19 #include <linux/sysdev.h>
 20 #include <linux/platform_device.h>
 21 
 22 #include <asm/hardware.h>
 23 #include <asm/io.h>
 24 #include <asm/irq.h>
 25 
 26 #include <asm/arch/regs-power.h>
 27 #include <asm/arch/regs-gpioj.h>
 28 #include <asm/arch/regs-gpio.h>
 29 #include <asm/arch/regs-dsc.h>
 30 
 31 #include <asm/plat-s3c24xx/cpu.h>
 32 #include <asm/plat-s3c24xx/pm.h>
 33 
 34 #include <asm/plat-s3c24xx/s3c2412.h>
 35 
 36 extern void s3c2412_sleep_enter(void);
 37 
 38 static void s3c2412_cpu_suspend(void)
 39 {
 40         unsigned long tmp;
 41 
 42         /* set our standby method to sleep */
 43 
 44         tmp = __raw_readl(S3C2412_PWRCFG);
 45         tmp |= S3C2412_PWRCFG_STANDBYWFI_SLEEP;
 46         __raw_writel(tmp, S3C2412_PWRCFG);
 47 
 48         s3c2412_sleep_enter();
 49 }
 50 
 51 static void s3c2412_pm_prepare(void)
 52 {
 53 }
 54 
 55 static int s3c2412_pm_add(struct sys_device *sysdev)
 56 {
 57         pm_cpu_prep = s3c2412_pm_prepare;
 58         pm_cpu_sleep = s3c2412_cpu_suspend;
 59 
 60         return 0;
 61 }
 62 
 63 static struct sleep_save s3c2412_sleep[] = {
 64         SAVE_ITEM(S3C2412_DSC0),
 65         SAVE_ITEM(S3C2412_DSC1),
 66         SAVE_ITEM(S3C2413_GPJDAT),
 67         SAVE_ITEM(S3C2413_GPJCON),
 68         SAVE_ITEM(S3C2413_GPJUP),
 69 
 70         /* save the PWRCFG to get back to original sleep method */
 71 
 72         SAVE_ITEM(S3C2412_PWRCFG),
 73 
 74         /* save the sleep configuration anyway, just in case these
 75          * get damaged during wakeup */
 76 
 77         SAVE_ITEM(S3C2412_GPBSLPCON),
 78         SAVE_ITEM(S3C2412_GPCSLPCON),
 79         SAVE_ITEM(S3C2412_GPDSLPCON),
 80         SAVE_ITEM(S3C2412_GPFSLPCON),
 81         SAVE_ITEM(S3C2412_GPGSLPCON),
 82         SAVE_ITEM(S3C2412_GPHSLPCON),
 83         SAVE_ITEM(S3C2413_GPJSLPCON),
 84 };
 85 
 86 static int s3c2412_pm_suspend(struct sys_device *dev, pm_message_t state)
 87 {
 88         s3c2410_pm_do_save(s3c2412_sleep, ARRAY_SIZE(s3c2412_sleep));
 89         return 0;
 90 }
 91 
 92 static int s3c2412_pm_resume(struct sys_device *dev)
 93 {
 94         unsigned long tmp;
 95 
 96         tmp = __raw_readl(S3C2412_PWRCFG);
 97         tmp &= ~S3C2412_PWRCFG_STANDBYWFI_MASK;
 98         tmp |=  S3C2412_PWRCFG_STANDBYWFI_IDLE;
 99         __raw_writel(tmp, S3C2412_PWRCFG);
100 
101         s3c2410_pm_do_restore(s3c2412_sleep, ARRAY_SIZE(s3c2412_sleep));
102         return 0;
103 }
104 
105 static struct sysdev_driver s3c2412_pm_driver = {
106         .add            = s3c2412_pm_add,
107         .suspend        = s3c2412_pm_suspend,
108         .resume         = s3c2412_pm_resume,
109 };
110 
111 static __init int s3c2412_pm_init(void)
112 {
113         return sysdev_driver_register(&s3c2412_sysclass, &s3c2412_pm_driver);
114 }
115 
116 arch_initcall(s3c2412_pm_init);
117 
  This page was automatically generated by the LXR engine.