Skip to content

iio: add Open Sensor Fusion UART support

Jinseob Kim linux-devicetree linux-doc linux-iio lkml 11 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v11 Latest8 patches 5 repliesIn review
  2. v108 patches 19 repliesSuperseded
  3. v95 patches 4 repliesSuperseded
Earlier versions · 8
VersionPostedPatchesRepliesStatus
v85 patches4 repliesSuperseded
v75 patches10 repliesSuperseded
v6 RFC5 patches17 repliesSuperseded
v5 RFC6 patches9 repliesSuperseded
v4 RFC6 patches9 repliesSuperseded
v3 RFC6 patches8 repliesSuperseded
v2 RFC7 patches18 repliesSuperseded
v1 RFC3 patches8 repliesSuperseded

Changes in v11 from the cover letter

- Move OSF under drivers/iio/sensorhubs/osf/ following review.
- Use the OSF GREEN compatible with the generic OSF fallback.
- Clarify complete capability-report snapshot semantics.
- Use designated decoded-frame initialization and drop decoded reserved fields while retaining reserved wire-byte tolerance.
- Reuse stream reset and simplify core/serdev locking and lifecycle.
- Use IIO buffer-mode claims instead of a private buffer lock.
- Simplify scan storage and channel declarations.
- Fix KUnit worker/device/mutex/resource/completion lifetimes. Generic IIO self-test extraction remains deferred.
- Synchronize KUnit fault observation and configuration completion with completions and thread joins instead of short polling/deadline windows.

Patches in v11 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8dt-bindings: iio: add Open Sensor Fusion deviceDocumentation/devicetree/bindings/iio/opensensorfusion,osf.yaml Documentation/devicetree/bindings/vendor-prefixes.yaml MAINTAINERS+63 -01 reply
2/8Documentation: iio: add Open Sensor Fusion driver overviewDocumentation/iio/index.rst Documentation/iio/open-sensor-fusion.rst MAINTAINERS+83 -00 replies
3/8iio: osf: add protocol decodingMAINTAINERS drivers/iio/sensorhubs/osf/osf_protocol.c drivers/iio/sensorhubs/osf/osf_protocol.h+315 -00 replies
4/8iio: osf: add validated stream parserdrivers/iio/sensorhubs/osf/osf_stream.c drivers/iio/sensorhubs/osf/osf_stream.h+283 -00 replies
5/8iio: osf: add UART transport and core receive pathdrivers/iio/Kconfig drivers/iio/Makefile drivers/iio/sensorhubs/Kconfig +6 more+300 -00 replies
6/8iio: osf: add IIO devices from capability reportsdrivers/iio/sensorhubs/osf/Kconfig drivers/iio/sensorhubs/osf/Makefile drivers/iio/sensorhubs/osf/osf_core.c +4 more+736 -70 replies
7/8iio: osf: add core KUnit testsdrivers/iio/sensorhubs/osf/Kconfig drivers/iio/sensorhubs/osf/Makefile drivers/iio/sensorhubs/osf/osf_core_test.c+1069 -01 reply
8/8iio: osf: add IIO KUnit testsdrivers/iio/sensorhubs/osf/Kconfig drivers/iio/sensorhubs/osf/Makefile drivers/iio/sensorhubs/osf/osf_iio_test.c+388 -20 replies

Reviews trailers per patch

1 of 8 patches has a Reviewed-by or Acked-by.

PatchConor Dooley
1/8R-b
2/8
3/8
4/8
5/8
6/8
7/8
8/8

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v11 thread

Cover letter [PATCH v11 0/8] iio: add Open Sensor Fusion UART support

This series adds a UART/serdev receiver for the project's fixed OSF Device-to-Host 0.0 protocol. Complete capability snapshots create IIO accelerometer, gyroscope, magnetometer and temperature devices with RAW, descriptor-derived SCALE and initialized buffered scans.

The receiver validates the fixed OSF0 envelope, CRC and exact known message lengths. Equivalent capability reports are idempotent; changes to a bound supported inventory fault the session until explicit rebind. IIO samples use host timestamps.

Changes since v10:
- Move OSF under drivers/iio/sensorhubs/osf/ following review.
- Use the OSF GREEN compatible with the generic OSF fallback.
- Clarify complete capability-report snapshot semantics.
- Use designated decoded-frame initialization and drop decoded reserved fields while retaining reserved wire-byte tolerance.
- Reuse stream reset and simplify core/serdev locking and lifecycle.
- Use IIO buffer-mode claims instead of a private buffer lock.
- Simplify scan storage and channel declarations.
- Fix KUnit worker/device/mutex/resource/completion lifetimes. Generic IIO self-test extraction remains deferred.
- Synchronize KUnit fault observation and configuration completion with completions and thread joins instead of short polling/deadline windows.

The IIO buffer teardown serialization issue found during the v10 review was fixed separately and is now in mainline as commit 84bb0fc46ccf ("iio: buffer: serialize buffer teardown with mode claims").

This series is based on the IIO testing snapshot fetched for this submission:
a22dc7ebb21a6bd4c8b63bc2c1dd46a24945aae7
Runtime validation used this testing base plus the eight OSF patches and the exact mainline IIO core fix 84bb0fc46ccf6a545b8fdf57cda83770186ed8dd. The core fix is not included in this series and must be present when running the series on this testing base.

Fresh validation of this source:
- GCC and Clang W=1 kernel builds; module builds.
- osf-core (16 tests) and osf-iio (2 tests), with KASAN, lockdep, DEBUG_MUTEXES, DEBUG_LOCK_ALLOC, DEBUG_OBJECTS and DEBUG_OBJECTS_FREE.
- 200 production module load/unload cycles and 200 test-enriched module load/unload cycles using identical driver/test C sources, exercising 20,000 IIO buffer toggles, scan subsets, timestamps and unregister.
- DT binding/style/example/schema checks and IIO Sphinx build.
- Clean sequential application and relevant builds of all eight patches. Physical board tests were not repeated for this revision.

Canonical specification (fixed revision):
https://github.com/opensensorfusion/opensensorfusion-protocol/blob/ca9cdea1ae550c2b4d6f29f87877adae99470744/spec/osf-d2h-0.0.md

The fixed public specification is maintained and adopted by the OSF project. This does not imply Linux maintainer approval of the specification or driver.

Jinseob Kim (8):
dt-bindings: iio: add Open Sensor Fusion device
Documentation: iio: add Open Sensor Fusion driver overview
iio: osf: add protocol decoding
iio: osf: add validated stream parser
iio: osf: add UART transport and core receive path
iio: osf: add IIO devices from capability reports
iio: osf: add core KUnit tests
iio: osf: add IIO KUnit tests

 .../bindings/iio/opensensorfusion,osf.yaml    |   55 +
 .../devicetree/bindings/vendor-prefixes.yaml  |    2 +
 Documentation/iio/index.rst                   |    1 +
 Documentation/iio/open-sensor-fusion.rst      |   81 ++
 MAINTAINERS                                   |    8 +
 drivers/iio/Kconfig                           |    1 +
 drivers/iio/Makefile                          |    1 +
 drivers/iio/sensorhubs/Kconfig                |    7 +
 drivers/iio/sensorhubs/Makefile               |    3 +
 drivers/iio/sensorhubs/osf/Kconfig            |   27 +
 drivers/iio/sensorhubs/osf/Makefile           |    7 +
 drivers/iio/sensorhubs/osf/osf_core.c         |  460 +++++++
 drivers/iio/sensorhubs/osf/osf_core.h         |   75 ++
 drivers/iio/sensorhubs/osf/osf_core_test.c    | 1056 +++++++++++++++++
 drivers/iio/sensorhubs/osf/osf_iio.c          |  288 +++++
 drivers/iio/sensorhubs/osf/osf_iio.h          |   22 +
 drivers/iio/sensorhubs/osf/osf_iio_test.c     |  386 ++++++
 drivers/iio/sensorhubs/osf/osf_protocol.c     |  215 ++++
 drivers/iio/sensorhubs/osf/osf_protocol.h     |   99 ++
 drivers/iio/sensorhubs/osf/osf_serdev.c       |  151 +++
 drivers/iio/sensorhubs/osf/osf_stream.c       |  230 ++++
 drivers/iio/sensorhubs/osf/osf_stream.h       |   53 +
 22 files changed, 3228 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/opensensorfusion,osf.yaml
 create mode 100644 Documentation/iio/open-sensor-fusion.rst
 create mode 100644 drivers/iio/sensorhubs/Kconfig
 create mode 100644 drivers/iio/sensorhubs/Makefile
 create mode 100644 drivers/iio/sensorhubs/osf/Kconfig
 create mode 100644 drivers/iio/sensorhubs/osf/Makefile
 create mode 100644 drivers/iio/sensorhubs/osf/osf_core.c
 create mode 100644 drivers/iio/sensorhubs/osf/osf_core.h
 create mode 100644 drivers/iio/sensorhubs/osf/osf_core_test.c
 create mode 100644 drivers/iio/sensorhubs/osf/osf_iio.c
 create mode 100644 drivers/iio/sensorhubs/osf/osf_iio.h
 create mode 100644 drivers/iio/sensorhubs/osf/osf_iio_test.c
 create mode 100644 drivers/iio/sensorhubs/osf/osf_protocol.c
 create mode 100644 drivers/iio/sensorhubs/osf/osf_protocol.h
 create mode 100644 drivers/iio/sensorhubs/osf/osf_serdev.c
 create mode 100644 drivers/iio/sensorhubs/osf/osf_stream.c
 create mode 100644 drivers/iio/sensorhubs/osf/osf_stream.h

base-commit: a22dc7ebb21a6bd4c8b63bc2c1dd46a24945aae7