Merge 5.0-rc6 into driver-core-next
[linux/fpc-iii.git] / arch / arm / plat-samsung / include / plat / pm-common.h
blob1268bae04234b648a3edd87baf588fe4c09f190e
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Copyright (C) 2013 Samsung Electronics Co., Ltd.
4 * Tomasz Figa <t.figa@samsung.com>
5 * Copyright (c) 2004 Simtec Electronics
6 * http://armlinux.simtec.co.uk/
7 * Written by Ben Dooks, <ben@simtec.co.uk>
8 */
10 #ifndef __PLAT_SAMSUNG_PM_COMMON_H
11 #define __PLAT_SAMSUNG_PM_COMMON_H __FILE__
13 #include <linux/irq.h>
15 /* sleep save info */
17 /**
18 * struct sleep_save - save information for shared peripherals.
19 * @reg: Pointer to the register to save.
20 * @val: Holder for the value saved from reg.
22 * This describes a list of registers which is used by the pm core and
23 * other subsystem to save and restore register values over suspend.
25 struct sleep_save {
26 void __iomem *reg;
27 unsigned long val;
30 #define SAVE_ITEM(x) \
31 { .reg = (x) }
33 /* helper functions to save/restore lists of registers. */
35 extern void s3c_pm_do_save(struct sleep_save *ptr, int count);
36 extern void s3c_pm_do_restore(const struct sleep_save *ptr, int count);
37 extern void s3c_pm_do_restore_core(const struct sleep_save *ptr, int count);
39 /* PM debug functions */
41 /**
42 * struct pm_uart_save - save block for core UART
43 * @ulcon: Save value for S3C2410_ULCON
44 * @ucon: Save value for S3C2410_UCON
45 * @ufcon: Save value for S3C2410_UFCON
46 * @umcon: Save value for S3C2410_UMCON
47 * @ubrdiv: Save value for S3C2410_UBRDIV
49 * Save block for UART registers to be held over sleep and restored if they
50 * are needed (say by debug).
52 struct pm_uart_save {
53 u32 ulcon;
54 u32 ucon;
55 u32 ufcon;
56 u32 umcon;
57 u32 ubrdiv;
58 u32 udivslot;
61 #ifdef CONFIG_SAMSUNG_PM_DEBUG
62 /**
63 * s3c_pm_dbg() - low level debug function for use in suspend/resume.
64 * @msg: The message to print.
66 * This function is used mainly to debug the resume process before the system
67 * can rely on printk/console output. It uses the low-level debugging output
68 * routine printascii() to do its work.
70 extern void s3c_pm_dbg(const char *msg, ...);
72 /**
73 * s3c_pm_debug_init() - suspend/resume low level debug initialization.
74 * @base: Virtual base of UART to use for suspend/resume debugging.
76 * This function needs to be called before S3C_PMDBG() can be used, to set up
77 * UART port base address and configuration.
79 extern void s3c_pm_debug_init(void);
81 #define S3C_PMDBG(fmt...) s3c_pm_dbg(fmt)
83 extern void s3c_pm_save_uarts(void);
84 extern void s3c_pm_restore_uarts(void);
85 #else
86 #define S3C_PMDBG(fmt...) pr_debug(fmt)
87 #define s3c_pm_debug_init() do { } while (0)
89 static inline void s3c_pm_save_uarts(void) { }
90 static inline void s3c_pm_restore_uarts(void) { }
91 #endif
93 /* suspend memory checking */
95 #ifdef CONFIG_SAMSUNG_PM_CHECK
96 extern void s3c_pm_check_prepare(void);
97 extern void s3c_pm_check_restore(void);
98 extern void s3c_pm_check_cleanup(void);
99 extern void s3c_pm_check_store(void);
100 #else
101 #define s3c_pm_check_prepare() do { } while (0)
102 #define s3c_pm_check_restore() do { } while (0)
103 #define s3c_pm_check_cleanup() do { } while (0)
104 #define s3c_pm_check_store() do { } while (0)
105 #endif
107 #endif