drivers/staging/iio/addac/adt7316-i2c.c
Source file repositories/reference/linux-study-clean/drivers/staging/iio/addac/adt7316-i2c.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/staging/iio/addac/adt7316-i2c.c- Extension
.c- Size
- 3118 bytes
- Lines
- 149
- Domain
- Driver Families
- Bucket
- drivers/staging
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/device.hlinux/kernel.hlinux/i2c.hlinux/interrupt.hlinux/module.hadt7316.h
Detected Declarations
function adt7316_i2c_readfunction adt7316_i2c_writefunction adt7316_i2c_multi_readfunction adt7316_i2c_multi_writefunction adt7316_i2c_probe
Annotated Snippet
if (ret < 0) {
dev_err(&cl->dev, "I2C multi read error\n");
return ret;
}
}
return 0;
}
static int adt7316_i2c_multi_write(void *client, u8 reg, u8 count, u8 *data)
{
struct i2c_client *cl = client;
int i, ret;
if (count > ADT7316_REG_MAX_ADDR)
count = ADT7316_REG_MAX_ADDR;
for (i = 0; i < count; i++) {
ret = adt7316_i2c_write(cl, reg, data[i]);
if (ret < 0) {
dev_err(&cl->dev, "I2C multi write error\n");
return ret;
}
}
return 0;
}
/*
* device probe and remove
*/
static int adt7316_i2c_probe(struct i2c_client *client)
{
const struct i2c_device_id *id = i2c_client_get_device_id(client);
struct adt7316_bus bus = {
.client = client,
.irq = client->irq,
.read = adt7316_i2c_read,
.write = adt7316_i2c_write,
.multi_read = adt7316_i2c_multi_read,
.multi_write = adt7316_i2c_multi_write,
};
return adt7316_probe(&client->dev, &bus, id->name);
}
static const struct i2c_device_id adt7316_i2c_id[] = {
{ "adt7316" },
{ "adt7317" },
{ "adt7318" },
{ "adt7516" },
{ "adt7517" },
{ "adt7519" },
{ }
};
MODULE_DEVICE_TABLE(i2c, adt7316_i2c_id);
static const struct of_device_id adt7316_of_match[] = {
{ .compatible = "adi,adt7316" },
{ .compatible = "adi,adt7317" },
{ .compatible = "adi,adt7318" },
{ .compatible = "adi,adt7516" },
{ .compatible = "adi,adt7517" },
{ .compatible = "adi,adt7519" },
{ }
};
MODULE_DEVICE_TABLE(of, adt7316_of_match);
static struct i2c_driver adt7316_driver = {
.driver = {
.name = "adt7316",
.of_match_table = adt7316_of_match,
.pm = pm_sleep_ptr(&adt7316_pm_ops),
},
.probe = adt7316_i2c_probe,
.id_table = adt7316_i2c_id,
};
module_i2c_driver(adt7316_driver);
MODULE_AUTHOR("Sonic Zhang <sonic.zhang@analog.com>");
MODULE_DESCRIPTION("I2C bus driver for Analog Devices ADT7316/7/9 and ADT7516/7/8 digital temperature sensor, ADC and DAC");
MODULE_LICENSE("GPL v2");
Annotation
- Immediate include surface: `linux/device.h`, `linux/kernel.h`, `linux/i2c.h`, `linux/interrupt.h`, `linux/module.h`, `adt7316.h`.
- Detected declarations: `function adt7316_i2c_read`, `function adt7316_i2c_write`, `function adt7316_i2c_multi_read`, `function adt7316_i2c_multi_write`, `function adt7316_i2c_probe`.
- Atlas domain: Driver Families / drivers/staging.
- 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.