public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: "Francesco Lavra" <flavra@baylibre.com>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@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 v2 3/3] iio: imu: st_lsm6dsx: Add support for rotation sensor
Date: Thu, 15 Jan 2026 14:51:43 +0100	[thread overview]
Message-ID: <aWjw7_poJUIh9HgI@lore-desk> (raw)
In-Reply-To: <aWjwWF2XmXJb-iJI@smile.fi.intel.com>

[-- Attachment #1: Type: text/plain, Size: 2074 bytes --]

On Jan 15, Andy Shevchenko wrote:
> On Thu, Jan 15, 2026 at 02:32:11PM +0100, Lorenzo Bianconi wrote:
> > > Some IMU chips in the LSM6DSX family have sensor fusion features that
> > > combine data from the accelerometer and gyroscope. One of these features
> > > generates rotation vector data and makes it available in the hardware
> > > FIFO as a quaternion (more specifically, the X, Y and Z components of the
> > > quaternion vector, expressed as 16-bit half-precision floating-point
> > > numbers).
> > > 
> > > Add support for a new sensor instance that allows receiving sensor fusion
> > > data, by defining a new struct st_lsm6dsx_sf_settings (which contains
> > > chip-specific details for the sensor fusion functionality), and adding this
> > > struct as a new field in struct st_lsm6dsx_settings. In st_lsm6dsx_core.c,
> > > populate this new struct for the LSM6DSV and LSM6DSV16X chips, and add the
> > > logic to initialize an additional IIO device if this struct is populated
> > > for the hardware type being probed.
> > > Note: a new IIO device is being defined (as opposed to adding channels to
> > > an existing device) because the rate at which sensor fusion data is
> > > generated may not match the data rate from any of the existing devices.
> > > 
> > > Tested on LSMDSV16X.
> 
> ...
> 
> > > +	settings = &sensor->hw->settings->sf_settings;
> > > +	switch (mask) {
> > > +	case IIO_CHAN_INFO_SAMP_FREQ: {
> > > +		u32 odr_mHz;
> > > +		u8 odr_val;
> > > +
> > > +		odr_mHz = val * MILLI + val2 * MILLI / MICRO;
> > > +		err = st_lsm6dsx_sf_get_odr_val(settings, odr_mHz, &odr_val);
> > > +		if (err)
> > > +			return err;
> > > +
> > > +		sensor->hwfifo_odr_mHz = odr_mHz;
> > > +		return 0;
> > 
> > break;
> > 
> > > +	}
> > > +	default:
> > > +		return -EINVAL;
> > 
> > break;
> > 
> > > +	}
> > 
> > return err;
> 
> Why?

I guess it is more clear, but just a Nit, I can live with the current implementation.

Regards,
Lorenzo

> 
> -- 
> With Best Regards,
> Andy Shevchenko
> 
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2026-01-15 13:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-15 12:24 [PATCH v2 0/3] imu: st_lsm6dsx: Add support for rotation sensor Francesco Lavra
2026-01-15 12:24 ` [PATCH v2 1/3] iio: imu: st_lsm6dsx: Set FIFO ODR for accelerometer and gyroscope only Francesco Lavra
2026-01-15 13:13   ` Lorenzo Bianconi
2026-01-16 19:47     ` Jonathan Cameron
2026-01-19  9:06       ` Francesco Lavra
2026-01-15 12:24 ` [PATCH v2 2/3] iio: imu: st_lsm6dsx: Set buffer sampling frequency for accelerometer only Francesco Lavra
2026-01-15 13:18   ` Lorenzo Bianconi
2026-01-16 19:49   ` Jonathan Cameron
2026-01-15 12:24 ` [PATCH v2 3/3] iio: imu: st_lsm6dsx: Add support for rotation sensor Francesco Lavra
2026-01-15 13:32   ` Lorenzo Bianconi
2026-01-15 13:49     ` Andy Shevchenko
2026-01-15 13:51       ` Lorenzo Bianconi [this message]
2026-01-15 13:58         ` Andy Shevchenko
2026-01-16 19:53           ` Jonathan Cameron
2026-01-16 20:04   ` Jonathan Cameron

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=aWjw7_poJUIh9HgI@lore-desk \
    --to=lorenzo@kernel.org \
    --cc=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=flavra@baylibre.com \
    --cc=jic23@kernel.org \
    --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