drivers/mfd/88pm886.c
Source file repositories/reference/linux-study-clean/drivers/mfd/88pm886.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mfd/88pm886.c- Extension
.c- Size
- 4212 bytes
- Lines
- 155
- Domain
- Driver Families
- Bucket
- drivers/mfd
- 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.
- 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/i2c.hlinux/mfd/core.hlinux/module.hlinux/notifier.hlinux/of.hlinux/platform_device.hlinux/reboot.hlinux/regmap.hlinux/mfd/88pm886.h
Detected Declarations
function pm886_power_off_handlerfunction pm886_setup_irqfunction pm886_probe
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
#include <linux/i2c.h>
#include <linux/mfd/core.h>
#include <linux/module.h>
#include <linux/notifier.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/reboot.h>
#include <linux/regmap.h>
#include <linux/mfd/88pm886.h>
static const struct regmap_config pm886_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
.max_register = PM886_REG_RTC_SPARE6,
};
static const struct regmap_irq pm886_regmap_irqs[] = {
REGMAP_IRQ_REG(PM886_IRQ_ONKEY, 0, PM886_INT_ENA1_ONKEY),
};
static const struct regmap_irq_chip pm886_regmap_irq_chip = {
.name = "88pm886",
.irqs = pm886_regmap_irqs,
.num_irqs = ARRAY_SIZE(pm886_regmap_irqs),
.num_regs = 4,
.status_base = PM886_REG_INT_STATUS1,
.ack_base = PM886_REG_INT_STATUS1,
.unmask_base = PM886_REG_INT_ENA_1,
};
static const struct resource pm886_onkey_resources[] = {
DEFINE_RES_IRQ_NAMED(PM886_IRQ_ONKEY, "88pm886-onkey"),
};
static const struct mfd_cell pm886_devs[] = {
MFD_CELL_NAME("88pm886-gpadc"),
MFD_CELL_RES("88pm886-onkey", pm886_onkey_resources),
MFD_CELL_NAME("88pm886-regulator"),
MFD_CELL_NAME("88pm886-rtc"),
};
static int pm886_power_off_handler(struct sys_off_data *sys_off_data)
{
struct pm886_chip *chip = sys_off_data->cb_data;
struct regmap *regmap = chip->regmap;
struct device *dev = &chip->client->dev;
int err;
err = regmap_update_bits(regmap, PM886_REG_MISC_CONFIG1, PM886_SW_PDOWN, PM886_SW_PDOWN);
if (err) {
dev_err(dev, "Failed to power off the device: %d\n", err);
return NOTIFY_BAD;
}
return NOTIFY_DONE;
}
static int pm886_setup_irq(struct pm886_chip *chip,
struct regmap_irq_chip_data **irq_data)
{
struct regmap *regmap = chip->regmap;
struct device *dev = &chip->client->dev;
int err;
/* Set interrupt clearing mode to clear on write. */
err = regmap_update_bits(regmap, PM886_REG_MISC_CONFIG2,
PM886_INT_INV | PM886_INT_CLEAR | PM886_INT_MASK_MODE,
PM886_INT_WC);
if (err) {
dev_err(dev, "Failed to set interrupt clearing mode: %d\n", err);
return err;
}
err = devm_regmap_add_irq_chip(dev, regmap, chip->client->irq,
IRQF_ONESHOT, 0, &pm886_regmap_irq_chip,
irq_data);
if (err) {
dev_err(dev, "Failed to request IRQ: %d\n", err);
return err;
}
return 0;
}
static int pm886_probe(struct i2c_client *client)
{
struct regmap_irq_chip_data *irq_data;
struct device *dev = &client->dev;
struct pm886_chip *chip;
Annotation
- Immediate include surface: `linux/i2c.h`, `linux/mfd/core.h`, `linux/module.h`, `linux/notifier.h`, `linux/of.h`, `linux/platform_device.h`, `linux/reboot.h`, `linux/regmap.h`.
- Detected declarations: `function pm886_power_off_handler`, `function pm886_setup_irq`, `function pm886_probe`.
- Atlas domain: Driver Families / drivers/mfd.
- Implementation status: source implementation candidate.
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.