drivers/input/misc/88pm886-onkey.c
Source file repositories/reference/linux-study-clean/drivers/input/misc/88pm886-onkey.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/input/misc/88pm886-onkey.c- Extension
.c- Size
- 2363 bytes
- Lines
- 99
- 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/input.hlinux/interrupt.hlinux/irq.hlinux/platform_device.hlinux/regmap.hlinux/mfd/88pm886.h
Detected Declarations
struct pm886_onkeyfunction pm886_onkey_irq_handlerfunction pm886_onkey_probe
Annotated Snippet
struct pm886_onkey {
struct input_dev *idev;
struct pm886_chip *chip;
};
static irqreturn_t pm886_onkey_irq_handler(int irq, void *data)
{
struct pm886_onkey *onkey = data;
struct regmap *regmap = onkey->chip->regmap;
struct input_dev *idev = onkey->idev;
struct device *parent = idev->dev.parent;
unsigned int val;
int err;
err = regmap_read(regmap, PM886_REG_STATUS1, &val);
if (err) {
dev_err(parent, "Failed to read status: %d\n", err);
return IRQ_NONE;
}
val &= PM886_ONKEY_STS1;
input_report_key(idev, KEY_POWER, val);
input_sync(idev);
return IRQ_HANDLED;
}
static int pm886_onkey_probe(struct platform_device *pdev)
{
struct pm886_chip *chip = dev_get_drvdata(pdev->dev.parent);
struct device *dev = &pdev->dev;
struct pm886_onkey *onkey;
struct input_dev *idev;
int irq, err;
onkey = devm_kzalloc(dev, sizeof(*onkey), GFP_KERNEL);
if (!onkey)
return -ENOMEM;
onkey->chip = chip;
irq = platform_get_irq(pdev, 0);
if (irq < 0)
return dev_err_probe(dev, irq, "Failed to get IRQ\n");
idev = devm_input_allocate_device(dev);
if (!idev) {
dev_err(dev, "Failed to allocate input device\n");
return -ENOMEM;
}
onkey->idev = idev;
idev->name = "88pm886-onkey";
idev->phys = "88pm886-onkey/input0";
idev->id.bustype = BUS_I2C;
input_set_capability(idev, EV_KEY, KEY_POWER);
err = devm_request_threaded_irq(dev, irq, NULL, pm886_onkey_irq_handler,
IRQF_ONESHOT | IRQF_NO_SUSPEND, "onkey",
onkey);
if (err)
return dev_err_probe(dev, err, "Failed to request IRQ\n");
err = input_register_device(idev);
if (err)
return dev_err_probe(dev, err, "Failed to register input device\n");
return 0;
}
static const struct platform_device_id pm886_onkey_id_table[] = {
{ "88pm886-onkey", },
{ }
};
MODULE_DEVICE_TABLE(platform, pm886_onkey_id_table);
static struct platform_driver pm886_onkey_driver = {
.driver = {
.name = "88pm886-onkey",
},
.probe = pm886_onkey_probe,
.id_table = pm886_onkey_id_table,
};
module_platform_driver(pm886_onkey_driver);
MODULE_DESCRIPTION("Marvell 88PM886 onkey driver");
MODULE_AUTHOR("Karel Balej <balejk@matfyz.cz>");
MODULE_LICENSE("GPL");
Annotation
- Immediate include surface: `linux/input.h`, `linux/interrupt.h`, `linux/irq.h`, `linux/platform_device.h`, `linux/regmap.h`, `linux/mfd/88pm886.h`.
- Detected declarations: `struct pm886_onkey`, `function pm886_onkey_irq_handler`, `function pm886_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.