cros_ec_sensors_read_lpc(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– cros_ec_sensors_read_lpc(9) πŸ’–

okay so bestie, welcome to the Kernel API Manual β€” this is the page for cros_ec_sensors_read_lpc, and honestly? it's giving "quiet hero of the sensor stack" energy. let's get into it 🫢


✨ NAME ✨

cros_ec_sensors_read_lpc β€” read acceleration data from EC shared memory.

like, that's the whole vibe. acceleration data. from the EC's shared memory. iconic behavior honestly 🌸


πŸŽ€ SYNOPSIS πŸŽ€

int cros_ec_sensors_read_lpc (struct iio_dev *indio_dev , unsigned long
scan_mask , s16 *data );

look at her. three params, one return value, zero drama (as long as you use the right read function, which β€” plot twist β€” you will hear about in a sec 😭).


πŸ¦‹ ARGUMENTS πŸ¦‹

  • indio_dev β€” pointer to IIO device. this is the little device handle that tells the function which sensor party we're crashing πŸ’…
  • scan_mask β€” bitmap of the sensor indices to scan. think of it as the guest list: it literally selects which sensor indices get scanned, one bit per sensor, no plus-ones 🌈
  • data β€” location to store data. this is where the good stuff lands, so pls make sure it's a real place in memory and not a vibe ✨

⭐ NOTE ⭐

okay this part is important so listen up: this is the safe function for reading the EC data. it guarantees that the data sampled was not modified by the EC while being read.

fr fr. no torn reads, no half-updated values, no "wait was that one byte from before or after" situation. it's the responsible one. the designated driver of the sensor read functions πŸš—πŸ’¨ iykyk


πŸ”₯ RETURN πŸ”₯

  • 0 on success πŸŽ‰
  • -errno on failure πŸ’€

that's it. that's the contract. classic, clean, no cap.


πŸ‘‘ SEE ALSO πŸ‘‘

the kernel file, because yes we cite our sources:

Kernel file ./drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c

and the whole friend group of related functions β€” every single one, bestie, not skipping a single name:

(and yeah β€” cros_ec_sensors_read_data_unsafe(9) is right there in the list. notice how this page is not that one. you're welcome 🫢)


πŸ’œ friendly reminder: this page comes to you from source ./drivers/iio/common/cros_ec_s... and is dated October 2026. slay, documented, timestamped, periodt. βœ¨πŸŽ€πŸ’…
πŸ“¦ where this page comes from