drivers/iio/chemical/atlas-sensor.c
Source file repositories/reference/linux-study-clean/drivers/iio/chemical/atlas-sensor.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/iio/chemical/atlas-sensor.c- Extension
.c- Size
- 18525 bytes
- Lines
- 772
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/init.hlinux/interrupt.hlinux/delay.hlinux/mutex.hlinux/err.hlinux/irq.hlinux/irq_work.hlinux/i2c.hlinux/mod_devicetable.hlinux/regmap.hlinux/iio/iio.hlinux/iio/buffer.hlinux/iio/trigger.hlinux/iio/trigger_consumer.hlinux/iio/triggered_buffer.hlinux/pm_runtime.h
Detected Declarations
struct atlas_datastruct atlas_devicefunction atlas_buffer_num_channelsfunction atlas_check_ph_calibrationfunction atlas_check_ec_calibrationfunction atlas_check_orp_calibrationfunction atlas_check_do_calibrationfunction atlas_set_powermodefunction atlas_set_interruptfunction atlas_buffer_postenablefunction atlas_buffer_predisablefunction atlas_work_handlerfunction atlas_trigger_handlerfunction atlas_interrupt_handlerfunction atlas_read_measurementfunction atlas_read_rawfunction atlas_write_rawfunction atlas_probefunction atlas_removefunction atlas_runtime_suspendfunction atlas_runtime_resume
Annotated Snippet
struct atlas_data {
struct i2c_client *client;
struct iio_trigger *trig;
const struct atlas_device *chip;
struct regmap *regmap;
struct irq_work work;
unsigned int interrupt_enabled;
/* 96-bit data + 32-bit pad + 64-bit timestamp */
__be32 buffer[6] __aligned(8);
};
static const struct regmap_config atlas_regmap_config = {
.name = "atlas_regmap",
.reg_bits = 8,
.val_bits = 8,
};
static int atlas_buffer_num_channels(const struct iio_chan_spec *spec)
{
int idx = 0;
for (; spec->type != IIO_TIMESTAMP; spec++)
idx++;
return idx;
};
static const struct iio_chan_spec atlas_ph_channels[] = {
{
.type = IIO_PH,
.address = ATLAS_REG_PH_DATA,
.info_mask_separate =
BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
.scan_index = 0,
.scan_type = {
.sign = 'u',
.realbits = 32,
.storagebits = 32,
.endianness = IIO_BE,
},
},
IIO_CHAN_SOFT_TIMESTAMP(1),
{
.type = IIO_TEMP,
.address = ATLAS_REG_PH_TEMP_DATA,
.info_mask_separate =
BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
.output = 1,
.scan_index = -1
},
};
#define ATLAS_CONCENTRATION_CHANNEL(_idx, _addr) \
{\
.type = IIO_CONCENTRATION, \
.indexed = 1, \
.channel = _idx, \
.address = _addr, \
.info_mask_separate = \
BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE), \
.scan_index = _idx + 1, \
.scan_type = { \
.sign = 'u', \
.realbits = 32, \
.storagebits = 32, \
.endianness = IIO_BE, \
}, \
}
static const struct iio_chan_spec atlas_ec_channels[] = {
{
.type = IIO_ELECTRICALCONDUCTIVITY,
.address = ATLAS_REG_EC_DATA,
.info_mask_separate =
BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
.scan_index = 0,
.scan_type = {
.sign = 'u',
.realbits = 32,
.storagebits = 32,
.endianness = IIO_BE,
},
},
ATLAS_CONCENTRATION_CHANNEL(0, ATLAS_REG_TDS_DATA),
ATLAS_CONCENTRATION_CHANNEL(1, ATLAS_REG_PSS_DATA),
IIO_CHAN_SOFT_TIMESTAMP(3),
{
.type = IIO_TEMP,
.address = ATLAS_REG_EC_TEMP_DATA,
.info_mask_separate =
Annotation
- Immediate include surface: `linux/module.h`, `linux/init.h`, `linux/interrupt.h`, `linux/delay.h`, `linux/mutex.h`, `linux/err.h`, `linux/irq.h`, `linux/irq_work.h`.
- Detected declarations: `struct atlas_data`, `struct atlas_device`, `function atlas_buffer_num_channels`, `function atlas_check_ph_calibration`, `function atlas_check_ec_calibration`, `function atlas_check_orp_calibration`, `function atlas_check_do_calibration`, `function atlas_set_powermode`, `function atlas_set_interrupt`, `function atlas_buffer_postenable`.
- Atlas domain: Driver Families / drivers/iio.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.