STRUCT LIS3LV02D_PLATFORM_DATA(9)
π struct lis3lv02d_platform_data β lis3 chip family platform data π
okay bestie, this is from the Kernel API Manual, section 9 β that's the manual name folded in right at the top, no cap. It's the platform-data struct for the lis3 chip family, and it's genuinely iconic for sensor setup. Every field below is doing a job, so let's get into it. π«Ά
πΈ NAME πΈ
struct lis3lv02d_platform_data β lis3 chip family platform data. That's the name, that's the vibe, periodt. β¨
β¨ SYNOPSIS β¨
struct lis3lv02d_platform_data {
#define LIS3_CLICK_SINGLE_X (1 << 0);
#define LIS3_CLICK_DOUBLE_X (1 << 1);
#define LIS3_CLICK_SINGLE_Y (1 << 2);
#define LIS3_CLICK_DOUBLE_Y (1 << 3);
#define LIS3_CLICK_SINGLE_Z (1 << 4);
#define LIS3_CLICK_DOUBLE_Z (1 << 5);
unsigned char click_flags;
unsigned char click_thresh_x;
unsigned char click_thresh_y;
unsigned char click_thresh_z;
unsigned char click_time_limit;
unsigned char click_latency;
unsigned char click_window;
#define LIS3_IRQ1_DISABLE (0 << 0);
#define LIS3_IRQ1_FF_WU_1 (1 << 0);
#define LIS3_IRQ1_FF_WU_2 (2 << 0);
#define LIS3_IRQ1_FF_WU_12 (3 << 0);
#define LIS3_IRQ1_DATA_READY (4 << 0);
#define LIS3_IRQ1_CLICK (7 << 0);
#define LIS3_IRQ1_MASK (7 << 0);
#define LIS3_IRQ2_DISABLE (0 << 3);
#define LIS3_IRQ2_FF_WU_1 (1 << 3);
#define LIS3_IRQ2_FF_WU_2 (2 << 3);
#define LIS3_IRQ2_FF_WU_12 (3 << 3);
#define LIS3_IRQ2_DATA_READY (4 << 3);
#define LIS3_IRQ2_CLICK (7 << 3);
#define LIS3_IRQ2_MASK (7 << 3);
#define LIS3_IRQ_OPEN_DRAIN (1 << 6);
#define LIS3_IRQ_ACTIVE_LOW (1 << 7);
unsigned char irq_cfg;
unsigned char irq_flags1;
unsigned char irq_flags2;
unsigned char duration1;
unsigned char duration2;
#define LIS3_WAKEUP_X_LO (1 << 0);
#define LIS3_WAKEUP_X_HI (1 << 1);
#define LIS3_WAKEUP_Y_LO (1 << 2);
#define LIS3_WAKEUP_Y_HI (1 << 3);
#define LIS3_WAKEUP_Z_LO (1 << 4);
#define LIS3_WAKEUP_Z_HI (1 << 5);
unsigned char wakeup_flags;
unsigned char wakeup_thresh;
unsigned char wakeup_flags2;
unsigned char wakeup_thresh2;
#define LIS3_HIPASS_CUTFF_8HZ 0;
#define LIS3_HIPASS_CUTFF_4HZ 1;
#define LIS3_HIPASS_CUTFF_2HZ 2;
#define LIS3_HIPASS_CUTFF_1HZ 3;
#define LIS3_HIPASS1_DISABLE (1 << 2);
#define LIS3_HIPASS2_DISABLE (1 << 3);
unsigned char hipass_ctrl;
#define LIS3_NO_MAP 0;
#define LIS3_DEV_X 1;
#define LIS3_DEV_Y 2;
#define LIS3_DEV_Z 3;
#define LIS3_INV_DEV_X -1;
#define LIS3_INV_DEV_Y -2;
#define LIS3_INV_DEV_Z -3;
s8 axis_x;
s8 axis_y;
s8 axis_z;
#define LIS3_USE_BLOCK_READ 0x02;
u16 driver_features;
int default_rate;
int (*setup_resources)(void);
int (*release_resources)(void);
s16 st_min_limits[3];
s16 st_max_limits[3];
int irq2;
};
π Members π
click_flagsβ click detection unit configuration. This is where the click unit gets its whole mood set. πclick_thresh_xβ click detection unit x axis threshold.click_thresh_yβ click detection unit y axis threshold.click_thresh_zβ click detection unit z axis threshold.click_time_limitβ click detection unit time parameter.click_latencyβ click detection unit latency parameter.click_windowβ click detection unit window parameter.irq_cfgβ on chip irq source and type configuration (click / data available / wake up, open drain, polarity). The IRQ mood board, basically. β‘irq_flags1β additional irq triggering flags for irq channel0.irq_flags2β additional irq triggering flags for irq channel1.duration1β wake up unit1duration parameter.duration2β wake up unit2duration parameter.wakeup_flagsβ wake up unit1flags.wakeup_threshβ wake up unit1threshold value.wakeup_flags2β wake up unit2flags.wakeup_thresh2β wake up unit2threshold value.hipass_ctrlβ high pass filter control (enable / disable, cut off frequency).axis_xβ sensor orientation remapping for x-axis.axis_yβ sensor orientation remapping for y-axis.axis_zβ sensor orientation remapping for z-axis.driver_featuresβ enable bits for different features. Disabled by default. πdefault_rateβ default sampling rate.0means reset default.setup_resourcesβ interrupt line setup call back function.release_resourcesβ interrupt line release call back function.st_min_limitsβ selftest acceptance minimum values(x, y, z).st_max_limitsβ selftest acceptance maximum values(x, y, z).irq2β irq line2number.
π¦ Description π¦
okay so platform data is literally used to set up the sensor chip. π If you want the meaning of the different chip features, the data sheet is the place β it's publicly available at www.st.com web pages. Right now, this platform data is used only for the 8 bit device. The 8 bit device has two wake up / free fall detection units and a click detection unit. There are so many ways to configure the chip that explaining the deeper meaning of the fields here is, ngl, quite hard. π
Behaviour of the detection blocks varies heavily depending on the configuration. For example, the interrupt detection block can use high pass filtered data, which makes it react to changes in the acceleration. Irq_flags can be used to enable interrupt detection on both edges. With proper chip configuration, this produces an interrupt when some trigger starts and when it goes away. π
π SEE ALSO π
Kernel file ./include/linux/lis3lv02d.hβ go read the header, bestie. π
source/version: ./include/linux Β· date: October 2026 Β· page: struct lis3l...latform_data(9) β and that's the whole manual page, bestie. slay. π
π¦ 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