Benjamin Chan | 6db7eb5 | 2017-02-17 14:49:45 -0500 | [diff] [blame] | 1 | /* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. |
Adrian Salido-Moreno | 5c15038 | 2016-04-06 09:29:37 -0700 | [diff] [blame] | 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_ROTATOR_DEBUG_H__ |
| 14 | #define __SDE_ROTATOR_DEBUG_H__ |
| 15 | |
| 16 | #include <linux/types.h> |
| 17 | #include <linux/dcache.h> |
| 18 | |
Benjamin Chan | 53e3bce | 2016-08-31 14:43:29 -0400 | [diff] [blame] | 19 | #define SDE_ROT_DATA_LIMITER (-1) |
| 20 | #define SDE_ROT_EVTLOG_TOUT_DATA_LIMITER (NULL) |
| 21 | |
| 22 | enum 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 | |
| 27 | enum 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 | |
| 41 | void sde_rot_evtlog(const char *name, int line, int flag, ...); |
| 42 | void sde_rot_dump_panic(void); |
| 43 | void sde_rot_evtlog_tout_handler(bool queue, const char *name, ...); |
| 44 | |
Adrian Salido-Moreno | 5c15038 | 2016-04-06 09:29:37 -0700 | [diff] [blame] | 45 | struct sde_rotator_device; |
| 46 | |
Benjamin Chan | 6a0d241 | 2016-10-27 17:47:46 -0400 | [diff] [blame] | 47 | struct 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 Chan | 6db7eb5 | 2017-02-17 14:49:45 -0500 | [diff] [blame] | 56 | struct mutex buflock; |
Benjamin Chan | 6a0d241 | 2016-10-27 17:47:46 -0400 | [diff] [blame] | 57 | }; |
| 58 | |
Adrian Salido-Moreno | 5c15038 | 2016-04-06 09:29:37 -0700 | [diff] [blame] | 59 | #if defined(CONFIG_DEBUG_FS) |
| 60 | struct dentry *sde_rotator_create_debugfs( |
| 61 | struct sde_rotator_device *rot_dev); |
| 62 | |
| 63 | void sde_rotator_destroy_debugfs(struct dentry *debugfs); |
| 64 | #else |
| 65 | static inline |
| 66 | struct dentry *sde_rotator_create_debugfs( |
| 67 | struct sde_rotator_device *rot_dev) |
| 68 | { |
| 69 | return NULL; |
| 70 | } |
| 71 | |
| 72 | static inline |
| 73 | void sde_rotator_destroy_debugfs(struct dentry *debugfs) |
| 74 | { |
| 75 | } |
| 76 | #endif |
| 77 | #endif /* __SDE_ROTATOR_DEBUG_H__ */ |