drivers/regulator/bd718x7-regulator.c
Source file repositories/reference/linux-study-clean/drivers/regulator/bd718x7-regulator.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/regulator/bd718x7-regulator.c- Extension
.c- Size
- 54840 bytes
- Lines
- 1840
- 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/cleanup.hlinux/delay.hlinux/err.hlinux/interrupt.hlinux/kernel.hlinux/mfd/rohm-bd718x7.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/regulator/driver.hlinux/regulator/machine.hlinux/regulator/of_regulator.hlinux/slab.h
Detected Declarations
struct reg_initstruct bd718xx_regulator_datafunction readingfunction never_enabled_by_hwstatefunction bd71837_get_buck34_enable_hwctrlfunction voltage_change_donefunction voltage_change_preparefunction bd718xx_set_voltage_sel_restrictedfunction bd718xx_set_voltage_sel_pickable_restrictedfunction bd71837_set_voltage_sel_pickable_restrictedfunction bd718x7_xvp_sanity_checkfunction bd718x7_set_ldo_uvpfunction bd718x7_get_buck_prot_regfunction bd718x7_get_buck_ovp_infofunction bd718x7_get_buck_uvp_infofunction bd718x7_set_buck_uvpfunction bd718x7_set_buck_ovpfunction buck_set_hw_dvs_levelsfunction mark_hw_controlledfunction regulatorfunction get_special_regulatorsfunction bd718xx_probefunction them
Annotated Snippet
struct reg_init {
unsigned int reg;
unsigned int mask;
unsigned int val;
};
struct bd718xx_regulator_data {
struct regulator_desc desc;
const struct rohm_dvs_config dvs;
const struct reg_init init;
const struct reg_init *additional_inits;
int additional_init_amnt;
};
static int bd718x7_xvp_sanity_check(struct regulator_dev *rdev, int lim_uV,
int severity)
{
/*
* BD71837/47/50 ... (ICs supported by this driver) do not provide
* warnings, only protection
*/
if (severity != REGULATOR_SEVERITY_PROT) {
dev_err(&rdev->dev,
"Unsupported Under Voltage protection level\n");
return -EINVAL;
}
/*
* And protection limit is not changeable. It can only be enabled
* or disabled
*/
if (lim_uV)
return -EINVAL;
return 0;
}
static int bd718x7_set_ldo_uvp(struct regulator_dev *rdev, int lim_uV,
int severity, bool enable)
{
int ldo_offset = rdev->desc->id - BD718XX_LDO1;
int prot_bit, ret;
ret = bd718x7_xvp_sanity_check(rdev, lim_uV, severity);
if (ret)
return ret;
prot_bit = BD718XX_LDO1_VRMON80 << ldo_offset;
if (enable)
return regmap_clear_bits(rdev->regmap, BD718XX_REG_MVRFLTMASK2,
prot_bit);
return regmap_set_bits(rdev->regmap, BD718XX_REG_MVRFLTMASK2,
prot_bit);
}
static int bd718x7_get_buck_prot_reg(int id, int *reg)
{
if (id > BD718XX_BUCK8) {
WARN_ON(id > BD718XX_BUCK8);
return -EINVAL;
}
if (id > BD718XX_BUCK4)
*reg = BD718XX_REG_MVRFLTMASK0;
else
*reg = BD718XX_REG_MVRFLTMASK1;
return 0;
}
static int bd718x7_get_buck_ovp_info(int id, int *reg, int *bit)
{
int ret;
ret = bd718x7_get_buck_prot_reg(id, reg);
if (ret)
return ret;
*bit = BIT((id % 4) * 2 + 1);
return 0;
}
static int bd718x7_get_buck_uvp_info(int id, int *reg, int *bit)
{
int ret;
ret = bd718x7_get_buck_prot_reg(id, reg);
Annotation
- Immediate include surface: `linux/cleanup.h`, `linux/delay.h`, `linux/err.h`, `linux/interrupt.h`, `linux/kernel.h`, `linux/mfd/rohm-bd718x7.h`, `linux/module.h`, `linux/of.h`.
- Detected declarations: `struct reg_init`, `struct bd718xx_regulator_data`, `function reading`, `function never_enabled_by_hwstate`, `function bd71837_get_buck34_enable_hwctrl`, `function voltage_change_done`, `function voltage_change_prepare`, `function bd718xx_set_voltage_sel_restricted`, `function bd718xx_set_voltage_sel_pickable_restricted`, `function bd71837_set_voltage_sel_pickable_restricted`.
- 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.