STRUCT SX_COMMON_DATA(9)
β¨ 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βtruewhen 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
- 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