linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Remi Buisson via B4 Relay <devnull+remi.buisson.tdk.com@kernel.org>
Cc: remi.buisson@tdk.com, "David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org,
	devicetree@vger.kernel.org
Subject: Re: [PATCH v4 4/9] iio: imu: inv_icm45600: add IMU IIO gyroscope device
Date: Sat, 16 Aug 2025 13:08:23 +0100	[thread overview]
Message-ID: <20250816130823.3cb14980@jic23-huawei> (raw)
In-Reply-To: <20250814-add_newport_driver-v4-4-4464b6600972@tdk.com>

On Thu, 14 Aug 2025 08:57:18 +0000
Remi Buisson via B4 Relay <devnull+remi.buisson.tdk.com@kernel.org> wrote:

> From: Remi Buisson <remi.buisson@tdk.com>
> 
> Add IIO device for gyroscope sensor
> with data polling interface and FIFO parsing.
> Attributes: raw, scale, sampling_frequency, calibbias.
> Temperature is available as a processed channel.
> 
> Signed-off-by: Remi Buisson <remi.buisson@tdk.com>
A few minor comments.

> diff --git a/drivers/iio/imu/inv_icm45600/inv_icm45600_gyro.c b/drivers/iio/imu/inv_icm45600/inv_icm45600_gyro.c
> new file mode 100644
> index 0000000000000000000000000000000000000000..7a5a2ce77f3e176bdcb5657c0b8d547024d04930
> --- /dev/null
> +++ b/drivers/iio/imu/inv_icm45600/inv_icm45600_gyro.c

> +int inv_icm45600_gyro_parse_fifo(struct iio_dev *indio_dev)

Ah. This is where this comes in.  Add header definition in this
patch as well.

> +{
> +	struct inv_icm45600_state *st = iio_device_get_drvdata(indio_dev);
> +	struct inv_icm45600_sensor_state *gyro_st = iio_priv(indio_dev);
> +	struct inv_sensors_timestamp *ts = &gyro_st->ts;
> +	ssize_t i, size;
> +	unsigned int no;
> +
> +	/* parse all fifo packets */
> +	for (i = 0, no = 0; i < st->fifo.count; i += size, ++no) {
> +		struct inv_icm45600_gyro_buffer buffer = { };
> +		const struct inv_icm45600_fifo_sensor_data *accel, *gyro;
> +		const __le16 *timestamp;
> +		const s8 *temp;
> +		unsigned int odr;
> +		s64 ts_val;
> +
> +		size = inv_icm45600_fifo_decode_packet(&st->fifo.data[i],

can drag size into this scope as well.

> +				&accel, &gyro, &temp, &timestamp, &odr);
> +		/* quit if error or FIFO is empty */
> +		if (size <= 0)
> +			return size;
> +
> +		/* skip packet if no gyro data or data is invalid */
> +		if (gyro == NULL || !inv_icm45600_fifo_is_data_valid(gyro))
> +			continue;
> +
> +		/* update odr */
> +		if (odr & INV_ICM45600_SENSOR_GYRO)
> +			inv_sensors_timestamp_apply_odr(ts, st->fifo.period,
> +							st->fifo.nb.total, no);
> +
> +		memcpy(&buffer.gyro, gyro, sizeof(buffer.gyro));
> +		/* convert 8 bits FIFO temperature in high resolution format */
> +		buffer.temp = temp ? (*temp * 64) : 0;
> +		ts_val = inv_sensors_timestamp_pop(ts);
> +		iio_push_to_buffers_with_timestamp(indio_dev, &buffer, ts_val);

Please switch to new iio_push_to_buffers_with_ts().
I want to get rid of the with_timestamp() version eventually as we might as well
always provide the buffer size.

> +	}
> +
> +	return 0;
> +}
> 


  reply	other threads:[~2025-08-16 12:08 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-14  8:57 [PATCH v4 0/9] iio: imu: new inv_icm45600 driver Remi Buisson via B4 Relay
2025-08-14  8:57 ` [PATCH v4 1/9] dt-bindings: iio: imu: Add inv_icm45600 Remi Buisson via B4 Relay
2025-08-15  8:46   ` Krzysztof Kozlowski
2025-08-18  8:35     ` Remi Buisson
2025-08-16 11:25   ` Jonathan Cameron
2025-08-19 12:54     ` Remi Buisson
2025-08-14  8:57 ` [PATCH v4 2/9] iio: imu: inv_icm45600: add new inv_icm45600 driver Remi Buisson via B4 Relay
2025-08-16 11:46   ` Jonathan Cameron
2025-08-19 12:56     ` Remi Buisson
2025-08-14  8:57 ` [PATCH v4 3/9] iio: imu: inv_icm45600: add buffer support in iio devices Remi Buisson via B4 Relay
2025-08-16 12:00   ` Jonathan Cameron
2025-08-19 12:58     ` Remi Buisson
2025-08-14  8:57 ` [PATCH v4 4/9] iio: imu: inv_icm45600: add IMU IIO gyroscope device Remi Buisson via B4 Relay
2025-08-16 12:08   ` Jonathan Cameron [this message]
2025-08-19 12:59     ` Remi Buisson
2025-08-14  8:57 ` [PATCH v4 5/9] iio: imu: inv_icm45600: add IMU IIO accelerometer device Remi Buisson via B4 Relay
2025-08-14  8:57 ` [PATCH v4 6/9] iio: imu: inv_icm45600: add I2C driver for inv_icm45600 driver Remi Buisson via B4 Relay
2025-08-15 11:31   ` kernel test robot
2025-08-16 12:16     ` Jonathan Cameron
2025-08-19 12:59       ` Remi Buisson
2025-08-14  8:57 ` [PATCH v4 7/9] iio: imu: inv_icm45600: add SPI " Remi Buisson via B4 Relay
2025-08-14  8:57 ` [PATCH v4 8/9] iio: imu: inv_icm45600: add I3C " Remi Buisson via B4 Relay
2025-08-14  8:57 ` [PATCH v4 9/9] MAINTAINERS: add entry for inv_icm45600 6-axis imu sensor Remi Buisson via B4 Relay
2025-08-16 12:17   ` Jonathan Cameron
2025-08-19 13:01     ` Remi Buisson

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=20250816130823.3cb14980@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=andy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=devnull+remi.buisson.tdk.com@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=remi.buisson@tdk.com \
    --cc=robh@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).