drivers/rtc/rtc-sa1100.c
Source file repositories/reference/linux-study-clean/drivers/rtc/rtc-sa1100.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/rtc/rtc-sa1100.c- Extension
.c- Size
- 9879 bytes
- Lines
- 355
- Domain
- Driver Families
- Bucket
- drivers/rtc
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/platform_device.hlinux/module.hlinux/clk.hlinux/rtc.hlinux/init.hlinux/fs.hlinux/interrupt.hlinux/slab.hlinux/string.hlinux/of.hlinux/pm.hlinux/bitops.hlinux/io.hrtc-sa1100.h
Detected Declarations
function Copyrightfunction sa1100_rtc_probefunction sa1100_rtc_alarm_irq_enablefunction sa1100_rtc_read_timefunction sa1100_rtc_set_timefunction sa1100_rtc_read_alarmfunction sa1100_rtc_set_alarmfunction sa1100_rtc_procfunction sa1100_rtc_initfunction sa1100_rtc_probefunction sa1100_rtc_removefunction sa1100_rtc_suspendfunction sa1100_rtc_resumeexport sa1100_rtc_init
Annotated Snippet
of_device_is_compatible(pdev->dev.of_node, "mrvl,sa1100-rtc")) {
info->rcnr = base + 0x04;
info->rtsr = base + 0x10;
info->rtar = base + 0x00;
info->rttr = base + 0x08;
} else {
info->rcnr = base + 0x0;
info->rtsr = base + 0x8;
info->rtar = base + 0x4;
info->rttr = base + 0xc;
}
platform_set_drvdata(pdev, info);
device_init_wakeup(&pdev->dev, true);
return sa1100_rtc_init(pdev, info);
}
static void sa1100_rtc_remove(struct platform_device *pdev)
{
struct sa1100_rtc *info = platform_get_drvdata(pdev);
if (info) {
spin_lock_irq(&info->lock);
writel_relaxed(0, info->rtsr);
spin_unlock_irq(&info->lock);
clk_disable_unprepare(info->clk);
}
}
#ifdef CONFIG_PM_SLEEP
static int sa1100_rtc_suspend(struct device *dev)
{
struct sa1100_rtc *info = dev_get_drvdata(dev);
if (device_may_wakeup(dev))
enable_irq_wake(info->irq_alarm);
return 0;
}
static int sa1100_rtc_resume(struct device *dev)
{
struct sa1100_rtc *info = dev_get_drvdata(dev);
if (device_may_wakeup(dev))
disable_irq_wake(info->irq_alarm);
return 0;
}
#endif
static SIMPLE_DEV_PM_OPS(sa1100_rtc_pm_ops, sa1100_rtc_suspend,
sa1100_rtc_resume);
#ifdef CONFIG_OF
static const struct of_device_id sa1100_rtc_dt_ids[] = {
{ .compatible = "mrvl,sa1100-rtc", },
{ .compatible = "mrvl,mmp-rtc", },
{}
};
MODULE_DEVICE_TABLE(of, sa1100_rtc_dt_ids);
#endif
static struct platform_driver sa1100_rtc_driver = {
.probe = sa1100_rtc_probe,
.remove = sa1100_rtc_remove,
.driver = {
.name = "sa1100-rtc",
.pm = &sa1100_rtc_pm_ops,
.of_match_table = of_match_ptr(sa1100_rtc_dt_ids),
},
};
module_platform_driver(sa1100_rtc_driver);
MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>");
MODULE_DESCRIPTION("SA11x0/PXA2xx Realtime Clock Driver (RTC)");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:sa1100-rtc");
Annotation
- Immediate include surface: `linux/platform_device.h`, `linux/module.h`, `linux/clk.h`, `linux/rtc.h`, `linux/init.h`, `linux/fs.h`, `linux/interrupt.h`, `linux/slab.h`.
- Detected declarations: `function Copyright`, `function sa1100_rtc_probe`, `function sa1100_rtc_alarm_irq_enable`, `function sa1100_rtc_read_time`, `function sa1100_rtc_set_time`, `function sa1100_rtc_read_alarm`, `function sa1100_rtc_set_alarm`, `function sa1100_rtc_proc`, `function sa1100_rtc_init`, `function sa1100_rtc_probe`.
- Atlas domain: Driver Families / drivers/rtc.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.