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 <flavra@baylibre.com>
---
Documentation/ABI/testing/sysfs-bus-iio | 13 +++++++++++++
drivers/iio/industrialio-core.c | 1 +
include/uapi/linux/iio/types.h | 1 +
tools/iio/iio_event_monitor.c | 1 +
4 files changed, 16 insertions(+)
diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio
index bd6c3305dd2b..54e38ebb044d 100644
--- a/Documentation/ABI/testing/sysfs-bus-iio
+++ b/Documentation/ABI/testing/sysfs-bus-iio
@@ -1755,6 +1755,19 @@ Description:
measurement from channel Y. Units after application of scale and
offset are milliamps.
+What: /sys/bus/iio/devices/iio:deviceX/in_rot_partial_quaternion_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 costraints:
+ - the quaternion vector is normalized, i.e. x^2 + y^2 + z^2 + w^2 = 1
+ - the rotation angle is within the [-180, 180] 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 = 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-core.c
index 22eefd048ba9..792fbeb0dfa8 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -125,6 +125,7 @@ static const char * const iio_modifier_names[] = {
[IIO_MOD_LIGHT_UVB] = "uvb",
[IIO_MOD_LIGHT_DUV] = "duv",
[IIO_MOD_QUATERNION] = "quaternion",
+ [IIO_MOD_PARTIAL_QUATERNION] = "partial_quaternion",
[IIO_MOD_TEMP_AMBIENT] = "ambient",
[IIO_MOD_TEMP_OBJECT] = "object",
[IIO_MOD_NORTH_MAGN] = "from_north_magnetic",
diff --git a/include/uapi/linux/iio/types.h b/include/uapi/linux/iio/types.h
index 6d269b844271..c80ef7c1ed12 100644
--- a/include/uapi/linux/iio/types.h
+++ b/include/uapi/linux/iio/types.h
@@ -77,6 +77,7 @@ enum iio_modifier {
IIO_MOD_LIGHT_GREEN,
IIO_MOD_LIGHT_BLUE,
IIO_MOD_QUATERNION,
+ IIO_MOD_PARTIAL_QUATERNION,
IIO_MOD_TEMP_AMBIENT,
IIO_MOD_TEMP_OBJECT,
IIO_MOD_NORTH_MAGN,
diff --git a/tools/iio/iio_event_monitor.c b/tools/iio/iio_event_monitor.c
index 03ca33869ce8..db0fb75806ab 100644
--- a/tools/iio/iio_event_monitor.c
+++ b/tools/iio/iio_event_monitor.c
@@ -113,6 +113,7 @@ static const char * const iio_modifier_names[] = {
[IIO_MOD_LIGHT_UVB] = "uvb",
[IIO_MOD_LIGHT_DUV] = "duv",
[IIO_MOD_QUATERNION] = "quaternion",
+ [IIO_MOD_PARTIAL_QUATERNION] = "partial_quaternion",
[IIO_MOD_TEMP_AMBIENT] = "ambient",
[IIO_MOD_TEMP_OBJECT] = "object",
[IIO_MOD_NORTH_MAGN] = "from_north_magnetic",
--
2.39.5
> diff --git a/include/uapi/linux/iio/types.h b/include/uapi/linux/iio/types.h
> index 6d269b844271..c80ef7c1ed12 100644
> --- a/include/uapi/linux/iio/types.h
> +++ b/include/uapi/linux/iio/types.h
> @@ -77,6 +77,7 @@ enum iio_modifier {
> IIO_MOD_LIGHT_GREEN,
> IIO_MOD_LIGHT_BLUE,
> IIO_MOD_QUATERNION,
> + IIO_MOD_PARTIAL_QUATERNION,
I nearly missed this. This is a userspace header for a reason. The ABI is
fixed so we can't change the enumeration. We can only add to the end.
Good thing the discussion on the _ came up and made me wonder why the name
above was in near one with underscores!
> IIO_MOD_TEMP_AMBIENT,
> IIO_MOD_TEMP_OBJECT,
> IIO_MOD_NORTH_MAGN,
All userspace code using these would now be broken.
On 3/4/26 2:07 AM, Francesco Lavra wrote:
> 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 <flavra@baylibre.com>
> ---
> Documentation/ABI/testing/sysfs-bus-iio | 13 +++++++++++++
> drivers/iio/industrialio-core.c | 1 +
> include/uapi/linux/iio/types.h | 1 +
> tools/iio/iio_event_monitor.c | 1 +
> 4 files changed, 16 insertions(+)
>
> diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio
> index bd6c3305dd2b..54e38ebb044d 100644
> --- a/Documentation/ABI/testing/sysfs-bus-iio
> +++ b/Documentation/ABI/testing/sysfs-bus-iio
> @@ -1755,6 +1755,19 @@ Description:
> measurement from channel Y. Units after application of scale and
> offset are milliamps.
>
> +What: /sys/bus/iio/devices/iio:deviceX/in_rot_partial_quaternion_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 costraints:
s/costraints/constraints/
> + - the quaternion vector is normalized, i.e. x^2 + y^2 + z^2 + w^2 = 1
Isn't this usually written with w first?
> + - the rotation angle is within the [-180, 180] range, i.e. the w
Best to say the angle units. IIO standard unit for angle is radians.
> + component (which represents the amount of rotation) is non-negative
> + These constraints allow the w value to be calculated from the other
> + components: w = 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-core.c
> index 22eefd048ba9..792fbeb0dfa8 100644
> --- a/drivers/iio/industrialio-core.c
> +++ b/drivers/iio/industrialio-core.c
> @@ -125,6 +125,7 @@ static const char * const iio_modifier_names[] = {
> [IIO_MOD_LIGHT_UVB] = "uvb",
> [IIO_MOD_LIGHT_DUV] = "duv",
> [IIO_MOD_QUATERNION] = "quaternion",
> + [IIO_MOD_PARTIAL_QUATERNION] = "partial_quaternion",
We've found that using `_` in components of the attribute name makes it
difficult to parse since you have to know all component names to know
where the break between components is. Each time we add something with
an `_` means all parsers need to be updated to handle the new name.
In other components, we've just squashed the two words together without
any space or punctuation to get around this problem. I find that rather hard
to read though.
I wonder if we could propose something different going forward to do a better
job being consistent and readable. For example, use a `-` at the word break
in components that have more than one word in the name.
> [IIO_MOD_TEMP_AMBIENT] = "ambient",
> [IIO_MOD_TEMP_OBJECT] = "object",
> [IIO_MOD_NORTH_MAGN] = "from_north_magnetic",
> diff --git a/include/uapi/linux/iio/types.h b/include/uapi/linux/iio/types.h
> index 6d269b844271..c80ef7c1ed12 100644
> --- a/include/uapi/linux/iio/types.h
> +++ b/include/uapi/linux/iio/types.h
> @@ -77,6 +77,7 @@ enum iio_modifier {
> IIO_MOD_LIGHT_GREEN,
> IIO_MOD_LIGHT_BLUE,
> IIO_MOD_QUATERNION,
> + IIO_MOD_PARTIAL_QUATERNION,
This is userspace API. We can't change the values of the enum
members after this, so new members have to be added at the end.
> IIO_MOD_TEMP_AMBIENT,
> IIO_MOD_TEMP_OBJECT,
> IIO_MOD_NORTH_MAGN,
> diff --git a/tools/iio/iio_event_monitor.c b/tools/iio/iio_event_monitor.c
> index 03ca33869ce8..db0fb75806ab 100644
> --- a/tools/iio/iio_event_monitor.c
> +++ b/tools/iio/iio_event_monitor.c
> @@ -113,6 +113,7 @@ static const char * const iio_modifier_names[] = {
> [IIO_MOD_LIGHT_UVB] = "uvb",
> [IIO_MOD_LIGHT_DUV] = "duv",
> [IIO_MOD_QUATERNION] = "quaternion",
> + [IIO_MOD_PARTIAL_QUATERNION] = "partial_quaternion",
> [IIO_MOD_TEMP_AMBIENT] = "ambient",
> [IIO_MOD_TEMP_OBJECT] = "object",
> [IIO_MOD_NORTH_MAGN] = "from_north_magnetic",
On Wed, 4 Mar 2026 16:35:39 -0600
David Lechner <dlechner@baylibre.com> wrote:
> On 3/4/26 2:07 AM, Francesco Lavra wrote:
> > 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 <flavra@baylibre.com>
> > ---
> > Documentation/ABI/testing/sysfs-bus-iio | 13 +++++++++++++
> > drivers/iio/industrialio-core.c | 1 +
> > include/uapi/linux/iio/types.h | 1 +
> > tools/iio/iio_event_monitor.c | 1 +
> > 4 files changed, 16 insertions(+)
> >
> > diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio
> > index bd6c3305dd2b..54e38ebb044d 100644
> > --- a/Documentation/ABI/testing/sysfs-bus-iio
> > +++ b/Documentation/ABI/testing/sysfs-bus-iio
> > @@ -1755,6 +1755,19 @@ Description:
> > measurement from channel Y. Units after application of scale and
> > offset are milliamps.
> >
> > +What: /sys/bus/iio/devices/iio:deviceX/in_rot_partial_quaternion_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 costraints:
>
> s/costraints/constraints/
>
> > + - the quaternion vector is normalized, i.e. x^2 + y^2 + z^2 + w^2 = 1
>
> Isn't this usually written with w first?
>
> > + - the rotation angle is within the [-180, 180] range, i.e. the w
>
> Best to say the angle units. IIO standard unit for angle is radians.
>
> > + component (which represents the amount of rotation) is non-negative
> > + These constraints allow the w value to be calculated from the other
> > + components: w = 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-core.c
> > index 22eefd048ba9..792fbeb0dfa8 100644
> > --- a/drivers/iio/industrialio-core.c
> > +++ b/drivers/iio/industrialio-core.c
> > @@ -125,6 +125,7 @@ static const char * const iio_modifier_names[] = {
> > [IIO_MOD_LIGHT_UVB] = "uvb",
> > [IIO_MOD_LIGHT_DUV] = "duv",
> > [IIO_MOD_QUATERNION] = "quaternion",
> > + [IIO_MOD_PARTIAL_QUATERNION] = "partial_quaternion",
>
> We've found that using `_` in components of the attribute name makes it
> difficult to parse since you have to know all component names to know
> where the break between components is. Each time we add something with
> an `_` means all parsers need to be updated to handle the new name.
>
> In other components, we've just squashed the two words together without
> any space or punctuation to get around this problem. I find that rather hard
> to read though.
>
> I wonder if we could propose something different going forward to do a better
> job being consistent and readable. For example, use a `-` at the word break
> in components that have more than one word in the name.
Whilst I can see the argument, I'm not keen on more punctuation in the filenames.
May well trip up someone's parser. For now squashing the spaces is probably
the best option.
This made me spot a major issue though. We can only add to end of these
enums, not the middle!
>
> > [IIO_MOD_TEMP_AMBIENT] = "ambient",
> > [IIO_MOD_TEMP_OBJECT] = "object",
> > [IIO_MOD_NORTH_MAGN] = "from_north_magnetic",
On Sat, Mar 07, 2026 at 01:03:12PM +0000, Jonathan Cameron wrote: > On Wed, 4 Mar 2026 16:35:39 -0600 > David Lechner <dlechner@baylibre.com> wrote: > > On 3/4/26 2:07 AM, Francesco Lavra wrote: ... > Whilst I can see the argument, I'm not keen on more punctuation in the filenames. > May well trip up someone's parser. For now squashing the spaces is probably > the best option. > > This made me spot a major issue though. We can only add to end of these > enums, not the middle! So, if not yet, we need to have a patch that adds a big fat note/warning about this on top of the enum(s). -- With Best Regards, Andy Shevchenko
On Sun, 8 Mar 2026 22:27:26 +0200 Andy Shevchenko <andriy.shevchenko@intel.com> wrote: > On Sat, Mar 07, 2026 at 01:03:12PM +0000, Jonathan Cameron wrote: > > On Wed, 4 Mar 2026 16:35:39 -0600 > > David Lechner <dlechner@baylibre.com> wrote: > > > On 3/4/26 2:07 AM, Francesco Lavra wrote: > > ... > > > Whilst I can see the argument, I'm not keen on more punctuation in the filenames. > > May well trip up someone's parser. For now squashing the spaces is probably > > the best option. > > > > This made me spot a major issue though. We can only add to end of these > > enums, not the middle! > > So, if not yet, we need to have a patch that adds a big fat note/warning about > this on top of the enum(s). To me that would basically say 'oh look this is a uapi header, you can't change anything'. I guess we have a few proof points that people don't actually realise that so maybe you are right.
On Wed, Mar 04, 2026 at 04:35:39PM -0600, David Lechner wrote: > On 3/4/26 2:07 AM, Francesco Lavra wrote: ... > > + - the quaternion vector is normalized, i.e. x^2 + y^2 + z^2 + w^2 = 1 > > Isn't this usually written with w first? > > > + - the rotation angle is within the [-180, 180] range, i.e. the w > > Best to say the angle units. IIO standard unit for angle is radians. > > > + component (which represents the amount of rotation) is non-negative Based on these, maybe the name should be normalised_360_quaternion (or variations of this)? Actually "partial" quaternion some articles use for something different as far as I can say. -- With Best Regards, Andy Shevchenko
On Thu, 5 Mar 2026 09:04:40 +0200 Andy Shevchenko <andriy.shevchenko@intel.com> wrote: > On Wed, Mar 04, 2026 at 04:35:39PM -0600, David Lechner wrote: > > On 3/4/26 2:07 AM, Francesco Lavra wrote: > > ... > > > > + - the quaternion vector is normalized, i.e. x^2 + y^2 + z^2 + w^2 = 1 > > > > Isn't this usually written with w first? > > > > > + - the rotation angle is within the [-180, 180] range, i.e. the w > > > > Best to say the angle units. IIO standard unit for angle is radians. > > > > > + component (which represents the amount of rotation) is non-negative > > Based on these, maybe the name should be > > normalised_360_quaternion > > (or variations of this)? Actually "partial" quaternion some articles use > for something different as far as I can say. The "axis" naming for the define is probably as good as we can do for something that is mathematically dubious in my view. There are two many ways it could be interpreted and I'd be surprised if this does get used in other devices, and they all pick the same way of filling in the missing constraint. Mind you I never much like quaternion's (part of my PhD was on Clifford / Geometric algebra's and exponentials of bivectors are so much cleaner :) Jonathan >
Hi Francesco,
kernel test robot noticed the following build warnings:
[auto build test WARNING on next-20260303]
[also build test WARNING on v7.0-rc2]
[cannot apply to jic23-iio/togreg linus/master v7.0-rc2 v7.0-rc1 v6.19]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Francesco-Lavra/iio-imu-st_lsm6dsx-Fix-check-for-invalid-samples-from-FIFO/20260304-161927
base: next-20260303
patch link: https://lore.kernel.org/r/20260304080706.2844472-1-flavra%40baylibre.com
patch subject: [PATCH v7 5/6] iio: ABI: Add partial quaternion modifier
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
docutils: docutils (Docutils 0.21.2, Python 3.13.5, on linux)
reproduce: (https://download.01.org/0day-ci/archive/20260304/202603042011.WHve1GRB-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603042011.WHve1GRB-lkp@intel.com/
All warnings (new ones prefixed by >>):
Warning: tools/docs/documentation-file-ref-check references a file that doesn't exist: Documentation/devicetree/dt-object-internal.txt
Warning: tools/docs/documentation-file-ref-check references a file that doesn't exist: m,^Documentation/scheduler/sched-pelt
Warning: tools/docs/documentation-file-ref-check references a file that doesn't exist: m,(Documentation/translations/[
Using alabaster theme
Documentation/ABI/testing/sysfs-bus-iio:1758: ERROR: Unexpected indentation. [docutils]
>> Documentation/ABI/testing/sysfs-bus-iio:1758: WARNING: Block quote ends without a blank line; unexpected unindent. [docutils]
Documentation/core-api/kref:328: ./include/linux/kref.h:72: WARNING: Invalid C declaration: Expected end of definition. [error at 96]
int kref_put_mutex (struct kref *kref, void (*release)(struct kref *kref), struct mutex *mutex) __cond_acquires(true# mutex)
------------------------------------------------------------------------------------------------^
Documentation/core-api/kref:328: ./include/linux/kref.h:94: WARNING: Invalid C declaration: Expected end of definition. [error at 92]
int kref_put_lock (struct kref *kref, void (*release)(struct kref *kref), spinlock_t *lock) __cond_acquires(true# lock)
vim +1758 Documentation/ABI/testing/sysfs-bus-iio
> 1758 What: /sys/bus/iio/devices/iio:deviceX/in_rot_partial_quaternion_raw
1759 KernelVersion: 7.1
1760 Contact: linux-iio@vger.kernel.org
1761 Description:
1762 Raw value of {x, y, z} components of the quaternion vector. These
1763 components represent the axis about which a rotation occurs, and are
1764 subject to the following costraints:
1765 - the quaternion vector is normalized, i.e. x^2 + y^2 + z^2 + w^2 = 1
1766 - the rotation angle is within the [-180, 180] range, i.e. the w
1767 component (which represents the amount of rotation) is non-negative
1768 These constraints allow the w value to be calculated from the other
1769 components: w = sqrt(1 - (x^2 + y^2 + z^2)).
1770
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
On Wed, Mar 04, 2026 at 09:07:05AM +0100, Francesco Lavra wrote:
> 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.
...
> +What: /sys/bus/iio/devices/iio:deviceX/in_rot_partial_quaternion_raw
> + 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 costraints:
> + - the quaternion vector is normalized, i.e. x^2 + y^2 + z^2 + w^2 = 1
> + - the rotation angle is within the [-180, 180] 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 = sqrt(1 - (x^2 + y^2 + z^2)).
Just to double check if we really do not have a special mathematical term for
that already. If we do, I prefer to have that over odd "partial quaternion".
--
With Best Regards,
Andy Shevchenko
On Wed, 2026-03-04 at 13:51 +0200, Andy Shevchenko wrote:
> On Wed, Mar 04, 2026 at 09:07:05AM +0100, Francesco Lavra wrote:
> > 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.
>
> ...
>
> > +What: /sys/bus/iio/devices/iio:deviceX/in_rot_partial_quatern
> > ion_raw
>
> > + 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 costraints:
> > + - the quaternion vector is normalized, i.e. x^2 + y^2 +
> > z^2 + w^2 = 1
> > + - the rotation angle is within the [-180, 180] 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 = sqrt(1 - (x^2 + y^2 + z^2)).
>
> Just to double check if we really do not have a special mathematical term
> for
> that already. If we do, I prefer to have that over odd "partial
> quaternion".
A quaternion is often represented as w + xi + yj + zk, i.e. it's composed
of a real coefficient (w) and 3 imaginary coefficients (x, y, z). With this
notation, the (x, y, z) components are referred to as the imaginary part of
the quaternion.
Alternatively, a quaternion is represented as the combination of a scalar
value w and a 3D vector value (x, y, z). With this notation, the (x, y, z)
components are referred to as the vector part of the quaternion; this can
be confusing, since the quaternion as a whole is often considered as a 4D
vector.
On 3/4/26 8:21 AM, Francesco Lavra wrote:
> On Wed, 2026-03-04 at 13:51 +0200, Andy Shevchenko wrote:
>> On Wed, Mar 04, 2026 at 09:07:05AM +0100, Francesco Lavra wrote:
>>> 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.
>>
>> ...
>>
>>> +What: /sys/bus/iio/devices/iio:deviceX/in_rot_partial_quatern
>>> ion_raw
>>
>>> + 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 costraints:
>>> + - the quaternion vector is normalized, i.e. x^2 + y^2 +
>>> z^2 + w^2 = 1
>>> + - the rotation angle is within the [-180, 180] 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 = sqrt(1 - (x^2 + y^2 + z^2)).
>>
>> Just to double check if we really do not have a special mathematical term
>> for
>> that already. If we do, I prefer to have that over odd "partial
>> quaternion".
>
> A quaternion is often represented as w + xi + yj + zk, i.e. it's composed
> of a real coefficient (w) and 3 imaginary coefficients (x, y, z). With this
> notation, the (x, y, z) components are referred to as the imaginary part of
> the quaternion.
> Alternatively, a quaternion is represented as the combination of a scalar
> value w and a 3D vector value (x, y, z). With this notation, the (x, y, z)
> components are referred to as the vector part of the quaternion; this can
> be confusing, since the quaternion as a whole is often considered as a 4D
> vector.
I'm surprised there isn't a common name for this. When I went looking, the
thing that came up most often is that Doom 3 used this in their MD5 file
format. So maybe IIO_MOD_DOOM3_QUATERNION? (joking)
I do think we could come up with something better than "partial" though.
My first thought is IIO_MOD_3D_QUATERNION since it is a 3-dimentional number,
but I could see that being confusing to some since quaternions are generally
used for rotations in 3-D space.
Maybe something like IIO_MOD_3VALUE_QUATERNION or IIO_MOD_COMPRESSED_QUATERNION
or just IIO_MOD_3QUATERNION?
On Wed, 2026-03-04 at 16:42 -0600, David Lechner wrote:
> On 3/4/26 8:21 AM, Francesco Lavra wrote:
> > On Wed, 2026-03-04 at 13:51 +0200, Andy Shevchenko wrote:
> > > On Wed, Mar 04, 2026 at 09:07:05AM +0100, Francesco Lavra wrote:
> > > > 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.
> > >
> > > ...
> > >
> > > > +What: /sys/bus/iio/devices/iio:deviceX/in_rot_partial_qua
> > > > tern
> > > > ion_raw
> > >
> > > > + 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 costraints:
> > > > + - the quaternion vector is normalized, i.e. x^2 +
> > > > y^2 +
> > > > z^2 + w^2 = 1
> > > > + - the rotation angle is within the [-180, 180]
> > > > 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 = sqrt(1 - (x^2 + y^2 + z^2)).
> > >
> > > Just to double check if we really do not have a special mathematical
> > > term
> > > for
> > > that already. If we do, I prefer to have that over odd "partial
> > > quaternion".
> >
> > A quaternion is often represented as w + xi + yj + zk, i.e. it's
> > composed
> > of a real coefficient (w) and 3 imaginary coefficients (x, y, z). With
> > this
> > notation, the (x, y, z) components are referred to as the imaginary
> > part of
> > the quaternion.
> > Alternatively, a quaternion is represented as the combination of a
> > scalar
> > value w and a 3D vector value (x, y, z). With this notation, the (x, y,
> > z)
> > components are referred to as the vector part of the quaternion; this
> > can
> > be confusing, since the quaternion as a whole is often considered as a
> > 4D
> > vector.
>
> I'm surprised there isn't a common name for this. When I went looking,
> the
> thing that came up most often is that Doom 3 used this in their MD5 file
> format. So maybe IIO_MOD_DOOM3_QUATERNION? (joking)
>
> I do think we could come up with something better than "partial" though.
>
> My first thought is IIO_MOD_3D_QUATERNION since it is a 3-dimentional
> number,
> but I could see that being confusing to some since quaternions are
> generally
> used for rotations in 3-D space.
>
> Maybe something like IIO_MOD_3VALUE_QUATERNION or
> IIO_MOD_COMPRESSED_QUATERNION
> or just IIO_MOD_3QUATERNION?
Or, since this represents the axis of rotation, perhaps something like
IIO_MOD_QUATERNION_AXIS?
On 3/5/26 2:50 AM, Francesco Lavra wrote:
> On Wed, 2026-03-04 at 16:42 -0600, David Lechner wrote:
>> On 3/4/26 8:21 AM, Francesco Lavra wrote:
>>> On Wed, 2026-03-04 at 13:51 +0200, Andy Shevchenko wrote:
>>>> On Wed, Mar 04, 2026 at 09:07:05AM +0100, Francesco Lavra wrote:
>>>>> 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.
>>>>
>>>> ...
>>>>
>>>>> +What: /sys/bus/iio/devices/iio:deviceX/in_rot_partial_qua
>>>>> tern
>>>>> ion_raw
>>>>
>>>>> + 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 costraints:
>>>>> + - the quaternion vector is normalized, i.e. x^2 +
>>>>> y^2 +
>>>>> z^2 + w^2 = 1
>>>>> + - the rotation angle is within the [-180, 180]
>>>>> 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 = sqrt(1 - (x^2 + y^2 + z^2)).
>>>>
>>>> Just to double check if we really do not have a special mathematical
>>>> term
>>>> for
>>>> that already. If we do, I prefer to have that over odd "partial
>>>> quaternion".
>>>
>>> A quaternion is often represented as w + xi + yj + zk, i.e. it's
>>> composed
>>> of a real coefficient (w) and 3 imaginary coefficients (x, y, z). With
>>> this
>>> notation, the (x, y, z) components are referred to as the imaginary
>>> part of
>>> the quaternion.
>>> Alternatively, a quaternion is represented as the combination of a
>>> scalar
>>> value w and a 3D vector value (x, y, z). With this notation, the (x, y,
>>> z)
>>> components are referred to as the vector part of the quaternion; this
>>> can
>>> be confusing, since the quaternion as a whole is often considered as a
>>> 4D
>>> vector.
>>
>> I'm surprised there isn't a common name for this. When I went looking,
>> the
>> thing that came up most often is that Doom 3 used this in their MD5 file
>> format. So maybe IIO_MOD_DOOM3_QUATERNION? (joking)
>>
>> I do think we could come up with something better than "partial" though.
>>
>> My first thought is IIO_MOD_3D_QUATERNION since it is a 3-dimentional
>> number,
>> but I could see that being confusing to some since quaternions are
>> generally
>> used for rotations in 3-D space.
>>
>> Maybe something like IIO_MOD_3VALUE_QUATERNION or
>> IIO_MOD_COMPRESSED_QUATERNION
>> or just IIO_MOD_3QUATERNION?
>
> Or, since this represents the axis of rotation, perhaps something like
> IIO_MOD_QUATERNION_AXIS?
Sounds OK to me.
On Thu, Mar 05, 2026 at 08:40:26AM -0600, David Lechner wrote:
> On 3/5/26 2:50 AM, Francesco Lavra wrote:
> > On Wed, 2026-03-04 at 16:42 -0600, David Lechner wrote:
> >> On 3/4/26 8:21 AM, Francesco Lavra wrote:
> >>> On Wed, 2026-03-04 at 13:51 +0200, Andy Shevchenko wrote:
> >>>> On Wed, Mar 04, 2026 at 09:07:05AM +0100, Francesco Lavra wrote:
...
> >>>>> +What: /sys/bus/iio/devices/iio:deviceX/in_rot_partial_qua
> >>>>> tern
> >>>>> ion_raw
> >>>>
> >>>>> + 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 costraints:
> >>>>> + - the quaternion vector is normalized, i.e. x^2 +
> >>>>> y^2 +
> >>>>> z^2 + w^2 = 1
> >>>>> + - the rotation angle is within the [-180, 180]
> >>>>> 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 = sqrt(1 - (x^2 + y^2 + z^2)).
> >>>>
> >>>> Just to double check if we really do not have a special mathematical
> >>>> term
> >>>> for
> >>>> that already. If we do, I prefer to have that over odd "partial
> >>>> quaternion".
> >>>
> >>> A quaternion is often represented as w + xi + yj + zk, i.e. it's
> >>> composed
> >>> of a real coefficient (w) and 3 imaginary coefficients (x, y, z). With
> >>> this
> >>> notation, the (x, y, z) components are referred to as the imaginary
> >>> part of
> >>> the quaternion.
> >>> Alternatively, a quaternion is represented as the combination of a
> >>> scalar
> >>> value w and a 3D vector value (x, y, z). With this notation, the (x, y,
> >>> z)
> >>> components are referred to as the vector part of the quaternion; this
> >>> can
> >>> be confusing, since the quaternion as a whole is often considered as a
> >>> 4D
> >>> vector.
> >>
> >> I'm surprised there isn't a common name for this. When I went looking,
> >> the
> >> thing that came up most often is that Doom 3 used this in their MD5 file
> >> format. So maybe IIO_MOD_DOOM3_QUATERNION? (joking)
> >>
> >> I do think we could come up with something better than "partial" though.
> >>
> >> My first thought is IIO_MOD_3D_QUATERNION since it is a 3-dimentional
> >> number,
> >> but I could see that being confusing to some since quaternions are
> >> generally
> >> used for rotations in 3-D space.
> >>
> >> Maybe something like IIO_MOD_3VALUE_QUATERNION or
> >> IIO_MOD_COMPRESSED_QUATERNION
> >> or just IIO_MOD_3QUATERNION?
> >
> > Or, since this represents the axis of rotation, perhaps something like
> > IIO_MOD_QUATERNION_AXIS?
>
> Sounds OK to me.
Agree, this is at least better than opaque "partial".
--
With Best Regards,
Andy Shevchenko
© 2016 - 2026 Red Hat, Inc.