drivers/mfd/bcm590xx.c
Source file repositories/reference/linux-study-clean/drivers/mfd/bcm590xx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mfd/bcm590xx.c- Extension
.c- Size
- 4748 bytes
- Lines
- 182
- 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/err.hlinux/i2c.hlinux/init.hlinux/mfd/bcm590xx.hlinux/mfd/core.hlinux/module.hlinux/moduleparam.hlinux/of.hlinux/regmap.hlinux/slab.h
Detected Declarations
function bcm590xx_parse_versionfunction bcm590xx_i2c_probe
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Broadcom BCM590xx PMU
*
* Copyright 2014 Linaro Limited
* Author: Matt Porter <mporter@linaro.org>
*/
#include <linux/err.h>
#include <linux/i2c.h>
#include <linux/init.h>
#include <linux/mfd/bcm590xx.h>
#include <linux/mfd/core.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/of.h>
#include <linux/regmap.h>
#include <linux/slab.h>
/* Under primary I2C address: */
#define BCM590XX_REG_PMUID 0x1e
#define BCM590XX_REG_PMUREV 0x1f
#define BCM590XX_PMUREV_DIG_MASK 0xF
#define BCM590XX_PMUREV_DIG_SHIFT 0
#define BCM590XX_PMUREV_ANA_MASK 0xF0
#define BCM590XX_PMUREV_ANA_SHIFT 4
static const struct mfd_cell bcm590xx_devs[] = {
{
.name = "bcm590xx-vregs",
},
};
static const struct regmap_config bcm590xx_regmap_config_pri = {
.reg_bits = 8,
.val_bits = 8,
.max_register = BCM590XX_MAX_REGISTER_PRI,
.cache_type = REGCACHE_MAPLE,
};
static const struct regmap_config bcm590xx_regmap_config_sec = {
.reg_bits = 8,
.val_bits = 8,
.max_register = BCM590XX_MAX_REGISTER_SEC,
.cache_type = REGCACHE_MAPLE,
};
/* Map PMU ID value to model name string */
static const char * const bcm590xx_names[] = {
[BCM590XX_PMUID_BCM59054] = "BCM59054",
[BCM590XX_PMUID_BCM59056] = "BCM59056",
};
static int bcm590xx_parse_version(struct bcm590xx *bcm590xx)
{
unsigned int id, rev;
int ret;
/* Get PMU ID and verify that it matches compatible */
ret = regmap_read(bcm590xx->regmap_pri, BCM590XX_REG_PMUID, &id);
if (ret) {
dev_err(bcm590xx->dev, "failed to read PMU ID: %d\n", ret);
return ret;
}
if (id != bcm590xx->pmu_id) {
dev_err(bcm590xx->dev, "Incorrect ID for %s: expected %x, got %x.\n",
bcm590xx_names[bcm590xx->pmu_id], bcm590xx->pmu_id, id);
return -ENODEV;
}
/* Get PMU revision and store it in the info struct */
ret = regmap_read(bcm590xx->regmap_pri, BCM590XX_REG_PMUREV, &rev);
if (ret) {
dev_err(bcm590xx->dev, "failed to read PMU revision: %d\n", ret);
return ret;
}
bcm590xx->rev_digital = (rev & BCM590XX_PMUREV_DIG_MASK) >> BCM590XX_PMUREV_DIG_SHIFT;
bcm590xx->rev_analog = (rev & BCM590XX_PMUREV_ANA_MASK) >> BCM590XX_PMUREV_ANA_SHIFT;
dev_dbg(bcm590xx->dev, "PMU ID 0x%x (%s), revision: digital %d, analog %d",
id, bcm590xx_names[id], bcm590xx->rev_digital, bcm590xx->rev_analog);
return 0;
}
static int bcm590xx_i2c_probe(struct i2c_client *i2c_pri)
Annotation
- Immediate include surface: `linux/err.h`, `linux/i2c.h`, `linux/init.h`, `linux/mfd/bcm590xx.h`, `linux/mfd/core.h`, `linux/module.h`, `linux/moduleparam.h`, `linux/of.h`.
- Detected declarations: `function bcm590xx_parse_version`, `function bcm590xx_i2c_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.