diff mbox series

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

Message ID 20230523124354.24294-1-mike.looijmans@topic.nl (mailing list archive)
State Deferred
Headers show
Series [1/2] dt-bindings: iio: adc: Add microchip MCP3561/2/4R devices | expand

Commit Message

Mike Looijmans May 23, 2023, 12:43 p.m. UTC
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.

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

---

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

Comments

Conor Dooley May 23, 2023, 4 p.m. UTC | #1
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@microchip.com/

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

Cheers,
Conor.

> 
> Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
> 
> ---
> 
>  .../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@topic.nl>
> +
> +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
> 
> 
> 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: mike.looijmans@topicproducts.com
> W: www.topic.nl
> 
> Please consider the environment before printing this e-mail
Mike Looijmans May 24, 2023, 9:02 a.m. UTC | #2
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@microchip.com/
> 
> 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@topic.nl>
>>
>> ---
>>
>>   .../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@topic.nl>
>> +
>> +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@topic.nl
W: www.topic.nl
Rob Herring (Arm) June 8, 2023, 7:52 p.m. UTC | #3
On Wed, May 24, 2023 at 11:02:39AM +0200, Mike Looijmans wrote:
> 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@microchip.com/
> > 
> > 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...)

b4 is The Way. Assuming you have mutt setup to reply, just pass a msgid 
or lore url to this script:

#!/bin/sh -e

if [ -z $1 ]; then
        echo "Usage: $0 [b4 mbox options] <messageId>"
        exit 1
fi

msgid=$1

tmpfile=$(mktemp)

b4 mbox -o - "$*" > $tmpfile
mutt -f $tmpfile

rm $tmpfile
diff mbox series

Patch

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@topic.nl>
+
+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>;
+      };
+    };