[PATCH 7/8] iio: imu: inv_mpu6050: align buffer for timestamp
Jonathan Cameron
jic23 at kernel.org
Fri Apr 18 08:02:38 PDT 2025
On Fri, 18 Apr 2025 11:26:39 +0000
Jean-Baptiste Maneyrol <Jean-Baptiste.Maneyrol at tdk.com> wrote:
> On Thu, 17 Apr 2025 19:46:00, Jonathan Cameron wrote:
> > On Thu, 17 Apr 2025 20:00:05 +0300
> > Andy Shevchenko <andy at kernel.org> wrote:
> >
> > > On Thu, Apr 17, 2025 at 11:52:39AM -0500, David Lechner wrote:
> > > > Align the buffer used with iio_push_to_buffers_with_timestamp() to
> > > > ensure the s64 timestamp is aligned to 8 bytes.
> > >
> > > Same question as per previous patch.
> > >
> > In this case I don't think we know the position of the timestamp
> > so a structure would be misleading.
> >
> > The comment above the define certainly suggests it is variable..
>
> I confirm timestamp position is changing depending on channels enabled. It
> can be at address 8, 16 or 24.
>
> If there is only 1 sensor enabled (6 bytes of data), timestamp is at address
> 8. 2 sensors (12 bytes of data), timestamp will be at address 16. 3 sensors
> for MPU-9xxx (19 bytes of data), timestamp will be at address 24.
>
> If the buffer is aligned on 8 bytes, it will always work without any problem.
>
> >
> > /*
> > * Maximum of 6 + 6 + 2 + 7 (for MPU9x50) = 21 round up to 24 and plus 8.
> > * May be less if fewer channels are enabled, as long as the timestamp
> > * remains 8 byte aligned
> > */
> > #define INV_MPU6050_OUTPUT_DATA_SIZE 32
>
> Thanks,
> JB
I applied this one as it stands with fixes tag and +CC stable.
Fixes: 0829edc43e0a ("iio: imu: inv_mpu6050: read the full fifo when processing data")
I thought about seeing if all the cases that are fixes are separable enough
to take through togreg-fixes whilst the with_ts() series goes through togreg
in parallel. I might see if that is doable easily.
Jonathan
More information about the Linux-mediatek
mailing list