drivers/rtc/rtc-isl12026.c
Source file repositories/reference/linux-study-clean/drivers/rtc/rtc-isl12026.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/rtc/rtc-isl12026.c- Extension
.c- Size
- 11338 bytes
- Lines
- 507
- 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.
- 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/bcd.hlinux/delay.hlinux/i2c.hlinux/module.hlinux/mutex.hlinux/nvmem-provider.hlinux/of.hlinux/rtc.hlinux/slab.h
Detected Declarations
struct isl12026function isl12026_read_regfunction isl12026_arm_writefunction isl12026_disarm_writefunction isl12026_write_regfunction isl12026_rtc_set_timefunction isl12026_rtc_read_timefunction isl12026_nvm_readfunction isl12026_nvm_writefunction isl12026_force_power_modesfunction isl12026_probefunction isl12026_remove
Annotated Snippet
struct isl12026 {
struct rtc_device *rtc;
struct i2c_client *nvm_client;
};
static int isl12026_read_reg(struct i2c_client *client, int reg)
{
u8 addr[] = {0, reg};
u8 val;
int ret;
struct i2c_msg msgs[] = {
{
.addr = client->addr,
.flags = 0,
.len = sizeof(addr),
.buf = addr
}, {
.addr = client->addr,
.flags = I2C_M_RD,
.len = 1,
.buf = &val
}
};
ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs));
if (ret != ARRAY_SIZE(msgs)) {
dev_err(&client->dev, "read reg error, ret=%d\n", ret);
ret = ret < 0 ? ret : -EIO;
} else {
ret = val;
}
return ret;
}
static int isl12026_arm_write(struct i2c_client *client)
{
int ret;
u8 op[3];
struct i2c_msg msg = {
.addr = client->addr,
.flags = 0,
.len = 1,
.buf = op
};
/* Set SR.WEL */
op[0] = 0;
op[1] = ISL12026_REG_SR;
op[2] = ISL12026_REG_SR_WEL;
msg.len = 3;
ret = i2c_transfer(client->adapter, &msg, 1);
if (ret != 1) {
dev_err(&client->dev, "write error SR.WEL, ret=%d\n", ret);
ret = ret < 0 ? ret : -EIO;
goto out;
}
/* Set SR.WEL and SR.RWEL */
op[2] = ISL12026_REG_SR_WEL | ISL12026_REG_SR_RWEL;
msg.len = 3;
ret = i2c_transfer(client->adapter, &msg, 1);
if (ret != 1) {
dev_err(&client->dev,
"write error SR.WEL|SR.RWEL, ret=%d\n", ret);
ret = ret < 0 ? ret : -EIO;
goto out;
} else {
ret = 0;
}
out:
return ret;
}
static int isl12026_disarm_write(struct i2c_client *client)
{
int ret;
u8 op[3] = {0, ISL12026_REG_SR, 0};
struct i2c_msg msg = {
.addr = client->addr,
.flags = 0,
.len = sizeof(op),
.buf = op
};
ret = i2c_transfer(client->adapter, &msg, 1);
if (ret != 1) {
dev_err(&client->dev,
"write error SR, ret=%d\n", ret);
Annotation
- Immediate include surface: `linux/bcd.h`, `linux/delay.h`, `linux/i2c.h`, `linux/module.h`, `linux/mutex.h`, `linux/nvmem-provider.h`, `linux/of.h`, `linux/rtc.h`.
- Detected declarations: `struct isl12026`, `function isl12026_read_reg`, `function isl12026_arm_write`, `function isl12026_disarm_write`, `function isl12026_write_reg`, `function isl12026_rtc_set_time`, `function isl12026_rtc_read_time`, `function isl12026_nvm_read`, `function isl12026_nvm_write`, `function isl12026_force_power_modes`.
- 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.
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.