linux/drivers/platform/x86/huawei-wmi.c

// SPDX-License-Identifier: GPL-2.0
/*
 *  Huawei WMI laptop extras driver
 *
 *  Copyright (C) 2018	      Ayman Bagabas <[email protected]>
 */

#include <linux/acpi.h>
#include <linux/debugfs.h>
#include <linux/delay.h>
#include <linux/dmi.h>
#include <linux/input.h>
#include <linux/input/sparse-keymap.h>
#include <linux/leds.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/platform_device.h>
#include <linux/power_supply.h>
#include <linux/sysfs.h>
#include <linux/wmi.h>
#include <acpi/battery.h>

/*
 * Huawei WMI GUIDs
 */
#define HWMI_METHOD_GUID
#define HWMI_EVENT_GUID

/* Legacy GUIDs */
#define WMI0_EXPENSIVE_GUID
#define WMI0_EVENT_GUID

/* HWMI commands */

enum {};

hwmi_arg;

struct quirk_entry {};

static struct quirk_entry *quirks;

struct huawei_wmi_debug {};

struct huawei_wmi {};

static struct huawei_wmi *huawei_wmi;

static const struct key_entry huawei_wmi_keymap[] =;

static int battery_reset =;
static int report_brightness =;

module_param(battery_reset, bint, 0444);
MODULE_PARM_DESC();
module_param(report_brightness, bint, 0444);
MODULE_PARM_DESC();

/* Quirks */

static int __init dmi_matched(const struct dmi_system_id *dmi)
{}

static struct quirk_entry quirk_unknown =;

static struct quirk_entry quirk_battery_reset =;

static struct quirk_entry quirk_matebook_x =;

static const struct dmi_system_id huawei_quirks[] =;

/* Utils */

static int huawei_wmi_call(struct huawei_wmi *huawei,
			   struct acpi_buffer *in, struct acpi_buffer *out)
{}

/* HWMI takes a 64 bit input and returns either a package with 2 buffers, one of
 * 4 bytes and the other of 256 bytes, or one buffer of size 0x104 (260) bytes.
 * The first 4 bytes are ignored, we ignore the first 4 bytes buffer if we got a
 * package, or skip the first 4 if a buffer of 0x104 is used. The first byte of
 * the remaining 0x100 sized buffer has the return status of every call. In case
 * the return status is non-zero, we return -ENODEV but still copy the returned
 * buffer to the given buffer parameter (buf).
 */
static int huawei_wmi_cmd(u64 arg, u8 *buf, size_t buflen)
{}

/* LEDs */

static int huawei_wmi_micmute_led_set(struct led_classdev *led_cdev,
		enum led_brightness brightness)
{}

static void huawei_wmi_leds_setup(struct device *dev)
{}

/* Battery protection */

static int huawei_wmi_battery_get(int *start, int *end)
{}

static int huawei_wmi_battery_set(int start, int end)
{}

static ssize_t charge_control_start_threshold_show(struct device *dev,
		struct device_attribute *attr,
		char *buf)
{}

static ssize_t charge_control_end_threshold_show(struct device *dev,
		struct device_attribute *attr,
		char *buf)
{}

static ssize_t charge_control_thresholds_show(struct device *dev,
		struct device_attribute *attr,
		char *buf)
{}

static ssize_t charge_control_start_threshold_store(struct device *dev,
		struct device_attribute *attr,
		const char *buf, size_t size)
{}

static ssize_t charge_control_end_threshold_store(struct device *dev,
		struct device_attribute *attr,
		const char *buf, size_t size)
{}

static ssize_t charge_control_thresholds_store(struct device *dev,
		struct device_attribute *attr,
		const char *buf, size_t size)
{}

static DEVICE_ATTR_RW(charge_control_start_threshold);
static DEVICE_ATTR_RW(charge_control_end_threshold);
static DEVICE_ATTR_RW(charge_control_thresholds);

static int huawei_wmi_battery_add(struct power_supply *battery, struct acpi_battery_hook *hook)
{}

static int huawei_wmi_battery_remove(struct power_supply *battery, struct acpi_battery_hook *hook)
{}

static struct acpi_battery_hook huawei_wmi_battery_hook =;

static void huawei_wmi_battery_setup(struct device *dev)
{}

static void huawei_wmi_battery_exit(struct device *dev)
{}

/* Fn lock */

static int huawei_wmi_fn_lock_get(int *on)
{}

static int huawei_wmi_fn_lock_set(int on)
{}

static ssize_t fn_lock_state_show(struct device *dev,
		struct device_attribute *attr,
		char *buf)
{}

static ssize_t fn_lock_state_store(struct device *dev,
		struct device_attribute *attr,
		const char *buf, size_t size)
{}

static DEVICE_ATTR_RW(fn_lock_state);

static void huawei_wmi_fn_lock_setup(struct device *dev)
{}

static void huawei_wmi_fn_lock_exit(struct device *dev)
{}

/* debugfs */

static void huawei_wmi_debugfs_call_dump(struct seq_file *m, void *data,
		union acpi_object *obj)
{}

static int huawei_wmi_debugfs_call_show(struct seq_file *m, void *data)
{}

DEFINE_SHOW_ATTRIBUTE();

static void huawei_wmi_debugfs_setup(struct device *dev)
{}

static void huawei_wmi_debugfs_exit(struct device *dev)
{}

/* Input */

static void huawei_wmi_process_key(struct input_dev *idev, int code)
{}

static void huawei_wmi_input_notify(u32 value, void *context)
{}

static int huawei_wmi_input_setup(struct device *dev, const char *guid)
{}

static void huawei_wmi_input_exit(struct device *dev, const char *guid)
{}

/* Huawei driver */

static const struct wmi_device_id huawei_wmi_events_id_table[] =;

static int huawei_wmi_probe(struct platform_device *pdev)
{}

static void huawei_wmi_remove(struct platform_device *pdev)
{}

static struct platform_driver huawei_wmi_driver =;

static __init int huawei_wmi_init(void)
{}

static __exit void huawei_wmi_exit(void)
{}

module_init();
module_exit(huawei_wmi_exit);

MODULE_ALIAS();
MODULE_DEVICE_TABLE(wmi, huawei_wmi_events_id_table);
MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();