18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ci#include <linux/types.h>
48c2ecf20Sopenharmony_ci#include <linux/kconfig.h>
58c2ecf20Sopenharmony_ci#include <linux/list.h>
68c2ecf20Sopenharmony_ci#include <linux/slab.h>
78c2ecf20Sopenharmony_ci#include <linux/security.h>
88c2ecf20Sopenharmony_ci#include <linux/highmem.h>
98c2ecf20Sopenharmony_ci#include <linux/umh.h>
108c2ecf20Sopenharmony_ci#include <linux/sysctl.h>
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include "fallback.h"
138c2ecf20Sopenharmony_ci#include "firmware.h"
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci/*
168c2ecf20Sopenharmony_ci * firmware fallback configuration table
178c2ecf20Sopenharmony_ci */
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_cistruct firmware_fallback_config fw_fallback_config = {
208c2ecf20Sopenharmony_ci	.force_sysfs_fallback = IS_ENABLED(CONFIG_FW_LOADER_USER_HELPER_FALLBACK),
218c2ecf20Sopenharmony_ci	.loading_timeout = 60,
228c2ecf20Sopenharmony_ci	.old_timeout = 60,
238c2ecf20Sopenharmony_ci};
248c2ecf20Sopenharmony_ciEXPORT_SYMBOL_NS_GPL(fw_fallback_config, FIRMWARE_LOADER_PRIVATE);
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci#ifdef CONFIG_SYSCTL
278c2ecf20Sopenharmony_cistruct ctl_table firmware_config_table[] = {
288c2ecf20Sopenharmony_ci	{
298c2ecf20Sopenharmony_ci		.procname	= "force_sysfs_fallback",
308c2ecf20Sopenharmony_ci		.data		= &fw_fallback_config.force_sysfs_fallback,
318c2ecf20Sopenharmony_ci		.maxlen         = sizeof(unsigned int),
328c2ecf20Sopenharmony_ci		.mode           = 0644,
338c2ecf20Sopenharmony_ci		.proc_handler   = proc_douintvec_minmax,
348c2ecf20Sopenharmony_ci		.extra1		= SYSCTL_ZERO,
358c2ecf20Sopenharmony_ci		.extra2		= SYSCTL_ONE,
368c2ecf20Sopenharmony_ci	},
378c2ecf20Sopenharmony_ci	{
388c2ecf20Sopenharmony_ci		.procname	= "ignore_sysfs_fallback",
398c2ecf20Sopenharmony_ci		.data		= &fw_fallback_config.ignore_sysfs_fallback,
408c2ecf20Sopenharmony_ci		.maxlen         = sizeof(unsigned int),
418c2ecf20Sopenharmony_ci		.mode           = 0644,
428c2ecf20Sopenharmony_ci		.proc_handler   = proc_douintvec_minmax,
438c2ecf20Sopenharmony_ci		.extra1		= SYSCTL_ZERO,
448c2ecf20Sopenharmony_ci		.extra2		= SYSCTL_ONE,
458c2ecf20Sopenharmony_ci	},
468c2ecf20Sopenharmony_ci	{ }
478c2ecf20Sopenharmony_ci};
488c2ecf20Sopenharmony_ci#endif
49