drivers/mfd/rohm-bd71828.c
Source file repositories/reference/linux-study-clean/drivers/mfd/rohm-bd71828.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mfd/rohm-bd71828.c- Extension
.c- Size
- 48369 bytes
- Lines
- 1086
- 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/gpio_keys.hlinux/i2c.hlinux/input.hlinux/interrupt.hlinux/ioport.hlinux/irq.hlinux/mfd/core.hlinux/mfd/rohm-bd71815.hlinux/mfd/rohm-bd71828.hlinux/mfd/rohm-bd72720.hlinux/mfd/rohm-generic.hlinux/module.hlinux/of.hlinux/regmap.hlinux/types.h
Detected Declarations
struct bd72720_regmapsfunction regmap_write_wrapperfunction regmap_read_wrapperfunction bd72720_set_type_configfunction set_clk_modefunction bd71828_power_offfunction bd71828_remove_powerofffunction bd71828_i2c_probe
Annotated Snippet
struct bd72720_regmaps {
struct regmap *map1_4b;
struct regmap *map2_4c;
};
/* Translate the slave 0x4c wrapper register address to a real one */
#define BD72720_REG_UNWRAP(reg) ((reg) - BD72720_SECONDARY_I2C_REG_OFFSET)
/* Ranges given to 'real' 0x4c regmap must use unwrapped addresses. */
#define BD72720_UNWRAP_REG_RANGE(startreg, endreg) \
regmap_reg_range(BD72720_REG_UNWRAP(startreg), BD72720_REG_UNWRAP(endreg))
static const struct regmap_range bd72720_volatile_ranges_4c[] = {
/* Status information */
BD72720_UNWRAP_REG_RANGE(BD72720_REG_CHG_STATE, BD72720_REG_CHG_EN),
/*
* Under certain circumstances, write to some bits may be
* ignored
*/
BD72720_UNWRAP_REG_RANGE(BD72720_REG_CHG_CTRL, BD72720_REG_CHG_CTRL),
/*
* TODO: Ensure this is used to advertise state, not (only?) to
* control it.
*/
BD72720_UNWRAP_REG_RANGE(BD72720_REG_VSYS_STATE_STAT, BD72720_REG_VSYS_STATE_STAT),
/* Measured data */
BD72720_UNWRAP_REG_RANGE(BD72720_REG_VM_VBAT_U, BD72720_REG_VM_VF_L),
/* Self clearing bits */
BD72720_UNWRAP_REG_RANGE(BD72720_REG_VM_VSYS_SA_MINMAX_CTRL,
BD72720_REG_VM_VSYS_SA_MINMAX_CTRL),
/* Counters, self clearing bits */
BD72720_UNWRAP_REG_RANGE(BD72720_REG_CC_CURCD_U, BD72720_REG_CC_CTRL),
/* Self clearing bits */
BD72720_UNWRAP_REG_RANGE(BD72720_REG_CC_CCNTD_CTRL, BD72720_REG_CC_CCNTD_CTRL),
/* Self clearing bits */
BD72720_UNWRAP_REG_RANGE(BD72720_REG_IMPCHK_CTRL, BD72720_REG_IMPCHK_CTRL),
};
static const struct regmap_access_table bd71815_volatile_regs = {
.yes_ranges = &bd71815_volatile_ranges[0],
.n_yes_ranges = ARRAY_SIZE(bd71815_volatile_ranges),
};
static const struct regmap_access_table bd71828_volatile_regs = {
.yes_ranges = &bd71828_volatile_ranges[0],
.n_yes_ranges = ARRAY_SIZE(bd71828_volatile_ranges),
};
static const struct regmap_access_table bd72720_volatile_regs_4b = {
.yes_ranges = &bd72720_volatile_ranges_4b[0],
.n_yes_ranges = ARRAY_SIZE(bd72720_volatile_ranges_4b),
};
static const struct regmap_access_table bd72720_precious_regs_4b = {
.yes_ranges = &bd72720_precious_ranges_4b[0],
.n_yes_ranges = ARRAY_SIZE(bd72720_precious_ranges_4b),
};
static const struct regmap_access_table bd72720_volatile_regs_4c = {
.yes_ranges = &bd72720_volatile_ranges_4c[0],
.n_yes_ranges = ARRAY_SIZE(bd72720_volatile_ranges_4c),
};
static const struct regmap_config bd71815_regmap = {
.reg_bits = 8,
.val_bits = 8,
.volatile_table = &bd71815_volatile_regs,
.max_register = BD71815_MAX_REGISTER - 1,
.cache_type = REGCACHE_MAPLE,
};
static const struct regmap_config bd71828_regmap = {
.reg_bits = 8,
.val_bits = 8,
.volatile_table = &bd71828_volatile_regs,
.max_register = BD71828_MAX_REGISTER,
.cache_type = REGCACHE_MAPLE,
};
static int regmap_write_wrapper(void *context, unsigned int reg, unsigned int val)
{
struct bd72720_regmaps *maps = context;
if (reg < BD72720_SECONDARY_I2C_REG_OFFSET)
return regmap_write(maps->map1_4b, reg, val);
reg = BD72720_REG_UNWRAP(reg);
return regmap_write(maps->map2_4c, reg, val);
}
Annotation
- Immediate include surface: `linux/gpio_keys.h`, `linux/i2c.h`, `linux/input.h`, `linux/interrupt.h`, `linux/ioport.h`, `linux/irq.h`, `linux/mfd/core.h`, `linux/mfd/rohm-bd71815.h`.
- Detected declarations: `struct bd72720_regmaps`, `function regmap_write_wrapper`, `function regmap_read_wrapper`, `function bd72720_set_type_config`, `function set_clk_mode`, `function bd71828_power_off`, `function bd71828_remove_poweroff`, `function bd71828_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.