STRUCT KX022A_CHIP_INFO(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸŽ€ 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 configuration
  • scale_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 to iio_chan_spec array
  • num_channels β€” number of iio_chan_spec channels
  • fifo_length β€” number of 16-bit samples in a full buffer
  • buf_smp_lvl_mask β€” buffer sample level mask
  • who β€” WHO_AM_I register πŸ‘€ (yes it's literally called that, we love a self-aware register)
  • id β€” WHO_AM_I register value
  • cntl β€” control register 1
  • cntl2 β€” control register 2
  • odcntl β€” output data control register
  • buf_cntl1 β€” buffer control register 1
  • buf_cntl2 β€” buffer control register 2
  • buf_clear β€” buffer clear register
  • buf_status1 β€” buffer status register 1
  • buf_read β€” buffer read register
  • inc1 β€” interrupt control register 1
  • inc4 β€” interrupt control register 4
  • inc5 β€” interrupt control register 5
  • inc6 β€” interrupt control register 6
  • xout_l β€” x-axis output least significant byte
  • get_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