drivers/rtc/rtc-s5m.c
Source file repositories/reference/linux-study-clean/drivers/rtc/rtc-s5m.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/rtc/rtc-s5m.c- Extension
.c- Size
- 20386 bytes
- Lines
- 834
- Domain
- Driver Families
- Bucket
- drivers/rtc
- 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.
- 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/module.hlinux/i2c.hlinux/bcd.hlinux/reboot.hlinux/regmap.hlinux/rtc.hlinux/platform_device.hlinux/mfd/samsung/core.hlinux/mfd/samsung/rtc.hlinux/mfd/samsung/s2mps14.h
Detected Declarations
struct s5m_rtc_reg_configstruct s5m_rtc_infofunction s5m8767_data_to_tmfunction s5m8767_tm_to_datafunction s5m8767_wait_for_udr_updatefunction s5m_check_pending_alarm_interruptfunction s5m8767_rtc_set_time_regfunction s5m8767_rtc_set_alarm_regfunction s5m_rtc_read_timefunction s5m_rtc_set_timefunction s5m_rtc_read_alarmfunction s5m_rtc_stop_alarmfunction s5m_rtc_start_alarmfunction s5m_rtc_set_alarmfunction s5m_rtc_alarm_irq_enablefunction s5m_rtc_alarm_irqfunction s5m8767_rtc_init_regfunction s5m_rtc_restart_s2mpg10function s5m_rtc_probefunction s5m_rtc_resumefunction s5m_rtc_suspend
Annotated Snippet
struct s5m_rtc_reg_config {
/* Number of registers used for setting time/alarm0/alarm1 */
unsigned int regs_count;
/* First register for time, seconds */
unsigned int time;
/* RTC control register */
unsigned int ctrl;
/* First register for alarm 0, seconds */
unsigned int alarm0;
/* First register for alarm 1, seconds */
unsigned int alarm1;
/*
* Register for update flag (UDR). Typically setting UDR field to 1
* will enable update of time or alarm register. Then it will be
* auto-cleared after successful update.
*/
unsigned int udr_update;
/* Auto-cleared mask in UDR field for writing time and alarm */
unsigned int autoclear_udr_mask;
/*
* Masks in UDR field for time and alarm operations.
* The read time mask can be 0. Rest should not.
*/
unsigned int read_time_udr_mask;
unsigned int write_time_udr_mask;
unsigned int write_alarm_udr_mask;
};
/* Register map for S5M8767 */
static const struct s5m_rtc_reg_config s5m_rtc_regs = {
.regs_count = 8,
.time = S5M_RTC_SEC,
.ctrl = S5M_ALARM1_CONF,
.alarm0 = S5M_ALARM0_SEC,
.alarm1 = S5M_ALARM1_SEC,
.udr_update = S5M_RTC_UDR_CON,
.autoclear_udr_mask = S5M_RTC_UDR_MASK,
.read_time_udr_mask = 0, /* Not needed */
.write_time_udr_mask = S5M_RTC_UDR_MASK | S5M_RTC_TIME_EN_MASK,
.write_alarm_udr_mask = S5M_RTC_UDR_MASK,
};
/* Register map for S2MPG10 */
static const struct s5m_rtc_reg_config s2mpg10_rtc_regs = {
.regs_count = 7,
.time = S2MPG10_RTC_SEC,
.ctrl = S2MPG10_RTC_CTRL,
.alarm0 = S2MPG10_RTC_A0SEC,
.alarm1 = S2MPG10_RTC_A1SEC,
.udr_update = S2MPG10_RTC_UPDATE,
.autoclear_udr_mask = S2MPS15_RTC_WUDR_MASK | S2MPS15_RTC_AUDR_MASK,
.read_time_udr_mask = S2MPS_RTC_RUDR_MASK,
.write_time_udr_mask = S2MPS15_RTC_WUDR_MASK,
.write_alarm_udr_mask = S2MPS15_RTC_AUDR_MASK,
};
/* Register map for S2MPS13 */
static const struct s5m_rtc_reg_config s2mps13_rtc_regs = {
.regs_count = 7,
.time = S2MPS_RTC_SEC,
.ctrl = S2MPS_RTC_CTRL,
.alarm0 = S2MPS_ALARM0_SEC,
.alarm1 = S2MPS_ALARM1_SEC,
.udr_update = S2MPS_RTC_UDR_CON,
.autoclear_udr_mask = S2MPS_RTC_WUDR_MASK,
.read_time_udr_mask = S2MPS_RTC_RUDR_MASK,
.write_time_udr_mask = S2MPS_RTC_WUDR_MASK,
.write_alarm_udr_mask = S2MPS_RTC_WUDR_MASK | S2MPS13_RTC_AUDR_MASK,
};
/* Register map for S2MPS11/14 */
static const struct s5m_rtc_reg_config s2mps14_rtc_regs = {
.regs_count = 7,
.time = S2MPS_RTC_SEC,
.ctrl = S2MPS_RTC_CTRL,
.alarm0 = S2MPS_ALARM0_SEC,
.alarm1 = S2MPS_ALARM1_SEC,
.udr_update = S2MPS_RTC_UDR_CON,
.autoclear_udr_mask = S2MPS_RTC_WUDR_MASK,
.read_time_udr_mask = S2MPS_RTC_RUDR_MASK,
.write_time_udr_mask = S2MPS_RTC_WUDR_MASK,
.write_alarm_udr_mask = S2MPS_RTC_WUDR_MASK | S2MPS_RTC_RUDR_MASK,
};
/*
* Register map for S2MPS15 - in comparison to S2MPS14 the WUDR and AUDR bits
* are swapped.
*/
static const struct s5m_rtc_reg_config s2mps15_rtc_regs = {
.regs_count = 7,
Annotation
- Immediate include surface: `linux/module.h`, `linux/i2c.h`, `linux/bcd.h`, `linux/reboot.h`, `linux/regmap.h`, `linux/rtc.h`, `linux/platform_device.h`, `linux/mfd/samsung/core.h`.
- Detected declarations: `struct s5m_rtc_reg_config`, `struct s5m_rtc_info`, `function s5m8767_data_to_tm`, `function s5m8767_tm_to_data`, `function s5m8767_wait_for_udr_update`, `function s5m_check_pending_alarm_interrupt`, `function s5m8767_rtc_set_time_reg`, `function s5m8767_rtc_set_alarm_reg`, `function s5m_rtc_read_time`, `function s5m_rtc_set_time`.
- Atlas domain: Driver Families / drivers/rtc.
- Implementation status: source implementation candidate.
- 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.