dt-bindings: iio: adc: ti-ads1298: Add bindings
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): 1b153bce-a66a-45ee-a5c6-963ea6fb1c82.949ef384-8293-46b8-903f-40a477c056ae.70c52742-e0f9-4db1-8f1b-864f11c71a24@emailsignatures365.codetwo.com
PATCH v5 1/2 dt-bindings: iio: adc: ti-ads1298: Add bindings
Bindings for the TI ADS1298 medical ADC. This device is typically used for ECG and similar measurements. Supports data acquisition at configurable scale and sampling frequency.
The device has so many options for connecting stuff, at this point the bindings aren't nearly complete but partial bindings are better than no bindings at all.
---
(no changes since v2)
Changes in v2:
Remove "clk" name
Add datasheet and "incomplete" note
.../bindings/iio/adc/ti,ads1298.yaml | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/adc/ti,ads1298.yaml
Documentation/devicetree/bindings/iio/adc/ti,ads1298.yaml new file +80 -0
@@ -0,0 +1,80 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/adc/ti,ads1298.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Texas Instruments' ads1298 medical ADC chips + +description: | + Datasheet at: https://www.ti.com/product/ADS1298 + Bindings for this chip aren't complete. + +maintainers: + - Mike Looijmans <[email protected]> + +properties: + compatible: + enum: + - ti,ads1298 + + reg: + maxItems: 1 + + spi-cpha: true + + reset-gpios: + maxItems: 1 + + avdd-supply: + description: + Analog power supply, voltage between AVDD and AVSS. When providing a + symmetric +/- 2.5V, the regulator should report 5V. + + vref-supply: + description: + Optional reference voltage. If omitted, internal reference is used, + which is 2.4V when analog supply is below 4.4V, 4V otherwise. + + clocks: + description: Optional 2.048 MHz external source clock on CLK pin + maxItems: 1 + + interrupts: + description: Interrupt on DRDY pin, triggers on falling edge + maxItems: 1 + + label: true + +required: + - compatible + - reg + - avdd-supply + - interrupts + +allOf: + - $ref: /schemas/spi/spi-peripheral-props.yaml# + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + #include <dt-bindings/interrupt-controller/irq.h> + spi { + #address-cells = <1>; + #size-cells = <0>; + + adc@1 { + reg = <1>; + compatible = "ti,ads1298"; + label = "ads1298-1-ecg"; + avdd-supply = <®_iso_5v_a>; + clocks = <&clk_ads1298>; + interrupt-parent = <&gpio0>; + interrupts = <78 IRQ_TYPE_EDGE_FALLING>; + spi-max-frequency = <20000000>; + spi-cpha; + }; + }; +...
Signature · 18 lines
2.34.1 Met vriendelijke groet / kind regards, Mike Looijmans System Expert TOPIC Embedded Products B.V. Materiaalweg 4, 5681 RJ Best The Netherlands T: +31 (0) 499 33 69 69 E: [email protected] W: www.topic.nl Please consider the environment before printing this e-mail
PATCH v5 2/2 iio: adc: ti-ads1298: Add driver
Skeleton driver for the TI ADS1298 medical ADC. This device is typically used for ECG and similar measurements. Supports data acquisition at configurable scale and sampling frequency.
---
Changes in v5:
Derive the name from the chip ID register Fail probe if the ID is unknown
Interpret the number of channels (only tested the "8")
Changes in v4:
Explain rdata_xfer_busy better and remove post-decrement Reset assert explanation and add cansleep Additional style changes
Changes in v3:
Indentation fixups
Remove unused headers
Remove #define leftovers
Use devm_get_clk_optional_enabled
Use ilog2 instead of fls()-1
Magic "23" replaced
Explain the extra "0" in read/write register
use guard() from cleanup.h
use REGCACHE_MAPLE
Changes in v2:
Remove accidental "default y" in Kconfig
Indentation and similar cosmetic fixes
Magic numbers into constants
Short return paths in read_raw and write_raw
DMA buffer alignment
Bounce buffer is u32 instead of u8
Avoid races using claim_direct_mode
Check errors on all register accesses
Immediate SPI restart to reduce underruns
"name" is chip name, not unique
drivers/iio/adc/Kconfig | 11 + drivers/iio/adc/Makefile | 1 + drivers/iio/adc/ti-ads1298.c | 768 +++++++++++++++++++++++++++++++++++ 3 files changed, 780 insertions(+) create mode 100644 drivers/iio/adc/ti-ads1298.c
drivers/iio/adc/Kconfig +11 -0
@@ -1318,6 +1318,17 @@ config TI_ADS8688 This driver can also be built as a module. If so, the module will be called ti-ads8688. +config TI_ADS1298 + tristate "Texas Instruments ADS1298" + depends on SPI + select IIO_BUFFER + help + If you say yes here you get support for Texas Instruments ADS1298 + medical ADC chips + + This driver can also be built as a module. If so, the module will be + called ti-ads1298. + config TI_ADS124S08 tristate "Texas Instruments ADS124S08" depends on SPI
drivers/iio/adc/Makefile +1 -0
@@ -117,6 +117,7 @@ obj-$(CONFIG_TI_ADS7924) += ti-ads7924.o obj-$(CONFIG_TI_ADS7950) += ti-ads7950.o obj-$(CONFIG_TI_ADS8344) += ti-ads8344.o obj-$(CONFIG_TI_ADS8688) += ti-ads8688.o +obj-$(CONFIG_TI_ADS1298) += ti-ads1298.o obj-$(CONFIG_TI_ADS124S08) += ti-ads124s08.o obj-$(CONFIG_TI_ADS131E08) += ti-ads131e08.o obj-$(CONFIG_TI_AM335X_ADC) += ti_am335x_adc.o
drivers/iio/adc/ti-ads1298.c new file +768 -0
768 lines not on this page · raw message
Signature · 18 lines
2.34.1 Met vriendelijke groet / kind regards, Mike Looijmans System Expert TOPIC Embedded Products B.V. Materiaalweg 4, 5681 RJ Best The Netherlands T: +31 (0) 499 33 69 69 E: [email protected] W: www.topic.nl Please consider the environment before printing this e-mail
Jonathan Cameron
maintainerRe: [PATCH v5 2/2] iio: adc: ti-ads1298: Add driver
Quoted 11 lines · On Fri, 16 Feb 2024 16:30:20 +0100 Mike Looijmans <[email protected]>…
Skeleton driver for the TI ADS1298 medical ADC. This device is typically used for ECG and similar measurements. Supports data acquisition at configurable scale and sampling frequency.
Signed-off-by Mike Looijmans <[email protected]>---
Changes in v5:
Derive the name from the chip ID register
Fail probe if the ID is unknown
This is a fun corner when it comes to DT bindings where we may have fallback compatibles for parts introduced in the future. For those we are supposed to ignore ID registers and just assume they are correct (in IIO I tends to suggest we print a message to say we are carrying on despite not recognising the ID) We could go half way here and assume the channel count can always be gotten from the register, but relax the family bit to allow families that aren't yet 'born'.
If we don't assume channel count, we would need to add explicit entries to the ID tables for each of the device supported.
Anyhow, I have no problem leaving that as a problem for another day.
Quoted 1 line
Interpret the number of channels (only tested the "8")
The way you've done this will not work if you want to add a timestamp (which is tricky in this device anyway) but for now it is fine.
I tweaked the order in kconfig and Makefile whilst applying. The relevant sections aren't in alphanumeric order as currently the TI parts with longer names come later. Having said that this fits better after ADS1100 than where you have it so I've moved it up to there.
However...
CHECK drivers/iio/adc/ti-ads1298.cdrivers/iio/adc/ti-ads1298.c:424:13: warning: context imbalance in 'ads1298_rdata_unmark_busy' - wrong count at exit drivers/iio/adc/ti-ads1298.c:465:9: warning: context imbalance in 'ads1298_rdata_release_busy_or_restart' - wrong count at exit drivers/iio/adc/ti-ads1298.c:531:9: warning: context imbalance in 'ads1298_interrupt' - wrong count at exit
MODPOST Module.symvers
sparse isn't happy (and I upgraded it to make sure I had anything new for guard() etc)
I think it is the missing context tracking referred to here:
https://lore.kernel.org/linux-sparse/[email protected]/
Anyhow, looks like false positives so applied to the togreg branch of iio.git but first pushed out as testing to let 0-day take a look.
Thanks,
Jonathan