xref: /linux/Documentation/devicetree/bindings/regulator/pwm-regulator.yaml (revision 156010ed9c2ac1e9df6c11b1f688cf8a6e0152e6)
1# SPDX-License-Identifier: GPL-2.0
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/regulator/pwm-regulator.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Generic PWM Regulator
8
9maintainers:
10  - Brian Norris <briannorris@chromium.org>
11  - Lee Jones <lee@kernel.org>
12  - Alexandre Courbot <acourbot@nvidia.com>
13
14description: |
15  Currently supports 2 modes of operation:
16
17  Voltage Table:
18    When in this mode, a voltage table (See below) of predefined voltage <=>
19    duty-cycle values must be provided via DT. Limitations are that the
20    regulator can only operate at the voltages supplied in the table.
21    Intermediary duty-cycle values which would normally allow finer grained
22    voltage selection are ignored and rendered useless.  Although more control
23    is given to the user if the assumptions made in continuous-voltage mode do
24    not reign true.
25
26  Continuous Voltage:
27    This mode uses the regulator's maximum and minimum supplied voltages
28    specified in the regulator-{min,max}-microvolt properties to calculate
29    appropriate duty-cycle values.  This allows for a much more fine grained
30    solution when compared with voltage-table mode above.  This solution does
31    make an assumption that a %50 duty-cycle value will cause the regulator
32    voltage to run at half way between the supplied max_uV and min_uV values.
33
34  If voltage-table is provided, then the device will be used in Voltage Table
35  Mode.  If no voltage-table is provided, then the device will be used in
36  Continuous Voltage Mode.
37
38allOf:
39  - $ref: regulator.yaml#
40
41properties:
42  compatible:
43    const: pwm-regulator
44
45  pwms:
46    maxItems: 1
47
48  voltage-table:
49    description: Voltage and Duty-Cycle table.
50    $ref: /schemas/types.yaml#/definitions/uint32-matrix
51    items:
52      items:
53        - description: voltage in microvolts (uV)
54        - description: duty-cycle in percent (%)
55
56  enable-gpios:
57    description: Regulator enable GPIO
58    maxItems: 1
59
60   # Optional properties for Continuous mode:
61  pwm-dutycycle-unit:
62    description:
63      Integer value encoding the duty cycle unit. If not
64        defined, <100> is assumed, meaning that
65        pwm-dutycycle-range contains values expressed in
66        percent.
67    default: 100
68
69  pwm-dutycycle-range:
70    description:
71      Should contain 2 entries. The first entry is encoding
72        the dutycycle for regulator-min-microvolt and the
73        second one the dutycycle for regulator-max-microvolt.
74        Duty cycle values are expressed in pwm-dutycycle-unit.
75        If not defined, <0 100> is assumed.
76    $ref: /schemas/types.yaml#/definitions/uint32-array
77    items:
78      - description: the dutycycle for regulator-min-microvolt
79      - description: the dutycycle for regulator-max-microvolt
80    default: [ 0 100 ]
81
82required:
83  - compatible
84  - pwms
85
86unevaluatedProperties: false
87
88examples:
89  - |
90    #include <dt-bindings/gpio/gpio.h>
91
92    // Continuous Voltage With Enable GPIO Example:
93    regulator {
94        compatible = "pwm-regulator";
95        pwms = <&pwm1 0 8448 0>;
96        enable-gpios = <&gpio0 23 GPIO_ACTIVE_HIGH>;
97        regulator-min-microvolt = <1016000>;
98        regulator-max-microvolt = <1114000>;
99        regulator-name = "vdd_logic";
100        /* unit == per-mille */
101        pwm-dutycycle-unit = <1000>;
102        /*
103        * Inverted PWM logic, and the duty cycle range is limited
104        * to 30%-70%.
105        */
106        pwm-dutycycle-range = <700 300>; /* */
107    };
108
109  - |
110    // Voltage Table Example:
111    regulator {
112        compatible = "pwm-regulator";
113        pwms = <&pwm1 0 8448 0>;
114        regulator-min-microvolt = <1016000>;
115        regulator-max-microvolt = <1114000>;
116        regulator-name = "vdd_logic";
117
118                /* Voltage Duty-Cycle */
119        voltage-table = <1114000 0>,
120            <1095000 10>,
121            <1076000 20>,
122            <1056000 30>,
123            <1036000 40>,
124            <1016000 50>;
125    };
126...
127