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