drivers/regulator/ltc3589.c
Source file repositories/reference/linux-study-clean/drivers/regulator/ltc3589.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/regulator/ltc3589.c- Extension
.c- Size
- 13034 bytes
- Lines
- 477
- 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/i2c.hlinux/init.hlinux/interrupt.hlinux/module.hlinux/kernel.hlinux/of.hlinux/regmap.hlinux/regulator/driver.hlinux/regulator/of_regulator.h
Detected Declarations
struct ltc3589_infostruct ltc3589enum ltc3589_regfunction ltc3589_set_suspend_voltagefunction ltc3589_set_suspend_modefunction ltc3589_scalefunction ltc3589_of_parse_cbfunction ltc3589_writeable_regfunction ltc3589_readable_regfunction ltc3589_volatile_regfunction ltc3589_isrfunction ltc3589_probe
Annotated Snippet
struct ltc3589_info {
const unsigned int *volt_table;
int fixed_uV;
};
struct ltc3589 {
struct regmap *regmap;
struct device *dev;
struct regulator_desc regulator_descs[LTC3589_NUM_REGULATORS];
struct regulator_dev *regulators[LTC3589_NUM_REGULATORS];
};
static const int ltc3589_ldo4[] = {
2800000, 2500000, 1800000, 3300000,
};
static const int ltc3589_12_ldo4[] = {
1200000, 1800000, 2500000, 3200000,
};
static const unsigned int ltc3589_ramp_table[] = {
880, 1750, 3500, 7000
};
static int ltc3589_set_suspend_voltage(struct regulator_dev *rdev, int uV)
{
struct ltc3589 *ltc3589 = rdev_get_drvdata(rdev);
int sel;
sel = regulator_map_voltage_linear(rdev, uV, uV);
if (sel < 0)
return sel;
/* DTV2 register follows right after the corresponding DTV1 register */
return regmap_update_bits(ltc3589->regmap, rdev->desc->vsel_reg + 1,
rdev->desc->vsel_mask, sel);
}
static int ltc3589_set_suspend_mode(struct regulator_dev *rdev,
unsigned int mode)
{
struct ltc3589 *ltc3589 = rdev_get_drvdata(rdev);
int mask, bit = 0;
/* VCCR reference selects are right next to the VCCR go bits */
mask = rdev->desc->apply_bit << 1;
if (mode == REGULATOR_MODE_STANDBY)
bit = mask; /* Select DTV2 */
mask |= rdev->desc->apply_bit;
bit |= rdev->desc->apply_bit;
return regmap_update_bits(ltc3589->regmap, LTC3589_VCCR, mask, bit);
}
/* SW1, SW2, SW3, LDO2 */
static const struct regulator_ops ltc3589_linear_regulator_ops = {
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap,
.list_voltage = regulator_list_voltage_linear,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.set_ramp_delay = regulator_set_ramp_delay_regmap,
.set_voltage_time_sel = regulator_set_voltage_time_sel,
.set_suspend_voltage = ltc3589_set_suspend_voltage,
.set_suspend_mode = ltc3589_set_suspend_mode,
};
/* BB_OUT, LDO3 */
static const struct regulator_ops ltc3589_fixed_regulator_ops = {
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap,
};
/* LDO1 */
static const struct regulator_ops ltc3589_fixed_standby_regulator_ops = {
};
/* LDO4 */
static const struct regulator_ops ltc3589_table_regulator_ops = {
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap,
.list_voltage = regulator_list_voltage_table,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
};
Annotation
- Immediate include surface: `linux/i2c.h`, `linux/init.h`, `linux/interrupt.h`, `linux/module.h`, `linux/kernel.h`, `linux/of.h`, `linux/regmap.h`, `linux/regulator/driver.h`.
- Detected declarations: `struct ltc3589_info`, `struct ltc3589`, `enum ltc3589_reg`, `function ltc3589_set_suspend_voltage`, `function ltc3589_set_suspend_mode`, `function ltc3589_scale`, `function ltc3589_of_parse_cb`, `function ltc3589_writeable_reg`, `function ltc3589_readable_reg`, `function ltc3589_volatile_reg`.
- 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.