blob: b8604f8847d9877fb883a3c25dc9e66086b4e4ea [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Zhonghui Fu431d4522015-03-18 15:54:27 +01002#ifndef PM_TRACE_H
3#define PM_TRACE_H
Linus Torvaldseb71c872006-06-24 14:27:42 -07004
Chen Yuba58d102016-11-28 14:35:19 -08005#include <linux/types.h>
Linus Torvaldseb71c872006-06-24 14:27:42 -07006#ifdef CONFIG_PM_TRACE
Zhonghui Fu431d4522015-03-18 15:54:27 +01007#include <asm/pm-trace.h>
Linus Torvaldseb71c872006-06-24 14:27:42 -07008
Rafael J. Wysockic5c6ba42006-09-25 23:32:58 -07009extern int pm_trace_enabled;
Chen Yuba58d102016-11-28 14:35:19 -080010extern bool pm_trace_rtc_abused;
11
12static inline bool pm_trace_rtc_valid(void)
13{
14 return !pm_trace_rtc_abused;
15}
Rafael J. Wysockic5c6ba42006-09-25 23:32:58 -070016
Rafael J. Wysocki5af84b82010-01-23 22:23:32 +010017static inline int pm_trace_is_enabled(void)
18{
19 return pm_trace_enabled;
20}
21
Linus Torvaldseb71c872006-06-24 14:27:42 -070022struct device;
23extern void set_trace_device(struct device *);
Zhonghui Fu431d4522015-03-18 15:54:27 +010024extern void generate_pm_trace(const void *tracedata, unsigned int user);
James Hogand33ac602010-10-12 00:00:25 +020025extern int show_trace_dev_match(char *buf, size_t size);
Linus Torvaldseb71c872006-06-24 14:27:42 -070026
Nigel Cunningham44bf4ce2007-07-21 17:10:41 +020027#define TRACE_DEVICE(dev) do { \
28 if (pm_trace_enabled) \
29 set_trace_device(dev); \
30 } while(0)
Linus Torvaldseb71c872006-06-24 14:27:42 -070031
32#else
33
Chen Yuba58d102016-11-28 14:35:19 -080034static inline bool pm_trace_rtc_valid(void) { return true; }
Rafael J. Wysocki5af84b82010-01-23 22:23:32 +010035static inline int pm_trace_is_enabled(void) { return 0; }
36
Linus Torvaldseb71c872006-06-24 14:27:42 -070037#define TRACE_DEVICE(dev) do { } while (0)
38#define TRACE_RESUME(dev) do { } while (0)
Zhonghui Fu431d4522015-03-18 15:54:27 +010039#define TRACE_SUSPEND(dev) do { } while (0)
Linus Torvaldseb71c872006-06-24 14:27:42 -070040
41#endif
42
43#endif