drivers/power/reset/th1520-aon-reboot.c
Source file repositories/reference/linux-study-clean/drivers/power/reset/th1520-aon-reboot.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/power/reset/th1520-aon-reboot.c- Extension
.c- Size
- 2540 bytes
- Lines
- 99
- 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/auxiliary_bus.hlinux/firmware/thead/thead,th1520-aon.hlinux/module.hlinux/notifier.hlinux/of.hlinux/reboot.hlinux/slab.h
Detected Declarations
struct th1520_aon_msg_empty_bodyfunction th1520_aon_pwroff_handlerfunction th1520_aon_restart_handlerfunction th1520_aon_reboot_probe
Annotated Snippet
struct th1520_aon_msg_empty_body {
struct th1520_aon_rpc_msg_hdr hdr;
u16 reserved[12];
} __packed __aligned(1);
static int th1520_aon_pwroff_handler(struct sys_off_data *data)
{
struct th1520_aon_chan *aon_chan = data->cb_data;
struct th1520_aon_msg_empty_body msg = {};
msg.hdr.svc = TH1520_AON_RPC_SVC_WDG;
msg.hdr.func = TH1520_AON_WDG_FUNC_POWER_OFF;
msg.hdr.size = TH1520_AON_RPC_MSG_NUM;
th1520_aon_call_rpc(aon_chan, &msg);
return NOTIFY_DONE;
}
static int th1520_aon_restart_handler(struct sys_off_data *data)
{
struct th1520_aon_chan *aon_chan = data->cb_data;
struct th1520_aon_msg_empty_body msg = {};
msg.hdr.svc = TH1520_AON_RPC_SVC_WDG;
msg.hdr.func = TH1520_AON_WDG_FUNC_RESTART;
msg.hdr.size = TH1520_AON_RPC_MSG_NUM;
th1520_aon_call_rpc(aon_chan, &msg);
return NOTIFY_DONE;
}
static int th1520_aon_reboot_probe(struct auxiliary_device *adev,
const struct auxiliary_device_id *id)
{
struct device *dev = &adev->dev;
int ret;
/* Expect struct th1520_aon_chan to be passed via platform_data */
ret = devm_register_sys_off_handler(dev, SYS_OFF_MODE_POWER_OFF,
TH1520_AON_REBOOT_PRIORITY,
th1520_aon_pwroff_handler,
adev->dev.platform_data);
if (ret) {
dev_err(dev, "Failed to register power off handler\n");
return ret;
}
ret = devm_register_sys_off_handler(dev, SYS_OFF_MODE_RESTART,
TH1520_AON_REBOOT_PRIORITY,
th1520_aon_restart_handler,
adev->dev.platform_data);
if (ret) {
dev_err(dev, "Failed to register restart handler\n");
return ret;
}
return 0;
}
static const struct auxiliary_device_id th1520_aon_reboot_id_table[] = {
{ .name = "th1520_pm_domains.reboot" },
{},
};
MODULE_DEVICE_TABLE(auxiliary, th1520_aon_reboot_id_table);
static struct auxiliary_driver th1520_aon_reboot_driver = {
.driver = {
.name = "th1520-aon-reboot",
},
.probe = th1520_aon_reboot_probe,
.id_table = th1520_aon_reboot_id_table,
};
module_auxiliary_driver(th1520_aon_reboot_driver);
MODULE_AUTHOR("Icenowy Zheng <uwu@icenowy.me>");
MODULE_DESCRIPTION("T-HEAD TH1520 AON-firmware-based reboot driver");
MODULE_LICENSE("GPL");
Annotation
- Immediate include surface: `linux/auxiliary_bus.h`, `linux/firmware/thead/thead,th1520-aon.h`, `linux/module.h`, `linux/notifier.h`, `linux/of.h`, `linux/reboot.h`, `linux/slab.h`.
- Detected declarations: `struct th1520_aon_msg_empty_body`, `function th1520_aon_pwroff_handler`, `function th1520_aon_restart_handler`, `function th1520_aon_reboot_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.