2017-12-25 20:54:35 +01:00
/* SPDX-License-Identifier: GPL-2.0 */
2014-03-18 07:28:09 +09:00
/*
* Copyright ( C ) 2013 Samsung Electronics Co . , Ltd .
* Tomasz Figa < t . figa @ samsung . com >
* Copyright ( c ) 2004 Simtec Electronics
* http : //armlinux.simtec.co.uk/
* Written by Ben Dooks , < ben @ simtec . co . uk >
2017-12-25 20:54:35 +01:00
*/
2014-03-18 07:28:09 +09:00
# ifndef __PLAT_SAMSUNG_PM_COMMON_H
# define __PLAT_SAMSUNG_PM_COMMON_H __FILE__
2014-03-18 07:28:10 +09:00
# include <linux/irq.h>
/* sleep save info */
/**
* struct sleep_save - save information for shared peripherals .
* @ reg : Pointer to the register to save .
* @ val : Holder for the value saved from reg .
*
* This describes a list of registers which is used by the pm core and
* other subsystem to save and restore register values over suspend .
*/
struct sleep_save {
void __iomem * reg ;
unsigned long val ;
} ;
# define SAVE_ITEM(x) \
{ . reg = ( x ) }
/* helper functions to save/restore lists of registers. */
extern void s3c_pm_do_save ( struct sleep_save * ptr , int count ) ;
extern void s3c_pm_do_restore ( const struct sleep_save * ptr , int count ) ;
extern void s3c_pm_do_restore_core ( const struct sleep_save * ptr , int count ) ;
2014-03-18 07:28:09 +09:00
/* PM debug functions */
/**
* struct pm_uart_save - save block for core UART
* @ ulcon : Save value for S3C2410_ULCON
* @ ucon : Save value for S3C2410_UCON
* @ ufcon : Save value for S3C2410_UFCON
* @ umcon : Save value for S3C2410_UMCON
* @ ubrdiv : Save value for S3C2410_UBRDIV
*
* Save block for UART registers to be held over sleep and restored if they
* are needed ( say by debug ) .
*/
struct pm_uart_save {
u32 ulcon ;
u32 ucon ;
u32 ufcon ;
u32 umcon ;
u32 ubrdiv ;
u32 udivslot ;
} ;
# ifdef CONFIG_SAMSUNG_PM_DEBUG
/**
* s3c_pm_dbg ( ) - low level debug function for use in suspend / resume .
* @ msg : The message to print .
*
* This function is used mainly to debug the resume process before the system
* can rely on printk / console output . It uses the low - level debugging output
* routine printascii ( ) to do its work .
*/
extern void s3c_pm_dbg ( const char * msg , . . . ) ;
# define S3C_PMDBG(fmt...) s3c_pm_dbg(fmt)
2020-08-06 20:20:29 +02:00
extern void s3c_pm_save_uarts ( bool is_s3c24xx ) ;
extern void s3c_pm_restore_uarts ( bool is_s3c24xx ) ;
# ifdef CONFIG_ARCH_S3C64XX
extern void s3c_pm_arch_update_uart ( void __iomem * regs ,
struct pm_uart_save * save ) ;
# else
static inline void
s3c_pm_arch_update_uart ( void __iomem * regs , struct pm_uart_save * save )
{
}
# endif
2014-03-18 07:28:09 +09:00
# else
# define S3C_PMDBG(fmt...) pr_debug(fmt)
2020-08-06 20:20:29 +02:00
static inline void s3c_pm_save_uarts ( bool is_s3c24xx ) { }
static inline void s3c_pm_restore_uarts ( bool is_s3c24xx ) { }
2014-03-18 07:28:09 +09:00
# endif
2014-03-18 07:28:10 +09:00
/* suspend memory checking */
# ifdef CONFIG_SAMSUNG_PM_CHECK
extern void s3c_pm_check_prepare ( void ) ;
extern void s3c_pm_check_restore ( void ) ;
extern void s3c_pm_check_cleanup ( void ) ;
extern void s3c_pm_check_store ( void ) ;
# else
# define s3c_pm_check_prepare() do { } while (0)
# define s3c_pm_check_restore() do { } while (0)
# define s3c_pm_check_cleanup() do { } while (0)
# define s3c_pm_check_store() do { } while (0)
# endif
2014-03-18 07:28:09 +09:00
# endif