STRUCT AD5761_STATE(9)
π struct ad5761_state(9) π
okay so this is a page straight out of the kernel API manual, and it's literally the blueprint for one driver instance's whole personality β its per-chip data bag. bestie, this struct is the main character of ad5761.c and it holds everything the driver needs to remember about the DAC it's currently babysitting. no cap.
β¨ NAME β¨
struct ad5761_state β driver instance specific data π
like, it's the little state blob that says "this particular chip, right here, here's what's up with it." periodt.
πΈ SYNOPSIS πΈ
struct ad5761_state {
struct spi_device *spi;
struct mutex lock;
bool use_intref;
int vref;
enum ad5761_voltage_range range;
union {
__be32 d32;
u8 d8[4];
} data[3];
};
look at her. iconic. she's got a pointer, a mutex, a couple of flags and numbers, a range enum, and a lil' union array of three. the vibes are immaculate π
π¦ Members π¦
spiβ aspi_deviceπ«Ά literally the SPI device this whole state belongs to. the whole reason we're here.lockβ astruct mutex, and its whole job is to protect the data buffer during SPI ops π like, don't let two threads touch the buffer at the same time, that's not the vibe. it's giving safety.use_intrefβ abool, and it'struewhen the internal voltage reference is used β¨ (as in, yes we're using the chip's own reference, not an external one, tyvm).vrefβ anintholding the actual voltage reference in mVolts β‘ so like, the real number, in millivolts. remember the units, bestie, they matter.rangeβ anenum ad5761_voltage_range, aka the output range mode used π it tells you which output range the thing is configured for.dataβ the cache aligned spi buffer π§ that's theunion { __be32 d32; u8 d8[4]; } data[3]up there β three of them, cache aligned, ready to be shoved down the SPI wire.
π SEE ALSO π
- Kernel file
./drivers/iio/dac/ad5761.cπ struct ad5761_chip_info(9)π
β οΈ friendly reminder: lock exists for a reason β it protects the data buffer during SPI ops. don't be the one who skips it, i'm literally begging π
and that's the whole page, fr fr β sourced from ./drivers/iio/dac, dated October 2026, in the kernel API manual. mwah, stan this struct for clear skin π
πβ
π¦ 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