linux/drivers/platform/x86/dell/dell-smbios.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 *  Common functions for kernel modules using Dell SMBIOS
 *
 *  Copyright (c) Red Hat <[email protected]>
 *  Copyright (c) 2014 Gabriele Mazzotta <[email protected]>
 *  Copyright (c) 2014 Pali Rohár <[email protected]>
 *
 *  Based on documentation in the libsmbios package:
 *  Copyright (C) 2005-2014 Dell Inc.
 */

#ifndef _DELL_SMBIOS_H_
#define _DELL_SMBIOS_H_

#include <linux/device.h>
#include <uapi/linux/wmi.h>

/* Classes and selects used only in kernel drivers */
#define CLASS_KBD_BACKLIGHT
#define SELECT_KBD_BACKLIGHT
#define SELECT_THERMAL_MANAGEMENT

/* Tokens used in kernel drivers, any of these
 * should be filtered from userspace access
 */
#define BRIGHTNESS_TOKEN
#define KBD_LED_AC_TOKEN
#define KBD_LED_OFF_TOKEN
#define KBD_LED_ON_TOKEN
#define KBD_LED_AUTO_TOKEN
#define KBD_LED_AUTO_25_TOKEN
#define KBD_LED_AUTO_50_TOKEN
#define KBD_LED_AUTO_75_TOKEN
#define KBD_LED_AUTO_100_TOKEN
#define BAT_PRI_AC_MODE_TOKEN
#define BAT_ADAPTIVE_MODE_TOKEN
#define BAT_CUSTOM_MODE_TOKEN
#define BAT_STANDARD_MODE_TOKEN
#define BAT_EXPRESS_MODE_TOKEN
#define BAT_CUSTOM_CHARGE_START
#define BAT_CUSTOM_CHARGE_END
#define GLOBAL_MIC_MUTE_ENABLE
#define GLOBAL_MIC_MUTE_DISABLE
#define GLOBAL_MUTE_ENABLE
#define GLOBAL_MUTE_DISABLE

struct notifier_block;

struct calling_interface_token {};

struct calling_interface_structure {} __packed;

int dell_smbios_register_device(struct device *d, void *call_fn);
void dell_smbios_unregister_device(struct device *d);

int dell_smbios_error(int value);
int dell_smbios_call_filter(struct device *d,
	struct calling_interface_buffer *buffer);
int dell_smbios_call(struct calling_interface_buffer *buffer);

void dell_fill_request(struct calling_interface_buffer *buffer,
			       u32 arg0, u32 arg1, u32 arg2, u32 arg3);
int dell_send_request(struct calling_interface_buffer *buffer,
			     u16 class, u16 select);

struct calling_interface_token *dell_smbios_find_token(int tokenid);

enum dell_laptop_notifier_actions {};

int dell_laptop_register_notifier(struct notifier_block *nb);
int dell_laptop_unregister_notifier(struct notifier_block *nb);
void dell_laptop_call_notifier(unsigned long action, void *data);
bool dell_smbios_class_is_supported(u16 class);

/* for the supported backends */
#ifdef CONFIG_DELL_SMBIOS_WMI
int init_dell_smbios_wmi(void);
void exit_dell_smbios_wmi(void);
#else /* CONFIG_DELL_SMBIOS_WMI */
static inline int init_dell_smbios_wmi(void)
{
	return -ENODEV;
}
static inline void exit_dell_smbios_wmi(void)
{}
#endif /* CONFIG_DELL_SMBIOS_WMI */

#ifdef CONFIG_DELL_SMBIOS_SMM
int init_dell_smbios_smm(void);
void exit_dell_smbios_smm(void);
#else /* CONFIG_DELL_SMBIOS_SMM */
static inline int init_dell_smbios_smm(void)
{
	return -ENODEV;
}
static inline void exit_dell_smbios_smm(void)
{}
#endif /* CONFIG_DELL_SMBIOS_SMM */

#endif /* _DELL_SMBIOS_H_ */