iio: imu: inv_mpu6050: add comment about frequencies
Subsystems (2)
PATCH 1/1 iio: imu: inv_mpu6050: add comment about frequencies
Although the driver allows frequencies between 4 and 1000 Hz, only the frequencies advertised in the available frequencies file are backed properly by a low-pass filter to prevent aliasing, so it's best to use them. Since this is not obvious to the user, add a comment explaining what's going on.
--- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +8 -1
@@ -798,7 +798,14 @@ static const struct iio_chan_spec inv_mpu_channels[] = { INV_MPU6050_CHAN(IIO_ACCEL, IIO_MOD_Z, INV_MPU6050_SCAN_ACCL_Z), }; -/* constant IIO attribute */ +/* +* The user can choose any frequency between INV_MPU6050_MIN_FIFO_RATE and +* INV_MPU6050_MAX_FIFO_RATE, but only these frequencies are matched by the +* low-pass filter. Specifically, each of these sampling rates are about twice +* the bandwidth of a corresponding low-pass filter, which should eliminate +* aliasing following the Nyquist principle. By picking a frequency different +* from these, the user risks aliasing effects. +*/ static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("10 20 50 100 200 500"); static IIO_CONST_ATTR(in_anglvel_scale_available, "0.000133090 0.000266181 0.000532362 0.001064724");
Signature · 1 line
2.11.0
From: Martin Kelly <[email protected]>
Sent: Monday, May 21, 2018 20:41
To: [email protected]
Cc: Jean-Baptiste Maneyrol; Jonathan Cameron; Martin Kelly
Subject: [PATCH] iio: imu: inv_mpu6050: add comment about frequencies
Although the driver allows frequencies between 4 and 1000 Hz, only the frequencies advertised in the available frequencies file are backed properly by a low-pass filter to prevent aliasing, so it's best to use them. Since this is not obvious to the user, add a comment explaining what's going on.
---
=A0drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 9 ++++++++- =A01 file changed, 8 insertions(+), 1 deletion(-)
drivers/iio/imu/i= renamed from drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +0 -0
nv_mpu6050/inv_mpu_core.c
index 43fba5f7532b..f9c0624505a2 100644
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +0 -0
@@ -798,7 +798,14 @@ static const struct iio_chan_spec inv_mpu_channels[] =
=3D {
=A0=A0=A0=A0=A0=A0=A0 INV_MPU6050_CHAN(IIO_ACCEL, IIO_MOD_Z, INV_MPU6050_SC= AN_ACCL_Z),
=A0};
-/* constant IIO attribute */
+/*
+ * The user can choose any frequency between INV_MPU6050_MIN_FIFO_RATE and
+ * INV_MPU6050_MAX_FIFO_RATE, but only these frequencies are matched by th= e
+ * low-pass filter. Specifically, each of these sampling rates are about t= wice
+ * the bandwidth of a corresponding low-pass filter, which should eliminat= e
+ * aliasing following the Nyquist principle. By picking a frequency differ= ent
+ * from these, the user risks aliasing effects.
+ */
=A0static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("10 20 50 100 200 500"); =A0static IIO_CONST_ATTR(in_anglvel_scale_available, =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 "0.000133090 0.000266181 0= .000532362 0.001064724");
--
2.11.0
=
Jonathan Cameron
maintainerQuoted 15 lines · On Tue, 22 May 2018 12:55:23 +0000 Jean-Baptiste Maneyrol…
=20
=20
From: Martin Kelly <[email protected]>
Sent: Monday, May 21, 2018 20:41
To: [email protected]
Cc: Jean-Baptiste Maneyrol; Jonathan Cameron; Martin Kelly
Subject: [PATCH] iio: imu:inv_mpu6050: add comment about frequencies =20
Although the driver allows frequencies between 4 and 1000 Hz, only the frequencies advertised in the available frequencies file are backed properly by a low-pass filter to prevent aliasing, so it's best to use them. Since this is not obvious to the user, add a comment explaining what's going on.
=20
Quoted 1 line
Signed-off-by Martin Kelly <[email protected]>
Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it.
Thanks,
Jonathan
drivers/iio/imu=
Quoted 5 lines
---
=C2=A0drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 9 ++++++++- =C2=A01 file changed, 8 insertions(+), 1 deletion(-) =20drivers/iio/imu= renamed from drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +0
-0
/inv_mpu6050/inv_mpu_core.c
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c static const struct iio_chan_spec inv_mpu_channels[]=
Quoted 4 lines
index
43fba5f7532b..f9c0624505a2100644drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +0
-0@@ -798,7 +798,14 @@ static const struct iio_chan_spec inv_mpu_channels[]=
=3D {
Quoted 1 line
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 INV_MPU6050_CHAN(IIO_ACCEL, II=
O_MOD_Z, INV_MPU6050_SCAN_ACCL_Z),
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
Quoted 5 lines
=C2=A0};
=20drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +2
-1-/* constant IIO attribute */ +/* +* The user can choose any frequency between INV_MPU6050_MIN_FIFO_RATE a=
nd
Quoted 1 line
+ *
INV_MPU6050_MAX_FIFO_RATE, but only these frequencies are matched by =
the
Quoted 1 line
+ * low-pass filter. Specifically, each of these sampling rates are about=
twice
Quoted 1 line
+ * the bandwidth of a corresponding low-pass filter, which should elimin=
ate
Quoted 1 line
+ * aliasing following the Nyquist principle. By picking a frequency diff=
erent
Quoted 5 lines
+ * from these, the user risks aliasing effects.
+ */
=C2=A0staticIIO_CONST_ATTR_SAMP_FREQ_AVAIL("10 20 50 100 200 500"); =C2=A0static IIO_CONST_ATTR(in_anglvel_scale_available, =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 "0.000133090 0.000266181 0.000532362 0.001064724");
Quoted 7 lines
--
2.11.0
=20--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