drivers/platform/x86/bitland-mifs-wmi.c
Source file repositories/reference/linux-study-clean/drivers/platform/x86/bitland-mifs-wmi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/platform/x86/bitland-mifs-wmi.c- Extension
.c- Size
- 21121 bytes
- Lines
- 838
- Domain
- Driver Families
- Bucket
- drivers/platform
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- 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/array_size.hlinux/bits.hlinux/container_of.hlinux/dev_printk.hlinux/device.hlinux/device/devres.hlinux/err.hlinux/hwmon.hlinux/init.hlinux/input-event-codes.hlinux/input.hlinux/input/sparse-keymap.hlinux/kernel.hlinux/leds.hlinux/module.hlinux/notifier.hlinux/platform_profile.hlinux/pm.hlinux/power_supply.hlinux/stddef.hlinux/string.hlinux/sysfs.hlinux/unaligned.hlinux/units.hlinux/wmi.h
Detected Declarations
struct bitland_mifs_inputstruct bitland_mifs_outputstruct bitland_mifs_eventstruct bitland_fan_notify_datastruct bitland_mifs_wmi_dataenum bitland_mifs_operationenum bitland_mifs_functionenum bitland_system_ac_modeenum bitland_mifs_power_profileenum bitland_mifs_event_idenum bitland_mifs_event_typeenum bitland_wmi_device_typeenum bitland_notifier_actionsfunction bitland_mifs_wmi_callfunction laptop_profile_getfunction bitland_check_performance_capabilityfunction laptop_profile_setfunction platform_profile_probefunction bitland_mifs_wmi_suspendfunction bitland_mifs_wmi_resumefunction laptop_hwmon_readfunction laptop_hwmon_read_stringfunction laptop_kbd_led_setfunction laptop_kbd_led_getfunction gpu_mode_showfunction gpu_mode_storefunction kb_mode_showfunction kb_mode_storefunction fan_boost_storefunction bitland_notifier_unregisterfunction bitland_notifier_callbackfunction bitland_mifs_wmi_probefunction bitland_mifs_wmi_notify
Annotated Snippet
struct bitland_mifs_input {
u8 reserved1;
u8 operation;
u8 reserved2;
u8 function;
u8 payload[28];
} __packed;
struct bitland_mifs_output {
u8 reserved1;
u8 operation;
u8 reserved2;
u8 function;
u8 data[28];
} __packed;
struct bitland_mifs_event {
u8 event_type;
u8 event_id;
u8 value_low; /* For most events, this is the value */
u8 value_high; /* For fan speed events, combined with value_low */
u8 reserved[4];
} __packed;
static BLOCKING_NOTIFIER_HEAD(bitland_notifier_list);
enum bitland_notifier_actions {
BITLAND_NOTIFY_KBD_BRIGHTNESS,
BITLAND_NOTIFY_PLATFORM_PROFILE,
BITLAND_NOTIFY_HWMON,
};
struct bitland_fan_notify_data {
int channel; /* 0 = CPU, 1 = GPU */
u16 speed;
};
struct bitland_mifs_wmi_data {
struct wmi_device *wdev;
struct mutex lock; /* Protects WMI calls */
struct led_classdev kbd_led;
struct notifier_block notifier;
struct input_dev *input_dev;
struct device *hwmon_dev;
struct device *pp_dev;
enum platform_profile_option saved_profile;
};
static int bitland_mifs_wmi_call(struct bitland_mifs_wmi_data *data,
const struct bitland_mifs_input *input,
struct bitland_mifs_output *output)
{
struct wmi_buffer in_buf = { .length = sizeof(*input), .data = (void *)input };
struct wmi_buffer out_buf = { 0 };
int ret;
guard(mutex)(&data->lock);
if (!output)
return wmidev_invoke_procedure(data->wdev, 0, 1, &in_buf);
ret = wmidev_invoke_method(data->wdev, 0, 1, &in_buf, &out_buf, sizeof(*output));
if (ret)
return ret;
memcpy(output, out_buf.data, sizeof(*output));
kfree(out_buf.data);
return 0;
}
static int laptop_profile_get(struct device *dev,
enum platform_profile_option *profile)
{
struct bitland_mifs_wmi_data *data = dev_get_drvdata(dev);
struct bitland_mifs_input input = {
.reserved1 = 0,
.operation = WMI_METHOD_GET,
.reserved2 = 0,
.function = WMI_FN_SYSTEM_PER_MODE,
};
struct bitland_mifs_output result;
int ret;
ret = bitland_mifs_wmi_call(data, &input, &result);
if (ret)
return ret;
switch (result.data[0]) {
case WMI_PP_BALANCED:
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/array_size.h`, `linux/bits.h`, `linux/container_of.h`, `linux/dev_printk.h`, `linux/device.h`, `linux/device/devres.h`, `linux/err.h`.
- Detected declarations: `struct bitland_mifs_input`, `struct bitland_mifs_output`, `struct bitland_mifs_event`, `struct bitland_fan_notify_data`, `struct bitland_mifs_wmi_data`, `enum bitland_mifs_operation`, `enum bitland_mifs_function`, `enum bitland_system_ac_mode`, `enum bitland_mifs_power_profile`, `enum bitland_mifs_event_id`.
- Atlas domain: Driver Families / drivers/platform.
- Implementation status: source implementation candidate.
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.