[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<FR2PPF4571F02BCCC21FE8D5BFCD1015B608C30A@FR2PPF4571F02BC.DEUP281.PROD.OUTLOOK.COM>
Date: Tue, 19 Aug 2025 12:59:01 +0000
From: Remi Buisson <Remi.Buisson@....com>
To: Jonathan Cameron <jic23@...nel.org>,
Remi Buisson via B4 Relay
<devnull+remi.buisson.tdk.com@...nel.org>
CC: David Lechner <dlechner@...libre.com>,
Nuno Sá
<nuno.sa@...log.com>,
Andy Shevchenko <andy@...nel.org>, Rob Herring
<robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley
<conor+dt@...nel.org>,
"linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>,
"linux-iio@...r.kernel.org"
<linux-iio@...r.kernel.org>,
"devicetree@...r.kernel.org"
<devicetree@...r.kernel.org>
Subject: RE: [PATCH v4 4/9] iio: imu: inv_icm45600: add IMU IIO gyroscope
device
>
>
>From: Jonathan Cameron <jic23@...nel.org>
>Sent: Saturday, August 16, 2025 2:08 PM
>To: Remi Buisson via B4 Relay <devnull+remi.buisson.tdk.com@...nel.org>
>Cc: Remi Buisson <Remi.Buisson@....com>; David Lechner <dlechner@...libre.com>; Nuno Sá <nuno.sa@...log.com>; Andy Shevchenko <andy@...nel.org>; Rob Herring <robh@...nel.org>; Krzysztof Kozlowski <krzk+dt@...nel.org>; Conor Dooley <conor+dt@...nel.org>; linux-kernel@...r.kernel.org; linux-iio@...r.kernel.org; devicetree@...r.kernel.org
>Subject: Re: [PATCH v4 4/9] iio: imu: inv_icm45600: add IMU IIO gyroscope device
>
>On Thu, 14 Aug 2025 08:57:18 +0000
>Remi Buisson via B4 Relay <devnull+remi.buisson.tdk.com@...nel.org> wrote:
>
>> From: Remi Buisson <remi.buisson@....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@....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.
Sure.
>
>> +{
>> + 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.
Unfortunately not, as it is used in the for loop conditions,
Moving it inside the loop creates an error:
error: ‘size’ undeclared (first use in this function); did you mean ‘ksize’?
750 | for (i = 0, no = 0; i < st->fifo.count; i += size, ++no) {
| ^~~~
| ksize
>
>> + &accel, &gyro, &temp, ×tamp, &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.
>
Sure.
>> + }
>> +
>> + return 0;
>> +}
>>
>
>
Powered by blists - more mailing lists