STRUCT KX022A_CHIP_INFO(9)
π struct kx022a_chip_info(9) π
okay bestie, so this is a page from the Kernel API Manual, section 9, and it's literally all about struct kx022a_chip_info β the little vibe-check struct that holds chip specific information for Kionix accelerometers. ngl it's giving "backend lore that makes the driver actually work" β¨
β¨ NAME β¨
struct kx022a_chip_info β Kionix accelerometer chip specific information π
So basically: every Kionix accelerometer has its own little personality (registers, scaling, channels), and this struct is where all that per-chip intel lives. Obsessed.
πΈ SYNOPSIS πΈ
struct kx022a_chip_info {
const char *name;
const struct regmap_config *regmap_config;
const int (*scale_table)[2];
const int scale_table_size;
const struct iio_chan_spec *channels;
unsigned int num_channels;
unsigned int fifo_length;
u16 buf_smp_lvl_mask;
u8 who;
u8 id;
u8 cntl;
u8 cntl2;
u8 odcntl;
u8 buf_cntl1;
u8 buf_cntl2;
u8 buf_clear;
u8 buf_status1;
u8 buf_read;
u8 inc1;
u8 inc4;
u8 inc5;
u8 inc6;
u8 xout_l;
int (*get_fifo_bytes_available)(struct kx022a_data *);
};
look at all those fields, main character energy fr fr π
π Members π
okay so here's the whole cast, one by one, no cap:
nameβ name of the device π·οΈregmap_configβ pointer to register map configurationscale_tableβ An array of tables of scaling factors for a supported acceleration measurement range. Each table contains a single scaling factor consisting of two integers. The first value in a table is the integer part, and the second value is the fractional part as parts per billion. so like... integer part, then the ppb fractional part. cute, precise, iconic πscale_table_sizeβ Amount of values in tables. (yep, count 'em)channelsβ pointer toiio_chan_specarraynum_channelsβ number ofiio_chan_specchannelsfifo_lengthβ number of 16-bit samples in a full bufferbuf_smp_lvl_maskβ buffer sample level maskwhoβWHO_AM_Iregister π (yes it's literally called that, we love a self-aware register)idβWHO_AM_Iregister valuecntlβ control register 1cntl2β control register 2odcntlβ output data control registerbuf_cntl1β buffer control register 1buf_cntl2β buffer control register 2buf_clearβ buffer clear registerbuf_status1β buffer status register 1buf_readβ buffer read registerinc1β interrupt control register 1inc4β interrupt control register 4inc5β interrupt control register 5inc6β interrupt control register 6xout_lβ x-axis output least significant byteget_fifo_bytes_availableβ function pointer to get amount of acceleration data bytes currently stored in the sensor's FIFO buffer π«Ά
lowkey the best part? it's all const-friendly and per-chip, so the driver just picks the right struct and slays. no runtime guessing, no mess. periodt.
π¦ SEE ALSO π¦
Kernel file ./drivers/iio/accel/kionix-kx022a.h β go read it, iykyk π
and that's the whole page bestie π
this gem lives in ./drivers/iio/accel, dated October 2026, and it's filed under struct kx022a_chip_info(9) β go forth and read registers responsibly πβ¨πΈ
π¦ 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