xref: /OK3568_Linux_fs/kernel/drivers/gpu/arm/bifrost/ipa/mali_kbase_ipa_debugfs.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  *
4  * (C) COPYRIGHT 2017, 2020-2021 ARM Limited. All rights reserved.
5  *
6  * This program is free software and is provided to you under the terms of the
7  * GNU General Public License version 2 as published by the Free Software
8  * Foundation, and any use by you of this program is subject to the terms
9  * of such GNU license.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, you can access it online at
18  * http://www.gnu.org/licenses/gpl-2.0.html.
19  *
20  */
21 
22 #ifndef _KBASE_IPA_DEBUGFS_H_
23 #define _KBASE_IPA_DEBUGFS_H_
24 
25 enum kbase_ipa_model_param_type {
26 	PARAM_TYPE_S32 = 1,
27 	PARAM_TYPE_STRING,
28 };
29 
30 #if IS_ENABLED(CONFIG_DEBUG_FS)
31 
32 void kbase_ipa_debugfs_init(struct kbase_device *kbdev);
33 int kbase_ipa_model_param_add(struct kbase_ipa_model *model, const char *name,
34 			      void *addr, size_t size,
35 			      enum kbase_ipa_model_param_type type);
36 void kbase_ipa_model_param_free_all(struct kbase_ipa_model *model);
37 
38 /**
39  * kbase_ipa_model_param_set_s32 - Set an integer model parameter
40  *
41  * @model:	pointer to IPA model
42  * @name:	name of corresponding debugfs entry
43  * @val:	new value of the parameter
44  *
45  * This function is only exposed for use by unit tests running in
46  * kernel space. Normally it is expected that parameter values will
47  * instead be set via debugfs.
48  */
49 void kbase_ipa_model_param_set_s32(struct kbase_ipa_model *model,
50 	const char *name, s32 val);
51 
52 #else /* CONFIG_DEBUG_FS */
53 
kbase_ipa_model_param_add(struct kbase_ipa_model * model,const char * name,void * addr,size_t size,enum kbase_ipa_model_param_type type)54 static inline int kbase_ipa_model_param_add(struct kbase_ipa_model *model,
55 					    const char *name, void *addr,
56 					    size_t size,
57 					    enum kbase_ipa_model_param_type type)
58 {
59 	return 0;
60 }
61 
kbase_ipa_model_param_free_all(struct kbase_ipa_model * model)62 static inline void kbase_ipa_model_param_free_all(struct kbase_ipa_model *model)
63 { }
64 
kbase_ipa_model_param_set_s32(struct kbase_ipa_model * model,const char * name,s32 val)65 static inline void kbase_ipa_model_param_set_s32(struct kbase_ipa_model *model,
66 						 const char *name, s32 val)
67 { }
68 #endif /* CONFIG_DEBUG_FS */
69 
70 #endif /* _KBASE_IPA_DEBUGFS_H_ */
71