Re: [PATCH v2 5/6] iio: imu: bmi270: Add triggered buffer for Bosch BMI270 IMU
From: Justin Weiss
Date: Sat Oct 19 2024 - 16:52:43 EST
Jonathan Cameron <jic23@xxxxxxxxxx> writes:
> On Fri, 18 Oct 2024 16:36:11 -0700
> Justin Weiss <justin@xxxxxxxxxxxxxxx> wrote:
>
>> Set up a triggered buffer for the accel and angl_vel values.
>>
>> Signed-off-by: Justin Weiss <justin@xxxxxxxxxxxxxxx>
> Looks good. One trivial comment inline.
>
> Thanks,
>
> Jonathan
>
>> ---
>> drivers/iio/imu/bmi270/Kconfig | 1 +
>> drivers/iio/imu/bmi270/bmi270.h | 9 +++++
>> drivers/iio/imu/bmi270/bmi270_core.c | 56 ++++++++++++++++++++++++++++
>> 3 files changed, 66 insertions(+)
>>
>> diff --git a/drivers/iio/imu/bmi270/Kconfig b/drivers/iio/imu/bmi270/Kconfig
>> index 0ffd29794fda..6362acc706da 100644
>> --- a/drivers/iio/imu/bmi270/Kconfig
>> +++ b/drivers/iio/imu/bmi270/Kconfig
>> @@ -6,6 +6,7 @@
>> config BMI270
>> tristate
>> select IIO_BUFFER
>> + select IIO_TRIGGERED_BUFFER
>>
>> config BMI270_I2C
>> tristate "Bosch BMI270 I2C driver"
>> diff --git a/drivers/iio/imu/bmi270/bmi270.h b/drivers/iio/imu/bmi270/bmi270.h
>> index 51e374fd4290..844d70a7d32e 100644
>> --- a/drivers/iio/imu/bmi270/bmi270.h
>> +++ b/drivers/iio/imu/bmi270/bmi270.h
>> @@ -11,6 +11,15 @@ struct bmi270_data {
>> struct device *dev;
>> struct regmap *regmap;
>> const struct bmi270_chip_info *chip_info;
>> +
>> + /*
>> + * Where IIO_DMA_MINALIGN is larger than 8 bytes, align to that
>
> maybe larger than 8 bytes
> on x86_64 I think it is 8 bytes exactly, though I could be remembering that wrong.
Got it. I'll change this to "... IIO_DMA_MINALIGN may be larger than 8
bytes, ..." in v3.
Justin
>> + * to ensure a DMA safe buffer.
>> + */
>> + struct {
>> + __le16 channels[6];
>> + aligned_s64 timestamp;
>> + } data __aligned(IIO_DMA_MINALIGN);
>> };
>>