STRUCT LIS3LV02D_PLATFORM_DATA(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– 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 channel 0.
  • irq_flags2 β€” additional irq triggering flags for irq channel 1.
  • duration1 β€” wake up unit 1 duration parameter.
  • duration2 β€” wake up unit 2 duration parameter.
  • wakeup_flags β€” wake up unit 1 flags.
  • wakeup_thresh β€” wake up unit 1 threshold value.
  • wakeup_flags2 β€” wake up unit 2 flags.
  • wakeup_thresh2 β€” wake up unit 2 threshold 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. 0 means 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 line 2 number.

πŸ¦‹ 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