STRUCT VADC_PRIV(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct vadc_priv(9) β€” the VADC private structure, explained by your favorite kernel bestie

okay so you opened the struct vadc_priv(9) page in the Kernel API Manual and you're like "what is all this" β€” don't worry, we're getting through it together 🫢. This is the private struct for the VADC driver, i.e. the little home where all the driver's own state lives. Nobody outside gets to peek in. It's giving private, it's giving exclusive, it's giving main character energy πŸ‘‘


✨ SYNOPSIS ✨

here's the whole thing, no cap, exactly as it is:

struct vadc_priv {
    struct regmap            *regmap;
    struct device            *dev;
    u16 base;
    unsigned int             nchannels;
    struct vadc_channel_prop *chan_props;
    struct iio_chan_spec     *iio_chans;
    bool are_ref_measured;
    bool poll_eoc;
    struct completion        complete;
    struct vadc_linear_graph graph[2];
    struct mutex             lock;
 };

like, look at her. eleven members, all baddies πŸ’–


πŸŽ€ Members πŸŽ€

  • regmap β€” pointer to struct regmap. yes bestie, the regmap, the one that handles all the register reads and writes for you πŸ’…
  • dev β€” pointer to struct device. the device this whole situation belongs to 🌸
  • base β€” the base address for the ADC peripheral. where it lives in register-land 🏠
  • nchannels β€” number of VADC channels. count 'em πŸ“Š
  • chan_props β€” array of VADC channel properties. one entry per channel, per channel πŸ’œ
  • iio_chans β€” array of IIO channels specification. this is the IIO-facing version of the channel lineup ✨
  • are_ref_measured β€” are reference points measured. literally just a yes/no on whether the reference points got measured 🧚
  • poll_eoc β€” use polling instead of interrupt. some setups poll, some get interrupted. both valid, both iconic πŸ¦‹
  • complete β€” VADC result notification after interrupt is received. it's the "hey your result is ready" completion πŸŽ€
  • graph β€” store parameters for calibration. and note it's graph[2] β€” two of them, so calibration can keep both sets of parameters, periodt πŸ“ˆ
  • lock β€” ADC lock for access to the peripheral. the mutex that keeps everyone from grabbing the peripheral at the same time, thank u πŸ”’
lowkey the lock is the MVP here β€” no lock, no peace, no cap πŸ’€

πŸ‘€ SEE ALSO πŸ‘€

  • the Kernel file ./drivers/iio/adc/qcom-spmi-vadc.c β€” go read the source, iykyk πŸ“–
  • struct vadc_channel_prop(9) β€” the channel properties struct, aka where chan_props points πŸ”₯

and that's the whole vibe check bestie, you ate πŸ’…βœ¨ this page came from ./drivers/iio/adc and it's dated October 2026 β€” so like, future energy fr fr 🌈⭐ mwah, go read some kernel code πŸ«ΆπŸ‘‘

πŸ“¦ where this page comes from