STRUCT AD7606_STATE(9)
๐ฆ struct ad7606_state(9) ๐ฆ
okay bestie, welcome to the Kernel API Manual ๐ this is the whole entire page for struct ad7606_state, and it's literally the glow-up your brain needed today. no cap.
โจ NAME โจ
struct ad7606_state โ the driver-instance-specific data ๐ like, every single little thing one AD7606 driver instance needs to keep track of about itself. main character energy fr fr.
๐ธ SYNOPSIS ๐ธ
struct ad7606_state {
struct device *dev;
const struct ad7606_chip_info *chip_info;
const struct ad7606_bus_ops *bops;
struct ad7606_chan_info chan_info[AD760X_MAX_CHANNELS];
unsigned int oversampling;
struct pwm_device *cnvst_pwm;
void __iomem *base_address;
bool sw_mode_en;
const unsigned int *oversampling_avail;
unsigned int num_os_ratios;
struct iio_backend *back;
int (*write_scale)(struct iio_dev *indio_dev, int ch, int val);
int (*write_os)(struct iio_dev *indio_dev, int val);
struct mutex lock;
struct gpio_desc *gpio_convst;
struct gpio_desc *gpio_reset;
struct gpio_desc *gpio_range;
struct gpio_desc *gpio_standby;
struct gpio_desc *gpio_frstdata;
struct gpio_descs *gpio_os;
struct iio_trigger *trig;
struct completion completion;
bool offload_en;
void *bus_data;
struct {
union {
u16 buf16[16];
u32 buf32[8];
};
aligned_s64 timestamp;
} data;
__be16 d16[2];
};
slay, now let's meet every single member one by one ๐
๐ Members ๐
devโ pointer to the kernel device ๐ซถ that's the device's whole identity, iconic.chip_infoโ the entry in the table of chips that describes this device ๐ so it knows which chip it actually is, iykyk.bopsโ the bus operations (SPI or parallel) ๐ literally how this thing talks to the outside world.chan_infoโ the scale configuration for channels ๐๏ธ per-channel scale deets, all tucked in here.oversamplingโ the oversampling selection ๐ฅ which oversampling setting got picked.cnvst_pwmโ pointer to the PWM device connected to thecnvstpin ๐ pwm go brrr.base_addressโ the address from where to read data in parallel operation ๐ like, the literal spot you read from when you're in parallel mode.sw_mode_enโ software mode enabled โtrue/falsevibe check.oversampling_availโ pointer to the array which stores the available oversampling ratios ๐ซ the menu of oversampling options, not the choice itself.num_os_ratiosโ number of elements stored inoversampling_availarray ๐ข so you know how many options are on that menu.backโ pointer to theiio_backendstructure, if used ๐ only if used, okay bestie, don't come for me.write_scaleโ pointer to the function which writes the scale โ๏ธ yes, a function pointer, yes, it's giving old-school cool.write_osโ pointer to the function which writes theos๐๏ธ another function pointer, same energy.lockโ protect sensor state from concurrent accesses to GPIOs ๐ mutual exclusion, no fighting over GPIOs in the group chat please.gpio_convstโ GPIO descriptor for conversion start signal (CONVST) โก the "go" signal.gpio_resetโ GPIO descriptor for device hard-reset ๐ hard reset, dramatic but necessary.gpio_rangeโ GPIO descriptor for range selection ๐ picks the range, obvi.gpio_standbyโ GPIO descriptor for stand-by signal (STBY), controls power-down mode of device ๐ด it literally decides when the device goes to sleep, relatable.gpio_frstdataโ GPIO descriptor for reading from device when data is being read on the first channel ๐ฏ first-channel-reading situation, very specific, very real.gpio_osโ GPIO descriptors to control oversampling on the device ๐๏ธ plural, it's a wholestruct gpio_descs.trigโ The IIO trigger associated with the device. ๐ฌ the trigger, the cue, the moment.completionโ completion to indicate end of conversion ๐ it tells everyone "we're done converting, wrap it up".offload_enโ SPI offload enabled ๐ yes/no, offload status.bus_dataโ bus-specific variables ๐ฆ the bus's own little bag of stuff.dataโ buffer for reading data from the device ๐พ this is where the readings land, including analigned_s64 timestampinside it.{unnamed_union}โ anonymous ๐ฎ it's an anonymous union, no name, no problem.d16โbe16buffer for reading data from the device ๐ธ big-endianbe16, two of them:d16[2].
๐ SEE ALSO ๐
Kernel file ./drivers/iio/adc/ad7606.h with struct ad7606_chip_info(9), struct ad7606_chan_info(9), struct ad7606_bus_ops(9), and struct ad7606_bus_info(9) ๐ go read those next, bestie, they're all in the same friend group.
that's the whole page, no skips, no cuts ๐ this came from ./drivers/iio/adc, dated October 2026, in the Kernel API Manual โ mwah, bye! ๐งโจ
๐ฆ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms