drivers/regulator/cpcap-regulator.c
Source file repositories/reference/linux-study-clean/drivers/regulator/cpcap-regulator.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/regulator/cpcap-regulator.c- Extension
.c- Size
- 21949 bytes
- Lines
- 672
- 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.
- 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/err.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/regmap.hlinux/regulator/driver.hlinux/regulator/machine.hlinux/regulator/of_regulator.hlinux/mfd/motorola-cpcap.h
Detected Declarations
struct cpcap_regulatorstruct cpcap_ddataenum cpcap_regulator_idfunction cpcap_regulator_enablefunction cpcap_regulator_disablefunction cpcap_map_modefunction cpcap_regulator_get_modefunction cpcap_regulator_set_modefunction cpcap_regulator_probe
Annotated Snippet
struct cpcap_regulator {
struct regulator_desc rdesc;
const u16 assign_reg;
const u16 assign_mask;
};
#define CPCAP_REG(_ID, reg, assignment_reg, assignment_mask, val_tbl, \
mode_mask, volt_mask, mode_val, off_val, \
volt_trans_time) { \
.rdesc = { \
.name = #_ID, \
.of_match = of_match_ptr(#_ID), \
.ops = &cpcap_regulator_ops, \
.regulators_node = of_match_ptr("regulators"), \
.type = REGULATOR_VOLTAGE, \
.id = CPCAP_##_ID, \
.owner = THIS_MODULE, \
.n_voltages = ARRAY_SIZE(val_tbl), \
.volt_table = (val_tbl), \
.vsel_reg = (reg), \
.vsel_mask = (volt_mask), \
.enable_reg = (reg), \
.enable_mask = (mode_mask), \
.enable_val = (mode_val), \
.disable_val = (off_val), \
.ramp_delay = (volt_trans_time), \
.of_map_mode = cpcap_map_mode, \
}, \
.assign_reg = (assignment_reg), \
.assign_mask = (assignment_mask), \
}
struct cpcap_ddata {
struct regmap *reg;
struct device *dev;
const struct cpcap_regulator *soc;
};
enum cpcap_regulator_id {
CPCAP_SW1,
CPCAP_SW2,
CPCAP_SW3,
CPCAP_SW4,
CPCAP_SW5,
CPCAP_SW6,
CPCAP_VCAM,
CPCAP_VCSI,
CPCAP_VDAC,
CPCAP_VDIG,
CPCAP_VFUSE,
CPCAP_VHVIO,
CPCAP_VSDIO,
CPCAP_VPLL,
CPCAP_VRF1,
CPCAP_VRF2,
CPCAP_VRFREF,
CPCAP_VWLAN1,
CPCAP_VWLAN2,
CPCAP_VSIM,
CPCAP_VSIMCARD,
CPCAP_VVIB,
CPCAP_VUSB,
CPCAP_VAUDIO,
CPCAP_NR_REGULATORS,
};
/*
* We need to also configure regulator idle mode for SoC off mode if
* CPCAP_REG_OFF_MODE_SEC is set.
*/
static int cpcap_regulator_enable(struct regulator_dev *rdev)
{
struct cpcap_regulator *regulator = rdev_get_drvdata(rdev);
int error;
error = regulator_enable_regmap(rdev);
if (error)
return error;
if (rdev->desc->enable_val & CPCAP_REG_OFF_MODE_SEC) {
error = regmap_update_bits(rdev->regmap, regulator->assign_reg,
regulator->assign_mask,
regulator->assign_mask);
if (error)
regulator_disable_regmap(rdev);
}
return error;
}
Annotation
- Immediate include surface: `linux/err.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `linux/regmap.h`, `linux/regulator/driver.h`, `linux/regulator/machine.h`, `linux/regulator/of_regulator.h`.
- Detected declarations: `struct cpcap_regulator`, `struct cpcap_ddata`, `enum cpcap_regulator_id`, `function cpcap_regulator_enable`, `function cpcap_regulator_disable`, `function cpcap_map_mode`, `function cpcap_regulator_get_mode`, `function cpcap_regulator_set_mode`, `function cpcap_regulator_probe`.
- 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.