drivers/regulator/db8500-prcmu.c
Source file repositories/reference/linux-study-clean/drivers/regulator/db8500-prcmu.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/regulator/db8500-prcmu.c- Extension
.c- Size
- 12221 bytes
- Lines
- 502
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/init.hlinux/err.hlinux/spinlock.hlinux/platform_device.hlinux/mfd/dbx500-prcmu.hlinux/regulator/driver.hlinux/regulator/machine.hlinux/regulator/db8500-prcmu.hlinux/regulator/of_regulator.hlinux/of.hlinux/module.hdbx500-prcmu.h
Detected Declarations
function Copyrightfunction db8500_regulator_disablefunction db8500_regulator_is_enabledfunction enable_epodfunction disable_epodfunction db8500_regulator_switch_enablefunction db8500_regulator_switch_disablefunction db8500_regulator_switch_is_enabledfunction db8500_regulator_probefunction db8500_regulator_removefunction db8500_regulator_initfunction db8500_regulator_exit
Annotated Snippet
if (!epod_on[epod_id]) {
ret = prcmu_set_epod(epod_id, EPOD_STATE_RAMRET);
if (ret < 0)
return ret;
}
epod_ramret[epod_id] = true;
} else {
ret = prcmu_set_epod(epod_id, EPOD_STATE_ON);
if (ret < 0)
return ret;
epod_on[epod_id] = true;
}
return 0;
}
static int disable_epod(u16 epod_id, bool ramret)
{
int ret;
if (ramret) {
if (!epod_on[epod_id]) {
ret = prcmu_set_epod(epod_id, EPOD_STATE_OFF);
if (ret < 0)
return ret;
}
epod_ramret[epod_id] = false;
} else {
if (epod_ramret[epod_id]) {
ret = prcmu_set_epod(epod_id, EPOD_STATE_RAMRET);
if (ret < 0)
return ret;
} else {
ret = prcmu_set_epod(epod_id, EPOD_STATE_OFF);
if (ret < 0)
return ret;
}
epod_on[epod_id] = false;
}
return 0;
}
/*
* Regulator switch
*/
static int db8500_regulator_switch_enable(struct regulator_dev *rdev)
{
struct dbx500_regulator_info *info = rdev_get_drvdata(rdev);
int ret;
if (info == NULL)
return -EINVAL;
dev_vdbg(rdev_get_dev(rdev), "regulator-switch-%s-enable\n",
info->desc.name);
ret = enable_epod(info->epod_id, info->is_ramret);
if (ret < 0) {
dev_err(rdev_get_dev(rdev),
"regulator-switch-%s-enable: prcmu call failed\n",
info->desc.name);
goto out;
}
info->is_enabled = true;
out:
return ret;
}
static int db8500_regulator_switch_disable(struct regulator_dev *rdev)
{
struct dbx500_regulator_info *info = rdev_get_drvdata(rdev);
int ret;
if (info == NULL)
return -EINVAL;
dev_vdbg(rdev_get_dev(rdev), "regulator-switch-%s-disable\n",
info->desc.name);
ret = disable_epod(info->epod_id, info->is_ramret);
if (ret < 0) {
dev_err(rdev_get_dev(rdev),
"regulator_switch-%s-disable: prcmu call failed\n",
info->desc.name);
goto out;
}
info->is_enabled = false;
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/init.h`, `linux/err.h`, `linux/spinlock.h`, `linux/platform_device.h`, `linux/mfd/dbx500-prcmu.h`, `linux/regulator/driver.h`, `linux/regulator/machine.h`.
- Detected declarations: `function Copyright`, `function db8500_regulator_disable`, `function db8500_regulator_is_enabled`, `function enable_epod`, `function disable_epod`, `function db8500_regulator_switch_enable`, `function db8500_regulator_switch_disable`, `function db8500_regulator_switch_is_enabled`, `function db8500_regulator_probe`, `function db8500_regulator_remove`.
- Atlas domain: Driver Families / drivers/regulator.
- Implementation status: source implementation candidate.
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.