drivers/iio/adc/ad4000.c

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

File Facts

System
Linux kernel
Corpus path
drivers/iio/adc/ad4000.c
Extension
.c
Size
39976 bytes
Lines
1265
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 ad4000_time_spec {
	int t_conv_ns;
	int t_quiet2_ns;
};

/*
 * Same timing specifications for all of AD4000, AD4001, ..., AD4008, AD4010,
 * ADAQ4001, and ADAQ4003.
 */
static const struct ad4000_time_spec ad4000_t_spec = {
	.t_conv_ns = 320,
	.t_quiet2_ns = 60,
};

/* AD4020, AD4021, AD4022 */
static const struct ad4000_time_spec ad4020_t_spec = {
	.t_conv_ns = 350,
	.t_quiet2_ns = 60,
};

/* AD7983, AD7984 */
static const struct ad4000_time_spec ad7983_t_spec = {
	.t_conv_ns = 500,
	.t_quiet2_ns = 0,
};

/* AD7980, AD7982 */
static const struct ad4000_time_spec ad7980_t_spec = {
	.t_conv_ns = 800,
	.t_quiet2_ns = 0,
};

/* AD7946, AD7686, AD7688, AD7988-5, AD7693 */
static const struct ad4000_time_spec ad7686_t_spec = {
	.t_conv_ns = 1600,
	.t_quiet2_ns = 0,
};

/* AD7690 */
static const struct ad4000_time_spec ad7690_t_spec = {
	.t_conv_ns = 2100,
	.t_quiet2_ns = 0,
};

/* AD7942, AD7685, AD7687 */
static const struct ad4000_time_spec ad7687_t_spec = {
	.t_conv_ns = 3200,
	.t_quiet2_ns = 0,
};

/* AD7691 */
static const struct ad4000_time_spec ad7691_t_spec = {
	.t_conv_ns = 3700,
	.t_quiet2_ns = 0,
};

/* AD7988-1 */
static const struct ad4000_time_spec ad7988_1_t_spec = {
	.t_conv_ns = 9500,
	.t_quiet2_ns = 0,
};

struct ad4000_chip_info {
	const char *dev_name;
	struct iio_chan_spec chan_spec[2];
	struct iio_chan_spec reg_access_chan_spec[2];
	struct iio_chan_spec offload_chan_spec;
	struct iio_chan_spec reg_access_offload_chan_spec;
	const struct ad4000_time_spec *time_spec;
	bool has_hardware_gain;
	int max_rate_hz;
};

static const struct ad4000_chip_info ad4000_chip_info = {
	.dev_name = "ad4000",
	.chan_spec = AD4000_PSEUDO_DIFF_CHANNELS('u', 16, 0),
	.reg_access_chan_spec = AD4000_PSEUDO_DIFF_CHANNELS('u', 16, 1),
	.offload_chan_spec = AD4000_PSEUDO_DIFF_CHANNEL('u', 16, 0, 1),
	.reg_access_offload_chan_spec = AD4000_PSEUDO_DIFF_CHANNEL('u', 16, 1, 1),
	.time_spec = &ad4000_t_spec,
	.max_rate_hz = 2 * MEGA,
};

static const struct ad4000_chip_info ad4001_chip_info = {
	.dev_name = "ad4001",
	.chan_spec = AD4000_DIFF_CHANNELS('s', 16, 0),
	.reg_access_chan_spec = AD4000_DIFF_CHANNELS('s', 16, 1),
	.offload_chan_spec = AD4000_DIFF_CHANNEL('s', 16, 0, 1),
	.reg_access_offload_chan_spec = AD4000_DIFF_CHANNEL('s', 16, 1, 1),
	.time_spec = &ad4000_t_spec,

Annotation

Implementation Notes