drivers/rtc/rtc-isl1208.c

Source file repositories/reference/linux-study-clean/drivers/rtc/rtc-isl1208.c

File Facts

System
Linux kernel
Corpus path
drivers/rtc/rtc-isl1208.c
Extension
.c
Size
25201 bytes
Lines
989
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct isl1208_config {
	unsigned int	nvmem_length;
	unsigned	has_tamper:1;
	unsigned	has_timestamp:1;
	unsigned	has_inverted_osc_bit:1;
};

static const struct isl1208_config config_isl1208 = {
	.nvmem_length = 2,
	.has_tamper = false,
	.has_timestamp = false
};

static const struct isl1208_config config_isl1209 = {
	.nvmem_length = 2,
	.has_tamper = true,
	.has_timestamp = false
};

static const struct isl1208_config config_isl1218 = {
	.nvmem_length = 8,
	.has_tamper = false,
	.has_timestamp = false
};

static const struct isl1208_config config_isl1219 = {
	.nvmem_length = 2,
	.has_tamper = true,
	.has_timestamp = true
};

static const struct isl1208_config config_raa215300_a0 = {
	.nvmem_length = 2,
	.has_tamper = false,
	.has_timestamp = false,
	.has_inverted_osc_bit = true
};

static const struct i2c_device_id isl1208_id[] = {
	{ "isl1208", .driver_data = (kernel_ulong_t)&config_isl1208 },
	{ "isl1209", .driver_data = (kernel_ulong_t)&config_isl1209 },
	{ "isl1218", .driver_data = (kernel_ulong_t)&config_isl1218 },
	{ "isl1219", .driver_data = (kernel_ulong_t)&config_isl1219 },
	{ "raa215300_a0", .driver_data = (kernel_ulong_t)&config_raa215300_a0 },
	{ }
};
MODULE_DEVICE_TABLE(i2c, isl1208_id);

static const __maybe_unused struct of_device_id isl1208_of_match[] = {
	{ .compatible = "isil,isl1208", .data = &config_isl1208 },
	{ .compatible = "isil,isl1209", .data = &config_isl1209 },
	{ .compatible = "isil,isl1218", .data = &config_isl1218 },
	{ .compatible = "isil,isl1219", .data = &config_isl1219 },
	{ }
};
MODULE_DEVICE_TABLE(of, isl1208_of_match);

/* Device state */
struct isl1208_state {
	struct nvmem_config nvmem_config;
	struct rtc_device *rtc;
	const struct isl1208_config *config;
};

/* block read */
static int
isl1208_i2c_read_regs(struct i2c_client *client, u8 reg, u8 buf[],
		      unsigned len)
{
	int ret;

	WARN_ON(reg > ISL1219_REG_YRT);
	WARN_ON(reg + len > ISL1219_REG_YRT + 1);

	ret = i2c_smbus_read_i2c_block_data(client, reg, len, buf);
	return (ret < 0) ? ret : 0;
}

/* block write */
static int
isl1208_i2c_set_regs(struct i2c_client *client, u8 reg, u8 const buf[],
		     unsigned len)
{
	int ret;

	WARN_ON(reg > ISL1219_REG_YRT);
	WARN_ON(reg + len > ISL1219_REG_YRT + 1);

	ret = i2c_smbus_write_i2c_block_data(client, reg, len, buf);
	return (ret < 0) ? ret : 0;

Annotation

Implementation Notes