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-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *  Common functions for kernel modules using Dell SMBIOS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *  Copyright (c) Red Hat <mjg@redhat.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *  Copyright (c) 2014 Gabriele Mazzotta <gabriele.mzt@gmail.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  *  Copyright (c) 2014 Pali Rohár <pali@kernel.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  *  Based on documentation in the libsmbios package:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  *  Copyright (C) 2005-2014 Dell Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #ifndef _DELL_SMBIOS_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #define _DELL_SMBIOS_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include <linux/device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include <uapi/linux/wmi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) /* Classes and selects used only in kernel drivers */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #define CLASS_KBD_BACKLIGHT 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #define SELECT_KBD_BACKLIGHT 11
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) /* Tokens used in kernel drivers, any of these
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  * should be filtered from userspace access
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #define BRIGHTNESS_TOKEN	0x007d
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #define KBD_LED_AC_TOKEN	0x0451
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #define KBD_LED_OFF_TOKEN	0x01E1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) #define KBD_LED_ON_TOKEN	0x01E2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #define KBD_LED_AUTO_TOKEN	0x01E3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) #define KBD_LED_AUTO_25_TOKEN	0x02EA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #define KBD_LED_AUTO_50_TOKEN	0x02EB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #define KBD_LED_AUTO_75_TOKEN	0x02EC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) #define KBD_LED_AUTO_100_TOKEN	0x02F6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) #define GLOBAL_MIC_MUTE_ENABLE	0x0364
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) #define GLOBAL_MIC_MUTE_DISABLE	0x0365
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) struct notifier_block;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) struct calling_interface_token {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	u16 tokenID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	u16 location;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 		u16 value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 		u16 stringlength;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) struct calling_interface_structure {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	struct dmi_header header;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	u16 cmdIOAddress;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	u8 cmdIOCode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	u32 supportedCmds;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	struct calling_interface_token tokens[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) int dell_smbios_register_device(struct device *d, void *call_fn);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) void dell_smbios_unregister_device(struct device *d);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) int dell_smbios_error(int value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) int dell_smbios_call_filter(struct device *d,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	struct calling_interface_buffer *buffer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) int dell_smbios_call(struct calling_interface_buffer *buffer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) struct calling_interface_token *dell_smbios_find_token(int tokenid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) enum dell_laptop_notifier_actions {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	DELL_LAPTOP_KBD_BACKLIGHT_BRIGHTNESS_CHANGED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) int dell_laptop_register_notifier(struct notifier_block *nb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) int dell_laptop_unregister_notifier(struct notifier_block *nb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) void dell_laptop_call_notifier(unsigned long action, void *data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) /* for the supported backends */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) #ifdef CONFIG_DELL_SMBIOS_WMI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) int init_dell_smbios_wmi(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) void exit_dell_smbios_wmi(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) #else /* CONFIG_DELL_SMBIOS_WMI */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) static inline int init_dell_smbios_wmi(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) static inline void exit_dell_smbios_wmi(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) #endif /* CONFIG_DELL_SMBIOS_WMI */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) #ifdef CONFIG_DELL_SMBIOS_SMM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) int init_dell_smbios_smm(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) void exit_dell_smbios_smm(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) #else /* CONFIG_DELL_SMBIOS_SMM */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) static inline int init_dell_smbios_smm(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) static inline void exit_dell_smbios_smm(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) #endif /* CONFIG_DELL_SMBIOS_SMM */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) #endif /* _DELL_SMBIOS_H_ */