summaryrefslogtreecommitdiff
path: root/rotator/sde_rotator_debug.h
blob: 8b988ff3083c6293a0d787b6711f6cb70acf9858 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2015-2020, The Linux Foundation. All rights reserved.
 */

#ifndef __SDE_ROTATOR_DEBUG_H__
#define __SDE_ROTATOR_DEBUG_H__

#include <linux/types.h>
#include <linux/dcache.h>

#define SDE_ROT_DATA_LIMITER (-1)
#define SDE_ROT_EVTLOG_TOUT_DATA_LIMITER (NULL)
#define SDE_ROT_EVTLOG_PANIC		0xdead
#define SDE_ROT_EVTLOG_FATAL		0xbad
#define SDE_ROT_EVTLOG_ERROR		0xebad

enum sde_rot_dbg_reg_dump_flag {
	SDE_ROT_DBG_DUMP_IN_LOG = BIT(0),
	SDE_ROT_DBG_DUMP_IN_MEM = BIT(1),
};

enum sde_rot_dbg_evtlog_flag {
	SDE_ROT_EVTLOG_DEFAULT = BIT(0),
	SDE_ROT_EVTLOG_IOMMU = BIT(1),
	SDE_ROT_EVTLOG_DBG = BIT(6),
	SDE_ROT_EVTLOG_ALL = BIT(7)
};

#define SDEROT_EVTLOG(...) sde_rot_evtlog(__func__, __LINE__, \
		SDE_ROT_EVTLOG_DEFAULT, ##__VA_ARGS__, SDE_ROT_DATA_LIMITER)

#define SDEROT_EVTLOG_TOUT_HANDLER(...)	\
	sde_rot_evtlog_tout_handler(false, __func__, ##__VA_ARGS__, \
		SDE_ROT_EVTLOG_TOUT_DATA_LIMITER)

#if defined(CONFIG_MSM_SDE_ROTATOR_EVTLOG_DEBUG) && \
	defined(CONFIG_DEBUG_FS)
void sde_rot_evtlog(const char *name, int line, int flag, ...);
void sde_rot_evtlog_tout_handler(bool queue, const char *name, ...);
#else
static inline
void sde_rot_evtlog(const char *name, int line, int flag, ...)
{
}
static inline
void sde_rot_evtlog_tout_handler(bool queue, const char *name, ...)
{
}
#endif

struct sde_rotator_device;

struct sde_rotator_debug_base {
	char name[80];
	void __iomem *base;
	size_t off;
	size_t cnt;
	size_t max_offset;
	char *buf;
	size_t buf_len;
	struct sde_rot_mgr *mgr;
	struct mutex buflock;
};

#if defined(CONFIG_DEBUG_FS)
struct dentry *sde_rotator_create_debugfs(
		struct sde_rotator_device *rot_dev);

void sde_rotator_destroy_debugfs(struct dentry *debugfs);
#else
static inline
struct dentry *sde_rotator_create_debugfs(
		struct sde_rotator_device *rot_dev)
{
	return NULL;
}

static inline
void sde_rotator_destroy_debugfs(struct dentry *debugfs)
{
}
#endif
#endif /* __SDE_ROTATOR_DEBUG_H__ */