Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) #ifndef __FIRMWARE_FALLBACK_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) #define __FIRMWARE_FALLBACK_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) #include <linux/firmware.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) #include <linux/device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) #include "firmware.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)  * struct firmware_fallback_config - firmware fallback configuration settings
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)  * Helps describe and fine tune the fallback mechanism.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)  * @force_sysfs_fallback: force the sysfs fallback mechanism to be used
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)  * 	as if one had enabled CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)  * 	Useful to help debug a CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)  * 	functionality on a kernel where that config entry has been disabled.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)  * @ignore_sysfs_fallback: force to disable the sysfs fallback mechanism.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)  * 	This emulates the behaviour as if we had set the kernel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)  * 	config CONFIG_FW_LOADER_USER_HELPER=n.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)  * @old_timeout: for internal use
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)  * @loading_timeout: the timeout to wait for the fallback mechanism before
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)  * 	giving up, in seconds.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) struct firmware_fallback_config {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	unsigned int force_sysfs_fallback;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 	unsigned int ignore_sysfs_fallback;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	int old_timeout;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 	int loading_timeout;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #ifdef CONFIG_FW_LOADER_USER_HELPER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) int firmware_fallback_sysfs(struct firmware *fw, const char *name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 			    struct device *device,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 			    u32 opt_flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 			    int ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) void kill_pending_fw_fallback_reqs(bool only_kill_custom);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) void fw_fallback_set_cache_timeout(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) void fw_fallback_set_default_timeout(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) int register_sysfs_loader(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) void unregister_sysfs_loader(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #else /* CONFIG_FW_LOADER_USER_HELPER */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) static inline int firmware_fallback_sysfs(struct firmware *fw, const char *name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 					  struct device *device,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 					  u32 opt_flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 					  int ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 	/* Keep carrying over the same error */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) static inline void kill_pending_fw_fallback_reqs(bool only_kill_custom) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) static inline void fw_fallback_set_cache_timeout(void) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) static inline void fw_fallback_set_default_timeout(void) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) static inline int register_sysfs_loader(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) static inline void unregister_sysfs_loader(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) #endif /* CONFIG_FW_LOADER_USER_HELPER */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) #ifdef CONFIG_EFI_EMBEDDED_FIRMWARE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) int firmware_fallback_platform(struct fw_priv *fw_priv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) static inline int firmware_fallback_platform(struct fw_priv *fw_priv)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) 	return -ENOENT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) #endif /* __FIRMWARE_FALLBACK_H */