Skip to contentSkip to conversation

Re-add filter_type/filter_mode

PATCH In review Marcelo Schmitt 2 participants 5 messages Feb 4, 2025 – Feb 8, 2025

Subsystems (3)
lore
Share & tools
lore

Marcelo Schmitt

author maintainer
#0 lore raw

v4 cover Re-add filter_type/filter_mode

Better document sysfs ABI for ADC digital filter configuration. Also update ad4130 driver to support the standardized IIO ABI for digital filter configuration.

Change log v3 -> v4
- Renamed in_voltage-voltage_filter_mode_available to in_voltage-voltage_filter_type_available instead of just removing the mode variant from sysfs-bus-iio.
- Added comment about backwards compatibility near ad4130 filter attribute declarations.
- Reordered patches so attributes are documented before use.
- Minor re-word of in_voltage-voltage_filter_mode_available text in sysfs-bus-iio-adc-ad4130 to make it more generic.
- Picked up review tags.

Change log v2 -> v3
- Added in_voltageY-voltageZ_filter_type to main IIO ADI doc too.
- Added filter_type attributes to ad4130 driver so it also supports the standardized ABI for digital filter configuration.
- No longer dropping AD4130 specific filter_type_available options from sysfs-bus-iio.
- Re-add sysfs-bus-iio-adc-ad4130 just mentioning the ABI at sysfs-bus-iio instead of repeating the doc.

Change log v1 -> v2
- Split into 3 patches.
- Re-added sysfs-bus-iio-adc-ad4130 to keep filter_mode separate from filter_type.
- Removed in_voltage-voltage_filter_mode_available from sysfs-bus-iio.
- Added deprecation notes in sysfs-bus-iio-adc-ad4130 asking to use filter_type for new drivers and referencing sysfs-bus-iio.
- Improved commit message with explanation about use of filter type attributes.
- Dropped AD4130 specific filter_type_available options from sysfs-bus-iio.

Link to v1: https://lore.kernel.org/linux-iio/b2132bd3ca1d64cdd8d5afab1f1f33c574718b50.1732901318.git.marcelo.schmitt@analog.com/
Link to v2: https://lore.kernel.org/linux-iio/[email protected]/
Link to v3: https://lore.kernel.org/linux-iio/[email protected]/

Marcelo Schmitt (3):
Documentation: ABI: IIO: Add filter_type documentation
Documentation: ABI: IIO: Re-add sysfs-bus-iio-adc-ad4130
iio: adc: ad4130: Add filter_type attributes

 Documentation/ABI/testing/sysfs-bus-iio       | 10 +++++++++-
 .../ABI/testing/sysfs-bus-iio-adc-ad4130      | 20 +++++++++++++++++++
 MAINTAINERS                                   |  1 +
 drivers/iio/adc/ad4130.c                      |  7 +++++++
 4 files changed, 37 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-adc-ad4130

base-commit: 9b75dd1b7d6b98699a104c6b1eec0c8817e5fd4b

Signature · 1 line
2.47.2
author maintainer
#1 lore raw

PATCH v4 1/3 Documentation: ABI: IIO: Add filter_type documentation

A previous patch added documentation for filter_type_available attributes. However, the description for the value attribute (filter_type) was missing. Add documentation for filter_type sysfs ABI.

Fixes 01bb12922b60 ("Documentation: ABI: added filter mode doc in sysfs-bus-iio")
---
 Documentation/ABI/testing/sysfs-bus-iio | 8 ++++++++
 1 file changed, 8 insertions(+)
Documentation/ABI/testing/sysfs-bus-iio +8 -0
index d97c35057a03..ff9cc09360dc 100644
@@ -2300,6 +2300,14 @@ Description:
 		* "sinc3+pf3" - Sinc3 + device specific Post Filter 3.
 		* "sinc3+pf4" - Sinc3 + device specific Post Filter 4.
 
+What:		/sys/bus/iio/devices/iio:deviceX/filter_type
+What:		/sys/bus/iio/devices/iio:deviceX/in_voltageY-voltageZ_filter_type
+KernelVersion:	6.1
+Contact:	[email protected]
+Description:
+		Specifies which filter type apply to the channel. The possible
+		values are given by the filter_type_available attribute.
+
 What:		/sys/.../events/in_proximity_thresh_either_runningperiod
 KernelVersion:	6.6
 Contact:	[email protected]
Signature · 1 line
2.47.2
author maintainer
#2 lore raw

PATCH v4 2/3 Documentation: ABI: IIO: Re-add sysfs-bus-iio-adc-ad4130

In reply to Marcelo Schmitt

The ad4130 driver exports in_voltageY-voltageZ_filter_mode and in_voltage-voltage_filter_mode_available attributes to user space. A previous patch merged the documentation for those attributes with the documentation for filter_type/filter_type_available into sysfs-bus-iio. Filter mode and filter type refer to the same feature which is the digital filter applied over ADC samples. However, since datasheets use the term filter type and ad4130 driver is the only one using filter_mode, deprecate the filter_mode ABI in favor of filter_type and keep the docs separate to avoid confusion and intricate attribute descriptions.

Fixes 01bb12922b60 ("Documentation: ABI: added filter mode doc in sysfs-bus-iio")
---
 Documentation/ABI/testing/sysfs-bus-iio       |  2 +-
 .../ABI/testing/sysfs-bus-iio-adc-ad4130      | 20 +++++++++++++++++++
 MAINTAINERS                                   |  1 +
 3 files changed, 22 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-adc-ad4130
Documentation/ABI/testing/sysfs-bus-iio +1 -1
index ff9cc09360dc..2f8898c1a664 100644
@@ -2277,7 +2277,7 @@ Description:
 		representing the sensor unique ID number.
 
 What:		/sys/bus/iio/devices/iio:deviceX/filter_type_available
-What:		/sys/bus/iio/devices/iio:deviceX/in_voltage-voltage_filter_mode_available
+What:		/sys/bus/iio/devices/iio:deviceX/in_voltage-voltage_filter_type_available
 KernelVersion:	6.1
 Contact:	[email protected]
 Description:
Documentation/ABI/testing/sysfs-bus-iio-adc-ad4130 new file +20 -0
new file mode 100644
index 000000000000..d3fad27421d6
@@ -0,0 +1,20 @@
+What:		/sys/bus/iio/devices/iio:deviceX/in_voltage-voltage_filter_mode_available
+KernelVersion:  6.2
+Contact:	[email protected]
+Description:
+		Reading returns a list with the possible filter modes.
+
+		This ABI is only kept for backwards compatibility and the values
+		returned are identical to filter_type_available attribute
+		documented in Documentation/ABI/testing/sysfs-bus-iio. Please,
+		use filter_type_available like ABI to provide filter options for
+		new drivers.
+
+What:		/sys/bus/iio/devices/iio:deviceX/in_voltageY-voltageZ_filter_mode
+KernelVersion:  6.2
+Contact:	[email protected]
+Description:
+		This ABI is only kept for backwards compatibility and the values
+		returned are identical to in_voltageY-voltageZ_filter_type
+		attribute documented in Documentation/ABI/testing/sysfs-bus-iio.
+		Please, use in_voltageY-voltageZ_filter_type for new drivers.
MAINTAINERS +1 -0
index 98a3c1e46311..28dbbf6d6efa 100644
@@ -1279,6 +1279,7 @@ M:	Cosmin Tanislav <[email protected]>
 L:	[email protected]
 S:	Supported
 W:	https://ez.analog.com/linux-software-drivers
+F:	Documentation/ABI/testing/sysfs-bus-iio-adc-ad4130
 F:	Documentation/devicetree/bindings/iio/adc/adi,ad4130.yaml
 F:	drivers/iio/adc/ad4130.c
 
Signature · 1 line
2.47.2
author maintainer
#3 lore raw

PATCH v4 3/3 iio: adc: ad4130: Add filter_type attributes

In reply to Marcelo Schmitt

Make filter control also available through filter_type attributes which are now standardized in main IIO ABI documentation.

---
 drivers/iio/adc/ad4130.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/iio/adc/ad4130.c +7 -0
index de32cc9d18c5..acc241cc0a7a 100644
@@ -939,9 +939,16 @@ static const struct iio_enum ad4130_filter_mode_enum = {
 };
 
 static const struct iio_chan_spec_ext_info ad4130_filter_mode_ext_info[] = {
+	/*
+	 * Intentional duplication of attributes to keep backwards compatibility
+	 * while standardizing over the main IIO ABI for digital filtering.
+	 */
 	IIO_ENUM("filter_mode", IIO_SEPARATE, &ad4130_filter_mode_enum),
 	IIO_ENUM_AVAILABLE("filter_mode", IIO_SHARED_BY_TYPE,
 			   &ad4130_filter_mode_enum),
+	IIO_ENUM("filter_type", IIO_SEPARATE, &ad4130_filter_mode_enum),
+	IIO_ENUM_AVAILABLE("filter_type", IIO_SHARED_BY_TYPE,
+			   &ad4130_filter_mode_enum),
 	{ }
 };
 
Signature · 1 line
2.47.2
maintainer
#4 lore raw
In reply to Marcelo Schmitt
Quoted 3 lines · On Tue, 4 Feb 2025 12:00:16 -0300 Marcelo Schmitt <[email protected]>…

Better document sysfs ABI for ADC digital filter configuration. Also update ad4130 driver to support the standardized IIO ABI for digital filter configuration.

Applied to the togreg branch of iio.git and pushed out as testing.

Thanks,

Jonathan

Quoted 48 lines

Change log v3 -> v4
- Renamed in_voltage-voltage_filter_mode_available to in_voltage-voltage_filter_type_available instead of just removing the mode variant from sysfs-bus-iio.
- Added comment about backwards compatibility near ad4130 filter attribute declarations.
- Reordered patches so attributes are documented before use.
- Minor re-word of in_voltage-voltage_filter_mode_available text in sysfs-bus-iio-adc-ad4130 to make it more generic.
- Picked up review tags.

Change log v2 -> v3
- Added in_voltageY-voltageZ_filter_type to main IIO ADI doc too.
- Added filter_type attributes to ad4130 driver so it also supports the standardized ABI for digital filter configuration.
- No longer dropping AD4130 specific filter_type_available options from sysfs-bus-iio.
- Re-add sysfs-bus-iio-adc-ad4130 just mentioning the ABI at sysfs-bus-iio instead of repeating the doc.

Change log v1 -> v2
- Split into 3 patches.
- Re-added sysfs-bus-iio-adc-ad4130 to keep filter_mode separate from filter_type.
- Removed in_voltage-voltage_filter_mode_available from sysfs-bus-iio.
- Added deprecation notes in sysfs-bus-iio-adc-ad4130 asking to use filter_type for new drivers and referencing sysfs-bus-iio.
- Improved commit message with explanation about use of filter type attributes.
- Dropped AD4130 specific filter_type_available options from sysfs-bus-iio.

Link to v1: https://lore.kernel.org/linux-iio/b2132bd3ca1d64cdd8d5afab1f1f33c574718b50.1732901318.git.marcelo.schmitt@analog.com/
Link to v2: https://lore.kernel.org/linux-iio/[email protected]/
Link to v3: https://lore.kernel.org/linux-iio/[email protected]/

Marcelo Schmitt (3):
Documentation: ABI: IIO: Add filter_type documentation
Documentation: ABI: IIO: Re-add sysfs-bus-iio-adc-ad4130
iio: adc: ad4130: Add filter_type attributes

 Documentation/ABI/testing/sysfs-bus-iio       | 10 +++++++++-
 .../ABI/testing/sysfs-bus-iio-adc-ad4130      | 20 +++++++++++++++++++
 MAINTAINERS                                   |  1 +
 drivers/iio/adc/ad4130.c                      |  7 +++++++
 4 files changed, 37 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-adc-ad4130

base-commit: 9b75dd1b7d6b98699a104c6b1eec0c8817e5fd4b