drivers/input/misc/da9063_onkey.c
Source file repositories/reference/linux-study-clean/drivers/input/misc/da9063_onkey.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/input/misc/da9063_onkey.c- Extension
.c- Size
- 7075 bytes
- Lines
- 269
- 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/devm-helpers.hlinux/module.hlinux/errno.hlinux/input.hlinux/interrupt.hlinux/mod_devicetable.hlinux/platform_device.hlinux/pm_wakeirq.hlinux/property.hlinux/workqueue.hlinux/regmap.hlinux/mfd/da9063/core.hlinux/mfd/da9063/registers.hlinux/mfd/da9062/core.hlinux/mfd/da9062/registers.h
Detected Declarations
struct da906x_chip_configstruct da9063_onkeyfunction da9063_poll_onfunction da9063_onkey_irq_handlerfunction da9063_onkey_probe
Annotated Snippet
struct da906x_chip_config {
/* REGS */
int onkey_status;
int onkey_pwr_signalling;
int onkey_fault_log;
int onkey_shutdown;
/* MASKS */
int onkey_nonkey_mask;
int onkey_nonkey_lock_mask;
int onkey_key_reset_mask;
int onkey_shutdown_mask;
/* NAMES */
const char *name;
};
struct da9063_onkey {
struct delayed_work work;
struct input_dev *input;
struct device *dev;
struct regmap *regmap;
const struct da906x_chip_config *config;
char phys[32];
bool key_power;
};
static const struct da906x_chip_config da9063_regs = {
/* REGS */
.onkey_status = DA9063_REG_STATUS_A,
.onkey_pwr_signalling = DA9063_REG_CONTROL_B,
.onkey_fault_log = DA9063_REG_FAULT_LOG,
.onkey_shutdown = DA9063_REG_CONTROL_F,
/* MASKS */
.onkey_nonkey_mask = DA9063_NONKEY,
.onkey_nonkey_lock_mask = DA9063_NONKEY_LOCK,
.onkey_key_reset_mask = DA9063_KEY_RESET,
.onkey_shutdown_mask = DA9063_SHUTDOWN,
/* NAMES */
.name = DA9063_DRVNAME_ONKEY,
};
static const struct da906x_chip_config da9062_regs = {
/* REGS */
.onkey_status = DA9062AA_STATUS_A,
.onkey_pwr_signalling = DA9062AA_CONTROL_B,
.onkey_fault_log = DA9062AA_FAULT_LOG,
.onkey_shutdown = DA9062AA_CONTROL_F,
/* MASKS */
.onkey_nonkey_mask = DA9062AA_NONKEY_MASK,
.onkey_nonkey_lock_mask = DA9062AA_NONKEY_LOCK_MASK,
.onkey_key_reset_mask = DA9062AA_KEY_RESET_MASK,
.onkey_shutdown_mask = DA9062AA_SHUTDOWN_MASK,
/* NAMES */
.name = "da9062-onkey",
};
static void da9063_poll_on(struct work_struct *work)
{
struct da9063_onkey *onkey = container_of(work,
struct da9063_onkey,
work.work);
const struct da906x_chip_config *config = onkey->config;
unsigned int val;
int fault_log = 0;
bool poll = true;
int error;
/* Poll to see when the pin is released */
error = regmap_read(onkey->regmap,
config->onkey_status,
&val);
if (error) {
dev_err(onkey->dev,
"Failed to read ON status: %d\n", error);
goto err_poll;
}
if (!(val & config->onkey_nonkey_mask)) {
error = regmap_update_bits(onkey->regmap,
config->onkey_pwr_signalling,
config->onkey_nonkey_lock_mask,
0);
if (error) {
dev_err(onkey->dev,
"Failed to reset the Key Delay %d\n", error);
goto err_poll;
}
input_report_key(onkey->input, KEY_POWER, 0);
input_sync(onkey->input);
Annotation
- Immediate include surface: `linux/devm-helpers.h`, `linux/module.h`, `linux/errno.h`, `linux/input.h`, `linux/interrupt.h`, `linux/mod_devicetable.h`, `linux/platform_device.h`, `linux/pm_wakeirq.h`.
- Detected declarations: `struct da906x_chip_config`, `struct da9063_onkey`, `function da9063_poll_on`, `function da9063_onkey_irq_handler`, `function da9063_onkey_probe`.
- 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.