Re: [PATCH 1/2] dt-bindings: iio: adc: Add microchip MCP3561/2/4R devices

From: Mike Looijmans
Date: Wed May 24 2023 - 05:03:18 EST


On 23-05-2023 18:00, Conor Dooley wrote:
On Tue, May 23, 2023 at 02:43:53PM +0200, Mike Looijmans wrote:
The MCP3564R is a 24-bit ADC with 8 multiplexed inputs. The MCP3561R is
the same device with 2 inputs, the MCP3562R has 4 inputs. The device
contains one ADC and a multiplexer to select the inputs to the ADC.

My favourite - nothing for a while & then two come along almost at once!
https://lore.kernel.org/all/20230519160145.44208-2-marius.cristea@xxxxxxxxxxxxx/

Would you mind, since he seems to have sent it first, reviewing his
series?


Oh, damn. Want to, just have to figure out how I can reply to mails that I never got (had delivery turned off for linux-iio). Tips welcome (just send to me personally...)


I see lots of similarities, but also some differences. The main being that I aimed at being able to add buffer support (continuous sampling, IRQ driven).


Also spotted a minor bug in Marius' driver, so yeah, I definitely want to comment...



Cheers,
Conor.


Signed-off-by: Mike Looijmans <mike.looijmans@xxxxxxxx>

---

.../bindings/iio/adc/microchip,mcp356xr.yaml | 84 +++++++++++++++++++
1 file changed, 84 insertions(+)
create mode 100644 Documentation/devicetree/bindings/iio/adc/microchip,mcp356xr.yaml

diff --git a/Documentation/devicetree/bindings/iio/adc/microchip,mcp356xr.yaml b/Documentation/devicetree/bindings/iio/adc/microchip,mcp356xr.yaml
new file mode 100644
index 000000000000..4aef166894c8
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/adc/microchip,mcp356xr.yaml
@@ -0,0 +1,84 @@
+# SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
+# Copyright 2023 Topic Embedded Systems
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/adc/microchip,mcp356xr.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Microchip MCP3561R/MCP3562R/MCP3564R ADC
+
+maintainers:
+ - Mike Looijmans <mike.looijmans@xxxxxxxx>
+
+description: |
+ Bindings for the Microchip MCP356xR 8-channel ADC devices. Datasheet and info
+ can be found at: https://www.microchip.com/en-us/product/MCP3564R
+
+properties:
+ compatible:
+ enum:
+ - microchip,mcp3561r
+ - microchip,mcp3562r
+ - microchip,mcp3564r
+
+ reg:
+ maxItems: 1
+
+ spi-max-frequency:
+ maximum: 20000000
+
+ clocks:
+ description:
+ Phandle and clock identifier for external sampling clock.
+ If not specified, the internal crystal oscillator will be used.
+ maxItems: 1
+
+ interrupts:
+ description: IRQ line of the ADC
+ maxItems: 1
+
+ drive-open-drain:
+ description:
+ Whether to drive the IRQ signal as push-pull (default) or open-drain. Note
+ that the device requires this pin to become "high", otherwise it will stop
+ converting.
+ type: boolean
+
+ microchip,device-addr:
+ description: Device address when multiple chips are present on the same bus.
+ $ref: /schemas/types.yaml#/definitions/uint32
+ enum: [0, 1, 2, 3]
+ default: 1
+
+ vref-supply:
+ description:
+ Phandle to the external reference voltage supply.
+ If not specified, the internal voltage reference (2.4V) will be used.
+
+required:
+ - compatible
+ - reg
+ - interrupts
+
+allOf:
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ spi {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ adc@0 {
+ compatible = "microchip,mcp3564r";
+ reg = <0>;
+ interrupt-parent = <&gpio5>;
+ interrupts = <15 2>;
+ spi-max-frequency = <20000000>;
+ microchip,device-addr = <1>;
+ vref-supply = <&vref_reg>;
+ clocks = <&xtal>;
+ };
+ };
--
2.17.1


--
Mike Looijmans
System Expert

TOPIC Embedded Products B.V.
Materiaalweg 4, 5681 RJ Best
The Netherlands

T: +31 (0) 499 33 69 69
E: mike.looijmans@xxxxxxxx
W: www.topic.nl