STRUCT CROS_EC_SENSORS_CORE_STATE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct cros_ec_sensors_core_state(9) β€” the Kernel API Manual glow-up

okay so picture this: it's a big ol' C struct living in the Kernel API Manual, section 9, and its whole personality is "state data for EC sensors IIO driver". that's it, that's the job. and honestly? it ate. let's get into it 🫢


✨ NAME ✨

struct cros_ec_sensors_core_state β€” literally just the state data for the EC sensors IIO driver. main character energy for a struct, ngl πŸ’…


🌸 SYNOPSIS 🌸

here's the whole shape of her, exactly as she is, no edits bestie:

struct cros_ec_sensors_core_state {
    struct cros_ec_device *ec;
    struct mutex cmd_lock;
    struct cros_ec_command *msg;
    struct ec_params_motion_sense param;
    struct ec_response_motion_sense *resp;
    enum motionsensor_type type;
    bool range_updated;
    int curr_range;
    struct calib_data {
      s16 offset;
      u16 scale;
    } calib[CROS_EC_SENSOR_MAX_AXIS];
    s8 sign[CROS_EC_SENSOR_MAX_AXIS];
    u8 samples[CROS_EC_SAMPLE_SIZE];
    int (*read_ec_sensors_data)(struct iio_dev *indio_dev, unsigned long
scan_mask, s16 *data);
    u32 fifo_max_event_count;
    int frequencies[6];
 };

like… she's serving structure. the nested struct calib_data in there? iconic. ✨


πŸŽ€ Members πŸŽ€

breaking down every single member because we do NOT skip:

  • ec β€” the cros EC device structure. yeah, the whole device. she's holding the keys πŸ”‘
  • cmd_lock β€” a struct mutex lock that stops simultaneous access to the commands. no cutting the line, no double-dipping, periodt πŸ’€
  • msg β€” the cros EC command structure 🎯
  • param β€” motion sensor parameters structure, the input side of the convo
  • resp β€” motion sensor response structure, the reply side. it's giving call and response πŸ¦‹
  • type β€” type of motion sensor (enum motionsensor_type, if you were curious πŸ‘€)
  • range_updated β€” True if the range of the sensor has been updated. she keeps receipts πŸ“
  • curr_range β€” if updated, the current range value. and bestie, listen: it gets reapplied at every resume. every single one. commitment πŸ’–
  • calib β€” the calibration parameters. quick note that matters: trigger captured data will always provide the calibrated data. so like, don't worry about it, it's already handled 🌈
  • samples β€” a static array holding data from a single capture. for each channel we need 2 bytes, except for the timestamp β€” the timestamp is always last and is always 8-byte aligned. alignment is self-care, fr fr ✨
  • read_ec_sensors_data β€” the function used for accessing sensors values. the lil worker bee 🐝
  • fifo_max_event_count β€” size of the EC sensor FIFO πŸ“¦
  • frequencies β€” table of known available frequencies: 0, Min and Max in mHz 🎡
ngl the members list above is exactly what the page gives us β€” no more, no less. if you're looking for the tea on sign, that's not spilled here πŸ™ˆ

πŸ”₯ SEE ALSO πŸ”₯

  • Kernel file ./include/linux/iio/common/cros_ec_sensors_core.h β€” go read her, iykyk πŸ“–

and that's the whole vibe check, bestie πŸ’œ this little gem comes to you from ./include/linux/iio/common, dated October 2026, and it's filed under struct cros...s_core_state(9) in the Kernel API Manual. slay, stay hydrated, and always align your timestamps πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from