public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: David Lechner <dlechner@baylibre.com>
Cc: "Francesco Lavra" <flavra@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v7 5/6] iio: ABI: Add partial quaternion modifier
Date: Sat, 7 Mar 2026 13:03:12 +0000	[thread overview]
Message-ID: <20260307130312.2efd100e@jic23-huawei> (raw)
In-Reply-To: <77e10517-2b6e-417b-95d3-185d3a067ba5@baylibre.com>

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",

  parent reply	other threads:[~2026-03-07 13:03 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-04  8:05 [PATCH v7 0/6] imu: st_lsm6dsx: Add support for rotation sensor Francesco Lavra
2026-03-04  8:06 ` [PATCH v7 1/6] iio: imu: st_lsm6dsx: Fix check for invalid samples from FIFO Francesco Lavra
2026-03-07 12:46   ` Jonathan Cameron
2026-03-07 15:23     ` Lorenzo Bianconi
2026-03-07 17:04       ` Jonathan Cameron
2026-03-07 17:20         ` Lorenzo Bianconi
2026-03-04  8:06 ` [PATCH v7 2/6] iio: Replace 'sign' field with union in struct iio_scan_type Francesco Lavra
2026-03-04 22:55   ` David Lechner
2026-03-07 12:47     ` Jonathan Cameron
2026-03-07 13:10   ` Jonathan Cameron
2026-03-04  8:06 ` [PATCH v7 3/6] iio: tools: Add support for floating-point numbers in buffer scan elements Francesco Lavra
2026-03-04 22:53   ` David Lechner
2026-03-04  8:06 ` [PATCH v7 4/6] iio: ABI: " Francesco Lavra
2026-03-04 22:45   ` David Lechner
2026-03-05  9:09     ` Francesco Lavra
2026-03-05  9:23       ` Andy Shevchenko
2026-03-05 14:37         ` David Lechner
2026-03-06 12:09           ` Andy Shevchenko
2026-03-07 12:51             ` Jonathan Cameron
2026-03-17 10:40               ` Francesco Lavra
2026-03-04  8:07 ` [PATCH v7 5/6] iio: ABI: Add partial quaternion modifier Francesco Lavra
2026-03-04 11:51   ` Andy Shevchenko
2026-03-04 14:21     ` Francesco Lavra
2026-03-04 22:42       ` David Lechner
2026-03-05  8:50         ` Francesco Lavra
2026-03-05 14:40           ` David Lechner
2026-03-06 12:10             ` Andy Shevchenko
2026-03-04 19:25   ` kernel test robot
2026-03-04 22:35   ` David Lechner
2026-03-05  7:04     ` Andy Shevchenko
2026-03-07 13:00       ` Jonathan Cameron
2026-03-07 13:03     ` Jonathan Cameron [this message]
2026-03-08 20:27       ` Andy Shevchenko
2026-03-14 11:14         ` Jonathan Cameron
2026-03-07 13:05   ` Jonathan Cameron
2026-03-04  8:07 ` [PATCH v7 6/6] iio: imu: st_lsm6dsx: Add support for rotation sensor Francesco Lavra
2026-03-04 13:39   ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260307130312.2efd100e@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=flavra@baylibre.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox