drivers/regulator/da9121-regulator.c
Source file repositories/reference/linux-study-clean/drivers/regulator/da9121-regulator.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/regulator/da9121-regulator.c- Extension
.c- Size
- 35914 bytes
- Lines
- 1226
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/of.hlinux/gpio/consumer.hlinux/regulator/of_regulator.hlinux/regulator/machine.hlinux/regulator/driver.hlinux/module.hlinux/regmap.hlinux/err.hlinux/i2c.hlinux/regulator/da9121.hlinux/interrupt.hlinux/workqueue.hda9121-regulator.h
Detected Declarations
struct da9121struct da9121_rangestruct da9121_variant_infostruct da9121_fieldstruct status_event_datafunction da9121_get_current_limitfunction da9121_ceiling_selectorfunction da9121_set_current_limitfunction da9121_map_modefunction da9121_buck_set_modefunction da9121_buck_get_modefunction da9121_of_parse_cbfunction da9121_status_poll_onfunction da9121_irq_handlerfunction da9121_set_regulator_configfunction da9121_check_device_typefunction da9121_assign_chip_modelfunction da9121_config_irqfunction da9121_i2c_probefunction da9121_i2c_remove
Annotated Snippet
struct da9121 {
struct device *dev;
struct delayed_work work;
struct da9121_pdata *pdata;
struct regmap *regmap;
struct regulator_dev *rdev[DA9121_IDX_MAX];
unsigned int persistent[2];
unsigned int passive_delay;
int chip_irq;
int variant_id;
int subvariant_id;
};
/* Define ranges for different variants, enabling translation to/from
* registers. Maximums give scope to allow for transients.
*/
struct da9121_range {
int val_min;
int val_max;
int val_stp;
int reg_min;
int reg_max;
};
static const struct da9121_range da9121_10A_2phase_current = {
.val_min = 7000000,
.val_max = 20000000,
.val_stp = 1000000,
.reg_min = 1,
.reg_max = 14,
};
static const struct da9121_range da9121_6A_2phase_current = {
.val_min = 7000000,
.val_max = 12000000,
.val_stp = 1000000,
.reg_min = 1,
.reg_max = 6,
};
static const struct da9121_range da9121_5A_1phase_current = {
.val_min = 3500000,
.val_max = 10000000,
.val_stp = 500000,
.reg_min = 1,
.reg_max = 14,
};
static const struct da9121_range da9121_3A_1phase_current = {
.val_min = 3500000,
.val_max = 6000000,
.val_stp = 500000,
.reg_min = 1,
.reg_max = 6,
};
static const struct da9121_range da914x_40A_4phase_current = {
.val_min = 26000000,
.val_max = 78000000,
.val_stp = 4000000,
.reg_min = 1,
.reg_max = 14,
};
static const struct da9121_range da914x_20A_2phase_current = {
.val_min = 13000000,
.val_max = 39000000,
.val_stp = 2000000,
.reg_min = 1,
.reg_max = 14,
};
struct da9121_variant_info {
int num_bucks;
int num_phases;
const struct da9121_range *current_range;
};
static const struct da9121_variant_info variant_parameters[] = {
{ 1, 2, &da9121_10A_2phase_current }, //DA9121_TYPE_DA9121_DA9130
{ 2, 1, &da9121_3A_1phase_current }, //DA9121_TYPE_DA9220_DA9132
{ 2, 1, &da9121_5A_1phase_current }, //DA9121_TYPE_DA9122_DA9131
{ 1, 2, &da9121_6A_2phase_current }, //DA9121_TYPE_DA9217
{ 1, 4, &da914x_40A_4phase_current }, //DA9121_TYPE_DA9141
{ 1, 2, &da914x_20A_2phase_current }, //DA9121_TYPE_DA9142
};
struct da9121_field {
unsigned int reg;
unsigned int msk;
Annotation
- Immediate include surface: `linux/of.h`, `linux/gpio/consumer.h`, `linux/regulator/of_regulator.h`, `linux/regulator/machine.h`, `linux/regulator/driver.h`, `linux/module.h`, `linux/regmap.h`, `linux/err.h`.
- Detected declarations: `struct da9121`, `struct da9121_range`, `struct da9121_variant_info`, `struct da9121_field`, `struct status_event_data`, `function da9121_get_current_limit`, `function da9121_ceiling_selector`, `function da9121_set_current_limit`, `function da9121_map_mode`, `function da9121_buck_set_mode`.
- Atlas domain: Driver Families / drivers/regulator.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.