Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 1 | /* linux/include/asm-arm/plat-s3c24xx/pm.h |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | * |
| 3 | * Copyright (c) 2004 Simtec Electronics |
Ben Dooks | 6419711 | 2008-12-12 00:24:06 +0000 | [diff] [blame^] | 4 | * http://armlinux.simtec.co.uk/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | * Written by Ben Dooks, <ben@simtec.co.uk> |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License version 2 as |
| 9 | * published by the Free Software Foundation. |
| 10 | */ |
| 11 | |
| 12 | /* s3c2410_pm_init |
| 13 | * |
| 14 | * called from board at initialisation time to setup the power |
| 15 | * management |
| 16 | */ |
| 17 | |
| 18 | #ifdef CONFIG_PM |
| 19 | |
| 20 | extern __init int s3c2410_pm_init(void); |
| 21 | |
| 22 | #else |
| 23 | |
| 24 | static inline int s3c2410_pm_init(void) |
| 25 | { |
| 26 | return 0; |
| 27 | } |
| 28 | #endif |
| 29 | |
| 30 | /* configuration for the IRQ mask over sleep */ |
| 31 | extern unsigned long s3c_irqwake_intmask; |
| 32 | extern unsigned long s3c_irqwake_eintmask; |
| 33 | |
| 34 | /* IRQ masks for IRQs allowed to go to sleep (see irq.c) */ |
| 35 | extern unsigned long s3c_irqwake_intallow; |
| 36 | extern unsigned long s3c_irqwake_eintallow; |
| 37 | |
Ben Dooks | 0033a2f | 2006-09-19 09:51:32 +0100 | [diff] [blame] | 38 | /* per-cpu sleep functions */ |
| 39 | |
| 40 | extern void (*pm_cpu_prep)(void); |
| 41 | extern void (*pm_cpu_sleep)(void); |
| 42 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | /* Flags for PM Control */ |
| 44 | |
| 45 | extern unsigned long s3c_pm_flags; |
| 46 | |
| 47 | /* from sleep.S */ |
| 48 | |
Ben Dooks | 58095d7 | 2006-09-16 00:04:23 +0100 | [diff] [blame] | 49 | extern int s3c2410_cpu_save(unsigned long *saveblk); |
| 50 | extern void s3c2410_cpu_suspend(void); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | extern void s3c2410_cpu_resume(void); |
| 52 | |
Ben Dooks | 6419711 | 2008-12-12 00:24:06 +0000 | [diff] [blame^] | 53 | extern unsigned long s3c_sleep_save_phys; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | |
| 55 | /* sleep save info */ |
| 56 | |
Ben Dooks | 6419711 | 2008-12-12 00:24:06 +0000 | [diff] [blame^] | 57 | /** |
| 58 | * struct sleep_save - save information for shared peripherals. |
| 59 | * @reg: Pointer to the register to save. |
| 60 | * @val: Holder for the value saved from reg. |
| 61 | * |
| 62 | * This describes a list of registers which is used by the pm core and |
| 63 | * other subsystem to save and restore register values over suspend. |
| 64 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | struct sleep_save { |
| 66 | void __iomem *reg; |
| 67 | unsigned long val; |
| 68 | }; |
| 69 | |
| 70 | #define SAVE_ITEM(x) \ |
| 71 | { .reg = (x) } |
| 72 | |
Ben Dooks | 6419711 | 2008-12-12 00:24:06 +0000 | [diff] [blame^] | 73 | /* helper functions to save/restore lists of registers. */ |
| 74 | |
| 75 | extern void s3c_pm_do_save(struct sleep_save *ptr, int count); |
| 76 | extern void s3c_pm_do_restore(struct sleep_save *ptr, int count); |
| 77 | extern void s3c_pm_do_restore_core(struct sleep_save *ptr, int count); |
Ben Dooks | 1e582fc | 2006-09-16 00:01:39 +0100 | [diff] [blame] | 78 | |
| 79 | #ifdef CONFIG_PM |
| 80 | extern int s3c24xx_irq_suspend(struct sys_device *dev, pm_message_t state); |
| 81 | extern int s3c24xx_irq_resume(struct sys_device *dev); |
| 82 | #else |
| 83 | #define s3c24xx_irq_suspend NULL |
| 84 | #define s3c24xx_irq_resume NULL |
| 85 | #endif |
Ben Dooks | 6419711 | 2008-12-12 00:24:06 +0000 | [diff] [blame^] | 86 | |
| 87 | /* PM debug functions */ |
| 88 | |
| 89 | #ifdef CONFIG_S3C2410_PM_DEBUG |
| 90 | /** |
| 91 | * s3c_pm_dbg() - low level debug function for use in suspend/resume. |
| 92 | * @msg: The message to print. |
| 93 | * |
| 94 | * This function is used mainly to debug the resume process before the system |
| 95 | * can rely on printk/console output. It uses the low-level debugging output |
| 96 | * routine printascii() to do its work. |
| 97 | */ |
| 98 | extern void s3c_pm_dbg(const char *msg, ...); |
| 99 | |
| 100 | #define S3C_PMDBG(fmt...) s3c_pm_dbg(fmt) |
| 101 | #else |
| 102 | #define S3C_PMDBG(fmt...) printk(KERN_DEBUG fmt) |
| 103 | #endif |