From nobody Mon Apr 6 23:35:57 2026 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.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 C4FBE3EB811 for ; Tue, 17 Mar 2026 15:04:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773759864; cv=none; b=b5U+GVukHZmowsD/ysF6S1rLT9uCw9en3VdmWsuF5y1RoROndTtd2GQvkmL4rW183V+q1uN5Tef9Y4kTd3K4vctZFB23jekOWUygL2bQujYhlZvJVs0cRWeOojLw2zntCUjOLxYGXPfzpJCCtns3pBK9+meJ+pA5SQlR6iUBeFk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773759864; c=relaxed/simple; bh=HohRRDF8l3Dbx0JorWXh1uk1N4zs/oYSUkkwvR1Z+LE=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=UrhWSBWszuaC4qDPkVBfUjQR/7+02K3WInUL4niIWBP6Coq2dAP3D34eOhwKWw90TqrflUOgQvFoFORz+oRaD9+QfNzhYse9WFdqP56zpjZXz+Pe0rXmJTol5gNAzNFl6xS7YoFyz1TPYXonxQv7EIiIptLbq02EraBKe6xZr2E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=PU/4661g; arc=none smtp.client-ip=209.85.221.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="PU/4661g" Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-4327790c4e9so4278191f8f.2 for ; Tue, 17 Mar 2026 08:04:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1773759861; x=1774364661; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Qy8dwe6FlWYM+ip3X8t+5BGr1q3na3YWkrOYcDJH1sc=; b=PU/4661gzUispEAYzY8T2a/J6e0+xLxLH8B6mH+PmWJDTaRoZW1x505xWE3bKflEKm yxzyhMQWhC1ORY99BGeH6hipyG8srRVuJT31pvxBjT0XIEdkc+rgxKfeh9q8FcbOhHWG 8Xo/c+zLJ8XtQttVlYTrWTXWUZwQ7iH+kva8XjagjuIPixHG61/eDqBDWoR4fcjL8gbZ FHFGYE+KpnW1exBXR3aMogT/z0tz+b0JpODheP2CqUStT3gktnDPFRnzuy52P6lB406s JMuqzr38XPZ8kC8+yBF/EYfdAq7Ct47l/olPUzhRzF1yawHB6vfdfsHsgGV/hwuGc05+ KWcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773759861; x=1774364661; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=Qy8dwe6FlWYM+ip3X8t+5BGr1q3na3YWkrOYcDJH1sc=; b=SCmgJdzZ/+6jqRmUNpcUnRujtbGto4OfrxuGU27G1YNd88+xgN/hKdI3mW/7xypak5 953RJq9aDbJ7YDqfvvdh4449qlOBkdM3ZR5v5tSONH/UVTG/UN/OwVT6Cuhqz3XJXBji BnkQoBwly4zLKiWa01Ps8tuB+LpC5WZ1h6OCsYRsD1ZVqwAEBAq+TjEScD3vfRdCLQHr iqGVzfLzuow9YnqFc5B3ZDbKA+yL26GqwiWgArJClK4p/1DyKQ1F9GGGKITk3jdwXNB3 v4lIo85VQHipb73wsN0Nkv3bVUuAaoJY4Lu1BqGwy86IXVT91fhVkB1twx4QmOv6bvFK zeTA== X-Forwarded-Encrypted: i=1; AJvYcCW8nSiDkvqnrwWmrH8ndGBej3lVle9IyZkuxjzDRhrCYOmeNxtzgpox5jR1LwTN72OTBPTKpJ6a17O0FNw=@vger.kernel.org X-Gm-Message-State: AOJu0Yxrr+f+4pIgr3t8pFgemLFr8vBI0wBGzQ3iuZnF+k3PJttWUD4c V9NDFy1OhqvzI80pl0Yz6xeRvux52UBILPGCWt0E87xRCaTmnoLUgRamHWMQZxTdTuU= X-Gm-Gg: ATEYQzy4G2jSdumiJN/9olZQu1jOg6AwonT7MhgKnKN4jlC31oNreV4306f4MkmtTJS 96o9M6PSpmEfcXACWsFpcQXikbRYcqIOCip4gqVMOCYjB+zeh3rMU75H2XbwrOP12tvAAdCitS7 IxvNNPyvZFYGOp/GkrB+0G7S6On0IsCU6BlPoP+8OqvccDu3yaEMF7W+A3iNNplbU4QoMPPkGRf eV1ZeF7vA9qgSeFALk6hJTLmsG8fU+nHWHAHWU6B30RnSvSEHDSiPBAF6DhboqZ+T2SBkvrRqEz rOCnw6X+xVYFBSkKAwcPU+lVv7Xz3Z89oIR2R26oTx5Y1GfoR+hEsVNkqpg9tHkP7dbeE0Mb95j WUBaNVx0EdySvVVCQltZpyMAXkF6LXIt2uNLTKmIqPt15iQRARgLJLVT6Tp3GW1K3ZtriuKHiWu zUmej8Nrl/PLiSNQ== X-Received: by 2002:a05:600c:4e4a:b0:485:4135:5c92 with SMTP id 5b1f17b1804b1-4855649360amr292454075e9.0.1773759860943; Tue, 17 Mar 2026 08:04:20 -0700 (PDT) Received: from localhost ([151.37.101.237]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48634a7ac2csm38692075e9.1.2026.03.17.08.04.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Mar 2026 08:04:20 -0700 (PDT) From: Francesco Lavra To: Jonathan Cameron , David Lechner , =?UTF-8?q?Nuno=20S=C3=A1?= , Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v8 5/6] iio: ABI: Add quaternion axis modifier Date: Tue, 17 Mar 2026 16:04:20 +0100 Message-Id: <20260317150420.3878400-1-flavra@baylibre.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20260317150316.3878107-1-flavra@baylibre.com> References: <20260317150316.3878107-1-flavra@baylibre.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3003; i=flavra@baylibre.com; h=from:subject; bh=HohRRDF8l3Dbx0JorWXh1uk1N4zs/oYSUkkwvR1Z+LE=; b=owEB7QES/pANAwAKAe3xO3POlDZfAcsmYgBpuW1zfUcZOZ9QxxP4UfnwEnT+HuNvD8t9POSyc pyp3qizUvCJAbMEAAEKAB0WIQSGV4VPlTvcox7DFObt8TtzzpQ2XwUCabltcwAKCRDt8TtzzpQ2 X0UuC/0RKlBcYDWfJv9o2PyvSd6XBzrMTqjUy7tvO87gAV8unVKprNL7pSKig+SkxeRAdtf+ACc 4OC+BtTBunaPnc4XWLezw2ZDHuwbjo2hCvvex7JZ0ueWCCYzR8aP3Qm6HX5lwuz+AhZar+DIGBS CYDObE4zDEvfYSLXKM3S4YxUtz/35G4A5mm9OKMmMEfDruW191iaHN6BHRrj+WEw0JGycFmJRPz N0uFqW2LrcUFnhfho7ol2OVAQ1snOOUm1wUitCuwQQAigskotAEhl8BaBdFZ37bmUXEdK/1rUWt WSmB52Q5LIAzI9fae3go6MsqEMFiPqCyNZoVD6AbynYOx6UJCv02cPA3LWC14IeKPPHFoAAEIhV wts+DDOd94HlmV8VbQ70vNWjT2LsYORmaUCtMZDxi58FsuX4h2g/+07hBTT4tBHwYsK14tJ570w 206DdgmQWTtfrSMj2BxqrGCAkBnOl9Ib+h92U1J87YcfTf5P9F863wrjRjRGbKSP0FoN0= X-Developer-Key: i=flavra@baylibre.com; a=openpgp; fpr=8657854F953BDCA31EC314E6EDF13B73CE94365F Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This modifier applies to the IIO_ROT channel type, and indicates a data representation that specifies the {x, y, z} components of the normalized quaternion vector. Signed-off-by: Francesco Lavra Reviewed-by: David Lechner --- Documentation/ABI/testing/sysfs-bus-iio | 15 +++++++++++++++ drivers/iio/industrialio-core.c | 1 + include/uapi/linux/iio/types.h | 1 + tools/iio/iio_event_monitor.c | 1 + 4 files changed, 18 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/te= sting/sysfs-bus-iio index bd6c3305dd2b..46fef26e5376 100644 --- a/Documentation/ABI/testing/sysfs-bus-iio +++ b/Documentation/ABI/testing/sysfs-bus-iio @@ -1755,6 +1755,21 @@ Description: measurement from channel Y. Units after application of scale and offset are milliamps. =20 +What: /sys/bus/iio/devices/iio:deviceX/in_rot_quaternionaxis_raw +KernelVersion: 7.1 +Contact: linux-iio@vger.kernel.org +Description: + Raw value of {x, y, z} components of the quaternion vector. These + components represent the axis about which a rotation occurs, and are + subject to the following constraints: + + - the quaternion vector is normalized, i.e. w^2 + x^2 + y^2 + z^2 =3D 1 + - the rotation angle is within the [-pi, pi] range, i.e. the w + component (which represents the amount of rotation) is non-negative + + These constraints allow the w value to be calculated from the other + components: w =3D sqrt(1 - (x^2 + y^2 + z^2)). + What: /sys/.../iio:deviceX/in_energy_en What: /sys/.../iio:deviceX/in_distance_en What: /sys/.../iio:deviceX/in_velocity_sqrt(x^2+y^2+z^2)_en diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-cor= e.c index 22eefd048ba9..bd6f4f9f4533 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -157,6 +157,7 @@ static const char * const iio_modifier_names[] =3D { [IIO_MOD_ACTIVE] =3D "active", [IIO_MOD_REACTIVE] =3D "reactive", [IIO_MOD_APPARENT] =3D "apparent", + [IIO_MOD_QUATERNION_AXIS] =3D "quaternionaxis", }; =20 /* relies on pairs of these shared then separate */ diff --git a/include/uapi/linux/iio/types.h b/include/uapi/linux/iio/types.h index 6d269b844271..d7c2bb223651 100644 --- a/include/uapi/linux/iio/types.h +++ b/include/uapi/linux/iio/types.h @@ -113,6 +113,7 @@ enum iio_modifier { IIO_MOD_ACTIVE, IIO_MOD_REACTIVE, IIO_MOD_APPARENT, + IIO_MOD_QUATERNION_AXIS, }; =20 enum iio_event_type { diff --git a/tools/iio/iio_event_monitor.c b/tools/iio/iio_event_monitor.c index 03ca33869ce8..df6c43d7738d 100644 --- a/tools/iio/iio_event_monitor.c +++ b/tools/iio/iio_event_monitor.c @@ -145,6 +145,7 @@ static const char * const iio_modifier_names[] =3D { [IIO_MOD_ACTIVE] =3D "active", [IIO_MOD_REACTIVE] =3D "reactive", [IIO_MOD_APPARENT] =3D "apparent", + [IIO_MOD_QUATERNION_AXIS] =3D "quaternionaxis", }; =20 static bool event_is_known(struct iio_event_data *event) --=20 2.39.5