drivers/input/misc/axp20x-pek.c
Source file repositories/reference/linux-study-clean/drivers/input/misc/axp20x-pek.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/input/misc/axp20x-pek.c- Extension
.c- Size
- 10431 bytes
- Lines
- 414
- Domain
- Driver Families
- Bucket
- drivers/input
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/errno.hlinux/irq.hlinux/init.hlinux/input.hlinux/interrupt.hlinux/kernel.hlinux/mfd/axp20x.hlinux/module.hlinux/platform_data/x86/soc.hlinux/platform_device.hlinux/regmap.hlinux/slab.h
Detected Declarations
struct axp20x_infostruct axp20x_pekstruct axp20x_timefunction axp20x_show_attrfunction axp20x_show_attr_startupfunction axp20x_show_attr_shutdownfunction axp20x_store_attrfunction axp20x_store_attr_startupfunction axp20x_store_attr_shutdownfunction axp20x_pek_irqfunction axp20x_pek_probe_input_devicefunction axp20x_pek_should_register_inputfunction axp20x_pek_probefunction axp20x_pek_suspendfunction axp20x_pek_resumefunction axp20x_pek_resume_noirq
Annotated Snippet
struct axp20x_info {
const struct axp20x_time *startup_time;
unsigned int startup_mask;
const struct axp20x_time *shutdown_time;
unsigned int shutdown_mask;
};
struct axp20x_pek {
struct axp20x_dev *axp20x;
struct input_dev *input;
struct axp20x_info *info;
int irq_dbr;
int irq_dbf;
};
struct axp20x_time {
unsigned int time;
unsigned int idx;
};
static const struct axp20x_time startup_time[] = {
{ .time = 128, .idx = 0 },
{ .time = 1000, .idx = 2 },
{ .time = 3000, .idx = 1 },
{ .time = 2000, .idx = 3 },
};
static const struct axp20x_time axp221_startup_time[] = {
{ .time = 128, .idx = 0 },
{ .time = 1000, .idx = 1 },
{ .time = 2000, .idx = 2 },
{ .time = 3000, .idx = 3 },
};
static const struct axp20x_time shutdown_time[] = {
{ .time = 4000, .idx = 0 },
{ .time = 6000, .idx = 1 },
{ .time = 8000, .idx = 2 },
{ .time = 10000, .idx = 3 },
};
static const struct axp20x_info axp20x_info = {
.startup_time = startup_time,
.startup_mask = AXP20X_PEK_STARTUP_MASK,
.shutdown_time = shutdown_time,
.shutdown_mask = AXP20X_PEK_SHUTDOWN_MASK,
};
static const struct axp20x_info axp221_info = {
.startup_time = axp221_startup_time,
.startup_mask = AXP20X_PEK_STARTUP_MASK,
.shutdown_time = shutdown_time,
.shutdown_mask = AXP20X_PEK_SHUTDOWN_MASK,
};
static ssize_t axp20x_show_attr(struct device *dev,
const struct axp20x_time *time,
unsigned int mask, char *buf)
{
struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev);
unsigned int val;
int ret, i;
ret = regmap_read(axp20x_pek->axp20x->regmap, AXP20X_PEK_KEY, &val);
if (ret != 0)
return ret;
val &= mask;
val >>= ffs(mask) - 1;
for (i = 0; i < 4; i++)
if (val == time[i].idx)
val = time[i].time;
return sprintf(buf, "%u\n", val);
}
static ssize_t axp20x_show_attr_startup(struct device *dev,
struct device_attribute *attr,
char *buf)
{
struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev);
return axp20x_show_attr(dev, axp20x_pek->info->startup_time,
axp20x_pek->info->startup_mask, buf);
}
static ssize_t axp20x_show_attr_shutdown(struct device *dev,
struct device_attribute *attr,
char *buf)
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/errno.h`, `linux/irq.h`, `linux/init.h`, `linux/input.h`, `linux/interrupt.h`, `linux/kernel.h`, `linux/mfd/axp20x.h`.
- Detected declarations: `struct axp20x_info`, `struct axp20x_pek`, `struct axp20x_time`, `function axp20x_show_attr`, `function axp20x_show_attr_startup`, `function axp20x_show_attr_shutdown`, `function axp20x_store_attr`, `function axp20x_store_attr_startup`, `function axp20x_store_attr_shutdown`, `function axp20x_pek_irq`.
- Atlas domain: Driver Families / drivers/input.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.