drivers/rtc/rtc-nvidia-vrs10.c
Source file repositories/reference/linux-study-clean/drivers/rtc/rtc-nvidia-vrs10.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/rtc/rtc-nvidia-vrs10.c- Extension
.c- Size
- 12875 bytes
- Lines
- 543
- 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/bits.hlinux/err.hlinux/i2c.hlinux/interrupt.hlinux/module.hlinux/rtc.h
Detected Declarations
struct nvvrs_rtc_infoenum nvvrs_irq_regsfunction nvvrs_update_bitsfunction nvvrs_rtc_write_alarmfunction nvvrs_rtc_enable_alarmfunction nvvrs_rtc_disable_alarmfunction nvvrs_rtc_read_timefunction nvvrs_rtc_set_timefunction nvvrs_rtc_read_alarmfunction nvvrs_rtc_set_alarmfunction nvvrs_pseq_irq_clearfunction nvvrs_rtc_irq_handlerfunction nvvrs_rtc_alarm_irq_enablefunction nvvrs_pseq_vendor_infofunction nvvrs_rtc_probefunction nvvrs_rtc_suspendfunction nvvrs_rtc_resume
Annotated Snippet
struct nvvrs_rtc_info {
struct device *dev;
struct i2c_client *client;
struct rtc_device *rtc;
unsigned int irq;
};
static int nvvrs_update_bits(struct nvvrs_rtc_info *info, u8 reg,
u8 mask, u8 value)
{
int ret;
u8 val;
ret = i2c_smbus_read_byte_data(info->client, reg);
if (ret < 0)
return ret;
val = (u8)ret;
val &= ~mask;
val |= (value & mask);
return i2c_smbus_write_byte_data(info->client, reg, val);
}
static int nvvrs_rtc_write_alarm(struct i2c_client *client, u8 *time)
{
int ret;
ret = i2c_smbus_write_byte_data(client, NVVRS_REG_RTC_A3, time[3]);
if (ret < 0)
return ret;
ret = i2c_smbus_write_byte_data(client, NVVRS_REG_RTC_A2, time[2]);
if (ret < 0)
return ret;
ret = i2c_smbus_write_byte_data(client, NVVRS_REG_RTC_A1, time[1]);
if (ret < 0)
return ret;
return i2c_smbus_write_byte_data(client, NVVRS_REG_RTC_A0, time[0]);
}
static int nvvrs_rtc_enable_alarm(struct nvvrs_rtc_info *info)
{
int ret;
/* Set RTC_WAKE bit for autonomous wake from sleep */
ret = nvvrs_update_bits(info, NVVRS_REG_CTL_2, NVVRS_REG_CTL_2_RTC_WAKE,
NVVRS_REG_CTL_2_RTC_WAKE);
if (ret < 0)
return ret;
/* Set RTC_PU bit for autonomous wake from shutdown */
ret = nvvrs_update_bits(info, NVVRS_REG_CTL_2, NVVRS_REG_CTL_2_RTC_PU,
NVVRS_REG_CTL_2_RTC_PU);
if (ret < 0)
return ret;
return 0;
}
static int nvvrs_rtc_disable_alarm(struct nvvrs_rtc_info *info)
{
struct i2c_client *client = info->client;
u8 val[4];
int ret;
/* Clear RTC_WAKE bit */
ret = nvvrs_update_bits(info, NVVRS_REG_CTL_2, NVVRS_REG_CTL_2_RTC_WAKE,
0);
if (ret < 0)
return ret;
/* Clear RTC_PU bit */
ret = nvvrs_update_bits(info, NVVRS_REG_CTL_2, NVVRS_REG_CTL_2_RTC_PU,
0);
if (ret < 0)
return ret;
/* Write ALARM_RESET_VAL in RTC Alarm register to disable alarm */
val[0] = 0xff;
val[1] = 0xff;
val[2] = 0xff;
val[3] = 0xff;
ret = nvvrs_rtc_write_alarm(client, val);
if (ret < 0)
return ret;
Annotation
- Immediate include surface: `linux/bits.h`, `linux/err.h`, `linux/i2c.h`, `linux/interrupt.h`, `linux/module.h`, `linux/rtc.h`.
- Detected declarations: `struct nvvrs_rtc_info`, `enum nvvrs_irq_regs`, `function nvvrs_update_bits`, `function nvvrs_rtc_write_alarm`, `function nvvrs_rtc_enable_alarm`, `function nvvrs_rtc_disable_alarm`, `function nvvrs_rtc_read_time`, `function nvvrs_rtc_set_time`, `function nvvrs_rtc_read_alarm`, `function nvvrs_rtc_set_alarm`.
- 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.