drivers/iio/imu/adis16550.c
Source file repositories/reference/linux-study-clean/drivers/iio/imu/adis16550.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/iio/imu/adis16550.c- Extension
.c- Size
- 30568 bytes
- Lines
- 1148
- Domain
- Driver Families
- Bucket
- drivers/iio
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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 an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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/bitfield.hlinux/bitops.hlinux/clk.hlinux/crc32.hlinux/debugfs.hlinux/iio/buffer.hlinux/iio/iio.hlinux/iio/imu/adis.hlinux/iio/trigger_consumer.hlinux/interrupt.hlinux/kernel.hlinux/lcm.hlinux/math.hlinux/module.hlinux/mod_devicetable.hlinux/regulator/consumer.hlinux/spi/spi.hlinux/swab.hlinux/unaligned.h
Detected Declarations
struct adis16550_syncstruct adis16550_chip_infostruct adis16550function spi_crc4function adis16550_spi_validatefunction adis16550_spi_msg_preparefunction adis16550_spi_xferfunction adis16550_spi_readfunction adis16550_spi_writefunction adis16550_show_firmware_revisionfunction adis16550_show_firmware_datefunction adis16550_show_serial_numberfunction adis16550_show_product_idfunction adis16550_show_flash_countfunction adis16550_debugfs_initfunction adis16550_get_freqfunction adis16550_set_freq_hzfunction adis16550_get_accl_filter_freqfunction adis16550_set_accl_filter_freqfunction adis16550_get_gyro_filter_freqfunction adis16550_set_gyro_filter_freqfunction adis16550_read_rawfunction adis16550_write_rawfunction BITfunction adis16550_validate_crcfunction adis16550_trigger_handlerfunction adis16550_update_scan_modefunction adis16550_resetfunction adis16550_config_syncfunction adis16550_probe
Annotated Snippet
static const struct file_operations adis16550_firmware_revision_fops = {
.open = simple_open,
.read = adis16550_show_firmware_revision,
.llseek = default_llseek,
.owner = THIS_MODULE,
};
static ssize_t adis16550_show_firmware_date(struct file *file,
char __user *userbuf,
size_t count, loff_t *ppos)
{
struct adis16550 *st = file->private_data;
char buf[12];
size_t len;
u32 date;
int ret;
ret = adis_read_reg_32(&st->adis, ADIS16550_REG_FW_DATE, &date);
if (ret)
return ret;
len = scnprintf(buf, sizeof(buf), "%.2x-%.2x-%.4x\n", date & 0xff,
(date >> 8) & 0xff, date >> 16);
return simple_read_from_buffer(userbuf, count, ppos, buf, len);
}
static const struct file_operations adis16550_firmware_date_fops = {
.open = simple_open,
.read = adis16550_show_firmware_date,
.llseek = default_llseek,
.owner = THIS_MODULE,
};
static int adis16550_show_serial_number(void *arg, u64 *val)
{
struct adis16550 *st = arg;
u32 serial;
int ret;
ret = adis_read_reg_32(&st->adis, ADIS16550_REG_SERIAL_NUM, &serial);
if (ret)
return ret;
*val = serial;
return 0;
}
DEFINE_DEBUGFS_ATTRIBUTE(adis16550_serial_number_fops,
adis16550_show_serial_number, NULL, "0x%.8llx\n");
static int adis16550_show_product_id(void *arg, u64 *val)
{
struct adis16550 *st = arg;
u16 prod_id;
int ret;
ret = adis_read_reg_16(&st->adis, ADIS16550_REG_PROD_ID, &prod_id);
if (ret)
return ret;
*val = prod_id;
return 0;
}
DEFINE_DEBUGFS_ATTRIBUTE(adis16550_product_id_fops,
adis16550_show_product_id, NULL, "%llu\n");
static int adis16550_show_flash_count(void *arg, u64 *val)
{
struct adis16550 *st = arg;
u16 flash_count;
int ret;
ret = adis_read_reg_16(&st->adis, ADIS16550_REG_FLASH_CNT, &flash_count);
if (ret)
return ret;
*val = flash_count;
return 0;
}
DEFINE_DEBUGFS_ATTRIBUTE(adis16550_flash_count_fops,
adis16550_show_flash_count, NULL, "%lld\n");
static void adis16550_debugfs_init(struct iio_dev *indio_dev)
{
struct adis16550 *st = iio_priv(indio_dev);
struct dentry *d = iio_get_debugfs_dentry(indio_dev);
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/bitops.h`, `linux/clk.h`, `linux/crc32.h`, `linux/debugfs.h`, `linux/iio/buffer.h`, `linux/iio/iio.h`, `linux/iio/imu/adis.h`.
- Detected declarations: `struct adis16550_sync`, `struct adis16550_chip_info`, `struct adis16550`, `function spi_crc4`, `function adis16550_spi_validate`, `function adis16550_spi_msg_prepare`, `function adis16550_spi_xfer`, `function adis16550_spi_read`, `function adis16550_spi_write`, `function adis16550_show_firmware_revision`.
- Atlas domain: Driver Families / drivers/iio.
- Implementation status: pattern 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.