drivers/regulator/hi6421v600-regulator.c
Source file repositories/reference/linux-study-clean/drivers/regulator/hi6421v600-regulator.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/regulator/hi6421v600-regulator.c- Extension
.c- Size
- 7937 bytes
- Lines
- 296
- 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/delay.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/regmap.hlinux/regulator/driver.hlinux/spmi.h
Detected Declarations
struct hi6421_spmi_reg_privstruct hi6421_spmi_reg_infoenum hi6421_spmi_regulator_idfunction HI6421V600_LDOfunction hi6421_spmi_regulator_get_modefunction hi6421_spmi_regulator_set_modefunction hi6421_spmi_regulator_get_optimum_modefunction hi6421_spmi_regulator_probe
Annotated Snippet
struct hi6421_spmi_reg_priv {
/* Serialize regulator enable logic */
struct mutex enable_mutex;
};
struct hi6421_spmi_reg_info {
struct regulator_desc desc;
u8 eco_mode_mask;
u32 eco_uA;
};
static const unsigned int range_1v5_to_2v0[] = {
1500000, 1550000, 1600000, 1650000,
1700000, 1725000, 1750000, 1775000,
1800000, 1825000, 1850000, 1875000,
1900000, 1925000, 1950000, 2000000
};
static const unsigned int range_1v725_to_1v9[] = {
1725000, 1750000, 1775000, 1800000,
1825000, 1850000, 1875000, 1900000
};
static const unsigned int range_1v75_to_3v3[] = {
1750000, 1800000, 1825000, 2800000,
2850000, 2950000, 3000000, 3300000
};
static const unsigned int range_1v8_to_3v0[] = {
1800000, 1850000, 2400000, 2600000,
2700000, 2850000, 2950000, 3000000
};
static const unsigned int range_2v5_to_3v3[] = {
2500000, 2600000, 2700000, 2800000,
3000000, 3100000, 3200000, 3300000
};
static const unsigned int range_2v6_to_3v3[] = {
2600000, 2700000, 2800000, 2900000,
3000000, 3100000, 3200000, 3300000
};
/**
* HI6421V600_LDO() - specify a LDO power line
* @_id: LDO id name string
* @vtable: voltage table
* @ereg: enable register
* @emask: enable mask
* @vreg: voltage select register
* @odelay: off/on delay time in uS
* @etime: enable time in uS
* @ecomask: eco mode mask
* @ecoamp: eco mode load uppler limit in uA
*/
#define HI6421V600_LDO(_id, vtable, ereg, emask, vreg, \
odelay, etime, ecomask, ecoamp) \
[hi6421v600_##_id] = { \
.desc = { \
.name = #_id, \
.of_match = of_match_ptr(#_id), \
.regulators_node = of_match_ptr("regulators"), \
.ops = &hi6421_spmi_ldo_rops, \
.type = REGULATOR_VOLTAGE, \
.id = hi6421v600_##_id, \
.owner = THIS_MODULE, \
.volt_table = vtable, \
.n_voltages = ARRAY_SIZE(vtable), \
.vsel_mask = ARRAY_SIZE(vtable) - 1, \
.vsel_reg = vreg, \
.enable_reg = ereg, \
.enable_mask = emask, \
.enable_time = etime, \
.ramp_delay = etime, \
.off_on_delay = odelay, \
}, \
.eco_mode_mask = ecomask, \
.eco_uA = ecoamp, \
}
static int hi6421_spmi_regulator_enable(struct regulator_dev *rdev)
{
struct hi6421_spmi_reg_priv *priv = rdev_get_drvdata(rdev);
int ret;
/* cannot enable more than one regulator at one time */
mutex_lock(&priv->enable_mutex);
ret = regmap_update_bits(rdev->regmap, rdev->desc->enable_reg,
rdev->desc->enable_mask,
Annotation
- Immediate include surface: `linux/delay.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `linux/regmap.h`, `linux/regulator/driver.h`, `linux/spmi.h`.
- Detected declarations: `struct hi6421_spmi_reg_priv`, `struct hi6421_spmi_reg_info`, `enum hi6421_spmi_regulator_id`, `function HI6421V600_LDO`, `function hi6421_spmi_regulator_get_mode`, `function hi6421_spmi_regulator_set_mode`, `function hi6421_spmi_regulator_get_optimum_mode`, `function hi6421_spmi_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.