1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */ 2*4882a593Smuzhiyun /* 3*4882a593Smuzhiyun * Copyright (C) 2020 Rockchip Electronics Co., Ltd. 4*4882a593Smuzhiyun * Author: Cerf Yu <cerf.yu@rock-chips.com> 5*4882a593Smuzhiyun */ 6*4882a593Smuzhiyun 7*4882a593Smuzhiyun #ifndef _RGA_DEBUGGER_H_ 8*4882a593Smuzhiyun #define _RGA_DEBUGGER_H_ 9*4882a593Smuzhiyun 10*4882a593Smuzhiyun #ifdef CONFIG_ROCKCHIP_RGA2_DEBUGGER 11*4882a593Smuzhiyun extern int RGA2_TEST_REG; 12*4882a593Smuzhiyun extern int RGA2_TEST_MSG; 13*4882a593Smuzhiyun extern int RGA2_TEST_TIME; 14*4882a593Smuzhiyun extern int RGA2_CHECK_MODE; 15*4882a593Smuzhiyun extern int RGA2_NONUSE; 16*4882a593Smuzhiyun extern int RGA2_INT_FLAG; 17*4882a593Smuzhiyun 18*4882a593Smuzhiyun /* 19*4882a593Smuzhiyun * struct rga_debugger - RGA debugger information 20*4882a593Smuzhiyun * 21*4882a593Smuzhiyun * This structure represents a debugger to be created by the rga driver 22*4882a593Smuzhiyun * or core. 23*4882a593Smuzhiyun */ 24*4882a593Smuzhiyun struct rga_debugger { 25*4882a593Smuzhiyun #ifdef CONFIG_ROCKCHIP_RGA2_DEBUG_FS 26*4882a593Smuzhiyun /* Directory of debugfs file */ 27*4882a593Smuzhiyun struct dentry *debugfs_dir; 28*4882a593Smuzhiyun struct list_head debugfs_entry_list; 29*4882a593Smuzhiyun struct mutex debugfs_lock; 30*4882a593Smuzhiyun #endif 31*4882a593Smuzhiyun 32*4882a593Smuzhiyun #ifdef CONFIG_ROCKCHIP_RGA2_PROC_FS 33*4882a593Smuzhiyun /* Directory of procfs file */ 34*4882a593Smuzhiyun struct proc_dir_entry *procfs_dir; 35*4882a593Smuzhiyun struct list_head procfs_entry_list; 36*4882a593Smuzhiyun struct mutex procfs_lock; 37*4882a593Smuzhiyun #endif 38*4882a593Smuzhiyun }; 39*4882a593Smuzhiyun 40*4882a593Smuzhiyun /* 41*4882a593Smuzhiyun * struct rga_debugger_list - debugfs/procfs info list entry 42*4882a593Smuzhiyun * 43*4882a593Smuzhiyun * This structure represents a debugfs/procfs file to be created by the rga 44*4882a593Smuzhiyun * driver or core. 45*4882a593Smuzhiyun */ 46*4882a593Smuzhiyun struct rga_debugger_list { 47*4882a593Smuzhiyun /* File name */ 48*4882a593Smuzhiyun const char *name; 49*4882a593Smuzhiyun /* 50*4882a593Smuzhiyun * Show callback. &seq_file->private will be set to the &struct 51*4882a593Smuzhiyun * rga_debugger_node corresponding to the instance of this info on a given 52*4882a593Smuzhiyun * &struct rga_debugger. 53*4882a593Smuzhiyun */ 54*4882a593Smuzhiyun int (*show)(struct seq_file *seq, void *data); 55*4882a593Smuzhiyun /* 56*4882a593Smuzhiyun * Write callback. &seq_file->private will be set to the &struct 57*4882a593Smuzhiyun * rga_debugger_node corresponding to the instance of this info on a given 58*4882a593Smuzhiyun * &struct rga_debugger. 59*4882a593Smuzhiyun */ 60*4882a593Smuzhiyun ssize_t (*write)(struct file *file, const char __user *ubuf, size_t len, loff_t *offp); 61*4882a593Smuzhiyun /* Procfs/Debugfs private data. */ 62*4882a593Smuzhiyun void *data; 63*4882a593Smuzhiyun }; 64*4882a593Smuzhiyun 65*4882a593Smuzhiyun /* 66*4882a593Smuzhiyun * struct rga_debugger_node - Nodes for debugfs/procfs 67*4882a593Smuzhiyun * 68*4882a593Smuzhiyun * This structure represents each instance of procfs/debugfs created from the 69*4882a593Smuzhiyun * template. 70*4882a593Smuzhiyun */ 71*4882a593Smuzhiyun struct rga_debugger_node { 72*4882a593Smuzhiyun struct rga_debugger *debugger; 73*4882a593Smuzhiyun 74*4882a593Smuzhiyun /* template for this node. */ 75*4882a593Smuzhiyun const struct rga_debugger_list *info_ent; 76*4882a593Smuzhiyun 77*4882a593Smuzhiyun /* Each Procfs/Debugfs file. */ 78*4882a593Smuzhiyun #ifdef CONFIG_ROCKCHIP_RGA2_DEBUG_FS 79*4882a593Smuzhiyun struct dentry *dent; 80*4882a593Smuzhiyun #endif 81*4882a593Smuzhiyun 82*4882a593Smuzhiyun #ifdef CONFIG_ROCKCHIP_RGA2_PROC_FS 83*4882a593Smuzhiyun struct proc_dir_entry *pent; 84*4882a593Smuzhiyun #endif 85*4882a593Smuzhiyun 86*4882a593Smuzhiyun struct list_head list; 87*4882a593Smuzhiyun }; 88*4882a593Smuzhiyun 89*4882a593Smuzhiyun #ifdef CONFIG_ROCKCHIP_RGA2_DEBUG_FS 90*4882a593Smuzhiyun int rga2_debugfs_init(void); 91*4882a593Smuzhiyun int rga2_debugfs_remove(void); 92*4882a593Smuzhiyun #else rga2_debugfs_remove(void)93*4882a593Smuzhiyunstatic inline int rga2_debugfs_remove(void) 94*4882a593Smuzhiyun { 95*4882a593Smuzhiyun return 0; 96*4882a593Smuzhiyun } rga2_debugfs_init(void)97*4882a593Smuzhiyunstatic inline int rga2_debugfs_init(void) 98*4882a593Smuzhiyun { 99*4882a593Smuzhiyun return 0; 100*4882a593Smuzhiyun } 101*4882a593Smuzhiyun #endif /* #ifdef CONFIG_ROCKCHIP_RGA2_DEBUG_FS */ 102*4882a593Smuzhiyun 103*4882a593Smuzhiyun #ifdef CONFIG_ROCKCHIP_RGA2_PROC_FS 104*4882a593Smuzhiyun int rga2_procfs_remove(void); 105*4882a593Smuzhiyun int rga2_procfs_init(void); 106*4882a593Smuzhiyun #else rga2_procfs_remove(void)107*4882a593Smuzhiyunstatic inline int rga2_procfs_remove(void) 108*4882a593Smuzhiyun { 109*4882a593Smuzhiyun return 0; 110*4882a593Smuzhiyun } rga2_procfs_init(void)111*4882a593Smuzhiyunstatic inline int rga2_procfs_init(void) 112*4882a593Smuzhiyun { 113*4882a593Smuzhiyun return 0; 114*4882a593Smuzhiyun } 115*4882a593Smuzhiyun #endif /* #ifdef CONFIG_ROCKCHIP_RGA2_PROC_FS */ 116*4882a593Smuzhiyun 117*4882a593Smuzhiyun #endif /* #ifdef CONFIG_ROCKCHIP_RGA2_DEBUGGER */ 118*4882a593Smuzhiyun 119*4882a593Smuzhiyun #endif /* #ifndef _RGA_DEBUGGER_H_ */ 120*4882a593Smuzhiyun 121