blob: 271c41f05ce5058d72db5ba6d00ae247ab6f43ef [file] [log] [blame]
Lloyd Atkinson5d40d312016-09-06 08:34:13 -04001/* Copyright (c) 2016, The Linux Foundation. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#ifndef SDE_DBG_H_
14#define SDE_DBG_H_
15
16#include <stdarg.h>
17#include <linux/debugfs.h>
18#include <linux/list.h>
19
20#define SDE_EVTLOG_DATA_LIMITER (-1)
21#define SDE_EVTLOG_FUNC_ENTRY 0x1111
22#define SDE_EVTLOG_FUNC_EXIT 0x2222
23
Lloyd Atkinsona54513f2016-10-03 22:31:43 -040024#define SDE_DBG_DUMP_DATA_LIMITER (NULL)
25
Lloyd Atkinson5d40d312016-09-06 08:34:13 -040026enum sde_dbg_evtlog_flag {
27 SDE_EVTLOG_DEFAULT = BIT(0),
28 SDE_EVTLOG_IRQ = BIT(1),
29 SDE_EVTLOG_ALL = BIT(7)
30};
31
32/**
33 * SDE_EVT32 - Write an list of 32bit values as an event into the event log
34 * ... - variable arguments
35 */
36#define SDE_EVT32(...) sde_evtlog(__func__, __LINE__, SDE_EVTLOG_DEFAULT, \
37 ##__VA_ARGS__, SDE_EVTLOG_DATA_LIMITER)
38#define SDE_EVT32_IRQ(...) sde_evtlog(__func__, __LINE__, SDE_EVTLOG_IRQ, \
39 ##__VA_ARGS__, SDE_EVTLOG_DATA_LIMITER)
40
Lloyd Atkinsona54513f2016-10-03 22:31:43 -040041#define SDE_DBG_DUMP(...) \
42 sde_dbg_dump(false, __func__, ##__VA_ARGS__, \
43 SDE_DBG_DUMP_DATA_LIMITER)
44
45#define SDE_DBG_DUMP_WQ(...) \
46 sde_dbg_dump(true, __func__, ##__VA_ARGS__, \
47 SDE_DBG_DUMP_DATA_LIMITER)
Lloyd Atkinson5d40d312016-09-06 08:34:13 -040048
49#if defined(CONFIG_DEBUG_FS)
50
51int sde_evtlog_init(struct dentry *debugfs_root);
52void sde_evtlog_destroy(void);
53void sde_evtlog(const char *name, int line, int flag, ...);
Lloyd Atkinsona54513f2016-10-03 22:31:43 -040054void sde_dbg_dump(bool queue, const char *name, ...);
Lloyd Atkinson5d40d312016-09-06 08:34:13 -040055#else
Lloyd Atkinsona54513f2016-10-03 22:31:43 -040056static inline int sde_evtlog_init(struct dentry *debugfs_root) { return 0; }
57static inline void sde_evtlog(const char *name, int line, flag, ...) {}
58static inline void sde_evtlog_destroy(void) { }
59static inline void sde_dbg_dump(bool queue, const char *name, ...) {}
Lloyd Atkinson5d40d312016-09-06 08:34:13 -040060#endif
61
62#endif /* SDE_DBG_H_ */