18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only) */
28c2ecf20Sopenharmony_ci/* Copyright(c) 2014 - 2020 Intel Corporation */
38c2ecf20Sopenharmony_ci#ifndef ADF_CFG_H_
48c2ecf20Sopenharmony_ci#define ADF_CFG_H_
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci#include <linux/list.h>
78c2ecf20Sopenharmony_ci#include <linux/rwsem.h>
88c2ecf20Sopenharmony_ci#include <linux/debugfs.h>
98c2ecf20Sopenharmony_ci#include "adf_accel_devices.h"
108c2ecf20Sopenharmony_ci#include "adf_cfg_common.h"
118c2ecf20Sopenharmony_ci#include "adf_cfg_strings.h"
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_cistruct adf_cfg_key_val {
148c2ecf20Sopenharmony_ci	char key[ADF_CFG_MAX_KEY_LEN_IN_BYTES];
158c2ecf20Sopenharmony_ci	char val[ADF_CFG_MAX_VAL_LEN_IN_BYTES];
168c2ecf20Sopenharmony_ci	enum adf_cfg_val_type type;
178c2ecf20Sopenharmony_ci	struct list_head list;
188c2ecf20Sopenharmony_ci};
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_cistruct adf_cfg_section {
218c2ecf20Sopenharmony_ci	char name[ADF_CFG_MAX_SECTION_LEN_IN_BYTES];
228c2ecf20Sopenharmony_ci	struct list_head list;
238c2ecf20Sopenharmony_ci	struct list_head param_head;
248c2ecf20Sopenharmony_ci};
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_cistruct adf_cfg_device_data {
278c2ecf20Sopenharmony_ci	struct list_head sec_list;
288c2ecf20Sopenharmony_ci	struct dentry *debug;
298c2ecf20Sopenharmony_ci	struct rw_semaphore lock;
308c2ecf20Sopenharmony_ci};
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ciint adf_cfg_dev_add(struct adf_accel_dev *accel_dev);
338c2ecf20Sopenharmony_civoid adf_cfg_dev_remove(struct adf_accel_dev *accel_dev);
348c2ecf20Sopenharmony_ciint adf_cfg_section_add(struct adf_accel_dev *accel_dev, const char *name);
358c2ecf20Sopenharmony_civoid adf_cfg_del_all(struct adf_accel_dev *accel_dev);
368c2ecf20Sopenharmony_ciint adf_cfg_add_key_value_param(struct adf_accel_dev *accel_dev,
378c2ecf20Sopenharmony_ci				const char *section_name,
388c2ecf20Sopenharmony_ci				const char *key, const void *val,
398c2ecf20Sopenharmony_ci				enum adf_cfg_val_type type);
408c2ecf20Sopenharmony_ciint adf_cfg_get_param_value(struct adf_accel_dev *accel_dev,
418c2ecf20Sopenharmony_ci			    const char *section, const char *name, char *value);
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci#endif
44