drivers/regulator/hi6421-regulator.c
Source file repositories/reference/linux-study-clean/drivers/regulator/hi6421-regulator.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/regulator/hi6421-regulator.c- Extension
.c- Size
- 18377 bytes
- Lines
- 591
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/slab.hlinux/device.hlinux/module.hlinux/err.hlinux/platform_device.hlinux/of.hlinux/regmap.hlinux/regulator/driver.hlinux/regulator/machine.hlinux/regulator/of_regulator.hlinux/mfd/hi6421-pmic.h
Detected Declarations
struct hi6421_regulator_pdatastruct hi6421_regulator_infoenum hi6421_regulator_idfunction hi6421_regulator_enablefunction hi6421_regulator_ldo_get_modefunction hi6421_regulator_buck_get_modefunction hi6421_regulator_ldo_set_modefunction hi6421_regulator_buck_set_modefunction hi6421_regulator_ldo_get_optimum_modefunction hi6421_regulator_probe
Annotated Snippet
struct hi6421_regulator_pdata {
struct mutex lock;
};
/*
* struct hi6421_regulator_info - hi6421 regulator information
* @desc: regulator description
* @mode_mask: ECO mode bitmask of LDOs; for BUCKs, this masks sleep
* @eco_microamp: eco mode load upper limit (in uA), valid for LDOs only
*/
struct hi6421_regulator_info {
struct regulator_desc desc;
u8 mode_mask;
u32 eco_microamp;
};
/* HI6421 regulators */
enum hi6421_regulator_id {
HI6421_LDO0,
HI6421_LDO1,
HI6421_LDO2,
HI6421_LDO3,
HI6421_LDO4,
HI6421_LDO5,
HI6421_LDO6,
HI6421_LDO7,
HI6421_LDO8,
HI6421_LDO9,
HI6421_LDO10,
HI6421_LDO11,
HI6421_LDO12,
HI6421_LDO13,
HI6421_LDO14,
HI6421_LDO15,
HI6421_LDO16,
HI6421_LDO17,
HI6421_LDO18,
HI6421_LDO19,
HI6421_LDO20,
HI6421_LDOAUDIO,
HI6421_BUCK0,
HI6421_BUCK1,
HI6421_BUCK2,
HI6421_BUCK3,
HI6421_BUCK4,
HI6421_BUCK5,
HI6421_NUM_REGULATORS,
};
/* LDO 0, 4~7, 9~14, 16~20 have same voltage table. */
static const unsigned int ldo_0_voltages[] = {
1500000, 1800000, 2400000, 2500000,
2600000, 2700000, 2850000, 3000000,
};
/* LDO 8, 15 have same voltage table. */
static const unsigned int ldo_8_voltages[] = {
1500000, 1800000, 2400000, 2600000,
2700000, 2850000, 3000000, 3300000,
};
/* Ranges are sorted in ascending order. */
static const struct linear_range ldo_audio_volt_range[] = {
REGULATOR_LINEAR_RANGE(2800000, 0, 3, 50000),
REGULATOR_LINEAR_RANGE(3000000, 4, 7, 100000),
};
static const unsigned int buck_3_voltages[] = {
950000, 1050000, 1100000, 1117000,
1134000, 1150000, 1167000, 1200000,
};
static const unsigned int buck_4_voltages[] = {
1150000, 1200000, 1250000, 1350000,
1700000, 1800000, 1900000, 2000000,
};
static const unsigned int buck_5_voltages[] = {
1150000, 1200000, 1250000, 1350000,
1600000, 1700000, 1800000, 1900000,
};
static const struct regulator_ops hi6421_ldo_ops;
static const struct regulator_ops hi6421_ldo_linear_ops;
static const struct regulator_ops hi6421_ldo_linear_range_ops;
static const struct regulator_ops hi6421_buck012_ops;
static const struct regulator_ops hi6421_buck345_ops;
#define HI6421_LDO_ENABLE_TIME (350)
/*
Annotation
- Immediate include surface: `linux/slab.h`, `linux/device.h`, `linux/module.h`, `linux/err.h`, `linux/platform_device.h`, `linux/of.h`, `linux/regmap.h`, `linux/regulator/driver.h`.
- Detected declarations: `struct hi6421_regulator_pdata`, `struct hi6421_regulator_info`, `enum hi6421_regulator_id`, `function hi6421_regulator_enable`, `function hi6421_regulator_ldo_get_mode`, `function hi6421_regulator_buck_get_mode`, `function hi6421_regulator_ldo_set_mode`, `function hi6421_regulator_buck_set_mode`, `function hi6421_regulator_ldo_get_optimum_mode`, `function hi6421_regulator_probe`.
- Atlas domain: Driver Families / drivers/regulator.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.