Skip to contentSkip to conversation

iio: imu: inv_mpu6050: advertise max and min freqs

PATCH In review Martin Kelly 3 participants 5 messages May 15, 2018 – May 21, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: imu: inv_mpu6050: advertise max and min freqs

Currently, we allow a minimum FIFO rate of 4 and a max of 1000, but we advertise down to only 10 and up to 1000. Expand the advertised range to reflect the full available range.

---
 drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +1 -1
index 43fba5f7532b..3f4862f09db3 100644
@@ -799,7 +799,7 @@ static const struct iio_chan_spec inv_mpu_channels[] = {
 };
 
 /* constant IIO attribute */
-static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("10 20 50 100 200 500");
+static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("4 10 20 50 100 200 500 1000");
 static IIO_CONST_ATTR(in_anglvel_scale_available,
 					  "0.000133090 0.000266181 0.000532362 0.001064724");
 static IIO_CONST_ATTR(in_accel_scale_available,
Signature · 1 line
2.11.0
#1 lore raw
Quoted 26 lines · Martin Kelly

CAUTION: This email originated from outside of the organization. Please make sure the sender is who they say they are and do not click links or open attachments unless you recognize the sender and know the content is safe.

Currently, we allow a minimum FIFO rate of 4 and a max of 1000, but we advertise down to only 10 and up to 1000. Expand the advertised range to reflect the full available range.

---
  drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +1 -2
index 43fba5f7532b..3f4862f09db3 100644
@@ -799,7 +799,7 @@ static const struct iio_chan_spec inv_mpu_channels[] = {
  };
 
  /* constant IIO attribute */
-static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("10 20 50 100 200 500");
+static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("4 10 20 50 100 200 500 1000");
  static IIO_CONST_ATTR(in_anglvel_scale_available,
                                           "0.000133090 0.000266181 0.000532362 0.001064724");
  static IIO_CONST_ATTR(in_accel_scale_available,
--
Quoted 2 lines

2.11.0

Hello,

in fact we advertise only frequencies that are supported by the low-pass filter. Filter bandwidths are: 5Hz, 10Hz, 20Hz, 42Hz (~50), 98Hz (~100), 188Hz (~200), which are corresponding to a sampling rate of (x2): 10Hz, 20Hz, ~50Hz, ~200Hz, ~400Hz. Only 500Hz is a little out of specs, since 400Hz is not a possible frequency.

You can always set the frequency to any supported values, but you can suffer from aliasing.

I strongly suggest we just keep it like it is today. Better not advertise frequencies that are not correctly filtered.

JB

#2 lore raw
Quoted 35 lines · Jean-Baptiste Maneyrol
Quoted 25 lines · Martin Kelly

CAUTION: This email originated from outside of the organization. Please make sure the sender is who they say they are and do not click links or open attachments unless you recognize the sender and know the content is safe.

Currently, we allow a minimum FIFO rate of 4 and a max of 1000, but we advertise down to only 10 and up to 1000. Expand the advertised range to reflect the full available range.

---
  drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +1 -1
index 43fba5f7532b..3f4862f09db3 100644
@@ -799,7 +799,7 @@ static const struct iio_chan_spec 
 inv_mpu_channels[] = {
   };
 
   /* constant IIO attribute */
-static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("10 20 50 100 200 500");
+static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("4 10 20 50 100 200 500 1000");
   static IIO_CONST_ATTR(in_anglvel_scale_available,
                                            "0.000133090 0.000266181 0.000532362 0.001064724");
Quoted 4 lines

  static IIO_CONST_ATTR(in_accel_scale_available,

Signature · 1 line
2.11.0

Hello,

Quoted 7 lines

in fact we advertise only frequencies that are supported by the low-pass filter. Filter bandwidths are: 5Hz, 10Hz, 20Hz, 42Hz (~50), 98Hz (~100), 188Hz (~200), which are corresponding to a sampling rate of (x2): 10Hz, 20Hz, ~50Hz, ~200Hz, ~400Hz. Only 500Hz is a little out of specs, since 400Hz is not a possible frequency.

You can always set the frequency to any supported values, but you can suffer from aliasing.

I strongly suggest we just keep it like it is today. Better not advertise frequencies that are not correctly filtered.

JB

OK, that makes sense and is fine with me. Perhaps I should instead just add a comment explaining the situation, since I couldn't tell from the code itself.

#3 lore raw
Quoted 50 lines · On Wed, 16 May 2018 09:07:53 -0700 Martin Kelly <[email protected]> wrote:
Quoted 49 lines · Jean-Baptiste Maneyrol
Quoted 28 lines · Martin Kelly

CAUTION: This email originated from outside of the organization. Please make sure the sender is who they say they are and do not click links or open attachments unless you recognize the sender and know the content is safe.

Currently, we allow a minimum FIFO rate of 4 and a max of 1000, but we advertise down to only 10 and up to 1000. Expand the advertised range to reflect the full available range.

---
  drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +1 -1
index 43fba5f7532b..3f4862f09db3 100644
@@ -799,7 +799,7 @@ static const struct iio_chan_spec 
 inv_mpu_channels[] = {
   };
 
   /* constant IIO attribute */
-static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("10 20 50 100 200 500");
+static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("4 10 20 50 100 200 500 1000");
   static IIO_CONST_ATTR(in_anglvel_scale_available,
Quoted 6 lines

                                           "0.000133090 0.000266181 0.000532362 0.001064724");
  static IIO_CONST_ATTR(in_accel_scale_available,

Signature · 1 line
2.11.0

Hello,

in fact we advertise only frequencies that are supported by the low-pass filter. Filter bandwidths are: 5Hz, 10Hz, 20Hz, 42Hz (~50), 98Hz (~100), 188Hz (~200), which are corresponding to a sampling rate of (x2): 10Hz, 20Hz, ~50Hz, ~200Hz, ~400Hz. Only 500Hz is a little out of specs, since 400Hz is not a possible frequency.

You can always set the frequency to any supported values, but you can suffer from aliasing.

Quoted 8 lines
Quoted 4 lines

I strongly suggest we just keep it like it is today. Better not advertise frequencies that are not correctly filtered.

JB

OK, that makes sense and is fine with me. Perhaps I should instead just add a comment explaining the situation, since I couldn't tell from the code itself.

Hmm. If this wasn't already the case I would advocate never allowing the user to pick frequencies where the device effectively won't work properly.

Ah well, too late now as they are in the ABI. Agreed a comment would avoid anyone trying to figure this out in future.

Jonathan

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
Quoted 61 lines · Jonathan Cameron
Quoted 50 lines · On Wed, 16 May 2018 09:07:53 -0700 Martin Kelly <[email protected]> wrote:
Quoted 49 lines · Jean-Baptiste Maneyrol
Quoted 29 lines · Martin Kelly

CAUTION: This email originated from outside of the organization. Please make sure the sender is who they say they are and do not click links or open attachments unless you recognize the sender and know the content is safe.

Currently, we allow a minimum FIFO rate of 4 and a max of 1000, but we advertise down to only 10 and up to 1000. Expand the advertised range to reflect the full available range.

---
   drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +1 -1
index 43fba5f7532b..3f4862f09db3 100644
@@ -799,7 +799,7 @@ static const struct iio_chan_spec
 inv_mpu_channels[] = {
   };
 
   /* constant IIO attribute */
-static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("10 20 50 100 200 500");
+static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("4 10 20 50 100 200 500 1000");
   static IIO_CONST_ATTR(in_anglvel_scale_available,
                                            "0.000133090 0.000266181
Quoted 5 lines

0.000532362 0.001064724");
  static IIO_CONST_ATTR(in_accel_scale_available,

Signature · 1 line
2.11.0

Hello,

in fact we advertise only frequencies that are supported by the low-pass filter. Filter bandwidths are: 5Hz, 10Hz, 20Hz, 42Hz (~50), 98Hz (~100), 188Hz (~200), which are corresponding to a sampling rate of (x2): 10Hz, 20Hz, ~50Hz, ~200Hz, ~400Hz. Only 500Hz is a little out of specs, since 400Hz is not a possible frequency.

You can always set the frequency to any supported values, but you can suffer from aliasing.

Quoted 8 lines
Quoted 4 lines

I strongly suggest we just keep it like it is today. Better not advertise frequencies that are not correctly filtered.

JB

OK, that makes sense and is fine with me. Perhaps I should instead just add a comment explaining the situation, since I couldn't tell from the code itself.

Quoted 8 lines

Hmm. If this wasn't already the case I would advocate never allowing the user to pick frequencies where the device effectively won't work properly.

Ah well, too late now as they are in the ABI. Agreed a comment would avoid anyone trying to figure this out in future.

Jonathan

OK, I sent a patch adding an explanatory comment.