STRUCT AK8974(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ NAME ✨

okay so struct ak8974 is the state container for the AK8974 driver, and this whole glow-up lives in the Kernel API Manual, section 9. bestie, it's giving β€œall the driver's remembered state in one iconic struct” πŸ’…βœ¨.

πŸ¦‹ SYNOPSIS πŸ¦‹

       struct ak8974 {
           struct i2c_client *i2c;
           struct iio_mount_matrix orientation;
           struct regmap *map;
           struct regulator_bulk_data regs[2];
           const char *name;
           u8 variant;
           struct mutex lock;
           bool drdy_irq;
           struct completion drdy_complete;
           bool drdy_active_low;
           struct {
             __le16 channels[3];
             aligned_s64 ts;
           } scan;
        };

πŸ”₯ Members πŸ”₯

  • i2c β€” the parent I2C client, aka where this part is hanging out on the bus 🚌.
  • orientation β€” the mounting matrix, so flipped axes and etc. get handled. very β€œwe know her” πŸ’….
  • map β€” the regmap used to access the AK8974 registers over I2C. slay.
  • regs β€” the avdd and dvdd power regulators. a whole regs[2] situation πŸ”‹.
  • name β€” the name of the part. iconic, no notes.
  • variant β€” the whoami ID value, used for selecting code paths. iykyk 🫢.
  • lock β€” a mutex that locks the magnetometer for exclusive use during a measurement. no sharing, bestie 😀.
  • drdy_irq β€” says it uses the DRDY IRQ line ⚑.
  • drdy_complete β€” the completion for DRDY. it's literally waiting for that signal 😭.
  • drdy_active_low β€” tells you the DRDY IRQ is active low.
  • scan β€” timestamps. the nested struct holds __le16 channels[3] and aligned_s64 ts, and the manpage keeps it simple: timestamps ⏱️.

πŸ‘‘ SEE ALSO πŸ‘‘

  • Kernel file ./drivers/iio/magnetometer/ak8974.c β€” go read the source, bestie, it's right there πŸ“–βœ¨.

mwah πŸ’‹ β€” signed off from source ./drivers/iio/magnetometer, October 2026 edition. stay slay, stay compiled 🫢🌈

πŸ“¦ where this page comes from