drivers/iio/adc/max1363.c
Source file repositories/reference/linux-study-clean/drivers/iio/adc/max1363.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/iio/adc/max1363.c- Extension
.c- Size
- 48670 bytes
- Lines
- 1693
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/interrupt.hlinux/cleanup.hlinux/device.hlinux/kernel.hlinux/sysfs.hlinux/list.hlinux/i2c.hlinux/regulator/consumer.hlinux/slab.hlinux/err.hlinux/module.hlinux/mod_devicetable.hlinux/property.hlinux/unaligned.hlinux/iio/iio.hlinux/iio/sysfs.hlinux/iio/events.hlinux/iio/buffer.hlinux/iio/kfifo_buf.hlinux/iio/trigger_consumer.hlinux/iio/triggered_buffer.h
Detected Declarations
struct max1363_modestruct max1363_chip_infostruct max1363_stateenum max1363_modesfunction max1363_smbus_sendfunction max1363_smbus_recvfunction max1363_write_basic_configfunction max1363_set_scan_modefunction max1363_read_single_chanfunction max1363_read_rawfunction max1363_monitor_show_freqfunction max1363_monitor_store_freqfunction max1363_read_threshfunction max1363_write_threshfunction max1363_event_handlerfunction max1363_read_event_configfunction max1363_monitor_mode_updatefunction __max1363_check_event_maskfunction __max1363_write_event_configfunction max1363_write_event_configfunction max1363_update_scan_modefunction max1363_initial_setupfunction max1363_alloc_scan_masksfunction max1363_trigger_handlerfunction max1363_probe
Annotated Snippet
struct max1363_mode {
int8_t conf;
DECLARE_BITMAP(modemask, MAX1363_MAX_CHANNELS);
};
/* This must be maintained along side the max1363_mode_table in max1363_core */
enum max1363_modes {
/* Single read of a single channel */
_s0, _s1, _s2, _s3, _s4, _s5, _s6, _s7, _s8, _s9, _s10, _s11,
/* Differential single read */
d0m1, d2m3, d4m5, d6m7, d8m9, d10m11,
d1m0, d3m2, d5m4, d7m6, d9m8, d11m10,
/* Scan to channel and mid to channel where overlapping */
s0to1, s0to2, s2to3, s0to3, s0to4, s0to5, s0to6,
s6to7, s0to7, s6to8, s0to8, s6to9,
s0to9, s6to10, s0to10, s6to11, s0to11,
/* Differential scan to channel and mid to channel where overlapping */
d0m1to2m3, d0m1to4m5, d0m1to6m7, d6m7to8m9,
d0m1to8m9, d6m7to10m11, d0m1to10m11, d1m0to3m2,
d1m0to5m4, d1m0to7m6, d7m6to9m8, d1m0to9m8,
d7m6to11m10, d1m0to11m10,
};
/**
* struct max1363_chip_info - chip specific information
* @info: iio core function callbacks structure
* @channels: channel specification
* @num_channels: number of channels
* @mode_list: array of available scan modes
* @default_mode: the scan mode in which the chip starts up
* @int_vref_mv: the internal reference voltage
* @num_modes: number of modes
* @bits: accuracy of the adc in bits
*/
struct max1363_chip_info {
const struct iio_info *info;
const struct iio_chan_spec *channels;
int num_channels;
const enum max1363_modes *mode_list;
enum max1363_modes default_mode;
u16 int_vref_mv;
u8 num_modes;
u8 bits;
};
/**
* struct max1363_state - driver instance specific data
* @client: i2c_client
* @setupbyte: cache of current device setup byte
* @configbyte: cache of current device config byte
* @chip_info: chip model specific constants, available modes, etc.
* @current_mode: the scan mode of this chip
* @lock: lock to ensure state is consistent
* @monitor_on: whether monitor mode is enabled
* @monitor_speed: parameter corresponding to device monitor speed setting
* @mask_high: bitmask for enabled high thresholds
* @mask_low: bitmask for enabled low thresholds
* @thresh_high: high threshold values
* @thresh_low: low threshold values
* @vref: Reference voltage regulator
* @vref_uv: Actual (external or internal) reference voltage
* @send: function used to send data to the chip
* @recv: function used to receive data from the chip
* @data: buffer to store channel data and timestamp
*/
struct max1363_state {
struct i2c_client *client;
u8 setupbyte;
u8 configbyte;
const struct max1363_chip_info *chip_info;
const struct max1363_mode *current_mode;
struct mutex lock;
/* Using monitor modes and buffer at the same time is
currently not supported */
bool monitor_on;
unsigned int monitor_speed:3;
u8 mask_high;
u8 mask_low;
/* 4x unipolar first then the fours bipolar ones */
s16 thresh_high[8];
s16 thresh_low[8];
struct regulator *vref;
u32 vref_uv;
int (*send)(const struct i2c_client *client,
const char *buf, int count);
int (*recv)(const struct i2c_client *client,
char *buf, int count);
struct {
u8 buf[MAX1363_MAX_CHANNELS * 2];
Annotation
- Immediate include surface: `linux/interrupt.h`, `linux/cleanup.h`, `linux/device.h`, `linux/kernel.h`, `linux/sysfs.h`, `linux/list.h`, `linux/i2c.h`, `linux/regulator/consumer.h`.
- Detected declarations: `struct max1363_mode`, `struct max1363_chip_info`, `struct max1363_state`, `enum max1363_modes`, `function max1363_smbus_send`, `function max1363_smbus_recv`, `function max1363_write_basic_config`, `function max1363_set_scan_mode`, `function max1363_read_single_chan`, `function max1363_read_raw`.
- 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.