drivers/platform/x86/lenovo/thinkpad_acpi.c
Source file repositories/reference/linux-study-clean/drivers/platform/x86/lenovo/thinkpad_acpi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/platform/x86/lenovo/thinkpad_acpi.c- Extension
.c- Size
- 322839 bytes
- Lines
- 12276
- 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/bitfield.hlinux/bitops.hlinux/delay.hlinux/dmi.hlinux/freezer.hlinux/hwmon.hlinux/hwmon-sysfs.hlinux/init.hlinux/input.hlinux/input/sparse-keymap.hlinux/jiffies.hlinux/kernel.hlinux/kthread.hlinux/leds.hlinux/list.hlinux/lockdep.hlinux/module.hlinux/mutex.hlinux/nvram.hlinux/pci.hlinux/platform_device.hlinux/platform_profile.hlinux/power_supply.hlinux/proc_fs.hlinux/rfkill.hlinux/sched.hlinux/sched/signal.hlinux/seq_file.hlinux/slab.hlinux/string.h
Detected Declarations
struct ibm_structstruct tp_acpi_drv_structstruct ibm_structstruct ibm_init_structstruct quirk_entrystruct thinkpad_id_datastruct tpacpi_led_classdevstruct tpacpi_quirkstruct tpacpi_rfkstruct tpacpi_rfk_opsstruct tp_nvram_statestruct ibm_thermal_sensors_structstruct tpacpi_alsa_datastruct tp_led_tablestruct tpacpi_battery_datastruct tpacpi_battery_driver_datastruct keyboard_lang_dataenum tp_nvram_addrenum tpacpi_hkey_event_tenum led_status_tenum tpacpi_rfkill_stateenum tpacpi_rfk_idenum ADAPTIVE_KEY_MODEenum keymap_indexenum video_access_modeenum led_access_modeenum thermal_access_modeenum tpacpi_brightness_access_modeenum tpacpi_volume_access_modeenum tpacpi_volume_capabilitiesenum tpacpi_mute_btn_modeenum fan_status_access_modeenum fan_control_access_modeenum fan_control_commandsfunction tpacpi_log_usertaskfunction tpacpi_check_quirksfunction tpacpi_is_lenovofunction tpacpi_is_ibmfunction acpi_evalffunction acpi_ec_readfunction acpi_ec_writefunction issue_thinkpad_cmos_commandfunction drv_acpi_handle_initfunction tpacpi_acpi_handle_locate_callbackfunction tpacpi_acpi_handle_locatefunction dispatch_acpi_notifyfunction setup_acpi_notifyfunction dispatch_proc_show
Annotated Snippet
static ssize_t interface_version_show(struct device_driver *drv, char *buf)
{
return sysfs_emit(buf, "0x%08x\n", TPACPI_SYSFS_VERSION);
}
static DRIVER_ATTR_RO(interface_version);
/* debug_level --------------------------------------------------------- */
static ssize_t debug_level_show(struct device_driver *drv, char *buf)
{
return sysfs_emit(buf, "0x%04x\n", dbg_level);
}
static ssize_t debug_level_store(struct device_driver *drv, const char *buf,
size_t count)
{
unsigned long t;
if (parse_strtoul(buf, 0xffff, &t))
return -EINVAL;
dbg_level = t;
return count;
}
static DRIVER_ATTR_RW(debug_level);
/* version ------------------------------------------------------------- */
static ssize_t version_show(struct device_driver *drv, char *buf)
{
return sysfs_emit(buf, "%s v%s\n",
TPACPI_DESC, TPACPI_VERSION);
}
static DRIVER_ATTR_RO(version);
/* --------------------------------------------------------------------- */
#ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES
/* wlsw_emulstate ------------------------------------------------------ */
static ssize_t wlsw_emulstate_show(struct device_driver *drv, char *buf)
{
return sysfs_emit(buf, "%d\n", !!tpacpi_wlsw_emulstate);
}
static ssize_t wlsw_emulstate_store(struct device_driver *drv, const char *buf,
size_t count)
{
unsigned long t;
if (parse_strtoul(buf, 1, &t))
return -EINVAL;
if (tpacpi_wlsw_emulstate != !!t) {
tpacpi_wlsw_emulstate = !!t;
tpacpi_rfk_update_hwblock_state(!t); /* negative logic */
}
return count;
}
static DRIVER_ATTR_RW(wlsw_emulstate);
/* bluetooth_emulstate ------------------------------------------------- */
static ssize_t bluetooth_emulstate_show(struct device_driver *drv, char *buf)
{
return sysfs_emit(buf, "%d\n", !!tpacpi_bluetooth_emulstate);
}
static ssize_t bluetooth_emulstate_store(struct device_driver *drv,
const char *buf, size_t count)
{
unsigned long t;
if (parse_strtoul(buf, 1, &t))
return -EINVAL;
tpacpi_bluetooth_emulstate = !!t;
return count;
}
static DRIVER_ATTR_RW(bluetooth_emulstate);
/* wwan_emulstate ------------------------------------------------- */
static ssize_t wwan_emulstate_show(struct device_driver *drv, char *buf)
{
return sysfs_emit(buf, "%d\n", !!tpacpi_wwan_emulstate);
}
static ssize_t wwan_emulstate_store(struct device_driver *drv, const char *buf,
size_t count)
{
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/backlight.h`, `linux/bitfield.h`, `linux/bitops.h`, `linux/delay.h`, `linux/dmi.h`, `linux/freezer.h`, `linux/hwmon.h`.
- Detected declarations: `struct ibm_struct`, `struct tp_acpi_drv_struct`, `struct ibm_struct`, `struct ibm_init_struct`, `struct quirk_entry`, `struct thinkpad_id_data`, `struct tpacpi_led_classdev`, `struct tpacpi_quirk`, `struct tpacpi_rfk`, `struct tpacpi_rfk_ops`.
- 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.