Hi all,
Attached link is the app note I used as reference for programming the max14001,
which I found to provide a much easier approach. You can find it here:
https://www.analog.com/media/en/technical-documentation/user-guides/guide-to-programming-the-max14001max14002-isolated-adcs--maxim-integrated.pdf
The code has been tested and is working fine with the max14001pmb and
max14001evsys boards on the Raspberry Pi 4.
Changes in v3:
max14001:
* Replaced __cacheline_aligned with __aligned(IIO_DMA_MINALIGN).
* Removed redundant assignment of the tx variable in the max14001_write()
and max14001_read() functions.
* Assigned struct device *dev with &spi->dev to improve code readability.
* Utilized a non-regmap approach and ensure a consistent use of interface
throughout the driver code. I attempted to use the regmap API but faced
difficulties in implementing it due to the timing diagram requirements.
Specifically, the need to change the chip select between transfers, which, as
far as I know, is not applicable with regmap. While I am open to thorough
guidance and suggestions on utilizing the regmap API, for now, I have chosen
to stick with the non-regmap approach.
bindings:
* Utilized the default register values, which led to the omission of some
properties in v2. I plan to include and switch to generic values the excluded
properties in v1 in future support.
* Dropped the status property.
* Moved the allOf property after the required property for better alignment.
Best Regards,
Kim Seer Paller
Kim Seer Paller (2):
dt-bindings:iio:adc: add max14001
iio: adc: max14001: New driver
.../bindings/iio/adc/adi,max14001.yaml | 54 +++
MAINTAINERS | 8 +
drivers/iio/adc/Kconfig | 10 +
drivers/iio/adc/Makefile | 1 +
drivers/iio/adc/max14001.c | 337 ++++++++++++++++++
5 files changed, 410 insertions(+)
create mode 100644 Documentation/devicetree/bindings/iio/adc/adi,max14001.yaml
create mode 100644 drivers/iio/adc/max14001.c
base-commit: 9561de3a55bed6bdd44a12820ba81ec416e705a7
--
2.34.1
The MAX14001 is configurable, isolated 10-bit ADCs for multi-range
binary inputs.
Signed-off-by: Kim Seer Paller <[email protected]>
---
.../bindings/iio/adc/adi,max14001.yaml | 54 +++++++++++++++++++
MAINTAINERS | 7 +++
2 files changed, 61 insertions(+)
create mode 100644 Documentation/devicetree/bindings/iio/adc/adi,max14001.yaml
diff --git a/Documentation/devicetree/bindings/iio/adc/adi,max14001.yaml b/Documentation/devicetree/bindings/iio/adc/adi,max14001.yaml
new file mode 100644
index 000000000000..9d03c611fca3
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/adc/adi,max14001.yaml
@@ -0,0 +1,54 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2023 Analog Devices Inc.
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/adc/adi,max14001.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Analog Devices MAX14001 ADC
+
+maintainers:
+ - Kim Seer Paller <[email protected]>
+
+description: |
+ Single channel 10 bit ADC with SPI interface. Datasheet
+ can be found here:
+ https://www.analog.com/media/en/technical-documentation/data-sheets/MAX14001-MAX14002.pdf
+
+properties:
+ compatible:
+ enum:
+ - adi,max14001
+
+ reg:
+ maxItems: 1
+
+ spi-max-frequency:
+ maximum: 5000000
+
+ vref-supply:
+ description: Voltage reference to establish input scaling.
+
+required:
+ - compatible
+ - reg
+
+allOf:
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ spi {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ adc@0 {
+ compatible = "adi,max14001";
+ reg = <0>;
+ spi-max-frequency = <5000000>;
+ vref-supply = <&vref_reg>;
+ };
+ };
+...
diff --git a/MAINTAINERS b/MAINTAINERS
index 0dab9737ec16..b8ad615d011f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -12660,6 +12660,13 @@ S: Maintained
F: Documentation/devicetree/bindings/sound/max9860.txt
F: sound/soc/codecs/max9860.*
+MAX14001 IIO ADC DRIVER
+M: Kim Seer Paller <[email protected]>
+L: [email protected]
+S: Supported
+W: https://ez.analog.com/linux-software-drivers
+F: Documentation/devicetree/bindings/iio/dac/adi,max14001.yaml
+
MAXBOTIX ULTRASONIC RANGER IIO DRIVER
M: Andreas Klinger <[email protected]>
L: [email protected]
--
2.34.1
On 08/06/2023 19:55, Kim Seer Paller wrote:
> The MAX14001 is configurable, isolated 10-bit ADCs for multi-range
> binary inputs.
Subject: still missing spaces, no improvements.
This is a friendly reminder during the review process.
It seems my previous comments were not fully addressed. Maybe my
feedback got lost between the quotes, maybe you just forgot to apply it.
Please go back to the previous discussion and either implement all
requested changes or keep discussing them.
Thank you.
With subject fixed:
Reviewed-by: Krzysztof Kozlowski <[email protected]>
---
This is an automated instruction, just in case, because many review tags
are being ignored. If you do not know the process, here is a short
explanation:
Please add Acked-by/Reviewed-by/Tested-by tags when posting new
versions, under or above your Signed-off-by tag. Tools like b4 can help
here. However, there's no need to repost patches *only* to add the tags.
The upstream maintainer will do that for acks received on the version
they apply.
https://elixir.bootlin.com/linux/v5.17/source/Documentation/process/submitting-patches.rst#L540
Best regards,
Krzysztof