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

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Asus PC WMI hotkey driver
 *
 * Copyright(C) 2010 Intel Corporation.
 * Copyright(C) 2010-2011 Corentin Chary <[email protected]>
 *
 * Portions based on wistron_btns.c:
 * Copyright (C) 2005 Miloslav Trmac <[email protected]>
 * Copyright (C) 2005 Bernhard Rosenkraenzer <[email protected]>
 * Copyright (C) 2005 Dmitry Torokhov <[email protected]>
 */

#define pr_fmt(fmt)

#include <linux/acpi.h>
#include <linux/backlight.h>
#include <linux/debugfs.h>
#include <linux/delay.h>
#include <linux/dmi.h>
#include <linux/fb.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/init.h>
#include <linux/input.h>
#include <linux/input/sparse-keymap.h>
#include <linux/kernel.h>
#include <linux/leds.h>
#include <linux/minmax.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/pci_hotplug.h>
#include <linux/platform_data/x86/asus-wmi.h>
#include <linux/platform_device.h>
#include <linux/platform_profile.h>
#include <linux/power_supply.h>
#include <linux/rfkill.h>
#include <linux/seq_file.h>
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/units.h>

#include <acpi/battery.h>
#include <acpi/video.h>

#include "asus-wmi.h"

MODULE_AUTHOR();
MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();

static bool fnlock_default =;
module_param(fnlock_default, bool, 0444);

#define to_asus_wmi_driver(pdrv)

#define ASUS_WMI_MGMT_GUID

#define NOTIFY_BRNUP_MIN
#define NOTIFY_BRNUP_MAX
#define NOTIFY_BRNDOWN_MIN
#define NOTIFY_BRNDOWN_MAX
#define NOTIFY_FNLOCK_TOGGLE
#define NOTIFY_KBD_DOCK_CHANGE
#define NOTIFY_KBD_BRTUP
#define NOTIFY_KBD_BRTDWN
#define NOTIFY_KBD_BRTTOGGLE
#define NOTIFY_KBD_FBM
#define NOTIFY_KBD_TTP
#define NOTIFY_LID_FLIP
#define NOTIFY_LID_FLIP_ROG

#define ASUS_WMI_FNLOCK_BIOS_DISABLED

#define ASUS_MID_FAN_DESC
#define ASUS_GPU_FAN_DESC
#define ASUS_FAN_DESC
#define ASUS_FAN_MFUN
#define ASUS_FAN_SFUN_READ
#define ASUS_FAN_SFUN_WRITE

/* Based on standard hwmon pwmX_enable values */
#define ASUS_FAN_CTRL_FULLSPEED
#define ASUS_FAN_CTRL_MANUAL
#define ASUS_FAN_CTRL_AUTO

#define ASUS_FAN_BOOST_MODE_NORMAL
#define ASUS_FAN_BOOST_MODE_OVERBOOST
#define ASUS_FAN_BOOST_MODE_OVERBOOST_MASK
#define ASUS_FAN_BOOST_MODE_SILENT
#define ASUS_FAN_BOOST_MODE_SILENT_MASK
#define ASUS_FAN_BOOST_MODES_MASK

#define ASUS_THROTTLE_THERMAL_POLICY_DEFAULT
#define ASUS_THROTTLE_THERMAL_POLICY_OVERBOOST
#define ASUS_THROTTLE_THERMAL_POLICY_SILENT

#define USB_INTEL_XUSB2PR
#define PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI

#define ASUS_ACPI_UID_ASUSWMI

#define WMI_EVENT_MASK

#define FAN_CURVE_POINTS
#define FAN_CURVE_BUF_LEN
#define FAN_CURVE_DEV_CPU
#define FAN_CURVE_DEV_GPU
#define FAN_CURVE_DEV_MID
/* Mask to determine if setting temperature or percentage */
#define FAN_CURVE_PWM_MASK

/* Limits for tunables available on ASUS ROG laptops */
#define PPT_TOTAL_MIN
#define PPT_TOTAL_MAX
#define PPT_CPU_MIN
#define PPT_CPU_MAX
#define NVIDIA_BOOST_MIN
#define NVIDIA_BOOST_MAX
#define NVIDIA_TEMP_MIN
#define NVIDIA_TEMP_MAX

#define ASUS_SCREENPAD_BRIGHT_MIN
#define ASUS_SCREENPAD_BRIGHT_MAX
#define ASUS_SCREENPAD_BRIGHT_DEFAULT

#define ASUS_MINI_LED_MODE_MASK
/* Standard modes for devices with only on/off */
#define ASUS_MINI_LED_OFF
#define ASUS_MINI_LED_ON
/* New mode on some devices, define here to clarify remapping later */
#define ASUS_MINI_LED_STRONG_MODE
/* New modes for devices with 3 mini-led mode types */
#define ASUS_MINI_LED_2024_WEAK
#define ASUS_MINI_LED_2024_STRONG
#define ASUS_MINI_LED_2024_OFF

/* Controls the power state of the USB0 hub on ROG Ally which input is on */
#define ASUS_USB0_PWR_EC0_CSEE
/* 300ms so far seems to produce a reliable result on AC and battery */
#define ASUS_USB0_PWR_EC0_CSEE_WAIT

static const char * const ashs_ids[] =;

static int throttle_thermal_policy_write(struct asus_wmi *);

static bool ashs_present(void)
{}

struct bios_args {} __packed;

/*
 * Struct that's used for all methods called via AGFN. Naming is
 * identically to the AML code.
 */
struct agfn_args {} __packed;

/* struct used for calling fan read and write methods */
struct agfn_fan_args {} __packed;

/*
 * <platform>/    - debugfs root directory
 *   dev_id      - current dev_id
 *   ctrl_param  - current ctrl_param
 *   method_id   - current method_id
 *   devs        - call DEVS(dev_id, ctrl_param) and print result
 *   dsts        - call DSTS(dev_id)  and print result
 *   call        - call method_id(dev_id, ctrl_param) and print result
 */
struct asus_wmi_debug {};

struct asus_rfkill {};

enum fan_type {};

struct fan_curve_data {};

struct asus_wmi {};

/* WMI ************************************************************************/

static int asus_wmi_evaluate_method3(u32 method_id,
		u32 arg0, u32 arg1, u32 arg2, u32 *retval)
{}

int asus_wmi_evaluate_method(u32 method_id, u32 arg0, u32 arg1, u32 *retval)
{}
EXPORT_SYMBOL_GPL();

static int asus_wmi_evaluate_method5(u32 method_id,
		u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4, u32 *retval)
{}

/*
 * Returns as an error if the method output is not a buffer. Typically this
 * means that the method called is unsupported.
 */
static int asus_wmi_evaluate_method_buf(u32 method_id,
		u32 arg0, u32 arg1, u8 *ret_buffer, size_t size)
{}

static int asus_wmi_evaluate_method_agfn(const struct acpi_buffer args)
{}

static int asus_wmi_get_devstate(struct asus_wmi *asus, u32 dev_id, u32 *retval)
{}

static int asus_wmi_set_devstate(u32 dev_id, u32 ctrl_param,
				 u32 *retval)
{}

/* Helper for special devices with magic return codes */
static int asus_wmi_get_devstate_bits(struct asus_wmi *asus,
				      u32 dev_id, u32 mask)
{}

static int asus_wmi_get_devstate_simple(struct asus_wmi *asus, u32 dev_id)
{}

static bool asus_wmi_dev_is_present(struct asus_wmi *asus, u32 dev_id)
{}

/* Input **********************************************************************/
static void asus_wmi_tablet_sw_report(struct asus_wmi *asus, bool value)
{}

static void asus_wmi_tablet_sw_init(struct asus_wmi *asus, u32 dev_id, int event_code)
{}

static int asus_wmi_input_init(struct asus_wmi *asus)
{}

static void asus_wmi_input_exit(struct asus_wmi *asus)
{}

/* Tablet mode ****************************************************************/

static void asus_wmi_tablet_mode_get_state(struct asus_wmi *asus)
{}

/* Charging mode, 1=Barrel, 2=USB ******************************************/
static ssize_t charge_mode_show(struct device *dev,
				   struct device_attribute *attr, char *buf)
{}

static DEVICE_ATTR_RO(charge_mode);

/* dGPU ********************************************************************/
static ssize_t dgpu_disable_show(struct device *dev,
				   struct device_attribute *attr, char *buf)
{}

/*
 * A user may be required to store the value twice, typcial store first, then
 * rescan PCI bus to activate power, then store a second time to save correctly.
 * The reason for this is that an extra code path in the ACPI is enabled when
 * the device and bus are powered.
 */
static ssize_t dgpu_disable_store(struct device *dev,
				    struct device_attribute *attr,
				    const char *buf, size_t count)
{}
static DEVICE_ATTR_RW(dgpu_disable);

/* eGPU ********************************************************************/
static ssize_t egpu_enable_show(struct device *dev,
				   struct device_attribute *attr, char *buf)
{}

/* The ACPI call to enable the eGPU also disables the internal dGPU */
static ssize_t egpu_enable_store(struct device *dev,
				    struct device_attribute *attr,
				    const char *buf, size_t count)
{}
static DEVICE_ATTR_RW(egpu_enable);

/* Is eGPU connected? *********************************************************/
static ssize_t egpu_connected_show(struct device *dev,
				   struct device_attribute *attr, char *buf)
{}

static DEVICE_ATTR_RO(egpu_connected);

/* gpu mux switch *************************************************************/
static ssize_t gpu_mux_mode_show(struct device *dev,
				 struct device_attribute *attr, char *buf)
{}

static ssize_t gpu_mux_mode_store(struct device *dev,
				  struct device_attribute *attr,
				  const char *buf, size_t count)
{}
static DEVICE_ATTR_RW(gpu_mux_mode);

/* TUF Laptop Keyboard RGB Modes **********************************************/
static ssize_t kbd_rgb_mode_store(struct device *dev,
				 struct device_attribute *attr,
				 const char *buf, size_t count)
{}
static DEVICE_ATTR_WO(kbd_rgb_mode);

static DEVICE_STRING_ATTR_RO(kbd_rgb_mode_index, 0444,
			     "cmd mode red green blue speed");

static struct attribute *kbd_rgb_mode_attrs[] =;

static const struct attribute_group kbd_rgb_mode_group =;

/* TUF Laptop Keyboard RGB State **********************************************/
static ssize_t kbd_rgb_state_store(struct device *dev,
				 struct device_attribute *attr,
				 const char *buf, size_t count)
{}
static DEVICE_ATTR_WO(kbd_rgb_state);

static DEVICE_STRING_ATTR_RO(kbd_rgb_state_index, 0444,
			     "cmd boot awake sleep keyboard");

static struct attribute *kbd_rgb_state_attrs[] =;

static const struct attribute_group kbd_rgb_state_group =;

static const struct attribute_group *kbd_rgb_mode_groups[] =;

/* Tunable: PPT: Intel=PL1, AMD=SPPT *****************************************/
static ssize_t ppt_pl2_sppt_store(struct device *dev,
				    struct device_attribute *attr,
				    const char *buf, size_t count)
{}

static ssize_t ppt_pl2_sppt_show(struct device *dev,
				       struct device_attribute *attr,
				       char *buf)
{}
static DEVICE_ATTR_RW(ppt_pl2_sppt);

/* Tunable: PPT, Intel=PL1, AMD=SPL ******************************************/
static ssize_t ppt_pl1_spl_store(struct device *dev,
				    struct device_attribute *attr,
				    const char *buf, size_t count)
{}
static ssize_t ppt_pl1_spl_show(struct device *dev,
				 struct device_attribute *attr,
				 char *buf)
{}
static DEVICE_ATTR_RW(ppt_pl1_spl);

/* Tunable: PPT APU FPPT ******************************************************/
static ssize_t ppt_fppt_store(struct device *dev,
				    struct device_attribute *attr,
				    const char *buf, size_t count)
{}

static ssize_t ppt_fppt_show(struct device *dev,
				struct device_attribute *attr,
				char *buf)
{}
static DEVICE_ATTR_RW(ppt_fppt);

/* Tunable: PPT APU SPPT *****************************************************/
static ssize_t ppt_apu_sppt_store(struct device *dev,
				    struct device_attribute *attr,
				    const char *buf, size_t count)
{}

static ssize_t ppt_apu_sppt_show(struct device *dev,
			     struct device_attribute *attr,
			     char *buf)
{}
static DEVICE_ATTR_RW(ppt_apu_sppt);

/* Tunable: PPT platform SPPT ************************************************/
static ssize_t ppt_platform_sppt_store(struct device *dev,
				    struct device_attribute *attr,
				    const char *buf, size_t count)
{}

static ssize_t ppt_platform_sppt_show(struct device *dev,
				 struct device_attribute *attr,
				 char *buf)
{}
static DEVICE_ATTR_RW(ppt_platform_sppt);

/* Tunable: NVIDIA dynamic boost *********************************************/
static ssize_t nv_dynamic_boost_store(struct device *dev,
				    struct device_attribute *attr,
				    const char *buf, size_t count)
{}

static ssize_t nv_dynamic_boost_show(struct device *dev,
				      struct device_attribute *attr,
				      char *buf)
{}
static DEVICE_ATTR_RW(nv_dynamic_boost);

/* Tunable: NVIDIA temperature target ****************************************/
static ssize_t nv_temp_target_store(struct device *dev,
				    struct device_attribute *attr,
				    const char *buf, size_t count)
{}

static ssize_t nv_temp_target_show(struct device *dev,
				     struct device_attribute *attr,
				     char *buf)
{}
static DEVICE_ATTR_RW(nv_temp_target);

/* Ally MCU Powersave ********************************************************/
static ssize_t mcu_powersave_show(struct device *dev,
				   struct device_attribute *attr, char *buf)
{}

static ssize_t mcu_powersave_store(struct device *dev,
				    struct device_attribute *attr,
				    const char *buf, size_t count)
{}
static DEVICE_ATTR_RW(mcu_powersave);

/* Battery ********************************************************************/

/* The battery maximum charging percentage */
static int charge_end_threshold;

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

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

static DEVICE_ATTR_RW(charge_control_end_threshold);

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

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

static struct acpi_battery_hook battery_hook =;

static void asus_wmi_battery_init(struct asus_wmi *asus)
{}

static void asus_wmi_battery_exit(struct asus_wmi *asus)
{}

/* LEDs ***********************************************************************/

/*
 * These functions actually update the LED's, and are called from a
 * workqueue. By doing this as separate work rather than when the LED
 * subsystem asks, we avoid messing with the Asus ACPI stuff during a
 * potentially bad time, such as a timer interrupt.
 */
static void tpd_led_update(struct work_struct *work)
{}

static void tpd_led_set(struct led_classdev *led_cdev,
			enum led_brightness value)
{}

static int read_tpd_led_state(struct asus_wmi *asus)
{}

static enum led_brightness tpd_led_get(struct led_classdev *led_cdev)
{}

static void kbd_led_update(struct asus_wmi *asus)
{}

static int kbd_led_read(struct asus_wmi *asus, int *level, int *env)
{}

static void do_kbd_led_set(struct led_classdev *led_cdev, int value)
{}

static void kbd_led_set(struct led_classdev *led_cdev,
			enum led_brightness value)
{}

static void kbd_led_set_by_kbd(struct asus_wmi *asus, enum led_brightness value)
{}

static enum led_brightness kbd_led_get(struct led_classdev *led_cdev)
{}

static int wlan_led_unknown_state(struct asus_wmi *asus)
{}

static void wlan_led_update(struct work_struct *work)
{}

static void wlan_led_set(struct led_classdev *led_cdev,
			 enum led_brightness value)
{}

static enum led_brightness wlan_led_get(struct led_classdev *led_cdev)
{}

static void lightbar_led_update(struct work_struct *work)
{}

static void lightbar_led_set(struct led_classdev *led_cdev,
			     enum led_brightness value)
{}

static enum led_brightness lightbar_led_get(struct led_classdev *led_cdev)
{}

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

static enum led_brightness camera_led_get(struct led_classdev *led_cdev)
{}

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

static void asus_wmi_led_exit(struct asus_wmi *asus)
{}

static int asus_wmi_led_init(struct asus_wmi *asus)
{}

/* RF *************************************************************************/

/*
 * PCI hotplug (for wlan rfkill)
 */
static bool asus_wlan_rfkill_blocked(struct asus_wmi *asus)
{}

static void asus_rfkill_hotplug(struct asus_wmi *asus)
{}

static void asus_rfkill_notify(acpi_handle handle, u32 event, void *data)
{}

static int asus_register_rfkill_notifier(struct asus_wmi *asus, char *node)
{}

static void asus_unregister_rfkill_notifier(struct asus_wmi *asus, char *node)
{}

static int asus_get_adapter_status(struct hotplug_slot *hotplug_slot,
				   u8 *value)
{}

static const struct hotplug_slot_ops asus_hotplug_slot_ops =;

static void asus_hotplug_work(struct work_struct *work)
{}

static int asus_setup_pci_hotplug(struct asus_wmi *asus)
{}

/*
 * Rfkill devices
 */
static int asus_rfkill_set(void *data, bool blocked)
{}

static void asus_rfkill_query(struct rfkill *rfkill, void *data)
{}

static int asus_rfkill_wlan_set(void *data, bool blocked)
{}

static const struct rfkill_ops asus_rfkill_wlan_ops =;

static const struct rfkill_ops asus_rfkill_ops =;

static int asus_new_rfkill(struct asus_wmi *asus,
			   struct asus_rfkill *arfkill,
			   const char *name, enum rfkill_type type, int dev_id)
{}

static void asus_wmi_rfkill_exit(struct asus_wmi *asus)
{}

static int asus_wmi_rfkill_init(struct asus_wmi *asus)
{}

/* Panel Overdrive ************************************************************/
static ssize_t panel_od_show(struct device *dev,
				   struct device_attribute *attr, char *buf)
{}

static ssize_t panel_od_store(struct device *dev,
				    struct device_attribute *attr,
				    const char *buf, size_t count)
{}
static DEVICE_ATTR_RW(panel_od);

/* Bootup sound ***************************************************************/

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

static ssize_t boot_sound_store(struct device *dev,
			      struct device_attribute *attr,
			      const char *buf, size_t count)
{}
static DEVICE_ATTR_RW(boot_sound);

/* Mini-LED mode **************************************************************/
static ssize_t mini_led_mode_show(struct device *dev,
				   struct device_attribute *attr, char *buf)
{}

static ssize_t mini_led_mode_store(struct device *dev,
				    struct device_attribute *attr,
				    const char *buf, size_t count)
{}
static DEVICE_ATTR_RW(mini_led_mode);

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

static DEVICE_ATTR_RO(available_mini_led_mode);

/* Quirks *********************************************************************/

static void asus_wmi_set_xusb2pr(struct asus_wmi *asus)
{}

/*
 * Some devices dont support or have borcken get_als method
 * but still support set method.
 */
static void asus_wmi_set_als(void)
{}

/* Hwmon device ***************************************************************/

static int asus_agfn_fan_speed_read(struct asus_wmi *asus, int fan,
					  int *speed)
{}

static int asus_agfn_fan_speed_write(struct asus_wmi *asus, int fan,
				     int *speed)
{}

/*
 * Check if we can read the speed of one fan. If true we assume we can also
 * control it.
 */
static bool asus_wmi_has_agfn_fan(struct asus_wmi *asus)
{}

static int asus_fan_set_auto(struct asus_wmi *asus)
{}

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

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

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

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

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

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

/* GPU fan on modern ROG laptops */
static ssize_t fan2_input_show(struct device *dev,
					struct device_attribute *attr,
					char *buf)
{}

/* Middle/Center fan on modern ROG laptops */
static ssize_t fan3_input_show(struct device *dev,
					struct device_attribute *attr,
					char *buf)
{}

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

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

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

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

/* Fan1 */
static DEVICE_ATTR_RW(pwm1);
static DEVICE_ATTR_RW(pwm1_enable);
static DEVICE_ATTR_RO(fan1_input);
static DEVICE_STRING_ATTR_RO(fan1_label, 0444, ASUS_FAN_DESC);

/* Fan2 - GPU fan */
static DEVICE_ATTR_RW(pwm2_enable);
static DEVICE_ATTR_RO(fan2_input);
static DEVICE_STRING_ATTR_RO(fan2_label, 0444, ASUS_GPU_FAN_DESC);
/* Fan3 - Middle/center fan */
static DEVICE_ATTR_RW(pwm3_enable);
static DEVICE_ATTR_RO(fan3_input);
static DEVICE_STRING_ATTR_RO(fan3_label, 0444, ASUS_MID_FAN_DESC);

/* Temperature */
static DEVICE_ATTR(temp1_input, S_IRUGO, asus_hwmon_temp1, NULL);

static struct attribute *hwmon_attributes[] =;

static umode_t asus_hwmon_sysfs_is_visible(struct kobject *kobj,
					  struct attribute *attr, int idx)
{}

static const struct attribute_group hwmon_attribute_group =;
__ATTRIBUTE_GROUPS();

static int asus_wmi_hwmon_init(struct asus_wmi *asus)
{}

static int asus_wmi_fan_init(struct asus_wmi *asus)
{}

/* Fan mode *******************************************************************/

static int fan_boost_mode_check_present(struct asus_wmi *asus)
{}

static int fan_boost_mode_write(struct asus_wmi *asus)
{}

static int fan_boost_mode_switch_next(struct asus_wmi *asus)
{}

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

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

// Fan boost mode: 0 - normal, 1 - overboost, 2 - silent
static DEVICE_ATTR_RW(fan_boost_mode);

/* Custom fan curves **********************************************************/

static void fan_curve_copy_from_buf(struct fan_curve_data *data, u8 *buf)
{}

static int fan_curve_get_factory_default(struct asus_wmi *asus, u32 fan_dev)
{}

/* Check if capability exists, and populate defaults */
static int fan_curve_check_present(struct asus_wmi *asus, bool *available,
				   u32 fan_dev)
{}

/* Determine which fan the attribute is for if SENSOR_ATTR */
static struct fan_curve_data *fan_curve_attr_select(struct asus_wmi *asus,
					      struct device_attribute *attr)
{}

/* Determine which fan the attribute is for if SENSOR_ATTR_2 */
static struct fan_curve_data *fan_curve_attr_2_select(struct asus_wmi *asus,
					    struct device_attribute *attr)
{}

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

/*
 * "fan_dev" is the related WMI method such as ASUS_WMI_DEVID_CPU_FAN_CURVE.
 */
static int fan_curve_write(struct asus_wmi *asus,
			   struct fan_curve_data *data)
{}

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

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

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

/* CPU */
static SENSOR_DEVICE_ATTR_RW(pwm1_enable, fan_curve_enable, FAN_CURVE_DEV_CPU);
static SENSOR_DEVICE_ATTR_2_RW(pwm1_auto_point1_temp, fan_curve,
			       FAN_CURVE_DEV_CPU, 0);
static SENSOR_DEVICE_ATTR_2_RW(pwm1_auto_point2_temp, fan_curve,
			       FAN_CURVE_DEV_CPU, 1);
static SENSOR_DEVICE_ATTR_2_RW(pwm1_auto_point3_temp, fan_curve,
			       FAN_CURVE_DEV_CPU, 2);
static SENSOR_DEVICE_ATTR_2_RW(pwm1_auto_point4_temp, fan_curve,
			       FAN_CURVE_DEV_CPU, 3);
static SENSOR_DEVICE_ATTR_2_RW(pwm1_auto_point5_temp, fan_curve,
			       FAN_CURVE_DEV_CPU, 4);
static SENSOR_DEVICE_ATTR_2_RW(pwm1_auto_point6_temp, fan_curve,
			       FAN_CURVE_DEV_CPU, 5);
static SENSOR_DEVICE_ATTR_2_RW(pwm1_auto_point7_temp, fan_curve,
			       FAN_CURVE_DEV_CPU, 6);
static SENSOR_DEVICE_ATTR_2_RW(pwm1_auto_point8_temp, fan_curve,
			       FAN_CURVE_DEV_CPU, 7);

static SENSOR_DEVICE_ATTR_2_RW(pwm1_auto_point1_pwm, fan_curve,
				FAN_CURVE_DEV_CPU | FAN_CURVE_PWM_MASK, 0);
static SENSOR_DEVICE_ATTR_2_RW(pwm1_auto_point2_pwm, fan_curve,
			       FAN_CURVE_DEV_CPU | FAN_CURVE_PWM_MASK, 1);
static SENSOR_DEVICE_ATTR_2_RW(pwm1_auto_point3_pwm, fan_curve,
			       FAN_CURVE_DEV_CPU | FAN_CURVE_PWM_MASK, 2);
static SENSOR_DEVICE_ATTR_2_RW(pwm1_auto_point4_pwm, fan_curve,
			       FAN_CURVE_DEV_CPU | FAN_CURVE_PWM_MASK, 3);
static SENSOR_DEVICE_ATTR_2_RW(pwm1_auto_point5_pwm, fan_curve,
			       FAN_CURVE_DEV_CPU | FAN_CURVE_PWM_MASK, 4);
static SENSOR_DEVICE_ATTR_2_RW(pwm1_auto_point6_pwm, fan_curve,
			       FAN_CURVE_DEV_CPU | FAN_CURVE_PWM_MASK, 5);
static SENSOR_DEVICE_ATTR_2_RW(pwm1_auto_point7_pwm, fan_curve,
			       FAN_CURVE_DEV_CPU | FAN_CURVE_PWM_MASK, 6);
static SENSOR_DEVICE_ATTR_2_RW(pwm1_auto_point8_pwm, fan_curve,
			       FAN_CURVE_DEV_CPU | FAN_CURVE_PWM_MASK, 7);

/* GPU */
static SENSOR_DEVICE_ATTR_RW(pwm2_enable, fan_curve_enable, FAN_CURVE_DEV_GPU);
static SENSOR_DEVICE_ATTR_2_RW(pwm2_auto_point1_temp, fan_curve,
			       FAN_CURVE_DEV_GPU, 0);
static SENSOR_DEVICE_ATTR_2_RW(pwm2_auto_point2_temp, fan_curve,
			       FAN_CURVE_DEV_GPU, 1);
static SENSOR_DEVICE_ATTR_2_RW(pwm2_auto_point3_temp, fan_curve,
			       FAN_CURVE_DEV_GPU, 2);
static SENSOR_DEVICE_ATTR_2_RW(pwm2_auto_point4_temp, fan_curve,
			       FAN_CURVE_DEV_GPU, 3);
static SENSOR_DEVICE_ATTR_2_RW(pwm2_auto_point5_temp, fan_curve,
			       FAN_CURVE_DEV_GPU, 4);
static SENSOR_DEVICE_ATTR_2_RW(pwm2_auto_point6_temp, fan_curve,
			       FAN_CURVE_DEV_GPU, 5);
static SENSOR_DEVICE_ATTR_2_RW(pwm2_auto_point7_temp, fan_curve,
			       FAN_CURVE_DEV_GPU, 6);
static SENSOR_DEVICE_ATTR_2_RW(pwm2_auto_point8_temp, fan_curve,
			       FAN_CURVE_DEV_GPU, 7);

static SENSOR_DEVICE_ATTR_2_RW(pwm2_auto_point1_pwm, fan_curve,
			       FAN_CURVE_DEV_GPU | FAN_CURVE_PWM_MASK, 0);
static SENSOR_DEVICE_ATTR_2_RW(pwm2_auto_point2_pwm, fan_curve,
			       FAN_CURVE_DEV_GPU | FAN_CURVE_PWM_MASK, 1);
static SENSOR_DEVICE_ATTR_2_RW(pwm2_auto_point3_pwm, fan_curve,
			       FAN_CURVE_DEV_GPU | FAN_CURVE_PWM_MASK, 2);
static SENSOR_DEVICE_ATTR_2_RW(pwm2_auto_point4_pwm, fan_curve,
			       FAN_CURVE_DEV_GPU | FAN_CURVE_PWM_MASK, 3);
static SENSOR_DEVICE_ATTR_2_RW(pwm2_auto_point5_pwm, fan_curve,
			       FAN_CURVE_DEV_GPU | FAN_CURVE_PWM_MASK, 4);
static SENSOR_DEVICE_ATTR_2_RW(pwm2_auto_point6_pwm, fan_curve,
			       FAN_CURVE_DEV_GPU | FAN_CURVE_PWM_MASK, 5);
static SENSOR_DEVICE_ATTR_2_RW(pwm2_auto_point7_pwm, fan_curve,
			       FAN_CURVE_DEV_GPU | FAN_CURVE_PWM_MASK, 6);
static SENSOR_DEVICE_ATTR_2_RW(pwm2_auto_point8_pwm, fan_curve,
			       FAN_CURVE_DEV_GPU | FAN_CURVE_PWM_MASK, 7);

/* MID */
static SENSOR_DEVICE_ATTR_RW(pwm3_enable, fan_curve_enable, FAN_CURVE_DEV_MID);
static SENSOR_DEVICE_ATTR_2_RW(pwm3_auto_point1_temp, fan_curve,
			       FAN_CURVE_DEV_MID, 0);
static SENSOR_DEVICE_ATTR_2_RW(pwm3_auto_point2_temp, fan_curve,
			       FAN_CURVE_DEV_MID, 1);
static SENSOR_DEVICE_ATTR_2_RW(pwm3_auto_point3_temp, fan_curve,
			       FAN_CURVE_DEV_MID, 2);
static SENSOR_DEVICE_ATTR_2_RW(pwm3_auto_point4_temp, fan_curve,
			       FAN_CURVE_DEV_MID, 3);
static SENSOR_DEVICE_ATTR_2_RW(pwm3_auto_point5_temp, fan_curve,
			       FAN_CURVE_DEV_MID, 4);
static SENSOR_DEVICE_ATTR_2_RW(pwm3_auto_point6_temp, fan_curve,
			       FAN_CURVE_DEV_MID, 5);
static SENSOR_DEVICE_ATTR_2_RW(pwm3_auto_point7_temp, fan_curve,
			       FAN_CURVE_DEV_MID, 6);
static SENSOR_DEVICE_ATTR_2_RW(pwm3_auto_point8_temp, fan_curve,
			       FAN_CURVE_DEV_MID, 7);

static SENSOR_DEVICE_ATTR_2_RW(pwm3_auto_point1_pwm, fan_curve,
			       FAN_CURVE_DEV_MID | FAN_CURVE_PWM_MASK, 0);
static SENSOR_DEVICE_ATTR_2_RW(pwm3_auto_point2_pwm, fan_curve,
			       FAN_CURVE_DEV_MID | FAN_CURVE_PWM_MASK, 1);
static SENSOR_DEVICE_ATTR_2_RW(pwm3_auto_point3_pwm, fan_curve,
			       FAN_CURVE_DEV_MID | FAN_CURVE_PWM_MASK, 2);
static SENSOR_DEVICE_ATTR_2_RW(pwm3_auto_point4_pwm, fan_curve,
			       FAN_CURVE_DEV_MID | FAN_CURVE_PWM_MASK, 3);
static SENSOR_DEVICE_ATTR_2_RW(pwm3_auto_point5_pwm, fan_curve,
			       FAN_CURVE_DEV_MID | FAN_CURVE_PWM_MASK, 4);
static SENSOR_DEVICE_ATTR_2_RW(pwm3_auto_point6_pwm, fan_curve,
			       FAN_CURVE_DEV_MID | FAN_CURVE_PWM_MASK, 5);
static SENSOR_DEVICE_ATTR_2_RW(pwm3_auto_point7_pwm, fan_curve,
			       FAN_CURVE_DEV_MID | FAN_CURVE_PWM_MASK, 6);
static SENSOR_DEVICE_ATTR_2_RW(pwm3_auto_point8_pwm, fan_curve,
			       FAN_CURVE_DEV_MID | FAN_CURVE_PWM_MASK, 7);

static struct attribute *asus_fan_curve_attr[] =;

static umode_t asus_fan_curve_is_visible(struct kobject *kobj,
					 struct attribute *attr, int idx)
{}

static const struct attribute_group asus_fan_curve_attr_group =;
__ATTRIBUTE_GROUPS();

/*
 * Must be initialised after throttle_thermal_policy_check_present() as
 * we check the status of throttle_thermal_policy_available during init.
 */
static int asus_wmi_custom_fan_curve_init(struct asus_wmi *asus)
{}

/* Throttle thermal policy ****************************************************/

static int throttle_thermal_policy_check_present(struct asus_wmi *asus)
{}

static int throttle_thermal_policy_write(struct asus_wmi *asus)
{}

static int throttle_thermal_policy_set_default(struct asus_wmi *asus)
{}

static int throttle_thermal_policy_switch_next(struct asus_wmi *asus)
{}

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

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

// Throttle thermal policy: 0 - default, 1 - overboost, 2 - silent
static DEVICE_ATTR_RW(throttle_thermal_policy);

/* Platform profile ***********************************************************/
static int asus_wmi_platform_profile_get(struct platform_profile_handler *pprof,
					enum platform_profile_option *profile)
{}

static int asus_wmi_platform_profile_set(struct platform_profile_handler *pprof,
					enum platform_profile_option profile)
{}

static int platform_profile_setup(struct asus_wmi *asus)
{}

/* Backlight ******************************************************************/

static int read_backlight_power(struct asus_wmi *asus)
{}

static int read_brightness_max(struct asus_wmi *asus)
{}

static int read_brightness(struct backlight_device *bd)
{}

static u32 get_scalar_command(struct backlight_device *bd)
{}

static int update_bl_status(struct backlight_device *bd)
{}

static const struct backlight_ops asus_wmi_bl_ops =;

static int asus_wmi_backlight_notify(struct asus_wmi *asus, int code)
{}

static int asus_wmi_backlight_init(struct asus_wmi *asus)
{}

static void asus_wmi_backlight_exit(struct asus_wmi *asus)
{}

static int is_display_toggle(int code)
{}

/* Screenpad backlight *******************************************************/

static int read_screenpad_backlight_power(struct asus_wmi *asus)
{}

static int read_screenpad_brightness(struct backlight_device *bd)
{}

static int update_screenpad_bl_status(struct backlight_device *bd)
{}

static const struct backlight_ops asus_screenpad_bl_ops =;

static int asus_screenpad_init(struct asus_wmi *asus)
{}

static void asus_screenpad_exit(struct asus_wmi *asus)
{}

/* Fn-lock ********************************************************************/

static bool asus_wmi_has_fnlock_key(struct asus_wmi *asus)
{}

static void asus_wmi_fnlock_update(struct asus_wmi *asus)
{}

/* WMI events *****************************************************************/

static int asus_wmi_get_event_code(u32 value)
{}

static void asus_wmi_handle_event_code(int code, struct asus_wmi *asus)
{}

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

/* Sysfs **********************************************************************/

static ssize_t store_sys_wmi(struct asus_wmi *asus, int devid,
			     const char *buf, size_t count)
{}

static ssize_t show_sys_wmi(struct asus_wmi *asus, int devid, char *buf)
{}

#define ASUS_WMI_CREATE_DEVICE_ATTR(_name, _mode, _cm)

ASUS_WMI_CREATE_DEVICE_ATTR();
ASUS_WMI_CREATE_DEVICE_ATTR();
ASUS_WMI_CREATE_DEVICE_ATTR();
ASUS_WMI_CREATE_DEVICE_ATTR();
ASUS_WMI_CREATE_DEVICE_ATTR();

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

static DEVICE_ATTR_WO(cpufv);

static struct attribute *platform_attributes[] =;

static umode_t asus_sysfs_is_visible(struct kobject *kobj,
				    struct attribute *attr, int idx)
{}

static const struct attribute_group platform_attribute_group =;

static void asus_wmi_sysfs_exit(struct platform_device *device)
{}

static int asus_wmi_sysfs_init(struct platform_device *device)
{}

/* Platform device ************************************************************/

static int asus_wmi_platform_init(struct asus_wmi *asus)
{}

/* debugfs ********************************************************************/

struct asus_wmi_debugfs_node {};

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

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

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

static struct asus_wmi_debugfs_node asus_wmi_debug_files[] =;

static int asus_wmi_debugfs_open(struct inode *inode, struct file *file)
{}

static const struct file_operations asus_wmi_debugfs_io_ops =;

static void asus_wmi_debugfs_exit(struct asus_wmi *asus)
{}

static void asus_wmi_debugfs_init(struct asus_wmi *asus)
{}

/* Init / exit ****************************************************************/

static int asus_wmi_add(struct platform_device *pdev)
{}

static void asus_wmi_remove(struct platform_device *device)
{}

/* Platform driver - hibernate/resume callbacks *******************************/

static int asus_hotk_thaw(struct device *device)
{}

static int asus_hotk_resume(struct device *device)
{}

static int asus_hotk_resume_early(struct device *device)
{}

static int asus_hotk_prepare(struct device *device)
{}

static int asus_hotk_restore(struct device *device)
{}

static const struct dev_pm_ops asus_pm_ops =;

/* Registration ***************************************************************/

static int asus_wmi_probe(struct platform_device *pdev)
{}

static bool used;

int __init_or_module asus_wmi_register_driver(struct asus_wmi_driver *driver)
{}
EXPORT_SYMBOL_GPL();

void asus_wmi_unregister_driver(struct asus_wmi_driver *driver)
{}
EXPORT_SYMBOL_GPL();

static int __init asus_wmi_init(void)
{}

static void __exit asus_wmi_exit(void)
{}

module_init();
module_exit(asus_wmi_exit);