drivers/iio/imu/adis16480.c
Source file repositories/reference/linux-study-clean/drivers/iio/imu/adis16480.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/iio/imu/adis16480.c- Extension
.c- Size
- 57805 bytes
- Lines
- 1873
- 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/clk.hlinux/bitfield.hlinux/interrupt.hlinux/irq.hlinux/math.hlinux/device.hlinux/kernel.hlinux/spi/spi.hlinux/mod_devicetable.hlinux/module.hlinux/lcm.hlinux/property.hlinux/swab.hlinux/crc32.hlinux/iio/iio.hlinux/iio/buffer.hlinux/iio/imu/adis.hlinux/iio/trigger_consumer.hlinux/debugfs.h
Detected Declarations
struct adis16480_chip_infostruct adis16480enum adis16480_int_pinenum adis16480_clock_modeenum adis16480_variantfunction adis16480_show_firmware_revisionfunction adis16480_show_firmware_datefunction adis16480_show_serial_numberfunction adis16480_show_product_idfunction adis16480_show_flash_countfunction adis16480_debugfs_initfunction adis16480_set_freqfunction betweenfunction adis16480_get_freqfunction adis16480_set_calibbiasfunction adis16480_get_calibbiasfunction adis16480_set_calibscalefunction adis16480_get_calibscalefunction adis16480_get_filter_freqfunction adis16480_set_filter_freqfunction adis16480_read_rawfunction adis16480_write_rawfunction BITfunction adis16480_validate_crcfunction adis16480_trigger_handlerfunction adis_dev_auto_scoped_lockfunction iio_for_each_active_channelfunction adis16480_update_scan_modefunction adis16480_stop_devicefunction adis16480_enable_irqfunction adis16480_config_irq_pinfunction adis16480_fw_get_ext_clk_pinfunction adis16480_ext_clk_configfunction adis16480_get_ext_clocksfunction adis16480_stopfunction adis16480_clk_disablefunction adis16480_probe
Annotated Snippet
static const struct file_operations adis16480_firmware_revision_fops = {
.open = simple_open,
.read = adis16480_show_firmware_revision,
.llseek = default_llseek,
.owner = THIS_MODULE,
};
static ssize_t adis16480_show_firmware_date(struct file *file,
char __user *userbuf, size_t count, loff_t *ppos)
{
struct adis16480 *adis16480 = file->private_data;
u16 md, year;
char buf[12];
size_t len;
int ret;
ret = adis_read_reg_16(&adis16480->adis, ADIS16480_REG_FIRM_Y, &year);
if (ret)
return ret;
ret = adis_read_reg_16(&adis16480->adis, ADIS16480_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 adis16480_firmware_date_fops = {
.open = simple_open,
.read = adis16480_show_firmware_date,
.llseek = default_llseek,
.owner = THIS_MODULE,
};
static int adis16480_show_serial_number(void *arg, u64 *val)
{
struct adis16480 *adis16480 = arg;
u16 serial;
int ret;
ret = adis_read_reg_16(&adis16480->adis, ADIS16480_REG_SERIAL_NUM,
&serial);
if (ret)
return ret;
*val = serial;
return 0;
}
DEFINE_DEBUGFS_ATTRIBUTE(adis16480_serial_number_fops,
adis16480_show_serial_number, NULL, "0x%.4llx\n");
static int adis16480_show_product_id(void *arg, u64 *val)
{
struct adis16480 *adis16480 = arg;
u16 prod_id;
int ret;
ret = adis_read_reg_16(&adis16480->adis, ADIS16480_REG_PROD_ID,
&prod_id);
if (ret)
return ret;
*val = prod_id;
return 0;
}
DEFINE_DEBUGFS_ATTRIBUTE(adis16480_product_id_fops,
adis16480_show_product_id, NULL, "%llu\n");
static int adis16480_show_flash_count(void *arg, u64 *val)
{
struct adis16480 *adis16480 = arg;
u32 flash_count;
int ret;
ret = adis_read_reg_32(&adis16480->adis, ADIS16480_REG_FLASH_CNT,
&flash_count);
if (ret)
return ret;
*val = flash_count;
return 0;
}
DEFINE_DEBUGFS_ATTRIBUTE(adis16480_flash_count_fops,
adis16480_show_flash_count, NULL, "%lld\n");
Annotation
- Immediate include surface: `linux/clk.h`, `linux/bitfield.h`, `linux/interrupt.h`, `linux/irq.h`, `linux/math.h`, `linux/device.h`, `linux/kernel.h`, `linux/spi/spi.h`.
- Detected declarations: `struct adis16480_chip_info`, `struct adis16480`, `enum adis16480_int_pin`, `enum adis16480_clock_mode`, `enum adis16480_variant`, `function adis16480_show_firmware_revision`, `function adis16480_show_firmware_date`, `function adis16480_show_serial_number`, `function adis16480_show_product_id`, `function adis16480_show_flash_count`.
- 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.