Skip to contentSkip to conversation

Initial filtering (hardware) control for IIO.

PATCH In review Jonathan Cameron 2 participants 5 messages Nov 27, 2011

Subsystems (4)
lore
Share & tools
lore

Jonathan Cameron

author maintainer
#0 lore raw

cover Initial filtering (hardware) control for IIO.

Hi Greg,

Thanks for merging all those patches yesterday.

These have been sitting in my tree and on linux-iio for far too long. I think all issues raised about the initial patch set were answered and fear this is not of sufficient interest to anyone to get a second review!

Anyhow fairly uncontroversial support for the low pass filters on the ADI imu units.

Original message was:

Hi All,

Technically this has all been on list before, just now it is in a coherent patch set.

Introduces low pass filter controls and description via 3db point. JohnLM suggested a whole load more stuff that we might want to know about filters. Whilst I am in favour of adding these at somepoint I think it should be as and when we have a user. I believe the naming here allows space for all the other things that have been suggested.

Thanks.

v1->v2 Added documentation.

Jonathan Cameron (3):
staging:iio: filter description - low pass 3db frequency. staging:iio:imu:adis16400 add control of data filtering. staging:iio:documentation: document filter_low_pass_3db_frequency.

 drivers/staging/iio/Documentation/sysfs-bus-iio |   10 ++
 drivers/staging/iio/iio.h                       |    7 +
 drivers/staging/iio/imu/adis16400.h             |    2 +
 drivers/staging/iio/imu/adis16400_core.c        |  177 ++++++++++++++++++-----
 drivers/staging/iio/industrialio-core.c         |    2 +
 5 files changed, 161 insertions(+), 37 deletions(-)
Signature · 1 line
1.7.7.3
author maintainer
#1 lore raw

PATCH 1/3 staging:iio: filter description - low pass 3db frequency.

From: Jonathan Cameron <[email protected]>

Introduce the first data filtering related parameter. For now we are ignoring the filter type and merely specifying its approximate (I read them off tiny graphs) 3db point.

---
 drivers/staging/iio/iio.h               |    7 +++++++
 drivers/staging/iio/industrialio-core.c |    2 ++
 2 files changed, 9 insertions(+), 0 deletions(-)
drivers/staging/iio/iio.h +7 -0
index 66c2604..4aed915 100644
@@ -35,6 +35,7 @@ enum iio_chan_info_enum {
 	IIO_CHAN_INFO_PEAK_SCALE,
 	IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW,
 	IIO_CHAN_INFO_AVERAGE_RAW,
+	IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY,
 };
 
 #define IIO_CHAN_INFO_SHARED_BIT(type) BIT(type*2)
@@ -74,6 +75,12 @@ enum iio_chan_info_enum {
 	IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_AVERAGE_RAW)
 #define IIO_CHAN_INFO_AVERAGE_RAW_SHARED_BIT			\
 	IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_AVERAGE_RAW)
+#define IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY_SHARED_BIT \
+	IIO_CHAN_INFO_SHARED_BIT(			       \
+		IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY)
+#define IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY_SEPARATE_BIT \
+	IIO_CHAN_INFO_SEPARATE_BIT(			       \
+		IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY)
 
 enum iio_endian {
 	IIO_CPU,
drivers/staging/iio/industrialio-core.c +2 -0
index 0b67166..55c0b48 100644
@@ -85,6 +85,8 @@ static const char * const iio_chan_info_postfix[] = {
 	[IIO_CHAN_INFO_PEAK_SCALE] = "peak_scale",
 	[IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW] = "quadrature_correction_raw",
 	[IIO_CHAN_INFO_AVERAGE_RAW] = "mean_raw",
+	[IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY]
+	= "filter_low_pass_3db_frequency",
 };
 
 /**
Signature · 1 line
1.7.7.3
author maintainer
#2 lore raw

PATCH 2/3 staging:iio:imu:adis16400 add control of data filtering.

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Bartlett filter used. Values read of figures on datasheet so far from precise.

---
 drivers/staging/iio/imu/adis16400.h      |    2 +
 drivers/staging/iio/imu/adis16400_core.c |  177 +++++++++++++++++++++++------
 2 files changed, 142 insertions(+), 37 deletions(-)
drivers/staging/iio/imu/adis16400.h +2 -0
index f3546ee..83d133e 100644
@@ -148,12 +148,14 @@ struct adis16400_chip_info {
  * @tx:			transmit buffer
  * @rx:			receive buffer
  * @buf_lock:		mutex to protect tx and rx
+ * @filt_int:		integer part of requested filter frequency
  **/
 struct adis16400_state {
 	struct spi_device		*us;
 	struct iio_trigger		*trig;
 	struct mutex			buf_lock;
 	struct adis16400_chip_info	*variant;
+	int				filt_int;
 
 	u8	tx[ADIS16400_MAX_TX] ____cacheline_aligned;
 	u8	rx[ADIS16400_MAX_RX] ____cacheline_aligned;
drivers/staging/iio/imu/adis16400_core.c +140 -37

385 lines not on this page · raw message

Signature · 1 line
1.7.7.3
author maintainer
#3 lore raw

PATCH 3/3 staging:iio:documentation: document filter_low_pass_3db_frequency.

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Add the sysfs ABI docs for all current instances of this parameter.

---
 drivers/staging/iio/Documentation/sysfs-bus-iio |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
drivers/staging/iio/Documentation/sysfs-bus-iio +10 -0
index 0d6823d..46a995d 100644
@@ -276,6 +276,16 @@ Description:
 		If a discrete set of scale values are available, they
 		are listed in this attribute.
 
+What:		/sys/.../in_accel_filter_low_pass_3db_frequency
+What:		/sys/.../in_magn_filter_low_pass_3db_frequency
+What:		/sys/.../in_anglvel_filter_low_pass_3db_frequency
+KernelVersion:	3.2
+Contact:	[email protected]
+Description:
+		If a known or controllable low pass filter is applied
+		to the underlying data channel, then this parameter
+		gives the 3dB frequency of the filter in Hz.
+
 What:		/sys/bus/iio/devices/iio:deviceX/out_voltageY_raw
 KernelVersion:	2.6.37
 Contact:	[email protected]
Signature · 1 line
1.7.7.3
#4 lore raw
In reply to Jonathan Cameron
Quoted 11 lines · Jonathan Cameron

Hi Greg,

Thanks for merging all those patches yesterday.

These have been sitting in my tree and on linux-iio for far too long. I think all issues raised about the initial patch set were answered and fear this is not of sufficient interest to anyone to get a second review!

Anyhow fairly uncontroversial support for the low pass filters on the ADI imu units.

All now applied, thanks.

greg k-h