Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Zhonghui Fu | 431d452 | 2015-03-18 15:54:27 +0100 | [diff] [blame] | 2 | #ifndef PM_TRACE_H |
| 3 | #define PM_TRACE_H |
Linus Torvalds | eb71c87 | 2006-06-24 14:27:42 -0700 | [diff] [blame] | 4 | |
Chen Yu | ba58d10 | 2016-11-28 14:35:19 -0800 | [diff] [blame] | 5 | #include <linux/types.h> |
Linus Torvalds | eb71c87 | 2006-06-24 14:27:42 -0700 | [diff] [blame] | 6 | #ifdef CONFIG_PM_TRACE |
Zhonghui Fu | 431d452 | 2015-03-18 15:54:27 +0100 | [diff] [blame] | 7 | #include <asm/pm-trace.h> |
Linus Torvalds | eb71c87 | 2006-06-24 14:27:42 -0700 | [diff] [blame] | 8 | |
Rafael J. Wysocki | c5c6ba4 | 2006-09-25 23:32:58 -0700 | [diff] [blame] | 9 | extern int pm_trace_enabled; |
Chen Yu | ba58d10 | 2016-11-28 14:35:19 -0800 | [diff] [blame] | 10 | extern bool pm_trace_rtc_abused; |
| 11 | |
| 12 | static inline bool pm_trace_rtc_valid(void) |
| 13 | { |
| 14 | return !pm_trace_rtc_abused; |
| 15 | } |
Rafael J. Wysocki | c5c6ba4 | 2006-09-25 23:32:58 -0700 | [diff] [blame] | 16 | |
Rafael J. Wysocki | 5af84b8 | 2010-01-23 22:23:32 +0100 | [diff] [blame] | 17 | static inline int pm_trace_is_enabled(void) |
| 18 | { |
| 19 | return pm_trace_enabled; |
| 20 | } |
| 21 | |
Linus Torvalds | eb71c87 | 2006-06-24 14:27:42 -0700 | [diff] [blame] | 22 | struct device; |
| 23 | extern void set_trace_device(struct device *); |
Zhonghui Fu | 431d452 | 2015-03-18 15:54:27 +0100 | [diff] [blame] | 24 | extern void generate_pm_trace(const void *tracedata, unsigned int user); |
James Hogan | d33ac60 | 2010-10-12 00:00:25 +0200 | [diff] [blame] | 25 | extern int show_trace_dev_match(char *buf, size_t size); |
Linus Torvalds | eb71c87 | 2006-06-24 14:27:42 -0700 | [diff] [blame] | 26 | |
Nigel Cunningham | 44bf4ce | 2007-07-21 17:10:41 +0200 | [diff] [blame] | 27 | #define TRACE_DEVICE(dev) do { \ |
| 28 | if (pm_trace_enabled) \ |
| 29 | set_trace_device(dev); \ |
| 30 | } while(0) |
Linus Torvalds | eb71c87 | 2006-06-24 14:27:42 -0700 | [diff] [blame] | 31 | |
| 32 | #else |
| 33 | |
Chen Yu | ba58d10 | 2016-11-28 14:35:19 -0800 | [diff] [blame] | 34 | static inline bool pm_trace_rtc_valid(void) { return true; } |
Rafael J. Wysocki | 5af84b8 | 2010-01-23 22:23:32 +0100 | [diff] [blame] | 35 | static inline int pm_trace_is_enabled(void) { return 0; } |
| 36 | |
Linus Torvalds | eb71c87 | 2006-06-24 14:27:42 -0700 | [diff] [blame] | 37 | #define TRACE_DEVICE(dev) do { } while (0) |
| 38 | #define TRACE_RESUME(dev) do { } while (0) |
Zhonghui Fu | 431d452 | 2015-03-18 15:54:27 +0100 | [diff] [blame] | 39 | #define TRACE_SUSPEND(dev) do { } while (0) |
Linus Torvalds | eb71c87 | 2006-06-24 14:27:42 -0700 | [diff] [blame] | 40 | |
| 41 | #endif |
| 42 | |
| 43 | #endif |