drivers/rtc/rtc-max77686.c
Source file repositories/reference/linux-study-clean/drivers/rtc/rtc-max77686.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/rtc/rtc-max77686.c- Extension
.c- Size
- 23340 bytes
- Lines
- 892
- 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.
- 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/i2c.hlinux/slab.hlinux/rtc.hlinux/delay.hlinux/mutex.hlinux/module.hlinux/platform_device.hlinux/mfd/max77686-private.hlinux/irqdomain.hlinux/regmap.h
Detected Declarations
struct max77686_rtc_driver_datastruct max77686_rtc_infoenum MAX77686_RTC_OPenum max77686_rtc_reg_offsetfunction max77686_rtc_data_to_tmfunction max77686_rtc_tm_to_datafunction max77686_rtc_updatefunction max77686_rtc_read_timefunction max77686_rtc_set_timefunction max77686_rtc_read_alarmfunction max77686_rtc_stop_alarmfunction max77686_rtc_start_alarmfunction max77686_rtc_set_alarmfunction max77686_rtc_alarm_irq_enablefunction max77686_rtc_alarm_irqfunction max77686_rtc_init_regfunction max77686_rtc_release_devfunction max77686_init_rtc_regmapfunction max77686_rtc_probefunction max77686_rtc_removefunction max77686_rtc_suspendfunction max77686_rtc_resume
Annotated Snippet
struct max77686_rtc_driver_data {
unsigned long delay;
u8 mask;
const unsigned int *map;
bool alarm_enable_reg;
int rtc_i2c_addr;
bool rtc_irq_from_platform;
int alarm_pending_status_reg;
const struct regmap_irq_chip *rtc_irq_chip;
const struct regmap_config *regmap_config;
};
struct max77686_rtc_info {
struct device *dev;
struct rtc_device *rtc_dev;
struct mutex lock;
struct regmap *regmap;
struct regmap *rtc_regmap;
const struct max77686_rtc_driver_data *drv_data;
struct regmap_irq_chip_data *rtc_irq_data;
int rtc_irq;
int virq;
};
enum MAX77686_RTC_OP {
MAX77686_RTC_WRITE,
MAX77686_RTC_READ,
};
/* These are not registers but just offsets that are mapped to addresses */
enum max77686_rtc_reg_offset {
REG_RTC_CONTROLM = 0,
REG_RTC_CONTROL,
REG_RTC_UPDATE0,
REG_WTSR_SMPL_CNTL,
REG_RTC_SEC,
REG_RTC_MIN,
REG_RTC_HOUR,
REG_RTC_WEEKDAY,
REG_RTC_MONTH,
REG_RTC_YEAR,
REG_RTC_MONTHDAY,
REG_ALARM1_SEC,
REG_ALARM1_MIN,
REG_ALARM1_HOUR,
REG_ALARM1_WEEKDAY,
REG_ALARM1_MONTH,
REG_ALARM1_YEAR,
REG_ALARM1_DATE,
REG_ALARM2_SEC,
REG_ALARM2_MIN,
REG_ALARM2_HOUR,
REG_ALARM2_WEEKDAY,
REG_ALARM2_MONTH,
REG_ALARM2_YEAR,
REG_ALARM2_DATE,
REG_RTC_AE1,
REG_RTC_END,
};
/* Maps RTC registers offset to the MAX77686 register addresses */
static const unsigned int max77686_map[REG_RTC_END] = {
[REG_RTC_CONTROLM] = MAX77686_RTC_CONTROLM,
[REG_RTC_CONTROL] = MAX77686_RTC_CONTROL,
[REG_RTC_UPDATE0] = MAX77686_RTC_UPDATE0,
[REG_WTSR_SMPL_CNTL] = MAX77686_WTSR_SMPL_CNTL,
[REG_RTC_SEC] = MAX77686_RTC_SEC,
[REG_RTC_MIN] = MAX77686_RTC_MIN,
[REG_RTC_HOUR] = MAX77686_RTC_HOUR,
[REG_RTC_WEEKDAY] = MAX77686_RTC_WEEKDAY,
[REG_RTC_MONTH] = MAX77686_RTC_MONTH,
[REG_RTC_YEAR] = MAX77686_RTC_YEAR,
[REG_RTC_MONTHDAY] = MAX77686_RTC_MONTHDAY,
[REG_ALARM1_SEC] = MAX77686_ALARM1_SEC,
[REG_ALARM1_MIN] = MAX77686_ALARM1_MIN,
[REG_ALARM1_HOUR] = MAX77686_ALARM1_HOUR,
[REG_ALARM1_WEEKDAY] = MAX77686_ALARM1_WEEKDAY,
[REG_ALARM1_MONTH] = MAX77686_ALARM1_MONTH,
[REG_ALARM1_YEAR] = MAX77686_ALARM1_YEAR,
[REG_ALARM1_DATE] = MAX77686_ALARM1_DATE,
[REG_ALARM2_SEC] = MAX77686_ALARM2_SEC,
[REG_ALARM2_MIN] = MAX77686_ALARM2_MIN,
[REG_ALARM2_HOUR] = MAX77686_ALARM2_HOUR,
[REG_ALARM2_WEEKDAY] = MAX77686_ALARM2_WEEKDAY,
[REG_ALARM2_MONTH] = MAX77686_ALARM2_MONTH,
[REG_ALARM2_YEAR] = MAX77686_ALARM2_YEAR,
[REG_ALARM2_DATE] = MAX77686_ALARM2_DATE,
Annotation
- Immediate include surface: `linux/i2c.h`, `linux/slab.h`, `linux/rtc.h`, `linux/delay.h`, `linux/mutex.h`, `linux/module.h`, `linux/platform_device.h`, `linux/mfd/max77686-private.h`.
- Detected declarations: `struct max77686_rtc_driver_data`, `struct max77686_rtc_info`, `enum MAX77686_RTC_OP`, `enum max77686_rtc_reg_offset`, `function max77686_rtc_data_to_tm`, `function max77686_rtc_tm_to_data`, `function max77686_rtc_update`, `function max77686_rtc_read_time`, `function max77686_rtc_set_time`, `function max77686_rtc_read_alarm`.
- Atlas domain: Driver Families / drivers/rtc.
- Implementation status: source 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.