Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Copyright (c) 2004 Simtec Electronics
0004  *  http://armlinux.simtec.co.uk/
0005  *  Written by Ben Dooks, <ben@simtec.co.uk>
0006  */
0007 
0008 /* s3c_pm_init
0009  *
0010  * called from board at initialisation time to setup the power
0011  * management
0012 */
0013 
0014 #include "pm-common.h"
0015 
0016 struct device;
0017 
0018 #ifdef CONFIG_SAMSUNG_PM
0019 
0020 extern __init int s3c_pm_init(void);
0021 extern __init int s3c64xx_pm_init(void);
0022 
0023 #else
0024 
0025 static inline int s3c_pm_init(void)
0026 {
0027     return 0;
0028 }
0029 
0030 static inline int s3c64xx_pm_init(void)
0031 {
0032     return 0;
0033 }
0034 #endif
0035 
0036 /* configuration for the IRQ mask over sleep */
0037 extern unsigned long s3c_irqwake_intmask;
0038 extern unsigned long s3c_irqwake_eintmask;
0039 
0040 /* per-cpu sleep functions */
0041 
0042 extern void (*pm_cpu_prep)(void);
0043 extern int (*pm_cpu_sleep)(unsigned long);
0044 
0045 /* Flags for PM Control */
0046 
0047 extern unsigned long s3c_pm_flags;
0048 
0049 /* from sleep.S */
0050 
0051 extern int s3c2410_cpu_suspend(unsigned long);
0052 
0053 #ifdef CONFIG_PM_SLEEP
0054 extern int s3c_irq_wake(struct irq_data *data, unsigned int state);
0055 extern void s3c_cpu_resume(void);
0056 #else
0057 #define s3c_irq_wake NULL
0058 #define s3c_cpu_resume NULL
0059 #endif
0060 
0061 #ifdef CONFIG_SAMSUNG_PM
0062 extern int s3c_irqext_wake(struct irq_data *data, unsigned int state);
0063 #else
0064 #define s3c_irqext_wake NULL
0065 #endif
0066 
0067 #ifdef CONFIG_S3C_PM_DEBUG_LED_SMDK
0068 /**
0069  * s3c_pm_debug_smdkled() - Debug PM suspend/resume via SMDK Board LEDs
0070  * @set: set bits for the state of the LEDs
0071  * @clear: clear bits for the state of the LEDs.
0072  */
0073 extern void s3c_pm_debug_smdkled(u32 set, u32 clear);
0074 
0075 #else
0076 static inline void s3c_pm_debug_smdkled(u32 set, u32 clear) { }
0077 #endif /* CONFIG_S3C_PM_DEBUG_LED_SMDK */
0078 
0079 /**
0080  * s3c_pm_configure_extint() - ensure pins are correctly set for IRQ
0081  *
0082  * Setup all the necessary GPIO pins for waking the system on external
0083  * interrupt.
0084  */
0085 extern void s3c_pm_configure_extint(void);
0086 
0087 #ifdef CONFIG_GPIO_SAMSUNG
0088 /**
0089  * samsung_pm_restore_gpios() - restore the state of the gpios after sleep.
0090  *
0091  * Restore the state of the GPIO pins after sleep, which may involve ensuring
0092  * that we do not glitch the state of the pins from that the bootloader's
0093  * resume code has done.
0094 */
0095 extern void samsung_pm_restore_gpios(void);
0096 
0097 /**
0098  * samsung_pm_save_gpios() - save the state of the GPIOs for restoring after sleep.
0099  *
0100  * Save the GPIO states for resotration on resume. See samsung_pm_restore_gpios().
0101  */
0102 extern void samsung_pm_save_gpios(void);
0103 #else
0104 static inline void samsung_pm_restore_gpios(void) {}
0105 static inline void samsung_pm_save_gpios(void) {}
0106 #endif
0107 
0108 extern void s3c_pm_save_core(void);
0109 extern void s3c_pm_restore_core(void);