drivers/regulator/lochnagar-regulator.c
Source file repositories/reference/linux-study-clean/drivers/regulator/lochnagar-regulator.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/regulator/lochnagar-regulator.c- Extension
.c- Size
- 7329 bytes
- Lines
- 283
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitops.hlinux/device.hlinux/err.hlinux/module.hlinux/mutex.hlinux/of.hlinux/platform_device.hlinux/regmap.hlinux/regulator/driver.hlinux/regulator/machine.hlinux/regulator/of_regulator.hlinux/mfd/lochnagar.hlinux/mfd/lochnagar1_regs.hlinux/mfd/lochnagar2_regs.h
Detected Declarations
enum lochnagar_regulatorsfunction lochnagar_micbias_enablefunction lochnagar_micbias_disablefunction lochnagar_micbias_of_parsefunction lochnagar_regulator_probe
Annotated Snippet
if (ret < 0) {
dev_err(lochnagar->dev,
"Failed to update micbias source: %d\n", ret);
return ret;
}
}
return 0;
}
static const struct regulator_desc lochnagar_regulators[] = {
[LOCHNAGAR_MICVDD] = {
.name = "MICVDD",
.supply_name = "SYSVDD",
.type = REGULATOR_VOLTAGE,
.n_voltages = 32,
.ops = &lochnagar_micvdd_ops,
.id = LOCHNAGAR_MICVDD,
.of_match = of_match_ptr("MICVDD"),
.enable_reg = LOCHNAGAR2_MICVDD_CTRL1,
.enable_mask = LOCHNAGAR2_MICVDD_REG_ENA_MASK,
.vsel_reg = LOCHNAGAR2_MICVDD_CTRL2,
.vsel_mask = LOCHNAGAR2_MICVDD_VSEL_MASK,
.linear_ranges = lochnagar_micvdd_ranges,
.n_linear_ranges = ARRAY_SIZE(lochnagar_micvdd_ranges),
.enable_time = 3000,
.ramp_delay = 1000,
.owner = THIS_MODULE,
},
[LOCHNAGAR_MIC1VDD] = {
.name = "MIC1VDD",
.supply_name = "MICBIAS1",
.type = REGULATOR_VOLTAGE,
.ops = &lochnagar_micbias_ops,
.id = LOCHNAGAR_MIC1VDD,
.of_match = of_match_ptr("MIC1VDD"),
.of_parse_cb = lochnagar_micbias_of_parse,
.enable_reg = LOCHNAGAR2_ANALOGUE_PATH_CTRL2,
.enable_mask = LOCHNAGAR2_P1_INPUT_BIAS_ENA_MASK,
.owner = THIS_MODULE,
},
[LOCHNAGAR_MIC2VDD] = {
.name = "MIC2VDD",
.supply_name = "MICBIAS2",
.type = REGULATOR_VOLTAGE,
.ops = &lochnagar_micbias_ops,
.id = LOCHNAGAR_MIC2VDD,
.of_match = of_match_ptr("MIC2VDD"),
.of_parse_cb = lochnagar_micbias_of_parse,
.enable_reg = LOCHNAGAR2_ANALOGUE_PATH_CTRL2,
.enable_mask = LOCHNAGAR2_P2_INPUT_BIAS_ENA_MASK,
.owner = THIS_MODULE,
},
[LOCHNAGAR_VDDCORE] = {
.name = "VDDCORE",
.supply_name = "SYSVDD",
.type = REGULATOR_VOLTAGE,
.n_voltages = 66,
.ops = &lochnagar_vddcore_ops,
.id = LOCHNAGAR_VDDCORE,
.of_match = of_match_ptr("VDDCORE"),
.enable_reg = LOCHNAGAR2_VDDCORE_CDC_CTRL1,
.enable_mask = LOCHNAGAR2_VDDCORE_CDC_REG_ENA_MASK,
.vsel_reg = LOCHNAGAR2_VDDCORE_CDC_CTRL2,
.vsel_mask = LOCHNAGAR2_VDDCORE_CDC_VSEL_MASK,
.linear_ranges = lochnagar_vddcore_ranges,
.n_linear_ranges = ARRAY_SIZE(lochnagar_vddcore_ranges),
.enable_time = 3000,
.ramp_delay = 1000,
.off_on_delay = 15000,
.owner = THIS_MODULE,
},
};
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/device.h`, `linux/err.h`, `linux/module.h`, `linux/mutex.h`, `linux/of.h`, `linux/platform_device.h`, `linux/regmap.h`.
- Detected declarations: `enum lochnagar_regulators`, `function lochnagar_micbias_enable`, `function lochnagar_micbias_disable`, `function lochnagar_micbias_of_parse`, `function lochnagar_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.