2017-12-25 20:54:35 +01:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
/*
|
2005-04-16 15:20:36 -07:00
|
|
|
* Copyright (c) 2004 Simtec Electronics
|
2008-12-12 00:24:06 +00:00
|
|
|
* http://armlinux.simtec.co.uk/
|
2005-04-16 15:20:36 -07:00
|
|
|
* Written by Ben Dooks, <ben@simtec.co.uk>
|
2017-12-25 20:54:35 +01:00
|
|
|
*/
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2008-12-12 00:24:18 +00:00
|
|
|
/* s3c_pm_init
|
2005-04-16 15:20:36 -07:00
|
|
|
*
|
|
|
|
* called from board at initialisation time to setup the power
|
|
|
|
* management
|
|
|
|
*/
|
|
|
|
|
2019-09-02 18:37:30 +02:00
|
|
|
#include "pm-common.h"
|
2010-12-02 14:35:38 +09:00
|
|
|
|
2011-12-21 16:01:38 -08:00
|
|
|
struct device;
|
2011-02-07 10:51:04 +09:00
|
|
|
|
2013-07-24 14:06:13 +09:00
|
|
|
#ifdef CONFIG_SAMSUNG_PM
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2008-12-12 00:24:18 +00:00
|
|
|
extern __init int s3c_pm_init(void);
|
2011-12-08 23:27:48 +01:00
|
|
|
extern __init int s3c64xx_pm_init(void);
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
#else
|
|
|
|
|
2008-12-12 00:24:18 +00:00
|
|
|
static inline int s3c_pm_init(void)
|
2005-04-16 15:20:36 -07:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2011-12-08 23:27:48 +01:00
|
|
|
|
|
|
|
static inline int s3c64xx_pm_init(void)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2005-04-16 15:20:36 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* configuration for the IRQ mask over sleep */
|
|
|
|
extern unsigned long s3c_irqwake_intmask;
|
|
|
|
extern unsigned long s3c_irqwake_eintmask;
|
|
|
|
|
2006-09-19 09:51:32 +01:00
|
|
|
/* per-cpu sleep functions */
|
|
|
|
|
|
|
|
extern void (*pm_cpu_prep)(void);
|
2011-07-02 09:54:01 +01:00
|
|
|
extern int (*pm_cpu_sleep)(unsigned long);
|
2006-09-19 09:51:32 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
/* Flags for PM Control */
|
|
|
|
|
|
|
|
extern unsigned long s3c_pm_flags;
|
|
|
|
|
|
|
|
/* from sleep.S */
|
|
|
|
|
2011-07-02 09:54:01 +01:00
|
|
|
extern int s3c2410_cpu_suspend(unsigned long);
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2015-02-27 05:50:22 +09:00
|
|
|
#ifdef CONFIG_PM_SLEEP
|
2012-11-22 14:46:21 +09:00
|
|
|
extern int s3c_irq_wake(struct irq_data *data, unsigned int state);
|
2013-07-24 14:06:13 +09:00
|
|
|
extern void s3c_cpu_resume(void);
|
2006-09-16 00:01:39 +01:00
|
|
|
#else
|
2012-11-22 14:46:21 +09:00
|
|
|
#define s3c_irq_wake NULL
|
2013-07-24 14:06:13 +09:00
|
|
|
#define s3c_cpu_resume NULL
|
2006-09-16 00:01:39 +01:00
|
|
|
#endif
|
2008-12-12 00:24:06 +00:00
|
|
|
|
2015-02-27 05:50:22 +09:00
|
|
|
#ifdef CONFIG_SAMSUNG_PM
|
|
|
|
extern int s3c_irqext_wake(struct irq_data *data, unsigned int state);
|
|
|
|
#else
|
|
|
|
#define s3c_irqext_wake NULL
|
|
|
|
#endif
|
|
|
|
|
2009-03-10 18:19:35 +00:00
|
|
|
#ifdef CONFIG_S3C_PM_DEBUG_LED_SMDK
|
|
|
|
/**
|
|
|
|
* s3c_pm_debug_smdkled() - Debug PM suspend/resume via SMDK Board LEDs
|
|
|
|
* @set: set bits for the state of the LEDs
|
|
|
|
* @clear: clear bits for the state of the LEDs.
|
|
|
|
*/
|
|
|
|
extern void s3c_pm_debug_smdkled(u32 set, u32 clear);
|
|
|
|
|
|
|
|
#else
|
|
|
|
static inline void s3c_pm_debug_smdkled(u32 set, u32 clear) { }
|
|
|
|
#endif /* CONFIG_S3C_PM_DEBUG_LED_SMDK */
|
|
|
|
|
2008-12-12 00:24:08 +00:00
|
|
|
/**
|
|
|
|
* s3c_pm_configure_extint() - ensure pins are correctly set for IRQ
|
|
|
|
*
|
|
|
|
* Setup all the necessary GPIO pins for waking the system on external
|
|
|
|
* interrupt.
|
|
|
|
*/
|
|
|
|
extern void s3c_pm_configure_extint(void);
|
|
|
|
|
2013-06-19 01:22:20 +09:00
|
|
|
#ifdef CONFIG_GPIO_SAMSUNG
|
2008-12-12 00:24:08 +00:00
|
|
|
/**
|
2011-08-30 20:47:32 +09:00
|
|
|
* samsung_pm_restore_gpios() - restore the state of the gpios after sleep.
|
2008-12-12 00:24:08 +00:00
|
|
|
*
|
|
|
|
* Restore the state of the GPIO pins after sleep, which may involve ensuring
|
|
|
|
* that we do not glitch the state of the pins from that the bootloader's
|
|
|
|
* resume code has done.
|
|
|
|
*/
|
2011-08-30 20:47:32 +09:00
|
|
|
extern void samsung_pm_restore_gpios(void);
|
2008-12-12 00:24:08 +00:00
|
|
|
|
|
|
|
/**
|
2011-08-30 20:47:32 +09:00
|
|
|
* samsung_pm_save_gpios() - save the state of the GPIOs for restoring after sleep.
|
2008-12-12 00:24:08 +00:00
|
|
|
*
|
2011-08-30 20:47:32 +09:00
|
|
|
* Save the GPIO states for resotration on resume. See samsung_pm_restore_gpios().
|
2008-12-12 00:24:08 +00:00
|
|
|
*/
|
2011-08-30 20:47:32 +09:00
|
|
|
extern void samsung_pm_save_gpios(void);
|
2013-06-19 01:22:20 +09:00
|
|
|
#else
|
|
|
|
static inline void samsung_pm_restore_gpios(void) {}
|
|
|
|
static inline void samsung_pm_save_gpios(void) {}
|
|
|
|
#endif
|
2008-12-12 00:24:08 +00:00
|
|
|
|
|
|
|
extern void s3c_pm_save_core(void);
|
|
|
|
extern void s3c_pm_restore_core(void);
|