2 * Copyright (C) 2013 Samsung Electronics Co., Ltd.
3 * Tomasz Figa <t.figa@samsung.com>
4 * Copyright (c) 2004 Simtec Electronics
5 * http://armlinux.simtec.co.uk/
6 * Written by Ben Dooks, <ben@simtec.co.uk>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #ifndef __PLAT_SAMSUNG_PM_COMMON_H
14 #define __PLAT_SAMSUNG_PM_COMMON_H __FILE__
16 #include <linux/irq.h>
21 * struct sleep_save - save information for shared peripherals.
22 * @reg: Pointer to the register to save.
23 * @val: Holder for the value saved from reg.
25 * This describes a list of registers which is used by the pm core and
26 * other subsystem to save and restore register values over suspend.
33 #define SAVE_ITEM(x) \
36 /* helper functions to save/restore lists of registers. */
38 extern void s3c_pm_do_save(struct sleep_save
*ptr
, int count
);
39 extern void s3c_pm_do_restore(const struct sleep_save
*ptr
, int count
);
40 extern void s3c_pm_do_restore_core(const struct sleep_save
*ptr
, int count
);
42 /* PM debug functions */
45 * struct pm_uart_save - save block for core UART
46 * @ulcon: Save value for S3C2410_ULCON
47 * @ucon: Save value for S3C2410_UCON
48 * @ufcon: Save value for S3C2410_UFCON
49 * @umcon: Save value for S3C2410_UMCON
50 * @ubrdiv: Save value for S3C2410_UBRDIV
52 * Save block for UART registers to be held over sleep and restored if they
53 * are needed (say by debug).
64 #ifdef CONFIG_SAMSUNG_PM_DEBUG
66 * s3c_pm_dbg() - low level debug function for use in suspend/resume.
67 * @msg: The message to print.
69 * This function is used mainly to debug the resume process before the system
70 * can rely on printk/console output. It uses the low-level debugging output
71 * routine printascii() to do its work.
73 extern void s3c_pm_dbg(const char *msg
, ...);
76 * s3c_pm_debug_init() - suspend/resume low level debug initialization.
77 * @base: Virtual base of UART to use for suspend/resume debugging.
79 * This function needs to be called before S3C_PMDBG() can be used, to set up
80 * UART port base address and configuration.
82 extern void s3c_pm_debug_init(void);
84 #define S3C_PMDBG(fmt...) s3c_pm_dbg(fmt)
86 extern void s3c_pm_save_uarts(void);
87 extern void s3c_pm_restore_uarts(void);
89 #define S3C_PMDBG(fmt...) pr_debug(fmt)
90 #define s3c_pm_debug_init() do { } while (0)
92 static inline void s3c_pm_save_uarts(void) { }
93 static inline void s3c_pm_restore_uarts(void) { }
96 /* suspend memory checking */
98 #ifdef CONFIG_SAMSUNG_PM_CHECK
99 extern void s3c_pm_check_prepare(void);
100 extern void s3c_pm_check_restore(void);
101 extern void s3c_pm_check_cleanup(void);
102 extern void s3c_pm_check_store(void);
104 #define s3c_pm_check_prepare() do { } while (0)
105 #define s3c_pm_check_restore() do { } while (0)
106 #define s3c_pm_check_cleanup() do { } while (0)
107 #define s3c_pm_check_store() do { } while (0)