drivers/platform/x86/lenovo/wmi-gamezone.c
Source file repositories/reference/linux-study-clean/drivers/platform/x86/lenovo/wmi-gamezone.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/platform/x86/lenovo/wmi-gamezone.c- Extension
.c- Size
- 10734 bytes
- Lines
- 410
- 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.
- 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/dmi.hlinux/export.hlinux/list.hlinux/module.hlinux/notifier.hlinux/platform_profile.hlinux/spinlock.hlinux/spinlock_types.hlinux/types.hlinux/wmi.hwmi-events.hwmi-helpers.h
Detected Declarations
struct lwmi_gz_privstruct quirk_entryfunction lwmi_gz_mode_callfunction lwmi_gz_event_callfunction lwmi_gz_thermal_mode_supportedfunction lwmi_gz_thermal_mode_getfunction lwmi_gz_profile_getfunction lwmi_gz_profile_setfunction lwmi_gz_extreme_supportedfunction lwmi_gz_platform_profile_probefunction lwmi_gz_probe
Annotated Snippet
struct lwmi_gz_priv {
enum thermal_mode current_mode;
struct notifier_block event_nb;
struct notifier_block mode_nb;
spinlock_t gz_mode_lock; /* current_mode lock */
struct wmi_device *wdev;
int extreme_supported;
struct device *ppdev;
};
struct quirk_entry {
bool extreme_supported;
};
static struct quirk_entry quirk_no_extreme_bug = {
.extreme_supported = false,
};
/**
* lwmi_gz_mode_call() - Call method for lenovo-wmi-other driver notifier.
*
* @nb: The notifier_block registered to lenovo-wmi-other driver.
* @cmd: The event type.
* @data: Thermal mode enum pointer pointer for returning the thermal mode.
*
* For LWMI_GZ_GET_THERMAL_MODE, retrieve the current thermal mode.
*
* Return: Notifier_block status.
*/
static int lwmi_gz_mode_call(struct notifier_block *nb, unsigned long cmd,
void *data)
{
enum thermal_mode **mode = data;
struct lwmi_gz_priv *priv;
priv = container_of(nb, struct lwmi_gz_priv, mode_nb);
switch (cmd) {
case LWMI_GZ_GET_THERMAL_MODE:
scoped_guard(spinlock, &priv->gz_mode_lock) {
**mode = priv->current_mode;
}
return NOTIFY_OK;
default:
return NOTIFY_DONE;
}
}
/**
* lwmi_gz_event_call() - Call method for lenovo-wmi-events driver notifier.
* block call chain.
* @nb: The notifier_block registered to lenovo-wmi-events driver.
* @cmd: The event type.
* @data: The data to be updated by the event.
*
* For LWMI_EVENT_THERMAL_MODE, set current_mode and notify platform_profile
* of a change.
*
* Return: notifier_block status.
*/
static int lwmi_gz_event_call(struct notifier_block *nb, unsigned long cmd,
void *data)
{
enum thermal_mode *mode = data;
struct lwmi_gz_priv *priv;
priv = container_of(nb, struct lwmi_gz_priv, event_nb);
switch (cmd) {
case LWMI_EVENT_THERMAL_MODE:
scoped_guard(spinlock, &priv->gz_mode_lock) {
priv->current_mode = *mode;
}
platform_profile_notify(priv->ppdev);
return NOTIFY_STOP;
default:
return NOTIFY_DONE;
}
}
/**
* lwmi_gz_thermal_mode_supported() - Get the version of the WMI
* interface to determine the support level.
* @wdev: The Gamezone WMI device.
* @supported: Pointer to return the support level with.
*
* Return: 0 on success, or an error code.
*/
static int lwmi_gz_thermal_mode_supported(struct wmi_device *wdev,
int *supported)
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/dmi.h`, `linux/export.h`, `linux/list.h`, `linux/module.h`, `linux/notifier.h`, `linux/platform_profile.h`, `linux/spinlock.h`.
- Detected declarations: `struct lwmi_gz_priv`, `struct quirk_entry`, `function lwmi_gz_mode_call`, `function lwmi_gz_event_call`, `function lwmi_gz_thermal_mode_supported`, `function lwmi_gz_thermal_mode_get`, `function lwmi_gz_profile_get`, `function lwmi_gz_profile_set`, `function lwmi_gz_extreme_supported`, `function lwmi_gz_platform_profile_probe`.
- Atlas domain: Driver Families / drivers/platform.
- Implementation status: source 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.