drivers/mfd/rohm-bd9576.c
Source file repositories/reference/linux-study-clean/drivers/mfd/rohm-bd9576.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mfd/rohm-bd9576.c- Extension
.c- Size
- 5655 bytes
- Lines
- 188
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/i2c.hlinux/interrupt.hlinux/ioport.hlinux/irq.hlinux/mfd/core.hlinux/mfd/rohm-bd957x.hlinux/mfd/rohm-generic.hlinux/module.hlinux/of.hlinux/regmap.hlinux/types.h
Detected Declarations
function bd957x_i2c_probefunction condition
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (C) 2021 ROHM Semiconductors
*
* ROHM BD9576MUF and BD9573MUF PMIC driver
*/
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/ioport.h>
#include <linux/irq.h>
#include <linux/mfd/core.h>
#include <linux/mfd/rohm-bd957x.h>
#include <linux/mfd/rohm-generic.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/regmap.h>
#include <linux/types.h>
enum {
BD957X_REGULATOR_CELL,
BD957X_WDT_CELL,
};
/*
* Due to the BD9576MUF nasty IRQ behaviour we don't always populate IRQs.
* These will be added to regulator resources only if IRQ information for the
* PMIC is populated in device-tree.
*/
static const struct resource bd9576_regulator_irqs[] = {
DEFINE_RES_IRQ_NAMED(BD9576_INT_THERM, "bd9576-temp"),
DEFINE_RES_IRQ_NAMED(BD9576_INT_OVD, "bd9576-ovd"),
DEFINE_RES_IRQ_NAMED(BD9576_INT_UVD, "bd9576-uvd"),
};
static struct mfd_cell bd9573_mfd_cells[] = {
[BD957X_REGULATOR_CELL] = { .name = "bd9573-regulator", },
[BD957X_WDT_CELL] = { .name = "bd9576-wdt", },
};
static struct mfd_cell bd9576_mfd_cells[] = {
[BD957X_REGULATOR_CELL] = { .name = "bd9576-regulator", },
[BD957X_WDT_CELL] = { .name = "bd9576-wdt", },
};
static const struct regmap_range volatile_ranges[] = {
regmap_reg_range(BD957X_REG_SMRB_ASSERT, BD957X_REG_SMRB_ASSERT),
regmap_reg_range(BD957X_REG_PMIC_INTERNAL_STAT,
BD957X_REG_PMIC_INTERNAL_STAT),
regmap_reg_range(BD957X_REG_INT_THERM_STAT, BD957X_REG_INT_THERM_STAT),
regmap_reg_range(BD957X_REG_INT_OVP_STAT, BD957X_REG_INT_SYS_STAT),
regmap_reg_range(BD957X_REG_INT_MAIN_STAT, BD957X_REG_INT_MAIN_STAT),
};
static const struct regmap_access_table volatile_regs = {
.yes_ranges = &volatile_ranges[0],
.n_yes_ranges = ARRAY_SIZE(volatile_ranges),
};
static const struct regmap_config bd957x_regmap = {
.reg_bits = 8,
.val_bits = 8,
.volatile_table = &volatile_regs,
.max_register = BD957X_MAX_REGISTER,
.cache_type = REGCACHE_MAPLE,
};
static const struct regmap_irq bd9576_irqs[] = {
REGMAP_IRQ_REG(BD9576_INT_THERM, 0, BD957X_MASK_INT_MAIN_THERM),
REGMAP_IRQ_REG(BD9576_INT_OVP, 0, BD957X_MASK_INT_MAIN_OVP),
REGMAP_IRQ_REG(BD9576_INT_SCP, 0, BD957X_MASK_INT_MAIN_SCP),
REGMAP_IRQ_REG(BD9576_INT_OCP, 0, BD957X_MASK_INT_MAIN_OCP),
REGMAP_IRQ_REG(BD9576_INT_OVD, 0, BD957X_MASK_INT_MAIN_OVD),
REGMAP_IRQ_REG(BD9576_INT_UVD, 0, BD957X_MASK_INT_MAIN_UVD),
REGMAP_IRQ_REG(BD9576_INT_UVP, 0, BD957X_MASK_INT_MAIN_UVP),
REGMAP_IRQ_REG(BD9576_INT_SYS, 0, BD957X_MASK_INT_MAIN_SYS),
};
static const struct regmap_irq_chip bd9576_irq_chip = {
.name = "bd9576_irq",
.irqs = &bd9576_irqs[0],
.num_irqs = ARRAY_SIZE(bd9576_irqs),
.status_base = BD957X_REG_INT_MAIN_STAT,
.mask_base = BD957X_REG_INT_MAIN_MASK,
.ack_base = BD957X_REG_INT_MAIN_STAT,
.init_ack_masked = true,
.num_regs = 1,
.irq_reg_stride = 1,
};
Annotation
- Immediate include surface: `linux/i2c.h`, `linux/interrupt.h`, `linux/ioport.h`, `linux/irq.h`, `linux/mfd/core.h`, `linux/mfd/rohm-bd957x.h`, `linux/mfd/rohm-generic.h`, `linux/module.h`.
- Detected declarations: `function bd957x_i2c_probe`, `function condition`.
- 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.