STRUCT AD5686_STATE(9)
π struct ad5686_state(9) π
okay so bestie, welcome to the Kernel API Manual, section 9 β this is the whole entire lore drop on struct ad5686_state, which is literally just driver instance specific data. that's it. that's the vibe. it's the little bundle of everything one AD5686 driver instance needs to know about itself π«Ά
β¨ SYNOPSIS β¨
struct ad5686_state {
struct device *dev;
const struct ad5686_chip_info *chip_info;
const struct ad5686_bus_ops *ops;
struct gpio_desc *ldac_gpio;
struct gpio_desc *gain_gpio;
unsigned int pwr_down_mask;
unsigned int pwr_down_mode;
int scale_avail[4];
unsigned short vref_mv;
bool double_scale;
bool use_internal_vref;
struct mutex lock;
void *bus_data;
union {
__be32 d32;
__be16 d16;
u8 d8[4];
} data[AD5686_MAX_CHANNELS];
};
look at her. she's iconic. she's a struct. copy her exactly, no cap π
πΈ Members πΈ
devβ thedeviceinstance. the main character, fr.chip_infoβ chip model specific constants, available modes etc. iykyk, every chip's got its own little personality π¦opsβ bus specific operations. the how-do-i-actually-talk-to-this-thing manual.ldac_gpioβ the LDAC pin GPIO descriptor. yes it's a real pin, no i will not be elaborating πgain_gpioβ the GAIN pin GPIO descriptor. her sister pin. slay.pwr_down_maskβ power down mask. it's giving bitmask energy.pwr_down_modeβ current power down mode. key word current β this one changes, bestie πscale_availβ pre-calculated available scale values. already done, already ate, no math needed at runtime β¨vref_mvβ actual reference voltage used. actual, as in the real one, as in not the theoretical one πdouble_scaleβ flag to indicate the gain multiplier is applied. a humblebooldoing honest work.use_internal_vrefβ set totrueif the internal reference voltage is used. set it totrue, not "true", not 1, we're being proper here πlockβ lock to protect access to state fields, which includes thedatabuffer duringregmapops. do NOT skip the lock, i'm literally begging you π«Ά concurrency is a vibe killer if you ignore her.bus_dataβ bus specific data. mystery box. whatever the bus wants, honestly.dataβ transfer buffers. it's aunionof__be32 d32,__be16 d16, andu8 d8[4], and there are[AD5686_MAX_CHANNELS]of them, so everyone gets their own lil buffer π§
π₯ SEE ALSO π₯
- Kernel file
./drivers/iio/dac/ad5686.h struct ad5686_bus_ops(9)struct ad5686_chip_info(9)
go read those too, they're the supporting cast and honestly they deserved more screen time π
heads up bestie:use_internal_vrefis aboolset totruewhen the internal reference voltage is the one in play, andlockis not decorative β it guards access to the state fields, including thedatabuffer duringregmapops. that part's not a suggestion, that's load-bearing π
and that's the page!! brought to you by ./drivers/iio/dac, dated October 2026 β signed, sealed, slayed. mwah ππβ
π¦ 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