drivers/power/reset/st-poweroff.c
Source file repositories/reference/linux-study-clean/drivers/power/reset/st-poweroff.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/power/reset/st-poweroff.c- Extension
.c- Size
- 2480 bytes
- Lines
- 104
- Domain
- Driver Families
- Bucket
- drivers/power
- 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/module.hlinux/of.hlinux/platform_device.hlinux/mfd/syscon.hlinux/reboot.hlinux/regmap.h
Detected Declarations
struct reset_syscfgfunction st_restartfunction st_reset_probe
Annotated Snippet
struct reset_syscfg {
struct regmap *regmap;
/* syscfg used for reset */
unsigned int offset_rst;
unsigned int mask_rst;
/* syscfg used for unmask the reset */
unsigned int offset_rst_msk;
unsigned int mask_rst_msk;
};
/* STiH407 */
#define STIH407_SYSCFG_4000 0x0
#define STIH407_SYSCFG_4008 0x20
static struct reset_syscfg stih407_reset = {
.offset_rst = STIH407_SYSCFG_4000,
.mask_rst = BIT(0),
.offset_rst_msk = STIH407_SYSCFG_4008,
.mask_rst_msk = BIT(0)
};
static struct reset_syscfg *st_restart_syscfg;
static int st_restart(struct notifier_block *this, unsigned long mode,
void *cmd)
{
/* reset syscfg updated */
regmap_update_bits(st_restart_syscfg->regmap,
st_restart_syscfg->offset_rst,
st_restart_syscfg->mask_rst,
0);
/* unmask the reset */
regmap_update_bits(st_restart_syscfg->regmap,
st_restart_syscfg->offset_rst_msk,
st_restart_syscfg->mask_rst_msk,
0);
return NOTIFY_DONE;
}
static struct notifier_block st_restart_nb = {
.notifier_call = st_restart,
.priority = 192,
};
static const struct of_device_id st_reset_of_match[] = {
{
.compatible = "st,stih407-restart",
.data = (void *)&stih407_reset,
},
{}
};
static int st_reset_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
struct device *dev = &pdev->dev;
st_restart_syscfg = (struct reset_syscfg *)of_device_get_match_data(dev);
if (!st_restart_syscfg)
return -ENODEV;
st_restart_syscfg->regmap =
syscon_regmap_lookup_by_phandle(np, "st,syscfg");
if (IS_ERR(st_restart_syscfg->regmap)) {
dev_err(dev, "No syscfg phandle specified\n");
return PTR_ERR(st_restart_syscfg->regmap);
}
return register_restart_handler(&st_restart_nb);
}
static struct platform_driver st_reset_driver = {
.probe = st_reset_probe,
.driver = {
.name = "st_reset",
.of_match_table = st_reset_of_match,
},
};
builtin_platform_driver(st_reset_driver);
MODULE_AUTHOR("Christophe Kerello <christophe.kerello@st.com>");
MODULE_DESCRIPTION("STMicroelectronics Power off Restart driver");
MODULE_LICENSE("GPL v2");
Annotation
- Immediate include surface: `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `linux/mfd/syscon.h`, `linux/reboot.h`, `linux/regmap.h`.
- Detected declarations: `struct reset_syscfg`, `function st_restart`, `function st_reset_probe`.
- Atlas domain: Driver Families / drivers/power.
- 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.