STRUCT AK8974(9)
β¨ 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β theregmapused to access the AK8974 registers over I2C. slay.regsβ theavddanddvddpower regulators. a wholeregs[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]andaligned_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
- 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