drivers/regulator/stm32-booster.c
Source file repositories/reference/linux-study-clean/drivers/regulator/stm32-booster.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/regulator/stm32-booster.c- Extension
.c- Size
- 3566 bytes
- Lines
- 129
- 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/mfd/syscon.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/regmap.hlinux/regulator/driver.hlinux/regulator/of_regulator.h
Detected Declarations
function stm32mp1_booster_enablefunction stm32mp1_booster_disablefunction stm32_booster_probe
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
// Copyright (C) STMicroelectronics 2019
// Author(s): Fabrice Gasnier <fabrice.gasnier@st.com>.
#include <linux/mfd/syscon.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/regulator/driver.h>
#include <linux/regulator/of_regulator.h>
/* STM32H7 SYSCFG register */
#define STM32H7_SYSCFG_PMCR 0x04
#define STM32H7_SYSCFG_BOOSTE_MASK BIT(8)
/* STM32MP1 SYSCFG has set and clear registers */
#define STM32MP1_SYSCFG_PMCSETR 0x04
#define STM32MP1_SYSCFG_PMCCLRR 0x44
#define STM32MP1_SYSCFG_EN_BOOSTER_MASK BIT(8)
static const struct regulator_ops stm32h7_booster_ops = {
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap,
};
static const struct regulator_desc stm32h7_booster_desc = {
.name = "booster",
.supply_name = "vdda",
.n_voltages = 1,
.type = REGULATOR_VOLTAGE,
.fixed_uV = 3300000,
.ramp_delay = 66000, /* up to 50us to stabilize */
.ops = &stm32h7_booster_ops,
.enable_reg = STM32H7_SYSCFG_PMCR,
.enable_mask = STM32H7_SYSCFG_BOOSTE_MASK,
.owner = THIS_MODULE,
};
static int stm32mp1_booster_enable(struct regulator_dev *rdev)
{
return regmap_write(rdev->regmap, STM32MP1_SYSCFG_PMCSETR,
STM32MP1_SYSCFG_EN_BOOSTER_MASK);
}
static int stm32mp1_booster_disable(struct regulator_dev *rdev)
{
return regmap_write(rdev->regmap, STM32MP1_SYSCFG_PMCCLRR,
STM32MP1_SYSCFG_EN_BOOSTER_MASK);
}
static const struct regulator_ops stm32mp1_booster_ops = {
.enable = stm32mp1_booster_enable,
.disable = stm32mp1_booster_disable,
.is_enabled = regulator_is_enabled_regmap,
};
static const struct regulator_desc stm32mp1_booster_desc = {
.name = "booster",
.supply_name = "vdda",
.n_voltages = 1,
.type = REGULATOR_VOLTAGE,
.fixed_uV = 3300000,
.ramp_delay = 66000,
.ops = &stm32mp1_booster_ops,
.enable_reg = STM32MP1_SYSCFG_PMCSETR,
.enable_mask = STM32MP1_SYSCFG_EN_BOOSTER_MASK,
.owner = THIS_MODULE,
};
static int stm32_booster_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct device_node *np = pdev->dev.of_node;
struct regulator_config config = { };
const struct regulator_desc *desc;
struct regulator_dev *rdev;
struct regmap *regmap;
int ret;
regmap = syscon_regmap_lookup_by_phandle(np, "st,syscfg");
if (IS_ERR(regmap))
return PTR_ERR(regmap);
desc = device_get_match_data(dev);
config.regmap = regmap;
config.dev = dev;
config.of_node = np;
Annotation
- Immediate include surface: `linux/mfd/syscon.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `linux/regmap.h`, `linux/regulator/driver.h`, `linux/regulator/of_regulator.h`.
- Detected declarations: `function stm32mp1_booster_enable`, `function stm32mp1_booster_disable`, `function stm32_booster_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.