Skip to content

drivers/imu: add LSM6DSO gyroscope driver#1511

Open
dbortz wants to merge 1 commit into
coredevices:mainfrom
dbortz:gyro-service
Open

drivers/imu: add LSM6DSO gyroscope driver#1511
dbortz wants to merge 1 commit into
coredevices:mainfrom
dbortz:gyro-service

Conversation

@dbortz

@dbortz dbortz commented Jun 12, 2026

Copy link
Copy Markdown

Splitting the original combined PR into smaller, layered PRs as requested (#1510 has the full context/RFC). This is the first of three:

  1. this PR — the LSM6DSO gyroscope driver
  2. (next) gyro_manager service + board enablement
  3. (after that) applib gyro_service + SDK export (PBL_GYRO)

I'll open each subsequent PR once the previous lands.

What this PR does

  • Refactors the LSM6DSO chip management (init, I2C, the shared hardware FIFO) out of the accelerometer driver into a small lsm6dso_core, so the accel and gyro halves can be compiled independently (CONFIG_ACCEL_LSM6DSO / CONFIG_GYRO_LSM6DSO). FIFO records from the two sensors are interleaved and dispatched by tag.
  • Adds the drivers/gyro.h interface and its LSM6DSO implementation (lsm6dso_gyro.c). The gyro is FIFO-batched and timer-polled (not all boards route an LSM6DSO interrupt pin) and stays powered down until samples are requested.
  • Resolves the existing ULP-mode TODO in lsm6dso.c: the accelerometer now leaves ultra-low-power mode while the gyro is active (datasheet §6.2.1).

On building / coverage

The driver isn't enabled on any board here — the service that consumes it (and the board enablement that links the two) is the next PR, so they can be reviewed separately as you asked. Concretely:

  • The lsm6dso_core refactor is exercised in CI via the existing accelerometer on asterix (no behavior change).
  • lsm6dso_gyro.c and the gyro-specific #if CONFIG_GYRO_LSM6DSO paths compile once the service PR enables a board — this is the usual driver-then-enable split. I've verified the full 3-PR series builds clean on obelix and asterix.

If you'd rather have the driver and service land together (so every line is exercised in this PR's own CI), I'm happy to combine those two — just say the word.

🤖 Generated with Claude Code

@dbortz dbortz requested review from gmarull and jplexer as code owners June 12, 2026 18:03

@gmarull gmarull left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

split changes into smaller PRs, eg first driver, then service, etc.

Refactor the LSM6DSO chip management (init, I2C, and the shared hardware
FIFO) out of the accelerometer driver into a small lsm6dso_core, then add
a gyroscope driver (drivers/gyro.h) implemented on top of it. The
accelerometer and gyroscope halves can now be compiled independently
(CONFIG_ACCEL_LSM6DSO / CONFIG_GYRO_LSM6DSO); FIFO records from the two
sensors are interleaved and dispatched by tag.

The gyroscope is FIFO-batched and timer-polled (not all boards route an
LSM6DSO interrupt pin) and is kept powered down until samples are
requested. This also resolves the existing ULP-mode TODO: the
accelerometer leaves ultra-low-power mode while the gyroscope is active,
per LSM6DSO datasheet section 6.2.1.

Not enabled on any board yet — the gyro_manager service that consumes
this driver, and the board enablement, follow in a separate change.

Signed-off-by: Dave Bortz <dbortz@gmail.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dbortz

dbortz commented Jun 15, 2026

Copy link
Copy Markdown
Author

Thanks for the review! Split as suggested — this PR is now just the driver (the lsm6dso_core refactor + the gyro driver). The gyro_manager service + board enablement will be the next PR, and the applib/SDK export (PBL_GYRO) the one after that. I'll open them in sequence as each lands. Branches are pushed (gyro-pr2-service, gyro-pr3-sdk) and the full series builds on obelix and asterix.

@dbortz dbortz changed the title Add gyroscope support: LSM6DSO driver, gyro_manager service, and SDK API (PBL_GYRO) drivers/imu: add LSM6DSO gyroscope driver Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants