[PATCH v9 0/5] iio: add Open Sensor Fusion UART support

From: Jinseob Kim

Date: Wed Sep 09 2026 - 12:46:33 EST


This series adds the Open Sensor Fusion UART receive path and IIO
devices discovered from capability reports. It exposes accelerometer,
gyroscope, magnetometer and temperature samples through the standard
direct-read and software-buffer interfaces.

Changes since v8:
- Configure UART at 115200 baud with flow control disabled before enabling
vcc. Acquire the regulator before opening UART, retain decoded early
capabilities, and publish IIO children only after fallible probe setup.
Close UART and drain receive work before releasing receive-side state.
- Give the aligned one-axis and three-axis scan structures explicit
padding members so designated initialization also initializes the bytes
between samples and timestamps.
- Pack selected channels into the active scan layout. Tests found that
forcing an XYZ producer layout could give X/Y/XY consumers a value at
the timestamp offset on the target IIO base. All nonempty masks remain
supported.
- Quiesce pushes with a driver mutex in predisable and admit them after
postenable. The same mutex covers the enabled check, layout access and
complete push; it does not claim IIO buffer mode.
- Keep the latest-cache rejection rules and add KUnit tests for early
capabilities, scan bytes/timestamps and buffer teardown.
- Tidy macro/call alignment, shorten the driver commit message, and
document the actual receive-side compatibility constraints.

Protocol specification remains an open review question. The accessible
historical protocol-v0 drafts at OSF revision
11d11eb413e6a0e861e4d45fdccadc71c5f15c48 disagree on reserved fields,
trailing extensions and magnetometer units. They do not establish a
versioned normative specification for this implementation. The driver
requires exact known payload lengths and capability scales in IIO units,
including gauss for magnetometers. Documentation now makes those
constraints explicit. This does not establish protocol maturity or
resolve the request for a canonical compatibility specification; feedback
on that requirement is still needed before merge.

Validation:
- GCC and Clang W=1 kernel/module builds with automatic stack
initialization disabled.
- Eight OSF KUnit cases, including all 44 sensor/mask/timestamp
combinations, retained latest-cache regressions and controlled
push/disable/unregister interleavings; Clang KASAN and lockdep.
- Before/after padding byte and generated-code checks, an auxiliary ASan
demux race harness, and 16 modeled probe/unwind/retry scenarios.
- Strict checkpatch on all five patches; clean apply with matching
intermediate/final trees and per-patch DT, documentation and code
builds. GCC and Clang final links pass.
- Fresh ARM64 Image, modules and Pi 4 DTB built from the final tree.
- Raspberry Pi 4 with those artifacts: four IIO devices, direct RAW,
12-second simultaneous capture, all 44 scan combinations, 400 buffer
transitions, unload/reload and verified return to the stock kernel.

Conor's Reviewed-by is retained on the unchanged binding. Randy's earlier
documentation Tested-by is not carried forward because patch 2 changed.
LLM assistance was used for the documentation, driver fixes and tests.

Based on Jonathan's IIO testing commit
edb91bc566576f6664a3efbad6bd4205aa1d5259.

v8: https://lore.kernel.org/linux-iio/20260820050608.5440-1-kimjinseob88@xxxxxxxxx/

Jinseob Kim (5):
dt-bindings: iio: add Open Sensor Fusion device
Documentation: iio: add Open Sensor Fusion driver overview
iio: osf: add protocol decoding
iio: osf: add authenticated stream parser
iio: osf: add UART IIO driver

.../bindings/iio/opensensorfusion,osf.yaml | 52 ++
.../devicetree/bindings/vendor-prefixes.yaml | 2 +
Documentation/iio/index.rst | 1 +
Documentation/iio/open-sensor-fusion.rst | 84 +++
MAINTAINERS | 8 +
drivers/iio/Kconfig | 1 +
drivers/iio/Makefile | 1 +
drivers/iio/opensensorfusion/Kconfig | 27 +
drivers/iio/opensensorfusion/Makefile | 7 +
drivers/iio/opensensorfusion/osf_core.c | 414 +++++++++++++
drivers/iio/opensensorfusion/osf_core.h | 73 +++
drivers/iio/opensensorfusion/osf_core_test.c | 577 ++++++++++++++++++
drivers/iio/opensensorfusion/osf_iio.c | 336 ++++++++++
drivers/iio/opensensorfusion/osf_iio.h | 22 +
drivers/iio/opensensorfusion/osf_iio_test.c | 325 ++++++++++
drivers/iio/opensensorfusion/osf_protocol.c | 224 +++++++
drivers/iio/opensensorfusion/osf_protocol.h | 101 +++
drivers/iio/opensensorfusion/osf_serdev.c | 162 +++++
drivers/iio/opensensorfusion/osf_stream.c | 231 +++++++
drivers/iio/opensensorfusion/osf_stream.h | 53 ++
20 files changed, 2701 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/opensensorfusion/Kconfig
create mode 100644 drivers/iio/opensensorfusion/Makefile
create mode 100644 drivers/iio/opensensorfusion/osf_core.c
create mode 100644 drivers/iio/opensensorfusion/osf_core.h
create mode 100644 drivers/iio/opensensorfusion/osf_core_test.c
create mode 100644 drivers/iio/opensensorfusion/osf_iio.c
create mode 100644 drivers/iio/opensensorfusion/osf_iio.h
create mode 100644 drivers/iio/opensensorfusion/osf_iio_test.c
create mode 100644 drivers/iio/opensensorfusion/osf_protocol.c
create mode 100644 drivers/iio/opensensorfusion/osf_protocol.h
create mode 100644 drivers/iio/opensensorfusion/osf_serdev.c
create mode 100644 drivers/iio/opensensorfusion/osf_stream.c
create mode 100644 drivers/iio/opensensorfusion/osf_stream.h


base-commit: edb91bc566576f6664a3efbad6bd4205aa1d5259
--
2.43.0