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