1 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only) */
2 /* Copyright(c) 2014 - 2020 Intel Corporation */
3 #ifndef ADF_CFG_H_
4 #define ADF_CFG_H_
5 
6 #include <linux/list.h>
7 #include <linux/rwsem.h>
8 #include <linux/debugfs.h>
9 #include "adf_accel_devices.h"
10 #include "adf_cfg_common.h"
11 #include "adf_cfg_strings.h"
12 
13 struct adf_cfg_key_val {
14 	char key[ADF_CFG_MAX_KEY_LEN_IN_BYTES];
15 	char val[ADF_CFG_MAX_VAL_LEN_IN_BYTES];
16 	enum adf_cfg_val_type type;
17 	struct list_head list;
18 };
19 
20 struct adf_cfg_section {
21 	char name[ADF_CFG_MAX_SECTION_LEN_IN_BYTES];
22 	struct list_head list;
23 	struct list_head param_head;
24 };
25 
26 struct adf_cfg_device_data {
27 	struct list_head sec_list;
28 	struct dentry *debug;
29 	struct rw_semaphore lock;
30 };
31 
32 int adf_cfg_dev_add(struct adf_accel_dev *accel_dev);
33 void adf_cfg_dev_remove(struct adf_accel_dev *accel_dev);
34 void adf_cfg_dev_dbgfs_add(struct adf_accel_dev *accel_dev);
35 void adf_cfg_dev_dbgfs_rm(struct adf_accel_dev *accel_dev);
36 int adf_cfg_section_add(struct adf_accel_dev *accel_dev, const char *name);
37 void adf_cfg_del_all(struct adf_accel_dev *accel_dev);
38 int adf_cfg_add_key_value_param(struct adf_accel_dev *accel_dev,
39 				const char *section_name,
40 				const char *key, const void *val,
41 				enum adf_cfg_val_type type);
42 int adf_cfg_get_param_value(struct adf_accel_dev *accel_dev,
43 			    const char *section, const char *name, char *value);
44 
45 #endif
46