xref: /linux/include/linux/soc/samsung/s3c-pm.h (revision a4eb44a6435d6d8f9e642407a4a06f65eb90ca04)
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  */
9 
10 #ifndef __LINUX_SOC_SAMSUNG_S3C_PM_H
11 #define __LINUX_SOC_SAMSUNG_S3C_PM_H __FILE__
12 
13 #include <linux/types.h>
14 
15 /* PM debug functions */
16 
17 /**
18  * struct pm_uart_save - save block for core UART
19  * @ulcon: Save value for S3C2410_ULCON
20  * @ucon: Save value for S3C2410_UCON
21  * @ufcon: Save value for S3C2410_UFCON
22  * @umcon: Save value for S3C2410_UMCON
23  * @ubrdiv: Save value for S3C2410_UBRDIV
24  *
25  * Save block for UART registers to be held over sleep and restored if they
26  * are needed (say by debug).
27 */
28 struct pm_uart_save {
29 	u32	ulcon;
30 	u32	ucon;
31 	u32	ufcon;
32 	u32	umcon;
33 	u32	ubrdiv;
34 	u32	udivslot;
35 };
36 
37 #ifdef CONFIG_SAMSUNG_PM_DEBUG
38 /**
39  * s3c_pm_dbg() - low level debug function for use in suspend/resume.
40  * @msg: The message to print.
41  *
42  * This function is used mainly to debug the resume process before the system
43  * can rely on printk/console output. It uses the low-level debugging output
44  * routine printascii() to do its work.
45  */
46 extern void s3c_pm_dbg(const char *msg, ...);
47 
48 #define S3C_PMDBG(fmt...) s3c_pm_dbg(fmt)
49 
50 extern void s3c_pm_save_uarts(bool is_s3c24xx);
51 extern void s3c_pm_restore_uarts(bool is_s3c24xx);
52 
53 #ifdef CONFIG_ARCH_S3C64XX
54 extern void s3c_pm_arch_update_uart(void __iomem *regs,
55 				    struct pm_uart_save *save);
56 #else
57 static inline void
58 s3c_pm_arch_update_uart(void __iomem *regs, struct pm_uart_save *save)
59 {
60 }
61 #endif
62 
63 #else
64 #define S3C_PMDBG(fmt...) pr_debug(fmt)
65 
66 static inline void s3c_pm_save_uarts(bool is_s3c24xx) { }
67 static inline void s3c_pm_restore_uarts(bool is_s3c24xx) { }
68 #endif
69 
70 /* suspend memory checking */
71 
72 #ifdef CONFIG_SAMSUNG_PM_CHECK
73 extern void s3c_pm_check_prepare(void);
74 extern void s3c_pm_check_restore(void);
75 extern void s3c_pm_check_cleanup(void);
76 extern void s3c_pm_check_store(void);
77 #else
78 #define s3c_pm_check_prepare() do { } while (0)
79 #define s3c_pm_check_restore() do { } while (0)
80 #define s3c_pm_check_cleanup() do { } while (0)
81 #define s3c_pm_check_store()   do { } while (0)
82 #endif
83 
84 /* system device subsystems */
85 
86 extern struct bus_type s3c2410_subsys;
87 extern struct bus_type s3c2410a_subsys;
88 extern struct bus_type s3c2412_subsys;
89 extern struct bus_type s3c2416_subsys;
90 extern struct bus_type s3c2440_subsys;
91 extern struct bus_type s3c2442_subsys;
92 extern struct bus_type s3c2443_subsys;
93 
94 #endif
95