drivers/iio/pressure/dlhl60d.c
Source file repositories/reference/linux-study-clean/drivers/iio/pressure/dlhl60d.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/iio/pressure/dlhl60d.c- Extension
.c- Size
- 7895 bytes
- Lines
- 362
- 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/delay.hlinux/i2c.hlinux/iio/iio.hlinux/iio/buffer.hlinux/iio/trigger_consumer.hlinux/iio/triggered_buffer.hlinux/unaligned.h
Detected Declarations
struct dlh_infostruct dlh_statefunction dlh_cmd_start_singlefunction dlh_cmd_read_datafunction dlh_start_capture_and_readfunction dlh_read_directfunction dlh_read_rawfunction dlh_trigger_handlerfunction iio_for_each_active_channelfunction dlh_interruptfunction dlh_probe
Annotated Snippet
struct dlh_info {
const char *name; /* chip name */
u8 osdig; /* digital offset factor */
unsigned int fss; /* full scale span (inch H2O) */
};
struct dlh_state {
struct i2c_client *client;
const struct dlh_info *info;
bool use_interrupt;
struct completion completion;
u8 rx_buf[DLH_NUM_READ_BYTES];
};
static const struct dlh_info dlhl60d_info = {
.name = "dlhl60d",
.osdig = 2,
.fss = 120,
};
static const struct dlh_info dlhl60g_info = {
.name = "dlhl60g",
.osdig = 10,
.fss = 60,
};
static int dlh_cmd_start_single(struct dlh_state *st)
{
int ret;
ret = i2c_smbus_write_byte(st->client, DLH_START_SINGLE);
if (ret)
dev_err(&st->client->dev,
"%s: I2C write byte failed\n", __func__);
return ret;
}
static int dlh_cmd_read_data(struct dlh_state *st)
{
int ret;
ret = i2c_master_recv(st->client, st->rx_buf, DLH_NUM_READ_BYTES);
if (ret < 0) {
dev_err(&st->client->dev,
"%s: I2C read block failed\n", __func__);
return ret;
}
if (st->rx_buf[0] != DLH_STATUS_OK) {
dev_err(&st->client->dev,
"%s: invalid status 0x%02x\n", __func__, st->rx_buf[0]);
return -EBUSY;
}
return 0;
}
static int dlh_start_capture_and_read(struct dlh_state *st)
{
int ret;
if (st->use_interrupt)
reinit_completion(&st->completion);
ret = dlh_cmd_start_single(st);
if (ret)
return ret;
if (st->use_interrupt) {
ret = wait_for_completion_timeout(&st->completion,
msecs_to_jiffies(DLH_SINGLE_DUT_MS));
if (!ret) {
dev_err(&st->client->dev,
"%s: conversion timed out\n", __func__);
return -ETIMEDOUT;
}
} else {
mdelay(DLH_SINGLE_DUT_MS);
}
return dlh_cmd_read_data(st);
}
static int dlh_read_direct(struct dlh_state *st,
unsigned int *pressure, unsigned int *temperature)
{
int ret;
ret = dlh_start_capture_and_read(st);
Annotation
- Immediate include surface: `linux/module.h`, `linux/delay.h`, `linux/i2c.h`, `linux/iio/iio.h`, `linux/iio/buffer.h`, `linux/iio/trigger_consumer.h`, `linux/iio/triggered_buffer.h`, `linux/unaligned.h`.
- Detected declarations: `struct dlh_info`, `struct dlh_state`, `function dlh_cmd_start_single`, `function dlh_cmd_read_data`, `function dlh_start_capture_and_read`, `function dlh_read_direct`, `function dlh_read_raw`, `function dlh_trigger_handler`, `function iio_for_each_active_channel`, `function dlh_interrupt`.
- 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.