STRUCT AD5686_STATE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 β€” the device instance. 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 humble bool doing honest work.
  • use_internal_vref β€” set to true if the internal reference voltage is used. set it to true, not "true", not 1, we're being proper here πŸŽ€
  • lock β€” lock to protect access to state fields, which includes the data buffer during regmap ops. 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 a union of __be32 d32, __be16 d16, and u8 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_vref is a bool set to true when the internal reference voltage is the one in play, and lock is not decorative β€” it guards access to the state fields, including the data buffer during regmap ops. 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