drivers/i2c/busses/i2c-icy.c
Source file repositories/reference/linux-study-clean/drivers/i2c/busses/i2c-icy.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/i2c/busses/i2c-icy.c- Extension
.c- Size
- 5723 bytes
- Lines
- 216
- Domain
- Driver Families
- Bucket
- drivers/i2c
- 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.
- 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/delay.hlinux/init.hlinux/io.hlinux/ioport.hlinux/kernel.hlinux/module.hlinux/i2c.hlinux/i2c-algo-pcf.hasm/amigahw.hasm/amigaints.hlinux/zorro.h../algos/i2c-algo-pcf.h
Detected Declarations
struct icy_i2cfunction icy_pcf_setpcffunction icy_pcf_getpcffunction icy_pcf_getownfunction icy_pcf_getclockfunction icy_pcf_waitforpinfunction icy_probefunction icy_remove
Annotated Snippet
struct icy_i2c {
struct i2c_adapter adapter;
void __iomem *reg_s0;
void __iomem *reg_s1;
struct i2c_client *ltc2990_client;
};
/*
* Functions called by i2c-algo-pcf
*/
static void icy_pcf_setpcf(void *data, int ctl, int val)
{
struct icy_i2c *i2c = (struct icy_i2c *)data;
u8 __iomem *address = ctl ? i2c->reg_s1 : i2c->reg_s0;
z_writeb(val, address);
}
static int icy_pcf_getpcf(void *data, int ctl)
{
struct icy_i2c *i2c = (struct icy_i2c *)data;
u8 __iomem *address = ctl ? i2c->reg_s1 : i2c->reg_s0;
return z_readb(address);
}
static int icy_pcf_getown(void *data)
{
return 0x55;
}
static int icy_pcf_getclock(void *data)
{
return 0x1c;
}
static void icy_pcf_waitforpin(void *data)
{
usleep_range(50, 150);
}
/*
* Main i2c-icy part
*/
static unsigned short const icy_ltc2990_addresses[] = {
0x4c, 0x4d, 0x4e, 0x4f, I2C_CLIENT_END
};
/*
* Additional sensors exposed once this property is applied:
*
* in1 will be the voltage of the 5V rail, divided by 2.
* in2 will be the voltage of the 12V rail, divided by 4.
* temp3 will be measured using a PCB loop next the chip.
*/
static const u32 icy_ltc2990_meas_mode[] = {0, 3};
static const struct property_entry icy_ltc2990_props[] = {
PROPERTY_ENTRY_U32_ARRAY("lltc,meas-mode", icy_ltc2990_meas_mode),
{ }
};
static const struct software_node icy_ltc2990_node = {
.properties = icy_ltc2990_props,
};
static int icy_probe(struct zorro_dev *z,
const struct zorro_device_id *ent)
{
struct icy_i2c *i2c;
struct i2c_algo_pcf_data *algo_data;
struct i2c_board_info ltc2990_info = {
.type = "ltc2990",
.swnode = &icy_ltc2990_node,
};
i2c = devm_kzalloc(&z->dev, sizeof(*i2c), GFP_KERNEL);
if (!i2c)
return -ENOMEM;
algo_data = devm_kzalloc(&z->dev, sizeof(*algo_data), GFP_KERNEL);
if (!algo_data)
return -ENOMEM;
dev_set_drvdata(&z->dev, i2c);
i2c->adapter.dev.parent = &z->dev;
i2c->adapter.owner = THIS_MODULE;
Annotation
- Immediate include surface: `linux/delay.h`, `linux/init.h`, `linux/io.h`, `linux/ioport.h`, `linux/kernel.h`, `linux/module.h`, `linux/i2c.h`, `linux/i2c-algo-pcf.h`.
- Detected declarations: `struct icy_i2c`, `function icy_pcf_setpcf`, `function icy_pcf_getpcf`, `function icy_pcf_getown`, `function icy_pcf_getclock`, `function icy_pcf_waitforpin`, `function icy_probe`, `function icy_remove`.
- Atlas domain: Driver Families / drivers/i2c.
- Implementation status: source implementation candidate.
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.