drivers/iio/adc/ad7380.c

Source file repositories/reference/linux-study-clean/drivers/iio/adc/ad7380.c

File Facts

System
Linux kernel
Corpus path
drivers/iio/adc/ad7380.c
Extension
.c
Size
64378 bytes
Lines
2155
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct ad7380_timing_specs {
	const unsigned int t_csh_ns;	/* CS minimum high time */
};

struct ad7380_chip_info {
	const char *name;
	const struct iio_chan_spec *channels;
	const struct iio_chan_spec *offload_channels;
	unsigned int num_channels;
	unsigned int num_simult_channels;
	bool has_hardware_gain;
	bool has_mux;
	const char * const *supplies;
	unsigned int num_supplies;
	bool external_ref_only;
	bool internal_ref_only;
	unsigned int internal_ref_mv;
	const char * const *vcm_supplies;
	unsigned int num_vcm_supplies;
	const unsigned long *available_scan_masks;
	const struct ad7380_timing_specs *timing_specs;
	u32 max_conversion_rate_hz;
};

static const struct iio_event_spec ad7380_events[] = {
	{
		.type = IIO_EV_TYPE_THRESH,
		.dir = IIO_EV_DIR_RISING,
		.mask_shared_by_dir = BIT(IIO_EV_INFO_VALUE),
	},
	{
		.type = IIO_EV_TYPE_THRESH,
		.dir = IIO_EV_DIR_FALLING,
		.mask_shared_by_dir = BIT(IIO_EV_INFO_VALUE),
	},
	{
		.type = IIO_EV_TYPE_THRESH,
		.dir = IIO_EV_DIR_EITHER,
		.mask_shared_by_all = BIT(IIO_EV_INFO_ENABLE),
	},
};

enum {
	AD7380_SCAN_TYPE_NORMAL,
	AD7380_SCAN_TYPE_RESOLUTION_BOOST,
};

/* Extended scan types for 12-bit unsigned chips. */
static const struct iio_scan_type ad7380_scan_type_12_u[] = {
	[AD7380_SCAN_TYPE_NORMAL] = {
		.sign = 'u',
		.realbits = 12,
		.storagebits = 16,
		.endianness = IIO_CPU,
	},
	[AD7380_SCAN_TYPE_RESOLUTION_BOOST] = {
		.sign = 'u',
		.realbits = 14,
		.storagebits = 16,
		.endianness = IIO_CPU,
	},
};

/* Extended scan types for 14-bit signed chips. */
static const struct iio_scan_type ad7380_scan_type_14_s[] = {
	[AD7380_SCAN_TYPE_NORMAL] = {
		.sign = 's',
		.realbits = 14,
		.storagebits = 16,
		.endianness = IIO_CPU,
	},
	[AD7380_SCAN_TYPE_RESOLUTION_BOOST] = {
		.sign = 's',
		.realbits = 16,
		.storagebits = 16,
		.endianness = IIO_CPU,
	},
};

/* Extended scan types for 14-bit unsigned chips. */
static const struct iio_scan_type ad7380_scan_type_14_u[] = {
	[AD7380_SCAN_TYPE_NORMAL] = {
		.sign = 'u',
		.realbits = 14,
		.storagebits = 16,
		.endianness = IIO_CPU,
	},
	[AD7380_SCAN_TYPE_RESOLUTION_BOOST] = {
		.sign = 'u',
		.realbits = 16,

Annotation

Implementation Notes