drivers/platform/x86/asus-wmi.c
Source file repositories/reference/linux-study-clean/drivers/platform/x86/asus-wmi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/platform/x86/asus-wmi.c- Extension
.c- Size
- 142849 bytes
- Lines
- 5407
- Domain
- Driver Families
- Bucket
- drivers/platform
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/acpi.hlinux/backlight.hlinux/bits.hlinux/debugfs.hlinux/delay.hlinux/dmi.hlinux/hwmon.hlinux/hwmon-sysfs.hlinux/init.hlinux/input.hlinux/input/sparse-keymap.hlinux/kernel.hlinux/leds.hlinux/minmax.hlinux/module.hlinux/pci.hlinux/pci_hotplug.hlinux/platform_data/x86/asus-wmi.hlinux/platform_device.hlinux/platform_profile.hlinux/power_supply.hlinux/rfkill.hlinux/seq_file.hlinux/slab.hlinux/spinlock.hlinux/types.hlinux/units.hacpi/battery.hacpi/video.hasus-wmi.h
Detected Declarations
struct bios_argsstruct agfn_argsstruct agfn_fan_argsstruct asus_wmi_debugstruct asus_rfkillstruct fan_curve_datastruct asus_wmistruct asus_hid_refstruct asus_wmi_debugfs_nodeenum fan_typefunction ashs_presentfunction asus_wmi_show_deprecatedfunction asus_wmi_evaluate_method3function asus_wmi_evaluate_methodfunction asus_wmi_evaluate_method5function asus_wmi_evaluate_method_buffunction asus_wmi_evaluate_method_agfnfunction asus_wmi_get_devstatefunction asus_wmi_get_devstate_dstsfunction asus_wmi_set_devstatefunction asus_wmi_get_devstate_bitsfunction asus_wmi_get_devstate_simplefunction asus_wmi_dev_is_presentfunction asus_wmi_tablet_sw_reportfunction asus_wmi_tablet_sw_initfunction asus_wmi_input_initfunction asus_wmi_input_exitfunction asus_wmi_tablet_mode_get_statefunction charge_mode_showfunction dgpu_disable_showfunction dgpu_disable_storefunction egpu_enable_showfunction egpu_enable_storefunction egpu_connected_showfunction gpu_mux_mode_showfunction gpu_mux_mode_storefunction kbd_rgb_mode_storefunction kbd_rgb_state_storefunction ppt_pl2_sppt_storefunction ppt_pl2_sppt_showfunction ppt_pl1_spl_storefunction ppt_pl1_spl_showfunction ppt_fppt_storefunction ppt_fppt_showfunction ppt_apu_sppt_storefunction ppt_apu_sppt_showfunction ppt_platform_sppt_storefunction ppt_platform_sppt_show
Annotated Snippet
static const struct file_operations asus_wmi_debugfs_io_ops = {
.owner = THIS_MODULE,
.open = asus_wmi_debugfs_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static void asus_wmi_debugfs_exit(struct asus_wmi *asus)
{
debugfs_remove_recursive(asus->debug.root);
}
static void asus_wmi_debugfs_init(struct asus_wmi *asus)
{
int i;
asus->debug.root = debugfs_create_dir(asus->driver->name, NULL);
debugfs_create_x32("method_id", S_IRUGO | S_IWUSR, asus->debug.root,
&asus->debug.method_id);
debugfs_create_x32("dev_id", S_IRUGO | S_IWUSR, asus->debug.root,
&asus->debug.dev_id);
debugfs_create_x32("ctrl_param", S_IRUGO | S_IWUSR, asus->debug.root,
&asus->debug.ctrl_param);
for (i = 0; i < ARRAY_SIZE(asus_wmi_debug_files); i++) {
struct asus_wmi_debugfs_node *node = &asus_wmi_debug_files[i];
node->asus = asus;
debugfs_create_file(node->name, S_IFREG | S_IRUGO,
asus->debug.root, node,
&asus_wmi_debugfs_io_ops);
}
}
/* Init / exit ****************************************************************/
static int asus_wmi_add(struct platform_device *pdev)
{
struct platform_driver *pdrv = to_platform_driver(pdev->dev.driver);
struct asus_wmi_driver *wdrv = to_asus_wmi_driver(pdrv);
struct asus_wmi *asus;
acpi_status status;
int err;
u32 result;
asus = kzalloc_obj(struct asus_wmi);
if (!asus)
return -ENOMEM;
asus->driver = wdrv;
asus->platform_device = pdev;
wdrv->platform_device = pdev;
platform_set_drvdata(asus->platform_device, asus);
if (wdrv->detect_quirks)
wdrv->detect_quirks(asus->driver);
err = asus_wmi_platform_init(asus);
if (err)
goto fail_platform;
if (use_ally_mcu_hack == ASUS_WMI_ALLY_MCU_HACK_INIT) {
if (acpi_has_method(NULL, ASUS_USB0_PWR_EC0_CSEE)
&& dmi_check_system(asus_rog_ally_device))
use_ally_mcu_hack = ASUS_WMI_ALLY_MCU_HACK_ENABLED;
if (dmi_match(DMI_BOARD_NAME, "RC71")) {
/*
* These steps ensure the device is in a valid good state, this is
* especially important for the Ally 1 after a reboot.
*/
acpi_execute_simple_method(NULL, ASUS_USB0_PWR_EC0_CSEE,
ASUS_USB0_PWR_EC0_CSEE_ON);
msleep(ASUS_USB0_PWR_EC0_CSEE_WAIT);
}
}
/* ensure defaults for tunables */
#if IS_ENABLED(CONFIG_ASUS_WMI_DEPRECATED_ATTRS)
asus->ppt_pl2_sppt = 5;
asus->ppt_pl1_spl = 5;
asus->ppt_apu_sppt = 5;
asus->ppt_platform_sppt = 5;
asus->ppt_fppt = 5;
asus->nv_dynamic_boost = 5;
asus->nv_temp_target = 75;
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/backlight.h`, `linux/bits.h`, `linux/debugfs.h`, `linux/delay.h`, `linux/dmi.h`, `linux/hwmon.h`, `linux/hwmon-sysfs.h`.
- Detected declarations: `struct bios_args`, `struct agfn_args`, `struct agfn_fan_args`, `struct asus_wmi_debug`, `struct asus_rfkill`, `struct fan_curve_data`, `struct asus_wmi`, `struct asus_hid_ref`, `struct asus_wmi_debugfs_node`, `enum fan_type`.
- Atlas domain: Driver Families / drivers/platform.
- Implementation status: pattern implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.