From nobody Mon Jun 8 04:24:52 2026 Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9125033A702 for ; Sun, 7 Jun 2026 23:45:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780875916; cv=none; b=Ka5APooMaT/FY7gCtDDOwkUjvACbaS5gOs9RQSE55aq3ACI14KP7KFPnffentx0C2zTQwjOcTG2p86w1ORgSFKI60xU2TyeVT3FW+uxE5Q1sool9Kj/vXaZ5Bw6eohaU9XOsOf61Q3VN9bhhsLbmMGmDWfaowVhjBLW0o4vPsFY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780875916; c=relaxed/simple; bh=Spsg1lhJOwmJ2qBBDyH8EyO73klzrypmW6Q3Hscl2pI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aKFSE5dwoqgq5J7nx8TOzX33cT7fzbgzD9Rjr+KOFiim6srK8HjERNYJke74BpaJsw66y1MaI8WKFzaWb9JVlcdBj5gUIlgh6JEBePmcMq5hcf0XndytsA/aL5zhlmzQDCj4bSg/hfA2kXPCTggfle14/neA0sAgrDoNsfxOX0c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=RELLlOtd; arc=none smtp.client-ip=209.85.210.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RELLlOtd" Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-842848fd613so2982149b3a.3 for ; Sun, 07 Jun 2026 16:45:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780875914; x=1781480714; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Ahs7nLcf9FlQuNK4toxYY0XgtCKzjOPXWCt75LqsX8Q=; b=RELLlOtdJeuklN0IPC0N4fELBQGbivMj+u3cRt89hqX1QvJQ8s0tO1w9peG8L7xNPp uwIE89aEQazibfTOJ1PBvniK7fyNEqr+FY1S8saUMXOQC7tEfF42nra20UegijpDwiri yskHvDY595YC/N5ELX7tDdK2oyByhDOS7tikErE7Q7GBt6zXb3gZy5nQfz3zYSdAmvBt BADlyYd0IaIj5g7U/cT4geYK8klz45BFFoNM9zHb5n00BbpKfPMBFZjQGHNgFAlJT4Fu +q0txLOGxHDI9gVHOeNH7XeShxY0ZyeEtZOJ0vFQupf7/MFAQFuUInpw8jJLIwAp+nWQ eIbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780875914; x=1781480714; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Ahs7nLcf9FlQuNK4toxYY0XgtCKzjOPXWCt75LqsX8Q=; b=D4DPupcJ625JWS6Vl8QUr5E1TpYW+nnRT9PAcWZd/kVqP8Ra9W5yKfAvClIwACk9R5 jV0ZoRsG+fRDB6uUFiqxnVwTH6NALF+muVemoby8f8h/yE74QwixSle1xOZYTGErfi8o Na8aiqSt6UDTx3Z8xOnVcxKPjbMbOPQsjoZ79UMu3oQYLP+E+UO81zPyeitKkSK0EbsW rpijpZtoVTs29xCqume4OS1/P2wdUHvfco7fa48rH3pVemWDakQZslSkrWwmk8eEQxZM o6MhDE8lIxTN6YFfY92F2Dya1hNUcKLo1L9KMAPm4m/cV3sz+cXK24KfqAwQ0YQHbLZC 60kw== X-Forwarded-Encrypted: i=1; AFNElJ+u4+N74CucMp+gh0LzOOrnfxQZ3l0TETfl2O09lsNIdXv+eI75TYtmFxHsX0NPr25qp+TRw+df241un3s=@vger.kernel.org X-Gm-Message-State: AOJu0YxgxEp4hcBBEjcn3Fh5AO/mDFYBHZJVo5sb21AkblcqwCQUMuYS UhFCAphgy0pYgXXk/81MBXCC8EZDDHS82Uj0PqkqmmpE0tKVqk6MkE2/ X-Gm-Gg: Acq92OG+Y8htITJExUKNBg67CrfT601Pk/NHdtUSt5yXtkPU3Ew1OvahF87D/1p5vDA X+ov0dZjbzqN5UYEbdNbaWewVOlCBqjz7cA+RHI7BFsBNQ6nAVAPKEXMmfdJbYpj9zy00bjcC9C K7Edd4BYaSnqLdY1QJPq5HT1oThMTyLsn9jXO/rDIBj2koPp1lnyuDpPvKuLIdCxNcFIeA1gc+v GV4BL8/mhGL0zPDtPqPySMXA8N7D0T0o4Wy0p0o+rvNEP2UjOURRnb82pg7VbUQBOWzO1HXIXPC y3WSQJ50SiHlRSdsqbBATiLSOG0BR5++topkyYbgBqJMGzZIboi3GDoKffAgcgaI4SwYYwfFVIp ufgMRD3qPdindLKBxzYk6mXsHOmX2domLsm63uqqDIh0e2K03WEzjrmaPRaI1sxl+5W4mE5U+Pw JiQhPTj4YDaJdD4E412St8q4y3PK9XkLVSxwnPV9mKIOFp5VwNloh3TFWG/CLrAB7KN708eOJuv q+RhsjVA4bDQkxlR417x9ZisZ+JBZrOlf6ieYY8s63Nt0qK X-Received: by 2002:a05:6a00:4298:b0:83a:4846:90b0 with SMTP id d2e1a72fcca58-842b10980d8mr13046383b3a.46.1780875913704; Sun, 07 Jun 2026 16:45:13 -0700 (PDT) Received: from DESKTOP-G3E0OSP.localdomain ([112.172.255.242]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-842828d6bd1sm19257732b3a.44.2026.06.07.16.45.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Jun 2026 16:45:13 -0700 (PDT) From: Jinseob Kim To: Jonathan Cameron , linux-iio@vger.kernel.org Cc: David Lechner , =?UTF-8?q?Nuno=20S=C3=A1?= , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Corbet , Shuah Khan , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH RFC v4 1/6] dt-bindings: iio: add Open Sensor Fusion device Date: Mon, 8 Jun 2026 08:43:38 +0900 Message-ID: <20260607234343.22109-2-kimjinseob88@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260607234343.22109-1-kimjinseob88@gmail.com> References: <20260607234343.22109-1-kimjinseob88@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Describe the OSF sensor aggregation hub. Use the generic opensensorfusion,osf compatible. Signed-off-by: Jinseob Kim --- .../iio/imu/opensensorfusion,osf-green.yaml | 43 ------------------- .../bindings/iio/opensensorfusion,osf.yaml | 43 +++++++++++++++++++ MAINTAINERS | 27 ++++++------ 3 files changed, 57 insertions(+), 56 deletions(-) delete mode 100644 Documentation/devicetree/bindings/iio/imu/opensensorfus= ion,osf-green.yaml create mode 100644 Documentation/devicetree/bindings/iio/opensensorfusion,= osf.yaml diff --git a/Documentation/devicetree/bindings/iio/imu/opensensorfusion,osf= -green.yaml b/Documentation/devicetree/bindings/iio/imu/opensensorfusion,os= f-green.yaml deleted file mode 100644 index 626b41fb0..000000000 --- a/Documentation/devicetree/bindings/iio/imu/opensensorfusion,osf-green.= yaml +++ /dev/null @@ -1,43 +0,0 @@ -# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) -%YAML 1.2 ---- -$id: http://devicetree.org/schemas/iio/imu/opensensorfusion,osf-green.yaml# -$schema: http://devicetree.org/meta-schemas/core.yaml# - -title: OSF GREEN sensor aggregation board - -maintainers: - - Jinseob Kim - -description: | - OSF GREEN is an STM32F405-based sensor aggregation board from the Open - Sensor Fusion open hardware project. It sends OSF0 capability, status, a= nd - sample frames to a host over a UART link. - - Open Sensor Fusion is not a generic industry standard. Public project and - hardware documentation is available at: - - https://github.com/opensensorfusion - https://github.com/opensensorfusion/opensensorfusion-hardware - -allOf: - - $ref: /schemas/serial/serial-peripheral-props.yaml# - -properties: - compatible: - const: opensensorfusion,osf-green - -required: - - compatible - -unevaluatedProperties: false - -examples: - - | - serial { - sensor { - compatible =3D "opensensorfusion,osf-green"; - }; - }; - -... diff --git a/Documentation/devicetree/bindings/iio/opensensorfusion,osf.yam= l b/Documentation/devicetree/bindings/iio/opensensorfusion,osf.yaml new file mode 100644 index 000000000..a4049715a --- /dev/null +++ b/Documentation/devicetree/bindings/iio/opensensorfusion,osf.yaml @@ -0,0 +1,43 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/opensensorfusion,osf.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Open Sensor Fusion Sensor Aggregation Hub + +maintainers: + - Jinseob Kim + +description: | + Open Sensor Fusion is a sensor aggregation hub. The hub exposes an OSF + protocol data stream over its host interface and may report capabilities= and + samples for multiple sensor classes. The Linux driver discovers the actu= al + sensor channels from OSF capability reports instead of describing those + sensors in Device Tree. + + Open Sensor Fusion is not a generic industry standard. Public project + documentation is available at: + + https://github.com/opensensorfusion + +allOf: + - $ref: /schemas/serial/serial-peripheral-props.yaml# + +properties: + compatible: + const: opensensorfusion,osf + +required: + - compatible + +unevaluatedProperties: false + +examples: + - | + serial { + sensor { + compatible =3D "opensensorfusion,osf"; + }; + }; +... diff --git a/MAINTAINERS b/MAINTAINERS index 56181470d..e227b9aff 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -19977,19 +19977,6 @@ F: Documentation/networking/oa-tc6-framework.rst F: drivers/net/ethernet/oa_tc6.c F: include/linux/oa_tc6.h =20 -OPEN SENSOR FUSION IIO DRIVER -M: Jinseob Kim -S: Maintained -F: Documentation/devicetree/bindings/iio/imu/opensensorfusion,osf-green.ya= ml -F: Documentation/iio/open-sensor-fusion-protocol-v0.rst -F: drivers/iio/opensensorfusion/Kconfig -F: drivers/iio/opensensorfusion/Makefile -F: drivers/iio/opensensorfusion/osf_core.* -F: drivers/iio/opensensorfusion/osf_iio.* -F: drivers/iio/opensensorfusion/osf_protocol.* -F: drivers/iio/opensensorfusion/osf_serdev.c -F: drivers/iio/opensensorfusion/osf_stream.* - OPEN FIRMWARE AND FLATTENED DEVICE TREE M: Rob Herring M: Saravana Kannan @@ -20024,6 +20011,20 @@ F: Documentation/devicetree/ F: arch/*/boot/dts/ F: include/dt-bindings/ =20 +OPEN SENSOR FUSION IIO DRIVER +M: Jinseob Kim +S: Maintained +F: Documentation/devicetree/bindings/iio/opensensorfusion,osf.yaml +F: Documentation/iio/open-sensor-fusion-protocol-v0.rst +F: drivers/iio/opensensorfusion/Kconfig +F: drivers/iio/opensensorfusion/Makefile +F: drivers/iio/opensensorfusion/osf_core.* +F: drivers/iio/opensensorfusion/osf_iio.* +F: drivers/iio/opensensorfusion/osf_protocol.* +F: drivers/iio/opensensorfusion/osf_serdev.c +F: drivers/iio/opensensorfusion/osf_stream.* + + OPENCOMPUTE PTP CLOCK DRIVER M: Vadim Fedorenko L: netdev@vger.kernel.org --=20 2.43.0 From nobody Mon Jun 8 04:24:52 2026 Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD05B3368A3 for ; Sun, 7 Jun 2026 23:45:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780875920; cv=none; b=XN3pYo+VqXeaOsADgC5LYjeh4/jF88uN6fVPeYL/4fVvQoXqCoj8WWWOiyFuxAMRdKn7sXE97TEKWsqdlwFQHQZ9OWovdAuCBefyQFd4+ydD8rWRMkiGB5aHax5h7+YDZycg+xXgLRwcZ1Im8E81Yz7y9jf6qQhgrJQwQLPQNQ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780875920; c=relaxed/simple; bh=frVXIk/he5j7loUU8RveXgVsf8ozNDsmdNT6TSVEGGo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pjUm9rbbbGEzVBP8fqlhnFvr/gum8wplbRMY4M4n8I5oBHl9c3MJrls4WqLmQG3aSvDioE4lVwC09mfP92aeTtfn0JEFYwD0V7F0Ibn0nBpahdCD1JdwSsZ95jVQq9sNdKJnonz5XFxJavPKQUjHIPRxCKEonQtYq9xLCtU7y3s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=anuuLU2N; arc=none smtp.client-ip=209.85.210.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="anuuLU2N" Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-842273a2c4dso2510350b3a.3 for ; Sun, 07 Jun 2026 16:45:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780875918; x=1781480718; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kKK4DtRzZCaG1BhvbydcKcJ9uELhzs4pECkpn9X7PSg=; b=anuuLU2Nb1sfuEmx1Z2ofb6Wz2GeMv5Nj9KRv5a2lw88N26XdiTCZq+WtXn3JGuEWU 2BT7/DGZ6qejsOrcvBLm+SLj1w3tXaKudNzM5qMCcbEN8i4FtjBQU4XbpJZzJZRk5MxM mGY2LQhnSOcJ0W6G4z/lXATjj0mbGhzd551sMXNRJt321S/K0A12G9EMbLJH927DOPf5 W4D2aN7ynqB01YWAOPVmhe+fh5jRDy0OCLjVIsYY32i/Rrxn6qW75Ns8CKeqjCWKUfsC oh6hS1vdfb6L9D6h2FFjHdkVDoT2DJuvuyTYb2xFDdnj6uSARe5ZCo44refuIPPZgtys fpgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780875918; x=1781480718; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=kKK4DtRzZCaG1BhvbydcKcJ9uELhzs4pECkpn9X7PSg=; b=bzSq39H6q5DrVAfAmae4EobfrjEWW4PUQlpc/dPnSFxWuVmRqCfQQcyOfaAirBooIt GUKOBLgD4tPXKK5ccmaEC25G8a8MoRwRHGqUP7Tyc74D4UX9LBjvFBPD3B01DLxxPZRc chjxoLct61uIo3l9lxOFNXG8HCFufNpwKjwWsKQlLJ5xAg4wTF5cQ9pcQOUTjLed1Vyy oxRFIH4KNTDLaTQ6L9se9Kj1g08EQ8rhE+eyEOw+UyD/qxZQWuC7RSv1clb7Vx4CcRBa i51BKKy1v8/TgLj1vkQnH6zcO9wzULKYQwmd2KCsT4+TbMo60EMNzykAb6bLPDLK8BLH V6JA== X-Forwarded-Encrypted: i=1; AFNElJ8KCsHGtVfClAXwRFoXdd7w6PJoWSl5RxihiwQsoeO7pyRwIVzKbSRtzf8PrFWyVmGO+P1FikeO7idgbuQ=@vger.kernel.org X-Gm-Message-State: AOJu0YzJM6fJe+daVzYNgfC1LSSWzpLXg+IXWJUyXEI7I9ccoVp6Nz8r 7sA1iW6BoZfpA0YLeN6EwLi7mR/sQjes9oxkyBmo28wgzpjISVxRhkRg X-Gm-Gg: Acq92OG+y6KbUBHwSA4PDVpoWDwhqK/9OODuniBOWjsYeS+AkyDfuTFlL5FKCj8TXfE k0loM8iN+L1Xm5tOzw4XGZhvZ/ZM00eEvILQm0meHdWdRrcIJTdOPombrex+jDVVV4g3Eh2O8mS XDhcTHj1lLm4qP5Hv2ANPWwZgoORyeXg8XhTsuMKdLi5vzY/y4hGET0qJogOvULPnIfqoR4kvw9 pyulkvIzpzT3X0p1HJZ2ZwLz9PHRaqvfk8sIUMovvjGUymyz0ydmE2ld6Dov6kai0aGdgPPR1Fn pg+uU/QjU+cdv4bfe24//cgIO+4tqjppBGBqlEXIuLobUsl8NX2chnzPLtfUguezs4lwVMlv2iL qrJFsF+2J0KIOzyL9IhB58r++U2Ugm3wfEHiZ9LxOh4LXp/XIRFiOMWFTFuGKdt8eLRbHRes4L+ x9dn6iIr4siVfNwDRlSyekv97m7XrS4fPfCVWzzooqbIgvgPEDRxSqwbvnw+b+6eLBo4y07NMJz a4J6TnUqyuGFZKAMApsRy49yTBfe7euq3U4xQJIk8GBUBvAVwxa/nIyWx0= X-Received: by 2002:a05:6a00:21ce:b0:842:6fec:1297 with SMTP id d2e1a72fcca58-842b0d81b56mr13302391b3a.9.1780875917910; Sun, 07 Jun 2026 16:45:17 -0700 (PDT) Received: from DESKTOP-G3E0OSP.localdomain ([112.172.255.242]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-842828d6bd1sm19257732b3a.44.2026.06.07.16.45.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Jun 2026 16:45:17 -0700 (PDT) From: Jinseob Kim To: Jonathan Cameron , linux-iio@vger.kernel.org Cc: David Lechner , =?UTF-8?q?Nuno=20S=C3=A1?= , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Corbet , Shuah Khan , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH RFC v4 2/6] Documentation: iio: add Open Sensor Fusion driver overview Date: Mon, 8 Jun 2026 08:43:39 +0900 Message-ID: <20260607234343.22109-3-kimjinseob88@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260607234343.22109-1-kimjinseob88@gmail.com> References: <20260607234343.22109-1-kimjinseob88@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add a short driver-facing overview. Leave full protocol details to project docs. Signed-off-by: Jinseob Kim --- Documentation/iio/index.rst | 1 + .../iio/open-sensor-fusion-protocol-v0.rst | 308 ------------------ Documentation/iio/open-sensor-fusion.rst | 62 ++++ MAINTAINERS | 3 +- 4 files changed, 64 insertions(+), 310 deletions(-) delete mode 100644 Documentation/iio/open-sensor-fusion-protocol-v0.rst create mode 100644 Documentation/iio/open-sensor-fusion.rst diff --git a/Documentation/iio/index.rst b/Documentation/iio/index.rst index ba3e609c6..2713ec5e0 100644 --- a/Documentation/iio/index.rst +++ b/Documentation/iio/index.rst @@ -38,4 +38,5 @@ Industrial I/O Kernel Drivers adxl345 bno055 ep93xx_adc + open-sensor-fusion opt4060 diff --git a/Documentation/iio/open-sensor-fusion-protocol-v0.rst b/Documen= tation/iio/open-sensor-fusion-protocol-v0.rst deleted file mode 100644 index 80852f4cf..000000000 --- a/Documentation/iio/open-sensor-fusion-protocol-v0.rst +++ /dev/null @@ -1,308 +0,0 @@ -.. SPDX-License-Identifier: GPL-2.0-only - -Open Sensor Fusion protocol v0 -=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D - -This document describes the OSF0 UART wire format used by the Open Sensor -Fusion Linux IIO driver. It is a wire format reference for the host driver= . It -is not a firmware programming interface. - -Background ----------- - -Open Sensor Fusion is an open hardware project for sensor aggregation devi= ces -and Linux IIO host support. It is not a generic sensor protocol standard. = The -first concrete hardware target is OSF GREEN, an STM32F405-based board that -streams OSF0 frames to a Linux host. - -Public project documentation is available at: - -- https://www.opensensorfusion.org/ -- https://github.com/opensensorfusion -- https://github.com/opensensorfusion/opensensorfusion-hardware -- https://github.com/opensensorfusion/opensensorfusion-linux - -Wire format and driver subset ------------------------------ - -OSF0 defines a small device-to-host UART frame format. The current RFC dri= ver -supports only the subset needed to expose OSF GREEN raw sensor data through -IIO: - -- ``SENSOR_SAMPLE`` frames for accelerometer, gyroscope, magnetometer, and - temperature samples. -- ``CAPABILITY_REPORT`` frames used to create the supported IIO devices. -- ``DEVICE_STATUS`` frames cached for diagnostics. - -The driver ignores vendor private message types and does not implement com= mand -transport, calibration controls, USB transport, fusion output, or runtime -capability removal. - -Device model ------------- - -An OSF0 device is a sensor aggregation device. It sends binary frames from= the -device to the host. The host driver decodes the frames and maps supported -sensors to IIO devices. - -The hardware used for smoke testing is an OSF GREEN prototype with an -STM32F405RGT6 MCU, an ICM42688P-class IMU, and an MMC5983MA magnetometer. = That -hardware is the first supported target for the RFC driver. - -Transport ---------- - -The transport is UART at 115200 baud, 8 data bits, no parity, and 1 stop b= it. -The Linux transport is serdev. The v0 upstream driver covers device-to-host -frames. Flow control is not used by the tested stream. - -Byte order ----------- - -All multi-byte integer fields are little-endian. Samples use signed 32-bit -little-endian integers when ``sample_format`` is ``s32``. - -Frame format ------------- - -Each frame has a fixed 38-byte header, a payload, and a 4-byte CRC. - -.. list-table:: - :header-rows: 1 - - * - Offset - - Size - - Field - - Description - * - 0 - - 4 - - magic - - ASCII ``OSF0`` - * - 4 - - 1 - - protocol_major - - Must be ``0`` - * - 5 - - 1 - - protocol_minor - - Minor version - * - 6 - - 2 - - header_len - - Must be ``38`` - * - 8 - - 2 - - message_type - - Message type - * - 10 - - 4 - - payload_len - - Payload length in bytes - * - 14 - - 8 - - sequence - - Monotonic device sequence - * - 22 - - 8 - - timestamp_us - - Device timestamp in microseconds - * - 30 - - 4 - - flags - - Message flags - * - 34 - - 4 - - reserved - - Must be zero for v0 - * - 38 - - payload_len - - payload - - Message payload - * - 38 + payload_len - - 4 - - crc32 - - CRC32 over header and payload - -The frame CRC is IEEE CRC32 as implemented by ``crc32_le()`` with initial -value ``0xffffffff`` and final XOR value ``0xffffffff``. The CRC field is = not -included in the CRC input. - -Message types -------------- - -.. list-table:: - :header-rows: 1 - - * - Value - - Name - - Direction - * - ``0x0001`` - - ``SENSOR_SAMPLE`` - - device to host - * - ``0x0002`` - - ``DEVICE_STATUS`` - - device to host - * - ``0x0003`` - - ``CAPABILITY_REPORT`` - - device to host - -Message types ``0x7f00`` through ``0x7fff`` are reserved. Values at or abo= ve -``0x8000`` are vendor private and are ignored by the current RFC driver. - -``SENSOR_SAMPLE`` payload -------------------------- - -The payload is a 16-byte payload header followed by ``4 * channel_count`` = bytes -of sample data. - -.. list-table:: - :header-rows: 1 - - * - Offset - - Size - - Field - - Description - * - 0 - - 2 - - sensor_type - - Sensor type ID - * - 2 - - 2 - - sensor_index - - Instance index - * - 4 - - 2 - - channel_count - - Number of ``s32`` channels - * - 6 - - 2 - - sample_format - - Must be ``1`` (``s32``) - * - 8 - - 4 - - scale_nano - - Scale factor in nano-units - * - 12 - - 4 - - reserved - - Must be zero for v0 - * - 16 - - 4 * channel_count - - samples - - Signed 32-bit channel samples - -The current RFC driver accepts only ``sample_format =3D s32`` and only the= fixed -channel counts used by its supported IIO devices. - -``DEVICE_STATUS`` payload -------------------------- - -The payload size is 20 bytes. Fields are ``uptime_s``, ``status_flags``, -``error_flags``, ``dropped_frames``, and a reserved field. Each field is -32 bits. The reserved field must be zero for v0. - -``CAPABILITY_REPORT`` payload ------------------------------ - -The base payload size is 4 bytes. It contains ``capability_count`` and a -reserved field. The reserved field must be zero for v0. Each capability en= try -is 20 bytes: - -.. list-table:: - :header-rows: 1 - - * - Offset - - Size - - Field - - Description - * - 0 - - 2 - - sensor_type - - Sensor type ID - * - 2 - - 2 - - sensor_index - - Instance index - * - 4 - - 2 - - channel_count - - Number of channels - * - 6 - - 2 - - sample_format - - Must be ``1`` (``s32``) - * - 8 - - 4 - - scale_nano - - Scale factor in nano-units - * - 12 - - 4 - - flags - - Capability flags - * - 16 - - 4 - - reserved - - Must be zero for v0 - -Capability flag bit 0 means enabled by default. Bit 1 means calibrated dat= a can -be provided by the device. Other bits are invalid for v0. - -Sensor type IDs ---------------- - -.. list-table:: - :header-rows: 1 - - * - Value - - Sensor - - Current RFC driver mapping - * - ``0x0001`` - - accelerometer - - ``IIO_ACCEL``, X/Y/Z - * - ``0x0002`` - - gyroscope - - ``IIO_ANGL_VEL``, X/Y/Z - * - ``0x0003`` - - magnetometer - - ``IIO_MAGN``, X/Y/Z - * - ``0x0004`` - - barometer - - not mapped - * - ``0x0005`` - - temperature - - ``IIO_TEMP`` - * - ``0x0006`` - - humidity - - not mapped - * - ``0x0007`` - - ambient light - - not mapped - * - ``0x0008`` - - proximity - - not mapped - -Scaling -------- - -``scale_nano`` is the per-channel scale value in nano-units. The Linux dri= ver -maps it to ``IIO_CHAN_INFO_SCALE`` as integer plus nano. The exact physical -unit depends on the IIO channel type. - -Timestamps ----------- - -The frame header carries ``timestamp_us``, a device-side timestamp in -microseconds. UART buffering and host scheduling can add delay before a fr= ame -is processed by the host. - -The current RFC driver does not claim production-grade host/device timesta= mp -correlation. Buffered IIO timestamps are taken from IIO timestamp clock ha= ndling -when samples are pushed to IIO buffers. - -Non-goals for v0 upstream -------------------------- - -The v0 upstream driver does not include USB transport, fusion output, Atti= tude -and Heading Reference System (AHRS) output, Kalman output, calibration com= mand -ABI, custom sysfs control surface, production timestamp correlation, or ru= ntime -capability removal. diff --git a/Documentation/iio/open-sensor-fusion.rst b/Documentation/iio/o= pen-sensor-fusion.rst new file mode 100644 index 000000000..244a4fecb --- /dev/null +++ b/Documentation/iio/open-sensor-fusion.rst @@ -0,0 +1,62 @@ +.. SPDX-License-Identifier: GPL-2.0-only + +Open Sensor Fusion +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +Open Sensor Fusion is a sensor aggregation hub interface. The Linux IIO dr= iver +receives OSF protocol frames from an attached device, discovers supported = sensor +streams through capability reports, and registers matching IIO devices for= the +sensor classes supported by the driver. + +This document is a driver-facing overview for the Linux IIO mapping. The f= ull +wire protocol, firmware behavior, and hardware model details belong in the= Open +Sensor Fusion project documentation. + +Device Model +------------ + +An OSF device sends binary frames from the device to the host. The host dr= iver +uses ``CAPABILITY_REPORT`` messages to discover which sensor streams are +available. Device Tree describes the attached OSF sensor aggregation hub; = it does +not enumerate the individual sensors discovered at runtime. + +The currently supported Linux subset exposes: + +* accelerometer samples as ``IIO_ACCEL`` X/Y/Z channels, +* gyroscope samples as ``IIO_ANGL_VEL`` X/Y/Z channels, +* magnetometer samples as ``IIO_MAGN`` X/Y/Z channels, and +* temperature samples as ``IIO_TEMP``. + +Protocol Scope +--------------- + +The driver supports OSF protocol major version 0 for the initial IIO recei= ve +path. The current wire magic is ``OSF0``; that string is a wire-format det= ail and +is not the Linux driver identity. Protocol versioning is carried by the +``protocol_major`` and ``protocol_minor`` fields in the frame header. + +The initial Linux driver handles device-to-host frames for: + +* ``SENSOR_SAMPLE`` buffered and direct-mode sample data, +* ``CAPABILITY_REPORT`` based IIO device registration, and +* ``DEVICE_STATUS`` cache updates. + +Vendor-private message types are ignored. Command transport, calibration +control ABI, fusion output ABI, and runtime capability removal are outside= the +initial Linux IIO receive path. + +Timestamps +---------- + +OSF frames include a device-side ``timestamp_us`` field. Buffered IIO samp= les use +an IIO timestamp captured on the host when samples are pushed to IIO buffe= rs. +The initial driver does not correlate the device timestamp with the host I= IO +clock. + +Compatibility Notes +------------------- + +The project protocol documentation should define the compatibility rules f= or +reserved fields, optional flags, and trailing extension data. Until those = rules +are finalized, the Linux decoder keeps conservative bounds checks around t= he +currently supported message layouts. diff --git a/MAINTAINERS b/MAINTAINERS index e227b9aff..2ddefc42d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -20015,7 +20015,7 @@ OPEN SENSOR FUSION IIO DRIVER M: Jinseob Kim S: Maintained F: Documentation/devicetree/bindings/iio/opensensorfusion,osf.yaml -F: Documentation/iio/open-sensor-fusion-protocol-v0.rst +F: Documentation/iio/open-sensor-fusion.rst F: drivers/iio/opensensorfusion/Kconfig F: drivers/iio/opensensorfusion/Makefile F: drivers/iio/opensensorfusion/osf_core.* @@ -20024,7 +20024,6 @@ F: drivers/iio/opensensorfusion/osf_protocol.* F: drivers/iio/opensensorfusion/osf_serdev.c F: drivers/iio/opensensorfusion/osf_stream.* =20 - OPENCOMPUTE PTP CLOCK DRIVER M: Vadim Fedorenko L: netdev@vger.kernel.org --=20 2.43.0 From nobody Mon Jun 8 04:24:52 2026 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 33CC033E35F for ; Sun, 7 Jun 2026 23:45:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780875923; cv=none; b=BVBOxXeduQrPlUzb98JU/oUVUts6TcKKJh6L1b/zxSzY0yYs2n3yoCbPV2cqrwV675XGfFfwUb8JwJJVdcNXjmaBR35ZIIqnRQ9tlDnWUvP7xnSMuhnXY5IehkrmjHRGekHpmWx/kQyuabwY8asIiCyQi+mWh5oilLbQwd9ISbU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780875923; c=relaxed/simple; bh=J+az5RicRenEneEDG27NK4Kvad9Qms6Iox6ODxzmpTU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fPpFQK8iuOYKw5yFoc+6lOoa5Zgd4Plt8xM8dtZD7X/C6/ddWEZbb5tSLns3dZoH6KagRVnlhIG/7z+Fbl9D/oal4ZhCrZLIhzeEviY1/9eV5XnujcaerMn1NL8/xB+IF9XrozgbBb88KaRLPeWRdTIp8n/sJlexCnIY0ese1gE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=I3LDUBy+; arc=none smtp.client-ip=209.85.210.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="I3LDUBy+" Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-84234c83142so1426309b3a.1 for ; Sun, 07 Jun 2026 16:45:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780875921; x=1781480721; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Moxyp6VJ7Jh2y4csvP0jcOZ0gGOtSLLwcv7kOefBRHI=; b=I3LDUBy+dwT5F4MV21F4/qE3Up91ZVyXpULmZ9tYyLoabjXA0hR9xHhQbv3Wt9jk3f 97r8eP4h1e3KWIZbhLqmiYBicIKA89kbMEyVT7miwXqQh3guAxyWWS6KgW3lsriPoMS6 yMErxXb0IgNL06qo5zIALfl1mOPoxflsmqq3XKBrNLLQHEJtCY2Vqtkcx26WzK2phKII 3TUtNj/iAYttvecv6Ufm4RRlzztkISzsgcB6RID1ngXHhk9shh0SbU2kcDDSAyoVjq8F MDLlIMouS0Nw3ZYeTD8PT7P6Ccl9zqZ8NdJ9GhWHCA20Fx4lM8b5D772ua26jVduWWDq i2kA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780875921; x=1781480721; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Moxyp6VJ7Jh2y4csvP0jcOZ0gGOtSLLwcv7kOefBRHI=; b=KAxrvwxMdrMcKpyVPIPFNufVrm0YgVjJfk6JddRszANvS4utTVdW7dZyA48keXWAD8 btpkdHO5Q70AaygN1dh5aLH+7SehJenWzovso+wVVxpGxuZfuMK2KKNEU0+OzhroAHhw mSVAIRr3Ud7NaelEL2X749cypYYZEMiq5G+ckCq3MhbJfKqXJFoOEPj4nTqFTbtFUETD YYRHbdm0bsrtBx5M0ecCE/bOz2v1bqlrfVUVg/d8z3Md/MpRjJ5+4cZnZPVtb7MuKzj2 og0rsNllHE5kkC2K1dAgtBNQMlZ+fY8TJR6dXkSb6iss8Q5yoX4HnjmC8o/r2wEgQYvY hbFA== X-Forwarded-Encrypted: i=1; AFNElJ856omx12zPyfxWW5cXt3h0MrWmeTRkE4FBSyjeActrfWVkZWb56yL+b70qPl8zg35GyqbG4B+FzFQ91DA=@vger.kernel.org X-Gm-Message-State: AOJu0Yw04gklCgjeDRHIm+jkyXiKNorEP7+1fxUvVWfJ4fstXPP5Xw8y RJN+ycA8ptYrBFOpBZX+83i41xe5D89p3NUtdWC8tJWCWwcAid1Dp4qB X-Gm-Gg: Acq92OG07G9uOODM20bLvAzSei8Du1bLy62pu46YtALckWVcixUVfuMZNtARU8hihkv ARw3CK0ZmzDiKwyY5TDLJDNIVodJSI4JdKgEDv/xsgd+iZz6UFwDtUl+8c7/2GLhgDr6PXr+tbn Vz/lFeI0psWEItFss/tHZXHQSunnKgCSdWHYDNOAnjGf5oUPy/PW+ZO4hHVgQDsN8GKwkfzKOUg vhFzAFOV+rZRek4oCrR97ulbxSgx42hROT9lIhZqKC+UwwvMBmr6NnMaz4O94o7qcM1+/Z6TebH zBLKJzDyg3kDrFoIiP4T7LiHZyVyB0qxPTWV0jX37yN7USFVhVtO30gLm2Iaa0dSJkf3kqZ4BqW Y/Ohx4R0AH+3Ka1NYjyeTiXTg1Z8etyBQ1ChEIbMHYxtxlALAX6nA85BrGPtGoNldVyAuWzBU8X BK66Bpa5QrMM7GzPPKdykK6b++AWBtyVSwbergIGWElXQsAgdlyz//+Ro4jbktDIYWtb4RMK+H+ lTSc23NMIeDAcUOKyRAJeU99wv6O5ywu845hy4P7wCFDTMe X-Received: by 2002:a05:6a00:4390:b0:842:6a3b:60ea with SMTP id d2e1a72fcca58-842b0fbbb03mr13296464b3a.40.1780875921415; Sun, 07 Jun 2026 16:45:21 -0700 (PDT) Received: from DESKTOP-G3E0OSP.localdomain ([112.172.255.242]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-842828d6bd1sm19257732b3a.44.2026.06.07.16.45.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Jun 2026 16:45:21 -0700 (PDT) From: Jinseob Kim To: Jonathan Cameron , linux-iio@vger.kernel.org Cc: David Lechner , =?UTF-8?q?Nuno=20S=C3=A1?= , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Corbet , Shuah Khan , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH RFC v4 3/6] iio: osf: add protocol decoding Date: Mon, 8 Jun 2026 08:43:40 +0900 Message-ID: <20260607234343.22109-4-kimjinseob88@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260607234343.22109-1-kimjinseob88@gmail.com> References: <20260607234343.22109-1-kimjinseob88@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use a FourCC-style wire magic comparison. Document signed little-endian sample handling. Signed-off-by: Jinseob Kim --- drivers/iio/opensensorfusion/osf_protocol.c | 4 +++- drivers/iio/opensensorfusion/osf_protocol.h | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/iio/opensensorfusion/osf_protocol.c b/drivers/iio/open= sensorfusion/osf_protocol.c index ed91d3dd5..5bee545f3 100644 --- a/drivers/iio/opensensorfusion/osf_protocol.c +++ b/drivers/iio/opensensorfusion/osf_protocol.c @@ -11,6 +11,7 @@ =20 #define OSF_CRC32_INIT GENMASK(31, 0) #define OSF_CRC32_XOROUT GENMASK(31, 0) +#define OSF_FRAME_MAGIC 0x3046534f /* "OSF0" little-endian */ =20 static bool osf_sensor_type_valid(u16 sensor_type) { @@ -38,7 +39,7 @@ int osf_protocol_decode_frame(const u8 *buf, size_t len, if (len < OSF_FRAME_MIN_LEN) return -EMSGSIZE; =20 - if (buf[0] !=3D 'O' || buf[1] !=3D 'S' || buf[2] !=3D 'F' || buf[3] !=3D = '0') + if (get_unaligned_le32(buf) !=3D OSF_FRAME_MAGIC) return -EPROTO; =20 major =3D buf[4]; @@ -136,6 +137,7 @@ int osf_protocol_sensor_sample_value(const struct osf_s= ensor_sample *sample, if (index >=3D sample->channel_count) return -ERANGE; =20 + /* Samples are little-endian two's-complement signed values. */ *value =3D (s32)get_unaligned_le32(sample->samples + index * sizeof(s32)); =20 return 0; diff --git a/drivers/iio/opensensorfusion/osf_protocol.h b/drivers/iio/open= sensorfusion/osf_protocol.h index 4b6fb131a..c62c2c254 100644 --- a/drivers/iio/opensensorfusion/osf_protocol.h +++ b/drivers/iio/opensensorfusion/osf_protocol.h @@ -2,6 +2,7 @@ #ifndef _OSF_PROTOCOL_H #define _OSF_PROTOCOL_H =20 +#include #include =20 #define OSF_PROTOCOL_MAJOR 0 @@ -14,7 +15,7 @@ #define OSF_DEVICE_STATUS_LEN 20 #define OSF_CAP_REPORT_BASE_LEN 4 #define OSF_CAP_SENSOR_ENTRY_LEN 20 -#define OSF_CAPABILITY_FLAGS_MASK 0x00000003U +#define OSF_CAPABILITY_FLAGS_MASK GENMASK(1, 0) =20 enum osf_message_type { OSF_MSG_SENSOR_SAMPLE =3D 0x0001, @@ -44,6 +45,7 @@ struct osf_frame { u64 sequence; u64 timestamp_us; u32 flags; + /* payload points into the caller-owned frame buffer. */ const u8 *payload; u32 crc; }; --=20 2.43.0 From nobody Mon Jun 8 04:24:52 2026 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 16E4F3382CB for ; Sun, 7 Jun 2026 23:45:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780875930; cv=none; b=h6VnUslr4/7nU/dG7Fzglzx2LAIxiwsiRYqn1TBTfzGFQivgGh1G0jzWThH4Rzt9k5QyPAW7jJb7aZZzfnvebqys547Gw/PV2LmkwWuTNZ1tC6ghMVk72OAQxm7OB7jvWE/GaahxgYHwMRQI7HE6EmvWVinoe53ZpOxJBvoZld4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780875930; c=relaxed/simple; bh=KJTRCy7wNY+N6IrE/mRVGcB/+axShhI0D7cUwSRv3Es=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uG3BzKzIF/+8MDWuj25P346oZPNF/sIcJL6FAA3T26L3zgr8qLjDBikXuSsePuf2/hS0BLOVqaOFNkBayWT9CcxVpZi/p8ulaPYj80PYTh83SlwodnIATNfqF8hjuF5y8rgHk0B7cdl6bhqHqEuTVEaGpt4GEtIaVHjan/2T6NI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=NfXaCEIz; arc=none smtp.client-ip=209.85.210.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NfXaCEIz" Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-84229481d44so1368611b3a.0 for ; Sun, 07 Jun 2026 16:45:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780875927; x=1781480727; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TaQl7dtgCPoeeJ0ksgq85IpZKAoo0yYD7cImexjDLms=; b=NfXaCEIzgPw9KMgLquOrieq1tveEjSb1X+Osk33RZeynIwunbKnR+mjfEhLYS0smB0 2tnklm4n7mrS2qtsI2lMcDCPf5KFq46B4OsHHwO8+DHQWtpc4ccoXWi0rHxdwwQ7cmee aCRmpSq1ZGkXqWgq3mFOtuDc+cX/08mbTAzQFkdrt48q8CEza4MgJJy2zu0Zu8BtJI1C ngFpXkBSRrQhXD0pr8GbD/IzoDHVnTb+s2dXqrD5tsGkJZy6VhDNr1EMqy/P+OuE5iXS raUCeAZh4BiMb8VZj7btGI2iKdSAQCcX4xF5Hky7MQEEi81jbdzNQctkookv5ougt3Ry nkJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780875927; x=1781480727; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=TaQl7dtgCPoeeJ0ksgq85IpZKAoo0yYD7cImexjDLms=; b=oqz8DhxpmZ+GsvU9In5ITVnYR3zitzpujJfy3G7BW1WIE1nl0dTfH7t2vVBSxM8EKg hgBzbobMronrfzqCG8op00U2t3FgJ/ZGXvUHeIQaZM5gZ0BCOmpnzxxiXpnxi5rXqNWf F+RecuRwyz362kEPdpl7cySGALrGApBWJM59PUW+Yym6vsvxAvtl0OpPx8JragCRLYSM iN8TvalAjIxTSlIv442XfC7sV72MIlsmdt5SBSUvIkaqfV3ubsd1rI0jd5ep6ksio+TQ CkBqTOMZJzMxlTOKc7zMOvOhNJFzuu1lBhWwMG2KNO1VYmJkIcCUOSBRybyK+FBLkFKD 5b2A== X-Forwarded-Encrypted: i=1; AFNElJ8YzQP7oe1RZhxcPi+XtPHUa1AiHZDtZzWZWvxl+THfZCoUCCo+R0/bfRHXSaCguwxHMoGWjsBnMW4CQik=@vger.kernel.org X-Gm-Message-State: AOJu0YzGPT3W76HUMIzGfp1SGhgcprTwPC6MzyQY0blT+KVma9Qq3RHM GdpIHZo1E6PGYFjGG5VkH6m4Re2rq0EtPHlrWOZhapU/E2zkeSw/n8KO X-Gm-Gg: Acq92OHy7T4RDZ5Vimw5xdtt/ypfdweIyb+a+Pzn6PiSyzCoHdmpjhd3Y4w4EBPOO7D 5wFdlEOVhqrVlhaBbsPpaa6dWnsqLk5Md4kBJuAhxRRv7PRzNfM/nJU6rYRUlysxtF2ojGiZtK5 utXNcH/EDcm62HWpN1JM8NVVG51HIlFWx2dusWIq4/0uNkm8mD0MAAc7n83MQvtDMTlnjACZ7vU H6Bixd8YQ5u3AqZhNXWWq9t/9/7t1fQa2QaZOES+tEzmZkEZDNOyiFEnb0BG4IEM00Oe4q3M4EN yT4hswnzFHap6jyJEY9XM0JacFeTju8KVyvv5DHZOiix4p3TpUB377pKAC4Rk5lpyrMWY/vDeTf y6QQZhASmr5g7wCj/JyeCB9t9ayjq9i8disSVm6ADb15HOrmyDxJ6CDON5GykYYtMzeiBxKlcMu bvdj11lVJivuvFf5c2HiluQ9LSxHuAEiTWqCPVEZqDqlLFUS2vljP7y1WPYsiIxHvhD2xwGWtc3 ApMAef/X43HeqDJMRuTguxhdtvNhf6Cj1iDu1vseqPGoUqd X-Received: by 2002:a05:6a00:3d4a:b0:842:5712:c2c2 with SMTP id d2e1a72fcca58-842b0fb6d60mr11804229b3a.41.1780875927308; Sun, 07 Jun 2026 16:45:27 -0700 (PDT) Received: from DESKTOP-G3E0OSP.localdomain ([112.172.255.242]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-842828d6bd1sm19257732b3a.44.2026.06.07.16.45.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Jun 2026 16:45:27 -0700 (PDT) From: Jinseob Kim To: Jonathan Cameron , linux-iio@vger.kernel.org Cc: David Lechner , =?UTF-8?q?Nuno=20S=C3=A1?= , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Corbet , Shuah Khan , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH RFC v4 4/6] iio: osf: add stream parser Date: Mon, 8 Jun 2026 08:43:41 +0900 Message-ID: <20260607234343.22109-5-kimjinseob88@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260607234343.22109-1-kimjinseob88@gmail.com> References: <20260607234343.22109-1-kimjinseob88@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Keep the parser focused on frame assembly. Let the core decode complete frames once. Signed-off-by: Jinseob Kim --- drivers/iio/opensensorfusion/osf_stream.c | 38 ++++++----------------- 1 file changed, 9 insertions(+), 29 deletions(-) diff --git a/drivers/iio/opensensorfusion/osf_stream.c b/drivers/iio/opense= nsorfusion/osf_stream.c index a2739c987..957f73716 100644 --- a/drivers/iio/opensensorfusion/osf_stream.c +++ b/drivers/iio/opensensorfusion/osf_stream.c @@ -62,8 +62,6 @@ static size_t osf_stream_discard_to_magic(struct osf_stre= am *stream) =20 static int osf_stream_process(struct osf_stream *stream) { - struct osf_frame frame; - size_t decoded_len; size_t discarded; size_t frame_len; u32 payload_len; @@ -82,10 +80,8 @@ static int osf_stream_process(struct osf_stream *stream) if (!stream->len) break; =20 - if (stream->len < OSF_FRAME_HEADER_LEN) { - stream->stats.partial_frames++; + if (stream->len < OSF_FRAME_HEADER_LEN) break; - } =20 if (get_unaligned_le16(stream->buf + 6) !=3D OSF_FRAME_HEADER_LEN) { @@ -106,34 +102,18 @@ static int osf_stream_process(struct osf_stream *stre= am) } =20 frame_len =3D OSF_FRAME_HEADER_LEN + payload_len + OSF_FRAME_CRC_LEN; - if (stream->len < frame_len) { - stream->stats.partial_frames++; + if (stream->len < frame_len) break; - } - - ret =3D osf_protocol_decode_frame(stream->buf, frame_len, &frame, - &decoded_len); - if (ret) { - if (ret =3D=3D -EBADMSG) - stream->stats.bad_crc_frames++; - stream->stats.dropped_bytes++; - osf_stream_drop_invalid_head(stream); - if (!first_err) - first_err =3D ret; - continue; - } - - if (decoded_len !=3D frame_len) { - stream->stats.dropped_bytes++; - osf_stream_drop_invalid_head(stream); - if (!first_err) - first_err =3D -EMSGSIZE; - continue; - } =20 ret =3D osf_core_receive_frame(stream->osf, stream->buf, frame_len); if (ret) { - osf_stream_discard(stream, frame_len); + if (ret =3D=3D -EBADMSG) { + stream->stats.bad_crc_frames++; + stream->stats.dropped_bytes++; + osf_stream_drop_invalid_head(stream); + } else { + osf_stream_discard(stream, frame_len); + } if (!first_err) first_err =3D ret; continue; --=20 2.43.0 From nobody Mon Jun 8 04:24:52 2026 Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1867C33F597 for ; Sun, 7 Jun 2026 23:45:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780875933; cv=none; b=N7FfOhZCSTtzRyssT6ZhuIRnhYrKgpXIY5wLv3TTVzew/HbCF1yJ6Hk04B5yoi787/AxT+W1aWW3sUycb1Olx80geDH7OB06LI+8LGUfMaPKeM4Z4kWO+0hqRnuL/k/QJXak5s0S5pRorXMFJDdaRCwPPNogKjbIJ6sesJGW1n0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780875933; c=relaxed/simple; bh=Io7D5KkHYqvenZqIL6Z7P+QZrmOBRoracJ76uWfi0JU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gfpk8hJHdANnBgF0xap1rzDFrEiW1CHom7l6gO2WF/smSwS+n9bQC3T7tnRqEnooum7hwS0PdbujylWvMTrQ0GlHELstdENLiak+P6Bwp4oEjFalagLMf5CqiguCuuaczYX6afcK2cHfvriIjPKLpKyIQyftyZxT0y17EAFqeJg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FvvgAz8n; arc=none smtp.client-ip=209.85.216.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FvvgAz8n" Received: by mail-pj1-f41.google.com with SMTP id 98e67ed59e1d1-36dd65b95f2so2505438a91.0 for ; Sun, 07 Jun 2026 16:45:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780875931; x=1781480731; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=q5OiZytJs8xCHWwIF7i0RCUYGoDtUsdsRhvMvvj/Vak=; b=FvvgAz8naXUNVfwWOhxdTpGzgl5nfFCrU3tbfBrRCrRbNy4Uhq5r5hmo6BGxt/rGxN HWkJY7otsUGfN6nFAW9f0eOV6kBVj3deIHXi11F3R2RF4RXLevcnG1aQlMzjieams9vJ xVLW9f9hkRbQJSr6Ugxli5gKwWXuKQNlPn6quWyPfMbgu1xNBBNIkkqrJYBWQY8fcoFq t85yA/0sRdIWx0TNaDU7o8VsRIXihAZiFdUqTxGxVk55Ujve/1wmD1hCoXiSw1zrhsWN DcMcPWC8aEZaxUaAtenWQaxdAC/NZvRnCm+r2TVje1pHmp6wy4BR5S5iUGQek9CZS5I2 RfWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780875931; x=1781480731; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=q5OiZytJs8xCHWwIF7i0RCUYGoDtUsdsRhvMvvj/Vak=; b=ClGHMf4AeLEXV6ZzSKc86XXabzD6To3+TS3iR3qzBGpq2JfGEaNGvPB4NJPyd2ffUR vuTnatabyJJMt4ZuWNKCybAniv3qDjGgQGVTS+Tt1frwm7XdQ3e1860wQfLFaWIMy37K QzXlqNCBDNq7h3J3LxCn6Q698JcltyBBg0zFGe7oCnZjP3iV5n/1IbfXaqYErhMaRSJY 183Y1gLnpWT5dXL8i0hhjlL5hRleGN+gu5k6L+WnIoUJraLVTTMy/g5dz0aIk94wlATJ HT00rhqfH59iXjXpM3QYmrTmKGNoy95z2k8uKzB6vH3lrVAY1oi65eolQWxlAyNw4sam JQvg== X-Forwarded-Encrypted: i=1; AFNElJ9QybNmt0SHuBPRdaMGD6ahcmXb+HZ+RJAQ6i9Xf+EABOzJFRvmnXZ3FxmH8Jgkm+o6vAkZyIbFmed3iWs=@vger.kernel.org X-Gm-Message-State: AOJu0Yz9AZixU+peqvr6/vnsD9heW9gfsk203+Ns2AEYWvtF0/LyOvAF R+/E13UEt6JFSz+21OvA2SX6U9nr2hVEnsTBeP/mKfxLMk4NHkadVe/4 X-Gm-Gg: Acq92OEW+YoOOW+Q2FV9TLri4gKR/49SwsUY/SFBDTfQJblOeiuD8aUTkYTOHOago+/ GizcH2I606nvMq2G6/zaw9BZkS/jMjuTdaKhuz+3nRHv2t3AnMOvHuU495cOkCrMyglj6I+v1Ic 4gDF8Ikjwv3G+8hPhZcd28ztY0FhDvucNmCGPk544bbnRCOZ0JDthN7xziBAshfMtM5PljVy+QV 4TZbsCeHmd85cBOD/TOq5vKO3W2yx/lf4/OQILAcjwxqltrDRpWtbnv8HsKIiqekh0oEkMu0PdJ YUO6S2XwE+DUdEej50Ur9VprRD1J8PKRw1hnkgsHx9pWsZjkgALnDHcDSF+cqYmX21TyiHwztoi CHzi3R/tBV9OjFjOtYCqSBzAVwzhtHxRPiy/X1GgiWcztCm1SlVecA9TVB6pfw34x7p2vNSgDFB uoNdJjTBuskd+PD0ziW7XgdtTfjhjmjGejhxaYWWe6Y6yk3N6hZHezxg5i04lLmUoRfHmpxZzDH C65hAs3uFmLxx6YRHJKHTi3aS0ZIKijFfCsAyXYfmRYeJqw X-Received: by 2002:a17:90a:d003:b0:368:65d1:893 with SMTP id 98e67ed59e1d1-371306869a2mr10501438a91.5.1780875931310; Sun, 07 Jun 2026 16:45:31 -0700 (PDT) Received: from DESKTOP-G3E0OSP.localdomain ([112.172.255.242]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-842828d6bd1sm19257732b3a.44.2026.06.07.16.45.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Jun 2026 16:45:31 -0700 (PDT) From: Jinseob Kim To: Jonathan Cameron , linux-iio@vger.kernel.org Cc: David Lechner , =?UTF-8?q?Nuno=20S=C3=A1?= , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Corbet , Shuah Khan , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH RFC v4 5/6] iio: osf: add UART transport Date: Mon, 8 Jun 2026 08:43:42 +0900 Message-ID: <20260607234343.22109-6-kimjinseob88@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260607234343.22109-1-kimjinseob88@gmail.com> References: <20260607234343.22109-1-kimjinseob88@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use the generic Open Sensor Fusion compatible. Avoid board-specific DT compatibles. Signed-off-by: Jinseob Kim --- drivers/iio/opensensorfusion/Kconfig | 4 ++-- drivers/iio/opensensorfusion/osf_serdev.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iio/opensensorfusion/Kconfig b/drivers/iio/opensensorf= usion/Kconfig index 957caed2b..8b9376d28 100644 --- a/drivers/iio/opensensorfusion/Kconfig +++ b/drivers/iio/opensensorfusion/Kconfig @@ -10,5 +10,5 @@ config OPEN_SENSOR_FUSION help Build the Open Sensor Fusion UART IIO driver. =20 - The driver receives OSF0 frames over a serdev UART and registers - IIO devices for supported capability entries. + The driver receives OSF protocol frames over a serdev UART and + registers IIO devices for supported capability entries. diff --git a/drivers/iio/opensensorfusion/osf_serdev.c b/drivers/iio/opense= nsorfusion/osf_serdev.c index 1ac93548d..fd36acd1b 100644 --- a/drivers/iio/opensensorfusion/osf_serdev.c +++ b/drivers/iio/opensensorfusion/osf_serdev.c @@ -91,7 +91,7 @@ static void osf_serdev_remove(struct serdev_device *serde= v) } =20 static const struct of_device_id osf_serdev_of_match[] =3D { - { .compatible =3D "opensensorfusion,osf-green" }, + { .compatible =3D "opensensorfusion,osf" }, { } }; MODULE_DEVICE_TABLE(of, osf_serdev_of_match); --=20 2.43.0 From nobody Mon Jun 8 04:24:52 2026 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 73C6432D0EE for ; Sun, 7 Jun 2026 23:45:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780875942; cv=none; b=V2/0RCEz3+hHSjSamb9tFa7pVd/vesF4XwcvsR7Mb4KJLohc3zlwMpjSMi5s9m7vijwXzT5j5HB/KJEnykASGDBXiLdJTqvro/aR3mHV/EvrwjfswW11xgIQpLxzMut3r5UlGJZjS/gn5Vei+hUt65X83qBZLCMlMkJyRfNolDg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780875942; c=relaxed/simple; bh=2sVlunj/mZoHcoxd2cD4P4fdrzm4ewYqwvFCAz1C1iw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VrS0L1lL+ElgxkBte/u0euioCyv8TmT5QVvqOk+qo3FMUcDuMhBlzrGUpDl4lFb9x1ToKgOmNjJPF2BnvWGk3PzPJ1RGHQT4S7nVkKzD1NsoRloxNuII1iROmvSS75qzPXgXM+nj5MyiTqJxAXbPvS56zeAdkZZjHRLMOzjQ91Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=cOEEziFM; arc=none smtp.client-ip=209.85.210.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cOEEziFM" Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-8422f395a4aso2175046b3a.0 for ; Sun, 07 Jun 2026 16:45:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780875941; x=1781480741; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=r3bgmmYaDea+Gj+ghcKiuju7bxxh1PhtZqeiDo8GA5Y=; b=cOEEziFMnPrWp1MARMwpw5TofC8CzKKDDPAhWuNp2MyCv1Aw4vPbofKX8WPKhQvTxk bCH6V0u+D7UsUXNNCOj19fGE3RGNoPdYjOrkVZbY/OYOo6Q2G7qYEe39zYb+sbiq1rRp UMOk+1G0JFUJyB3EqrMENM29RJJoQY/OlivF013dR194815DmJt3cWHNm6Z00WlqD98t YW7y/N2NpE8dUuqgO+aKOtuDzjgIRdBQC5BCSlRHlRDiFkkdj9XPYLCymaF+jdJq5HtU AOiSI23KpSi4FYlihzELLSs/Iv7ZdcO9t5qp/10TVKvfEEM7UujlWhQmdi8ecYvza2qS UuDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780875941; x=1781480741; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=r3bgmmYaDea+Gj+ghcKiuju7bxxh1PhtZqeiDo8GA5Y=; b=tTxv72NaNFFPWM3UD0+/bxWdUBXaswe9gRe1D0IICt9PT6nRTkBtn8qBcibQ1Xaih5 1OVNo6dBAK8UE58e/+fK6Ft1gBidqXWS7PCy8rZnqOUBrTvZ0RSWJdT+MycidyFpasvn /FsKkkkZ3kWV9KA5Pp4dV1ipUtaXtP695fUJ7o7PRG6h/cn42TRM8PbCR5HVijly3V5x 1Tzehq3+M4xFzH9xr72OFPImeOtMxj9w5r4obHu/o3eLf28jR+aFGfYHy0T+JStX77C9 QY28C5dKwBYTNtItotHx43HI9UNMcNGSY2mX0QUOExJD1L7YKMAv0911pv38AvBwGo6R DlpA== X-Forwarded-Encrypted: i=1; AFNElJ91eDqo3Boh8xIJg7Q++kK6xDraKBSF/3wUxfgbv8VfE2GZFc6aJyQsoamNDd9gSekt3REfR9gQaQ8/qQc=@vger.kernel.org X-Gm-Message-State: AOJu0YykN4n//WGzdoYOO+tlFVJSu0Q/OuPXFL1kYvE1FcrgwIL3OkPh HyJrZmQYye2bfOE48PmpeoqiUlQBGdtpCo6r5jy1yXGXZsxPA3ckcwmR X-Gm-Gg: Acq92OFVx0jCACxeDPy3lRUOfWJq0RCabJPa9QndPE0fJsL/CxUDeiW8Xlb5BhV2PVx +mTB0JrGdQ7sYoqlj5zhGP7HQ3JY2HD2dTgpQvHIxhvrgfLUgjIE/uFSABlXq9kEQy/JOrvpRKq VK8fW0qEhBYr2HdllZSE63PkijOwg1ofnUthMXHEaiSmgUT0cvFBC8uYocxFjS6x8/5RhbjzDNv +xfRuCSSJEhUtOVKiQpMYCwXrNP9uo6huhdpjbeWtWS1Sr1cNZ7B7NjyoEzwdhWS+nXT/8fRpaz H8zMkLMJl0KQkRLCnv05ypLoNJsXrWmS03vrUVvCYRcEGwH4pfP8BxdCXIp7woAGHeB6nxI2LBI z5/JS/C/qB0SPus0ScGkDldZAfm+uW5UV6IugWczxQIoUk4bIrcjOlOgjn2nPtc08hf22F4rRij JwqkO/t+F+rQGEU4R8oGpqstZa+buitloz31m2Dvg7BXjC6wAcyRjlY6fTqvpBlzzmRULvSVpNS /LNKkoWPowOjz1JoaUXyE5KMHyXR+j1EHUwr6/idMlc46yS X-Received: by 2002:a05:6a00:808a:b0:842:4982:82f with SMTP id d2e1a72fcca58-842b666f8d7mr8968903b3a.2.1780875940733; Sun, 07 Jun 2026 16:45:40 -0700 (PDT) Received: from DESKTOP-G3E0OSP.localdomain ([112.172.255.242]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-842828d6bd1sm19257732b3a.44.2026.06.07.16.45.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Jun 2026 16:45:40 -0700 (PDT) From: Jinseob Kim To: Jonathan Cameron , linux-iio@vger.kernel.org Cc: David Lechner , =?UTF-8?q?Nuno=20S=C3=A1?= , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Corbet , Shuah Khan , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH RFC v4 6/6] iio: osf: register IIO devices from capabilities Date: Mon, 8 Jun 2026 08:43:43 +0900 Message-ID: <20260607234343.22109-7-kimjinseob88@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260607234343.22109-1-kimjinseob88@gmail.com> References: <20260607234343.22109-1-kimjinseob88@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Clean up the IIO sample push path. Drop the redundant temperature scan mask. Signed-off-by: Jinseob Kim --- drivers/iio/opensensorfusion/osf_core.c | 9 +++++---- drivers/iio/opensensorfusion/osf_iio.c | 15 +++------------ 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/drivers/iio/opensensorfusion/osf_core.c b/drivers/iio/opensens= orfusion/osf_core.c index e0a12de01..61ef55646 100644 --- a/drivers/iio/opensensorfusion/osf_core.c +++ b/drivers/iio/opensensorfusion/osf_core.c @@ -293,10 +293,11 @@ int osf_core_read_latest_sample(struct osf_device *os= f, u16 sensor_type, latest->sensor_index !=3D sensor_index) continue; =20 - if (latest->valid && channel < latest->channel_count) { - *value =3D latest->values[channel]; - ret =3D 0; - } + if (!latest->valid || channel >=3D latest->channel_count) + break; + + *value =3D latest->values[channel]; + ret =3D 0; break; } mutex_unlock(&osf->latest_lock); diff --git a/drivers/iio/opensensorfusion/osf_iio.c b/drivers/iio/opensenso= rfusion/osf_iio.c index 5e5099878..3da3f2bda 100644 --- a/drivers/iio/opensensorfusion/osf_iio.c +++ b/drivers/iio/opensensorfusion/osf_iio.c @@ -6,7 +6,6 @@ #include #include #include -#include #include #include =20 @@ -89,10 +88,6 @@ static const unsigned long osf_3axis_available_scan_mask= s[] =3D { 0 }; =20 -static const unsigned long osf_temp_available_scan_masks[] =3D { - BIT(0), - 0 -}; =20 static const struct osf_iio_sensor_spec osf_iio_sensor_specs[] =3D { { @@ -125,7 +120,6 @@ static const struct osf_iio_sensor_spec osf_iio_sensor_= specs[] =3D { .name =3D "osf-temp", .channels =3D osf_temp_channels, .num_channels =3D ARRAY_SIZE(osf_temp_channels), - .available_scan_masks =3D osf_temp_available_scan_masks, }, }; =20 @@ -265,21 +259,18 @@ int osf_iio_push_sample(struct iio_dev *indio_dev, co= nst s32 *values, unsigned int channel_count) { struct osf_iio_state *state =3D iio_priv(indio_dev); - s32 scan[OSF_MAX_SAMPLE_CHANNELS] =3D { }; s64 timestamp; =20 if (channel_count !=3D state->spec->channel_count) return -EPROTO; =20 - memcpy(scan, values, channel_count * sizeof(*values)); - - /* Buffer state can change here; IIO rechecks it during the push path. */ + /* This is only a fast path; IIO rechecks buffer state while pushing. */ if (!iio_buffer_enabled(indio_dev)) return 0; =20 timestamp =3D iio_get_time_ns(indio_dev); =20 - return iio_push_to_buffers_with_ts_unaligned(indio_dev, scan, - channel_count * sizeof(*scan), + return iio_push_to_buffers_with_ts_unaligned(indio_dev, values, + channel_count * sizeof(*values), timestamp); } --=20 2.43.0