STRUCT SX_COMMON_DATA(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ struct sx_common_data πŸ’… β€” the Semtech Sensor private data glow-up

Okay so bestie, welcome to struct sx_common_data(9) in the Kernel API Manual, and ngl this one is the struct that holds all the private data for Semtech sensors. It's giving backstage-pass energy: everything the sensor driver needs to keep track of lives in here. Let's go πŸŽ€


🌸 SYNOPSIS 🌸

struct sx_common_data {
    const struct sx_common_chip_info *chip_info;
    struct mutex mutex;
    struct completion completion;
    struct i2c_client *client;
    struct iio_trigger *trig;
    struct regmap *regmap;
    unsigned long chan_prox_stat;
    bool trigger_enabled;
    struct {
      __be16 channels[SX_COMMON_MAX_NUM_CHANNELS];
      aligned_s64 ts;
    } buffer;
    unsigned int suspend_ctrl;
    unsigned long chan_read;
    unsigned long chan_event;
 };

πŸ‘‘ Members πŸ‘‘

  • chip_info β€” the struct that defines the sensor's internals. Basically the sensor's whole personality ✨
  • mutex β€” serializes access to the registers and the channel configuration, so nobody's fighting over the hardware. One at a time, bestie πŸ’…
  • completion β€” the completion object we wait on for data acquisition. It's the "text me when it's ready" of the kernel 🫢
  • client β€” the I2C client structure, iykyk.
  • trig β€” the IIO trigger object. Iconic.
  • regmap β€” the register map. Main character energy fr fr.
  • chan_prox_stat β€” the last reading of the proximity status for each channel. The tea: we only send an event to user space when this changes, so no spam, only ✨news✨.
  • trigger_enabled β€” true when the device trigger is enabled. Bool doing its little bool thing πŸ’–
  • buffer β€” the buffer that stores raw samples. Keeping the receipts 🧾
  • suspend_ctrl β€” remembers the enabled channels and the sample rate during suspend. It's literally the "hold my info while I nap" field 😭
  • chan_read β€” a bit field for each raw channel enabled. Every bit is a little yes/no πŸ’€
  • chan_event β€” a bit field for each event enabled. Same vibe, event edition πŸ”₯

πŸ¦‹ SEE ALSO πŸ¦‹

  • The kernel file ./drivers/iio/proximity/sx_common.h β€” like, go read it, it's right there πŸ’œ
  • struct sx_common_ops(9)
  • struct sx_common_chip_info(9)

Also lowkey shoutout to ./drivers/iio/proximity as the source/version and October 2026 as the date β€” that's the footer flex, and we're mentioning it here because we're cute like that 🌈. Periodt. πŸ’…βœ¨

πŸ“¦ where this page comes from