drivers/platform/x86/dell/dell-rbtn.c
Source file repositories/reference/linux-study-clean/drivers/platform/x86/dell/dell-rbtn.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/platform/x86/dell/dell-rbtn.c- Extension
.c- Size
- 11075 bytes
- Lines
- 514
- Domain
- Driver Families
- Bucket
- drivers/platform
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/module.hlinux/acpi.hlinux/rfkill.hlinux/input.hlinux/platform_device.hdell-rbtn.h
Detected Declarations
struct rbtn_dataenum rbtn_typefunction rbtn_checkfunction rbtn_getfunction rbtn_acquirefunction rbtn_rfkill_queryfunction rbtn_rfkill_set_blockfunction rbtn_rfkill_initfunction rbtn_rfkill_exitfunction rbtn_rfkill_eventfunction rbtn_input_initfunction rbtn_input_exitfunction rbtn_input_eventfunction rbtn_clear_suspended_flagfunction rbtn_suspendfunction rbtn_resumefunction rbtn_inc_countfunction rbtn_switch_devfunction dell_rbtn_notifier_registerfunction dell_rbtn_notifier_unregisterfunction rbtn_cleanupfunction rbtn_probefunction rbtn_removefunction rbtn_notifyexport dell_rbtn_notifier_registerexport dell_rbtn_notifier_unregister
Annotated Snippet
struct rbtn_data {
enum rbtn_type type;
struct rfkill *rfkill;
struct input_dev *input_dev;
bool suspended;
};
/*
* acpi functions
*/
static enum rbtn_type rbtn_check(struct acpi_device *device)
{
unsigned long long output;
acpi_status status;
status = acpi_evaluate_integer(device->handle, "CRBT", NULL, &output);
if (ACPI_FAILURE(status))
return RBTN_UNKNOWN;
switch (output) {
case 0:
case 1:
return RBTN_TOGGLE;
case 2:
case 3:
return RBTN_SLIDER;
default:
return RBTN_UNKNOWN;
}
}
static int rbtn_get(struct acpi_device *device)
{
unsigned long long output;
acpi_status status;
status = acpi_evaluate_integer(device->handle, "GRBT", NULL, &output);
if (ACPI_FAILURE(status))
return -EINVAL;
return !output;
}
static int rbtn_acquire(struct acpi_device *device, bool enable)
{
struct acpi_object_list input;
union acpi_object param;
acpi_status status;
param.type = ACPI_TYPE_INTEGER;
param.integer.value = enable;
input.count = 1;
input.pointer = ¶m;
status = acpi_evaluate_object(device->handle, "ARBT", &input, NULL);
if (ACPI_FAILURE(status))
return -EINVAL;
return 0;
}
/*
* rfkill device
*/
static void rbtn_rfkill_query(struct rfkill *rfkill, void *data)
{
struct acpi_device *device = data;
int state;
state = rbtn_get(device);
if (state < 0)
return;
rfkill_set_states(rfkill, state, state);
}
static int rbtn_rfkill_set_block(void *data, bool blocked)
{
/* NOTE: setting soft rfkill state is not supported */
return -EINVAL;
}
static const struct rfkill_ops rbtn_ops = {
.query = rbtn_rfkill_query,
.set_block = rbtn_rfkill_set_block,
};
Annotation
- Immediate include surface: `linux/module.h`, `linux/acpi.h`, `linux/rfkill.h`, `linux/input.h`, `linux/platform_device.h`, `dell-rbtn.h`.
- Detected declarations: `struct rbtn_data`, `enum rbtn_type`, `function rbtn_check`, `function rbtn_get`, `function rbtn_acquire`, `function rbtn_rfkill_query`, `function rbtn_rfkill_set_block`, `function rbtn_rfkill_init`, `function rbtn_rfkill_exit`, `function rbtn_rfkill_event`.
- Atlas domain: Driver Families / drivers/platform.
- Implementation status: integration 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.