drivers/iio/imu/adis16475.c
Source file repositories/reference/linux-study-clean/drivers/iio/imu/adis16475.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/iio/imu/adis16475.c- Extension
.c- Size
- 63747 bytes
- Lines
- 2110
- 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/debugfs.hlinux/delay.hlinux/device.hlinux/kernel.hlinux/iio/buffer.hlinux/iio/iio.hlinux/iio/imu/adis.hlinux/iio/sysfs.hlinux/iio/trigger_consumer.hlinux/irq.hlinux/lcm.hlinux/math.hlinux/module.hlinux/mod_devicetable.hlinux/property.hlinux/spi/spi.h
Detected Declarations
struct adis16475_syncstruct adis16475_chip_infostruct adis16475enum adis16475_variantfunction adis16475_show_firmware_revisionfunction adis16475_show_firmware_datefunction adis16475_show_serial_numberfunction adis16475_show_product_idfunction adis16475_show_flash_countfunction adis16475_debugfs_initfunction adis16475_get_freqfunction adis16475_set_freqfunction betweenfunction adis16475_get_filterfunction adis16475_set_filterfunction adis16475_get_fifo_enabledfunction adis16475_get_fifo_watermarkfunction hwfifo_watermark_min_showfunction hwfifo_watermark_max_showfunction adis16475_buffer_postenablefunction adis16475_buffer_postdisablefunction adis16475_set_watermarkfunction adis16475_read_rawfunction adis16475_write_rawfunction BITfunction adis16475_update_scan_modefunction adis16475_validate_crcfunction adis16475_burst32_checkfunction adis16475_push_single_samplefunction iio_for_each_active_channelfunction adis16475_burst32_checkfunction adis16475_trigger_handlerfunction adis16575_update_msg_for_burstfunction adis16575_custom_burst_readfunction FIFOfunction adis16475_config_sync_modefunction adis16475_config_irq_pinfunction adis16475_probe
Annotated Snippet
static const struct file_operations adis16475_firmware_revision_fops = {
.open = simple_open,
.read = adis16475_show_firmware_revision,
.llseek = default_llseek,
.owner = THIS_MODULE,
};
static ssize_t adis16475_show_firmware_date(struct file *file,
char __user *userbuf,
size_t count, loff_t *ppos)
{
struct adis16475 *st = file->private_data;
u16 md, year;
char buf[12];
size_t len;
int ret;
ret = adis_read_reg_16(&st->adis, ADIS16475_REG_FIRM_Y, &year);
if (ret)
return ret;
ret = adis_read_reg_16(&st->adis, ADIS16475_REG_FIRM_DM, &md);
if (ret)
return ret;
len = snprintf(buf, sizeof(buf), "%.2x-%.2x-%.4x\n", md >> 8, md & 0xff,
year);
return simple_read_from_buffer(userbuf, count, ppos, buf, len);
}
static const struct file_operations adis16475_firmware_date_fops = {
.open = simple_open,
.read = adis16475_show_firmware_date,
.llseek = default_llseek,
.owner = THIS_MODULE,
};
static int adis16475_show_serial_number(void *arg, u64 *val)
{
struct adis16475 *st = arg;
u16 serial;
int ret;
ret = adis_read_reg_16(&st->adis, ADIS16475_REG_SERIAL_NUM, &serial);
if (ret)
return ret;
*val = serial;
return 0;
}
DEFINE_DEBUGFS_ATTRIBUTE(adis16475_serial_number_fops,
adis16475_show_serial_number, NULL, "0x%.4llx\n");
static int adis16475_show_product_id(void *arg, u64 *val)
{
struct adis16475 *st = arg;
u16 prod_id;
int ret;
ret = adis_read_reg_16(&st->adis, ADIS16475_REG_PROD_ID, &prod_id);
if (ret)
return ret;
*val = prod_id;
return 0;
}
DEFINE_DEBUGFS_ATTRIBUTE(adis16475_product_id_fops,
adis16475_show_product_id, NULL, "%llu\n");
static int adis16475_show_flash_count(void *arg, u64 *val)
{
struct adis16475 *st = arg;
u32 flash_count;
int ret;
ret = adis_read_reg_32(&st->adis, ADIS16475_REG_FLASH_CNT,
&flash_count);
if (ret)
return ret;
*val = flash_count;
return 0;
}
DEFINE_DEBUGFS_ATTRIBUTE(adis16475_flash_count_fops,
adis16475_show_flash_count, NULL, "%lld\n");
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/bitops.h`, `linux/clk.h`, `linux/debugfs.h`, `linux/delay.h`, `linux/device.h`, `linux/kernel.h`, `linux/iio/buffer.h`.
- Detected declarations: `struct adis16475_sync`, `struct adis16475_chip_info`, `struct adis16475`, `enum adis16475_variant`, `function adis16475_show_firmware_revision`, `function adis16475_show_firmware_date`, `function adis16475_show_serial_number`, `function adis16475_show_product_id`, `function adis16475_show_flash_count`, `function adis16475_debugfs_init`.
- 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.