drivers/iio/chemical/scd30_i2c.c
Source file repositories/reference/linux-study-clean/drivers/iio/chemical/scd30_i2c.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/iio/chemical/scd30_i2c.c- Extension
.c- Size
- 3288 bytes
- Lines
- 141
- Domain
- Driver Families
- Bucket
- drivers/iio
- 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/crc8.hlinux/device.hlinux/errno.hlinux/i2c.hlinux/mod_devicetable.hlinux/module.hlinux/types.hlinux/unaligned.hscd30.h
Detected Declarations
function scd30_i2c_xferfunction scd30_i2c_commandfunction scd30_i2c_probe
Annotated Snippet
if (crc != buf[i + 2]) {
dev_err(state->dev, "data integrity check failed\n");
return -EIO;
}
*rsp++ = buf[i];
*rsp++ = buf[i + 1];
}
return 0;
}
static int scd30_i2c_probe(struct i2c_client *client)
{
if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
return -EOPNOTSUPP;
crc8_populate_msb(scd30_i2c_crc8_tbl, SCD30_I2C_CRC8_POLYNOMIAL);
return scd30_probe(&client->dev, client->irq, client->name, NULL, scd30_i2c_command);
}
static const struct of_device_id scd30_i2c_of_match[] = {
{ .compatible = "sensirion,scd30" },
{ }
};
MODULE_DEVICE_TABLE(of, scd30_i2c_of_match);
static struct i2c_driver scd30_i2c_driver = {
.driver = {
.name = KBUILD_MODNAME,
.of_match_table = scd30_i2c_of_match,
.pm = pm_sleep_ptr(&scd30_pm_ops),
},
.probe = scd30_i2c_probe,
};
module_i2c_driver(scd30_i2c_driver);
MODULE_AUTHOR("Tomasz Duszynski <tomasz.duszynski@octakon.com>");
MODULE_DESCRIPTION("Sensirion SCD30 carbon dioxide sensor i2c driver");
MODULE_LICENSE("GPL v2");
MODULE_IMPORT_NS("IIO_SCD30");
Annotation
- Immediate include surface: `linux/crc8.h`, `linux/device.h`, `linux/errno.h`, `linux/i2c.h`, `linux/mod_devicetable.h`, `linux/module.h`, `linux/types.h`, `linux/unaligned.h`.
- Detected declarations: `function scd30_i2c_xfer`, `function scd30_i2c_command`, `function scd30_i2c_probe`.
- Atlas domain: Driver Families / drivers/iio.
- 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.