1# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/iio/adc/amlogic,meson-saradc.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Amlogic Meson SAR (Successive Approximation Register) A/D converter
8
9maintainers:
10  - Martin Blumenstingl <martin.blumenstingl@googlemail.com>
11
12description:
13  Binding covers a range of ADCs found on Amlogic Meson SoCs.
14
15properties:
16  compatible:
17    oneOf:
18      - const: amlogic,meson-saradc
19      - items:
20          - enum:
21              - amlogic,meson8-saradc
22              - amlogic,meson8b-saradc
23              - amlogic,meson8m2-saradc
24              - amlogic,meson-gxbb-saradc
25              - amlogic,meson-gxl-saradc
26              - amlogic,meson-gxm-saradc
27              - amlogic,meson-axg-saradc
28              - amlogic,meson-g12a-saradc
29          - const: amlogic,meson-saradc
30
31  reg:
32    maxItems: 1
33
34  interrupts:
35    description: Interrupt indicates end of sampling.
36    maxItems: 1
37
38  clocks:
39    minItems: 2
40    maxItems: 4
41
42  clock-names:
43    minItems: 2
44    maxItems: 4
45    items:
46      - const: clkin
47      - const: core
48      - const: adc_clk
49      - const: adc_sel
50
51  vref-supply: true
52
53  "#io-channel-cells":
54    const: 1
55
56  amlogic,hhi-sysctrl:
57    $ref: /schemas/types.yaml#/definitions/phandle
58    description:
59      Syscon which contains the 5th bit of the TSC (temperature sensor
60      coefficient) on Meson8b and Meson8m2 (which used to calibrate the
61      temperature sensor)
62
63  nvmem-cells:
64    description: phandle to the temperature_calib eFuse cells
65    maxItems: 1
66
67  nvmem-cell-names:
68    const: temperature_calib
69
70allOf:
71  - if:
72      properties:
73        compatible:
74          contains:
75            enum:
76              - amlogic,meson8-saradc
77              - amlogic,meson8b-saradc
78              - amlogic,meson8m2-saradc
79    then:
80      properties:
81        clocks:
82          maxItems: 2
83        clock-names:
84          maxItems: 2
85    else:
86      properties:
87        nvmem-cells: false
88        mvmem-cel-names: false
89        clocks:
90          minItems: 4
91        clock-names:
92          minItems: 4
93
94  - if:
95      properties:
96        compatible:
97          contains:
98            enum:
99              - amlogic,meson8b-saradc
100              - amlogic,meson8m2-saradc
101    then:
102      properties:
103        amlogic,hhi-sysctrl: true
104    else:
105      properties:
106        amlogic,hhi-sysctrl: false
107
108required:
109  - compatible
110  - reg
111  - interrupts
112  - clocks
113  - clock-names
114  - "#io-channel-cells"
115
116additionalProperties: false
117
118examples:
119  - |
120    #include <dt-bindings/interrupt-controller/irq.h>
121    #include <dt-bindings/clock/gxbb-clkc.h>
122    #include <dt-bindings/interrupt-controller/arm-gic.h>
123    soc {
124        #address-cells = <2>;
125        #size-cells = <2>;
126        adc@8680 {
127            compatible = "amlogic,meson-gxl-saradc", "amlogic,meson-saradc";
128            #io-channel-cells = <1>;
129            reg = <0x0 0x8680 0x0 0x34>;
130            interrupts = <GIC_SPI 73 IRQ_TYPE_EDGE_RISING>;
131            clocks = <&xtal>,
132                <&clkc CLKID_SAR_ADC>,
133                <&clkc CLKID_SAR_ADC_CLK>,
134                <&clkc CLKID_SAR_ADC_SEL>;
135            clock-names = "clkin", "core", "adc_clk", "adc_sel";
136        };
137        adc@9680 {
138            compatible = "amlogic,meson8b-saradc", "amlogic,meson-saradc";
139            #io-channel-cells = <1>;
140            reg = <0x0 0x9680 0x0 0x34>;
141            interrupts = <GIC_SPI 73 IRQ_TYPE_EDGE_RISING>;
142            clocks = <&xtal>, <&clkc CLKID_SAR_ADC>;
143            clock-names = "clkin", "core";
144            nvmem-cells = <&tsens_caldata>;
145            nvmem-cell-names = "temperature_calib";
146            amlogic,hhi-sysctrl = <&hhi>;
147        };
148    };
149...
150