drivers/regulator/bd9571mwv-regulator.c
Source file repositories/reference/linux-study-clean/drivers/regulator/bd9571mwv-regulator.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/regulator/bd9571mwv-regulator.c- Extension
.c- Size
- 9440 bytes
- Lines
- 368
- 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/mfd/rohm-generic.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/regulator/driver.hlinux/mfd/bd9571mwv.h
Detected Declarations
struct bd9571mwv_regenum bd9571mwv_regulatorsfunction bd9571mwv_avs_get_moni_statefunction bd9571mwv_avs_set_voltage_sel_regmapfunction bd9571mwv_avs_get_voltage_sel_regmapfunction bd9571mwv_reg_set_voltage_sel_regmapfunction bd9571mwv_bkup_mode_readfunction bd9571mwv_bkup_mode_writefunction backup_mode_showfunction backup_mode_storefunction bd9571mwv_suspendfunction bd9571mwv_resumefunction bd9571mwv_regulator_removefunction bd9571mwv_regulator_probe
Annotated Snippet
struct bd9571mwv_reg {
struct regmap *regmap;
/* DDR Backup Power */
u8 bkup_mode_cnt_keepon; /* from "rohm,ddr-backup-power" */
u8 bkup_mode_cnt_saved;
bool bkup_mode_enabled;
/* Power switch type */
bool rstbmode_level;
bool rstbmode_pulse;
};
enum bd9571mwv_regulators { VD09, VD18, VD25, VD33, DVFS };
#define BD9571MWV_REG(_name, _of, _id, _ops, _vr, _vm, _nv, _min, _step, _lmin)\
{ \
.name = _name, \
.of_match = of_match_ptr(_of), \
.regulators_node = "regulators", \
.id = _id, \
.ops = &_ops, \
.n_voltages = _nv, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
.vsel_reg = _vr, \
.vsel_mask = _vm, \
.min_uV = _min, \
.uV_step = _step, \
.linear_min_sel = _lmin, \
}
static int bd9571mwv_avs_get_moni_state(struct regulator_dev *rdev)
{
unsigned int val;
int ret;
ret = regmap_read(rdev->regmap, BD9571MWV_AVS_SET_MONI, &val);
if (ret != 0)
return ret;
return val & BD9571MWV_AVS_SET_MONI_MASK;
}
static int bd9571mwv_avs_set_voltage_sel_regmap(struct regulator_dev *rdev,
unsigned int sel)
{
int ret;
ret = bd9571mwv_avs_get_moni_state(rdev);
if (ret < 0)
return ret;
return regmap_write_bits(rdev->regmap, BD9571MWV_AVS_VD09_VID(ret),
rdev->desc->vsel_mask, sel);
}
static int bd9571mwv_avs_get_voltage_sel_regmap(struct regulator_dev *rdev)
{
unsigned int val;
int ret;
ret = bd9571mwv_avs_get_moni_state(rdev);
if (ret < 0)
return ret;
ret = regmap_read(rdev->regmap, BD9571MWV_AVS_VD09_VID(ret), &val);
if (ret != 0)
return ret;
val &= rdev->desc->vsel_mask;
val >>= ffs(rdev->desc->vsel_mask) - 1;
return val;
}
static int bd9571mwv_reg_set_voltage_sel_regmap(struct regulator_dev *rdev,
unsigned int sel)
{
return regmap_write_bits(rdev->regmap, BD9571MWV_DVFS_SETVID,
rdev->desc->vsel_mask, sel);
}
/* Operations permitted on AVS voltage regulator */
static const struct regulator_ops avs_ops = {
.set_voltage_sel = bd9571mwv_avs_set_voltage_sel_regmap,
.map_voltage = regulator_map_voltage_linear,
.get_voltage_sel = bd9571mwv_avs_get_voltage_sel_regmap,
.list_voltage = regulator_list_voltage_linear,
};
Annotation
- Immediate include surface: `linux/mfd/rohm-generic.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `linux/regulator/driver.h`, `linux/mfd/bd9571mwv.h`.
- Detected declarations: `struct bd9571mwv_reg`, `enum bd9571mwv_regulators`, `function bd9571mwv_avs_get_moni_state`, `function bd9571mwv_avs_set_voltage_sel_regmap`, `function bd9571mwv_avs_get_voltage_sel_regmap`, `function bd9571mwv_reg_set_voltage_sel_regmap`, `function bd9571mwv_bkup_mode_read`, `function bd9571mwv_bkup_mode_write`, `function backup_mode_show`, `function backup_mode_store`.
- 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.