[3/4] dt-bindings: iio: dac: add mcp4822

Message ID 20230405140114.99011-4-frattaroli.nicolas@gmail.com
State New
Headers
Series Add MCP48XX bindings and driver support |

Commit Message

Nicolas Frattaroli April 5, 2023, 2:01 p.m. UTC
  The MCP4801, MCP4802, MCP4811, MCP4812, MCP4821, and MCP4822 are
SPI digital-to-analog converters by Microchip, which have an
internal voltage reference, in contrast to the MCP49xx series
of DACs which use an external voltage reference.

Thus, these need a separate binding, as to not overcomplicate
the mcp4922 binding.

Signed-off-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
---
 .../bindings/iio/dac/microchip,mcp4822.yaml   | 49 +++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/dac/microchip,mcp4822.yaml
  

Comments

Nicolas Frattaroli April 5, 2023, 2:17 p.m. UTC | #1
On Mittwoch, 5. April 2023 16:10:10 CEST Krzysztof Kozlowski wrote:
> On 05/04/2023 16:01, Nicolas Frattaroli wrote:
> > The MCP4801, MCP4802, MCP4811, MCP4812, MCP4821, and MCP4822 are
> > SPI digital-to-analog converters by Microchip, which have an
> > internal voltage reference, in contrast to the MCP49xx series
> > of DACs which use an external voltage reference.
> > 
> > Thus, these need a separate binding, as to not overcomplicate
> > the mcp4922 binding.
> 
> The difference is just one property which is very easy to handle - one
> allOf:if:then: with
>     vref-supply: false
> 
> Are there any other differences?
> 
> Best regards,
> Krzysztof
> 
> 

In place of the external vref input, the MCP48XX series chips also
have a "SHDN" input, which is an active-low pin to disable the whole
chip and put it in a low power state. Future users of the bindings
may want to model this as being tied to some GPIO, though I haven't
done it here since I don't care about this feature.

Kind regards,
Nicolas Frattaroli
  
Krzysztof Kozlowski April 6, 2023, 6:58 p.m. UTC | #2
On 05/04/2023 16:17, Nicolas Frattaroli wrote:
> On Mittwoch, 5. April 2023 16:10:10 CEST Krzysztof Kozlowski wrote:
>> On 05/04/2023 16:01, Nicolas Frattaroli wrote:
>>> The MCP4801, MCP4802, MCP4811, MCP4812, MCP4821, and MCP4822 are
>>> SPI digital-to-analog converters by Microchip, which have an
>>> internal voltage reference, in contrast to the MCP49xx series
>>> of DACs which use an external voltage reference.
>>>
>>> Thus, these need a separate binding, as to not overcomplicate
>>> the mcp4922 binding.
>>
>> The difference is just one property which is very easy to handle - one
>> allOf:if:then: with
>>     vref-supply: false
>>
>> Are there any other differences?
>>
>> Best regards,
>> Krzysztof
>>
>>
> 
> In place of the external vref input, the MCP48XX series chips also
> have a "SHDN" input, which is an active-low pin to disable the whole
> chip and put it in a low power state. Future users of the bindings
> may want to model this as being tied to some GPIO, though I haven't
> done it here since I don't care about this feature.

OK to keep them separate, but then you should add here powerdown-gpios.
Bindings should be complete.

Best regards,
Krzysztof
  

Patch

diff --git a/Documentation/devicetree/bindings/iio/dac/microchip,mcp4822.yaml b/Documentation/devicetree/bindings/iio/dac/microchip,mcp4822.yaml
new file mode 100644
index 000000000000..c6eaf0079add
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/dac/microchip,mcp4822.yaml
@@ -0,0 +1,49 @@ 
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/dac/microchip,mcp4822.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Microchip MCP4801, MCP4802, MCP4811, MCP4812, MCP4821 and MCP4822 SPI DACs
+
+maintainers:
+  - Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
+
+properties:
+  compatible:
+    enum:
+      - microchip,mcp4801
+      - microchip,mcp4802
+      - microchip,mcp4811
+      - microchip,mcp4812
+      - microchip,mcp4821
+      - microchip,mcp4822
+
+  reg:
+    maxItems: 1
+
+  vdd-supply: true
+
+required:
+  - compatible
+  - reg
+  - vdd-supply
+
+allOf:
+  - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    spi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        dac@0 {
+            compatible = "microchip,mcp4821";
+            reg = <0>;
+            vdd-supply = <&dac_reg>;
+        };
+    };
+...