Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v6.14 116 lines 3.3 kB view raw
1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* 3 * Common functions for kernel modules using Dell SMBIOS 4 * 5 * Copyright (c) Red Hat <mjg@redhat.com> 6 * Copyright (c) 2014 Gabriele Mazzotta <gabriele.mzt@gmail.com> 7 * Copyright (c) 2014 Pali Rohár <pali@kernel.org> 8 * 9 * Based on documentation in the libsmbios package: 10 * Copyright (C) 2005-2014 Dell Inc. 11 */ 12 13#ifndef _DELL_SMBIOS_H_ 14#define _DELL_SMBIOS_H_ 15 16#include <linux/device.h> 17#include <uapi/linux/wmi.h> 18 19/* Classes and selects used only in kernel drivers */ 20#define CLASS_KBD_BACKLIGHT 4 21#define SELECT_KBD_BACKLIGHT 11 22#define SELECT_THERMAL_MANAGEMENT 19 23 24/* Tokens used in kernel drivers, any of these 25 * should be filtered from userspace access 26 */ 27#define BRIGHTNESS_TOKEN 0x007d 28#define KBD_LED_AC_TOKEN 0x0451 29#define KBD_LED_OFF_TOKEN 0x01E1 30#define KBD_LED_ON_TOKEN 0x01E2 31#define KBD_LED_AUTO_TOKEN 0x01E3 32#define KBD_LED_AUTO_25_TOKEN 0x02EA 33#define KBD_LED_AUTO_50_TOKEN 0x02EB 34#define KBD_LED_AUTO_75_TOKEN 0x02EC 35#define KBD_LED_AUTO_100_TOKEN 0x02F6 36#define BAT_PRI_AC_MODE_TOKEN 0x0341 37#define BAT_ADAPTIVE_MODE_TOKEN 0x0342 38#define BAT_CUSTOM_MODE_TOKEN 0x0343 39#define BAT_STANDARD_MODE_TOKEN 0x0346 40#define BAT_EXPRESS_MODE_TOKEN 0x0347 41#define BAT_CUSTOM_CHARGE_START 0x0349 42#define BAT_CUSTOM_CHARGE_END 0x034A 43#define GLOBAL_MIC_MUTE_ENABLE 0x0364 44#define GLOBAL_MIC_MUTE_DISABLE 0x0365 45#define GLOBAL_MUTE_ENABLE 0x058C 46#define GLOBAL_MUTE_DISABLE 0x058D 47 48struct notifier_block; 49 50struct calling_interface_token { 51 u16 tokenID; 52 u16 location; 53 union { 54 u16 value; 55 u16 stringlength; 56 }; 57}; 58 59struct calling_interface_structure { 60 struct dmi_header header; 61 u16 cmdIOAddress; 62 u8 cmdIOCode; 63 u32 supportedCmds; 64 struct calling_interface_token tokens[]; 65} __packed; 66 67int dell_smbios_register_device(struct device *d, void *call_fn); 68void dell_smbios_unregister_device(struct device *d); 69 70int dell_smbios_error(int value); 71int dell_smbios_call_filter(struct device *d, 72 struct calling_interface_buffer *buffer); 73int dell_smbios_call(struct calling_interface_buffer *buffer); 74 75void dell_fill_request(struct calling_interface_buffer *buffer, 76 u32 arg0, u32 arg1, u32 arg2, u32 arg3); 77int dell_send_request(struct calling_interface_buffer *buffer, 78 u16 class, u16 select); 79 80struct calling_interface_token *dell_smbios_find_token(int tokenid); 81 82enum dell_laptop_notifier_actions { 83 DELL_LAPTOP_KBD_BACKLIGHT_BRIGHTNESS_CHANGED, 84}; 85 86int dell_laptop_register_notifier(struct notifier_block *nb); 87int dell_laptop_unregister_notifier(struct notifier_block *nb); 88void dell_laptop_call_notifier(unsigned long action, void *data); 89bool dell_smbios_class_is_supported(u16 class); 90 91/* for the supported backends */ 92#ifdef CONFIG_DELL_SMBIOS_WMI 93int init_dell_smbios_wmi(void); 94void exit_dell_smbios_wmi(void); 95#else /* CONFIG_DELL_SMBIOS_WMI */ 96static inline int init_dell_smbios_wmi(void) 97{ 98 return -ENODEV; 99} 100static inline void exit_dell_smbios_wmi(void) 101{} 102#endif /* CONFIG_DELL_SMBIOS_WMI */ 103 104#ifdef CONFIG_DELL_SMBIOS_SMM 105int init_dell_smbios_smm(void); 106void exit_dell_smbios_smm(void); 107#else /* CONFIG_DELL_SMBIOS_SMM */ 108static inline int init_dell_smbios_smm(void) 109{ 110 return -ENODEV; 111} 112static inline void exit_dell_smbios_smm(void) 113{} 114#endif /* CONFIG_DELL_SMBIOS_SMM */ 115 116#endif /* _DELL_SMBIOS_H_ */