drivers/regulator/hi6421v530-regulator.c
Source file repositories/reference/linux-study-clean/drivers/regulator/hi6421v530-regulator.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/regulator/hi6421v530-regulator.c- Extension
.c- Size
- 5771 bytes
- Lines
- 207
- Domain
- Driver Families
- Bucket
- drivers/regulator
- 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/mfd/hi6421-pmic.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/regmap.hlinux/regulator/driver.h
Detected Declarations
struct hi6421v530_regulator_infoenum hi6421v530_regulator_idfunction hi6421v530_regulator_ldo_get_modefunction hi6421v530_regulator_ldo_set_modefunction hi6421v530_regulator_probe
Annotated Snippet
struct hi6421v530_regulator_info {
struct regulator_desc rdesc;
u8 mode_mask;
};
/* HI6421v530 regulators */
enum hi6421v530_regulator_id {
HI6421V530_LDO3,
HI6421V530_LDO9,
HI6421V530_LDO11,
HI6421V530_LDO15,
HI6421V530_LDO16,
};
static const unsigned int ldo_3_voltages[] = {
1800000, 1825000, 1850000, 1875000,
1900000, 1925000, 1950000, 1975000,
2000000, 2025000, 2050000, 2075000,
2100000, 2125000, 2150000, 2200000,
};
static const unsigned int ldo_9_11_voltages[] = {
1750000, 1800000, 1825000, 2800000,
2850000, 2950000, 3000000, 3300000,
};
static const unsigned int ldo_15_16_voltages[] = {
1750000, 1800000, 2400000, 2600000,
2700000, 2850000, 2950000, 3000000,
};
static const struct regulator_ops hi6421v530_ldo_ops;
#define HI6421V530_LDO_ENABLE_TIME (350)
/*
* _id - LDO id name string
* v_table - voltage table
* vreg - voltage select register
* vmask - voltage select mask
* ereg - enable register
* emask - enable mask
* odelay - off/on delay time in uS
* ecomask - eco mode mask
*/
#define HI6421V530_LDO(_ID, v_table, vreg, vmask, ereg, emask, \
odelay, ecomask) { \
.rdesc = { \
.name = #_ID, \
.of_match = of_match_ptr(#_ID), \
.regulators_node = of_match_ptr("regulators"), \
.ops = &hi6421v530_ldo_ops, \
.type = REGULATOR_VOLTAGE, \
.id = HI6421V530_##_ID, \
.owner = THIS_MODULE, \
.n_voltages = ARRAY_SIZE(v_table), \
.volt_table = v_table, \
.vsel_reg = HI6421_REG_TO_BUS_ADDR(vreg), \
.vsel_mask = vmask, \
.enable_reg = HI6421_REG_TO_BUS_ADDR(ereg), \
.enable_mask = emask, \
.enable_time = HI6421V530_LDO_ENABLE_TIME, \
.off_on_delay = odelay, \
}, \
.mode_mask = ecomask, \
}
/* HI6421V530 regulator information */
static const struct hi6421v530_regulator_info hi6421v530_regulator_info[] = {
HI6421V530_LDO(LDO3, ldo_3_voltages, 0x061, 0xf, 0x060, 0x2,
20000, 0x6),
HI6421V530_LDO(LDO9, ldo_9_11_voltages, 0x06b, 0x7, 0x06a, 0x2,
40000, 0x6),
HI6421V530_LDO(LDO11, ldo_9_11_voltages, 0x06f, 0x7, 0x06e, 0x2,
40000, 0x6),
HI6421V530_LDO(LDO15, ldo_15_16_voltages, 0x077, 0x7, 0x076, 0x2,
40000, 0x6),
HI6421V530_LDO(LDO16, ldo_15_16_voltages, 0x079, 0x7, 0x078, 0x2,
40000, 0x6),
};
static unsigned int hi6421v530_regulator_ldo_get_mode(
struct regulator_dev *rdev)
{
const struct hi6421v530_regulator_info *info;
unsigned int reg_val;
info = container_of_const(rdev->desc, struct hi6421v530_regulator_info, rdesc);
regmap_read(rdev->regmap, rdev->desc->enable_reg, ®_val);
Annotation
- Immediate include surface: `linux/mfd/hi6421-pmic.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `linux/regmap.h`, `linux/regulator/driver.h`.
- Detected declarations: `struct hi6421v530_regulator_info`, `enum hi6421v530_regulator_id`, `function hi6421v530_regulator_ldo_get_mode`, `function hi6421v530_regulator_ldo_set_mode`, `function hi6421v530_regulator_probe`.
- Atlas domain: Driver Families / drivers/regulator.
- 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.