| 1 | /* arch/arm/plat-samsung/include/plat/pm.h |
| 2 | * |
| 3 | * Copyright (c) 2004 Simtec Electronics |
| 4 | * http://armlinux.simtec.co.uk/ |
| 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 | /* s3c_pm_init |
| 13 | * |
| 14 | * called from board at initialisation time to setup the power |
| 15 | * management |
| 16 | */ |
| 17 | |
| 18 | #include <plat/pm-common.h> |
| 19 | |
| 20 | struct device; |
| 21 | |
| 22 | #ifdef CONFIG_SAMSUNG_PM |
| 23 | |
| 24 | extern __init int s3c_pm_init(void); |
| 25 | extern __init int s3c64xx_pm_init(void); |
| 26 | |
| 27 | #else |
| 28 | |
| 29 | static inline int s3c_pm_init(void) |
| 30 | { |
| 31 | return 0; |
| 32 | } |
| 33 | |
| 34 | static inline int s3c64xx_pm_init(void) |
| 35 | { |
| 36 | return 0; |
| 37 | } |
| 38 | #endif |
| 39 | |
| 40 | /* configuration for the IRQ mask over sleep */ |
| 41 | extern unsigned long s3c_irqwake_intmask; |
| 42 | extern unsigned long s3c_irqwake_eintmask; |
| 43 | |
| 44 | /* per-cpu sleep functions */ |
| 45 | |
| 46 | extern void (*pm_cpu_prep)(void); |
| 47 | extern int (*pm_cpu_sleep)(unsigned long); |
| 48 | |
| 49 | /* Flags for PM Control */ |
| 50 | |
| 51 | extern unsigned long s3c_pm_flags; |
| 52 | |
| 53 | /* from sleep.S */ |
| 54 | |
| 55 | extern int s3c2410_cpu_suspend(unsigned long); |
| 56 | |
| 57 | #ifdef CONFIG_PM_SLEEP |
| 58 | extern int s3c_irq_wake(struct irq_data *data, unsigned int state); |
| 59 | extern void s3c_cpu_resume(void); |
| 60 | #else |
| 61 | #define s3c_irq_wake NULL |
| 62 | #define s3c_cpu_resume NULL |
| 63 | #endif |
| 64 | |
| 65 | #ifdef CONFIG_SAMSUNG_PM |
| 66 | extern int s3c_irqext_wake(struct irq_data *data, unsigned int state); |
| 67 | #else |
| 68 | #define s3c_irqext_wake NULL |
| 69 | #endif |
| 70 | |
| 71 | #ifdef CONFIG_S3C_PM_DEBUG_LED_SMDK |
| 72 | /** |
| 73 | * s3c_pm_debug_smdkled() - Debug PM suspend/resume via SMDK Board LEDs |
| 74 | * @set: set bits for the state of the LEDs |
| 75 | * @clear: clear bits for the state of the LEDs. |
| 76 | */ |
| 77 | extern void s3c_pm_debug_smdkled(u32 set, u32 clear); |
| 78 | |
| 79 | #else |
| 80 | static inline void s3c_pm_debug_smdkled(u32 set, u32 clear) { } |
| 81 | #endif /* CONFIG_S3C_PM_DEBUG_LED_SMDK */ |
| 82 | |
| 83 | /** |
| 84 | * s3c_pm_configure_extint() - ensure pins are correctly set for IRQ |
| 85 | * |
| 86 | * Setup all the necessary GPIO pins for waking the system on external |
| 87 | * interrupt. |
| 88 | */ |
| 89 | extern void s3c_pm_configure_extint(void); |
| 90 | |
| 91 | #ifdef CONFIG_GPIO_SAMSUNG |
| 92 | /** |
| 93 | * samsung_pm_restore_gpios() - restore the state of the gpios after sleep. |
| 94 | * |
| 95 | * Restore the state of the GPIO pins after sleep, which may involve ensuring |
| 96 | * that we do not glitch the state of the pins from that the bootloader's |
| 97 | * resume code has done. |
| 98 | */ |
| 99 | extern void samsung_pm_restore_gpios(void); |
| 100 | |
| 101 | /** |
| 102 | * samsung_pm_save_gpios() - save the state of the GPIOs for restoring after sleep. |
| 103 | * |
| 104 | * Save the GPIO states for resotration on resume. See samsung_pm_restore_gpios(). |
| 105 | */ |
| 106 | extern void samsung_pm_save_gpios(void); |
| 107 | #else |
| 108 | static inline void samsung_pm_restore_gpios(void) {} |
| 109 | static inline void samsung_pm_save_gpios(void) {} |
| 110 | #endif |
| 111 | |
| 112 | extern void s3c_pm_save_core(void); |
| 113 | extern void s3c_pm_restore_core(void); |