[PATCH v2 1/6] iio: imu: bmi270: Use INFO_SAMP_FREQ instead of INFO_FREQUENCY

Justin Weiss posted 6 patches 1 month, 1 week ago
There is a newer version of this series
[PATCH v2 1/6] iio: imu: bmi270: Use INFO_SAMP_FREQ instead of INFO_FREQUENCY
Posted by Justin Weiss 1 month, 1 week ago
Use IIO_CHAN_INFO_SAMP_FREQ instead of IIO_CHAN_INFO_FREQUENCY
to match the BMI160 / BMI323 drivers.

Fixes: 3ea51548d6b2 ("iio: imu: Add i2c driver for bmi270 imu")
Signed-off-by: Justin Weiss <justin@justinweiss.com>
---
 drivers/iio/imu/bmi270/bmi270_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/imu/bmi270/bmi270_core.c b/drivers/iio/imu/bmi270/bmi270_core.c
index aeda7c4228df..87036f352698 100644
--- a/drivers/iio/imu/bmi270/bmi270_core.c
+++ b/drivers/iio/imu/bmi270/bmi270_core.c
@@ -122,7 +122,7 @@ static const struct iio_info bmi270_info = {
 	.channel2 = IIO_MOD_##_axis,				\
 	.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),		\
 	.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE) |	\
-		BIT(IIO_CHAN_INFO_FREQUENCY),			\
+		BIT(IIO_CHAN_INFO_SAMP_FREQ),			\
 }
 
 #define BMI270_ANG_VEL_CHANNEL(_axis) {				\
@@ -131,7 +131,7 @@ static const struct iio_info bmi270_info = {
 	.channel2 = IIO_MOD_##_axis,				\
 	.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),		\
 	.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE) |	\
-		BIT(IIO_CHAN_INFO_FREQUENCY),			\
+		BIT(IIO_CHAN_INFO_SAMP_FREQ),			\
 }
 
 static const struct iio_chan_spec bmi270_channels[] = {
-- 
2.47.0
Re: [PATCH v2 1/6] iio: imu: bmi270: Use INFO_SAMP_FREQ instead of INFO_FREQUENCY
Posted by Jonathan Cameron 1 month, 1 week ago
On Fri, 18 Oct 2024 16:36:07 -0700
Justin Weiss <justin@justinweiss.com> wrote:

> Use IIO_CHAN_INFO_SAMP_FREQ instead of IIO_CHAN_INFO_FREQUENCY
> to match the BMI160 / BMI323 drivers.
> 
> Fixes: 3ea51548d6b2 ("iio: imu: Add i2c driver for bmi270 imu")
> Signed-off-by: Justin Weiss <justin@justinweiss.com>

Whilst this gets rid of the wrong attributes, they still aren't
wired up to anything either way so a read will always return an error.

For now, the fix is drop the bit and bring it back in a patch
that adds the read_raw handling for the sampling frequency
(patch 6 I think).

> ---
>  drivers/iio/imu/bmi270/bmi270_core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/imu/bmi270/bmi270_core.c b/drivers/iio/imu/bmi270/bmi270_core.c
> index aeda7c4228df..87036f352698 100644
> --- a/drivers/iio/imu/bmi270/bmi270_core.c
> +++ b/drivers/iio/imu/bmi270/bmi270_core.c
> @@ -122,7 +122,7 @@ static const struct iio_info bmi270_info = {
>  	.channel2 = IIO_MOD_##_axis,				\
>  	.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),		\
>  	.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE) |	\
> -		BIT(IIO_CHAN_INFO_FREQUENCY),			\
> +		BIT(IIO_CHAN_INFO_SAMP_FREQ),			\
>  }
>  
>  #define BMI270_ANG_VEL_CHANNEL(_axis) {				\
> @@ -131,7 +131,7 @@ static const struct iio_info bmi270_info = {
>  	.channel2 = IIO_MOD_##_axis,				\
>  	.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),		\
>  	.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE) |	\
> -		BIT(IIO_CHAN_INFO_FREQUENCY),			\
> +		BIT(IIO_CHAN_INFO_SAMP_FREQ),			\
>  }
>  
>  static const struct iio_chan_spec bmi270_channels[] = {
Re: [PATCH v2 1/6] iio: imu: bmi270: Use INFO_SAMP_FREQ instead of INFO_FREQUENCY
Posted by Justin Weiss 1 month, 1 week ago
Jonathan Cameron <jic23@kernel.org> writes:

> On Fri, 18 Oct 2024 16:36:07 -0700
> Justin Weiss <justin@justinweiss.com> wrote:
>
>> Use IIO_CHAN_INFO_SAMP_FREQ instead of IIO_CHAN_INFO_FREQUENCY
>> to match the BMI160 / BMI323 drivers.
>> 
>> Fixes: 3ea51548d6b2 ("iio: imu: Add i2c driver for bmi270 imu")
>> Signed-off-by: Justin Weiss <justin@justinweiss.com>
>
> Whilst this gets rid of the wrong attributes, they still aren't
> wired up to anything either way so a read will always return an error.
>
> For now, the fix is drop the bit and bring it back in a patch
> that adds the read_raw handling for the sampling frequency
> (patch 6 I think).

Makes sense. I'll remove both SCALE and FREQUENCY here, because neither
of them are wired up right now.

Justin

>> ---
>>  drivers/iio/imu/bmi270/bmi270_core.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>> 
>> diff --git a/drivers/iio/imu/bmi270/bmi270_core.c b/drivers/iio/imu/bmi270/bmi270_core.c
>> index aeda7c4228df..87036f352698 100644
>> --- a/drivers/iio/imu/bmi270/bmi270_core.c
>> +++ b/drivers/iio/imu/bmi270/bmi270_core.c
>> @@ -122,7 +122,7 @@ static const struct iio_info bmi270_info = {
>>  	.channel2 = IIO_MOD_##_axis,				\
>>  	.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),		\
>>  	.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE) |	\
>> -		BIT(IIO_CHAN_INFO_FREQUENCY),			\
>> +		BIT(IIO_CHAN_INFO_SAMP_FREQ),			\
>>  }
>>  
>>  #define BMI270_ANG_VEL_CHANNEL(_axis) {				\
>> @@ -131,7 +131,7 @@ static const struct iio_info bmi270_info = {
>>  	.channel2 = IIO_MOD_##_axis,				\
>>  	.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),		\
>>  	.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE) |	\
>> -		BIT(IIO_CHAN_INFO_FREQUENCY),			\
>> +		BIT(IIO_CHAN_INFO_SAMP_FREQ),			\
>>  }
>>  
>>  static const struct iio_chan_spec bmi270_channels[] = {