blob: c6d0151d37dec8ac1cc204f04451dfb9c96daa79 [file] [log] [blame]
Benjamin Chan6db7eb52017-02-17 14:49:45 -05001/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
Adrian Salido-Moreno5c150382016-04-06 09:29:37 -07002 *
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_ROTATOR_DEBUG_H__
14#define __SDE_ROTATOR_DEBUG_H__
15
16#include <linux/types.h>
17#include <linux/dcache.h>
18
Benjamin Chan53e3bce2016-08-31 14:43:29 -040019#define SDE_ROT_DATA_LIMITER (-1)
20#define SDE_ROT_EVTLOG_TOUT_DATA_LIMITER (NULL)
21
22enum sde_rot_dbg_reg_dump_flag {
23 SDE_ROT_DBG_DUMP_IN_LOG = BIT(0),
24 SDE_ROT_DBG_DUMP_IN_MEM = BIT(1),
25};
26
27enum sde_rot_dbg_evtlog_flag {
28 SDE_ROT_EVTLOG_DEFAULT = BIT(0),
29 SDE_ROT_EVTLOG_IOMMU = BIT(1),
30 SDE_ROT_EVTLOG_DBG = BIT(6),
31 SDE_ROT_EVTLOG_ALL = BIT(7)
32};
33
34#define SDEROT_EVTLOG(...) sde_rot_evtlog(__func__, __LINE__, \
35 SDE_ROT_EVTLOG_DEFAULT, ##__VA_ARGS__, SDE_ROT_DATA_LIMITER)
36
37#define SDEROT_EVTLOG_TOUT_HANDLER(...) \
38 sde_rot_evtlog_tout_handler(false, __func__, ##__VA_ARGS__, \
39 SDE_ROT_EVTLOG_TOUT_DATA_LIMITER)
40
41void sde_rot_evtlog(const char *name, int line, int flag, ...);
42void sde_rot_dump_panic(void);
43void sde_rot_evtlog_tout_handler(bool queue, const char *name, ...);
44
Adrian Salido-Moreno5c150382016-04-06 09:29:37 -070045struct sde_rotator_device;
46
Benjamin Chan6a0d2412016-10-27 17:47:46 -040047struct sde_rotator_debug_base {
48 char name[80];
49 void __iomem *base;
50 size_t off;
51 size_t cnt;
52 size_t max_offset;
53 char *buf;
54 size_t buf_len;
55 struct sde_rot_mgr *mgr;
Benjamin Chan6db7eb52017-02-17 14:49:45 -050056 struct mutex buflock;
Benjamin Chan6a0d2412016-10-27 17:47:46 -040057};
58
Adrian Salido-Moreno5c150382016-04-06 09:29:37 -070059#if defined(CONFIG_DEBUG_FS)
60struct dentry *sde_rotator_create_debugfs(
61 struct sde_rotator_device *rot_dev);
62
63void sde_rotator_destroy_debugfs(struct dentry *debugfs);
64#else
65static inline
66struct dentry *sde_rotator_create_debugfs(
67 struct sde_rotator_device *rot_dev)
68{
69 return NULL;
70}
71
72static inline
73void sde_rotator_destroy_debugfs(struct dentry *debugfs)
74{
75}
76#endif
77#endif /* __SDE_ROTATOR_DEBUG_H__ */