# Generic PWM Regulator

_Peios Kernel / Hardware and drivers / Device-tree binding reference / Regulator bindings_

> Device-tree binding reference for Generic PWM Regulator.

<!-- SPDX-License-Identifier: GPL-2.0 -->


<a id="dt-root"></a>

**Schema identifier (<code>&#36;id</code>):** <span id="dt-09f478f44eb202ea573e"><code>&#34;http&#58;&#47;&#47;devicetree&#46;org&#47;schemas&#47;regulator&#47;pwm&#45;regulator&#46;yaml&#35;&#34;</code></span>

**Schema dialect (<code>&#36;schema</code>):** <span id="dt-dcb375baab6014763a68"><code>&#34;http&#58;&#47;&#47;devicetree&#46;org&#47;meta&#45;schemas&#47;core&#46;yaml&#35;&#34;</code></span>

<a id="dt-e46b5a5dd81dbd751c9f"></a>

**Maintainers (<code>maintainers</code>):** <a id="dt-fbc39820abb8bb999095"></a> <span id="dt-fb78ddfc22abfc6fe56d"><code>&#34;Brian Norris &#60;briannorris&#64;chromium&#46;org&#62;&#34;</code></span>, <span id="dt-0f999bb9185dbf6b58d8"><code>&#34;Lee Jones &#60;lee&#64;kernel&#46;org&#62;&#34;</code></span>, <span id="dt-2f1516674166ff6e66b8"><code>&#34;Alexandre Courbot &#60;acourbot&#64;nvidia&#46;com&#62;&#34;</code></span>

<div id="dt-6d1c5ef59f0239d38c02">
<p style="white-space: pre-wrap">Currently supports 2 modes of operation:</p>
<pre><code>Voltage Table:
  When in this mode, a voltage table (See below) of predefined voltage &lt;=&gt;
  duty-cycle values must be provided via DT. Limitations are that the
  regulator can only operate at the voltages supplied in the table.
  Intermediary duty-cycle values which would normally allow finer grained
  voltage selection are ignored and rendered useless.  Although more control
  is given to the user if the assumptions made in continuous-voltage mode do
  not reign true.</code></pre>
<pre><code>Continuous Voltage:
  This mode uses the regulator's maximum and minimum supplied voltages
  specified in the regulator-{min,max}-microvolt properties to calculate
  appropriate duty-cycle values.  This allows for a much more fine grained
  solution when compared with voltage-table mode above.  This solution does
  make an assumption that a %50 duty-cycle value will cause the regulator
  voltage to run at half way between the supplied max_uV and min_uV values.</code></pre>
<p style="white-space: pre-wrap">If voltage-table is provided, then the device will be used in Voltage Table
Mode.  If no voltage-table is provided, then the device will be used in
Continuous Voltage Mode.</p>
</div>

<a id="dt-935ee547587f3e75de61"></a>

## All of these rules must match (<code>allOf</code>)

<a id="dt-d33de94ac1d3652cd22a"></a>

### Rule 1

> **Shared schema rule (<code>&#36;ref</code>):** <span id="dt-95c8874f25311f4b1ab1">[<code>regulator&#46;yaml&#35;</code>](</kernel/hardware/devicetree-bindings/dt-regulator/regulator.md#dt-root>)</span>

<a id="dt-e1f655ed0ff4d595dadc"></a>

## Properties and child nodes (<code>properties</code>)

<a id="dt-5c1d81699dcbe840de83"></a>

### <code>compatible</code> — required here

**Exact value (<code>const</code>):** <span id="dt-1765195bf8e86c3ccec6"><code>&#34;pwm&#45;regulator&#34;</code></span>

<a id="dt-4a7041c930b420fcb4d6"></a>

### <code>pwms</code> — required here

**Maximum number of items (<code>maxItems</code>):** <span id="dt-92a0cfeeb9788737f274"><code>1</code></span>

<a id="dt-2c12b6c5656c8a008e8d"></a>

### <code>voltage&#45;table</code> — not listed as required here

<div id="dt-2260d26eec550c1d4993">
<p style="white-space: pre-wrap">Voltage and Duty-Cycle table.</p>
</div>

**Shared schema rule (<code>&#36;ref</code>):** <span id="dt-14a669544900c0fe0bed">[<code>&#47;schemas&#47;types&#46;yaml&#35;&#47;definitions&#47;uint32&#45;matrix</code>](</kernel/hardware/devicetree-bindings/dt-shared/types.md#dt-d948f2945b497d9aa3c7>)</span>

<a id="dt-466781fabceb3dcd3193"></a>

#### Array item rules (<code>items</code>)

> <a id="dt-46728d6876b5581da6b0"></a>
>
> **Array item rules (<code>items</code>)**
>
> <a id="dt-3b088de7481c577a3b33"></a>
>
> **Item 1**
>
> > <div id="dt-c80f1f8026ee95a6dd74">
> > <p style="white-space: pre-wrap">voltage in microvolts (uV)</p>
> > </div>
>
> <a id="dt-bb830c32bbc3db097798"></a>
>
> **Item 2**
>
> > <div id="dt-b867ce2ae6a23e8ee1ae">
> > <p style="white-space: pre-wrap">duty-cycle in percent (%)</p>
> > </div>

<a id="dt-0d068058a6f4b36b1505"></a>

### <code>enable&#45;gpios</code> — not listed as required here

<div id="dt-2169b15d9fc9d03c1e0f">
<p style="white-space: pre-wrap">Regulator enable GPIO</p>
</div>

**Maximum number of items (<code>maxItems</code>):** <span id="dt-3ea466d5c9323bd58f62"><code>1</code></span>

<a id="dt-9aa2389761dec9e9aceb"></a>

### <code>pwm&#45;dutycycle&#45;unit</code> — not listed as required here

<div id="dt-1801b99769cdc507bbbf">
<p style="white-space: pre-wrap">Integer value encoding the duty cycle unit. If not defined, &lt;100&gt; is assumed, meaning that pwm-dutycycle-range contains values expressed in percent.</p>
</div>

**Shared schema rule (<code>&#36;ref</code>):** <span id="dt-831706c31f713bdf6e44">[<code>&#47;schemas&#47;types&#46;yaml&#35;&#47;definitions&#47;uint32</code>](</kernel/hardware/devicetree-bindings/dt-shared/types.md#dt-d57795d6573ee5d67d37>)</span>

**Default value (<code>default</code>):** <span id="dt-1f2d17af8d57afc4cd22"><code>100</code></span>

<a id="dt-cf63899c7376e0f23da3"></a>

### <code>pwm&#45;dutycycle&#45;range</code> — not listed as required here

<div id="dt-b6709a62a6920b85b5bc">
<p style="white-space: pre-wrap">Should contain 2 entries. The first entry is encoding the dutycycle for regulator-min-microvolt and the second one the dutycycle for regulator-max-microvolt. Duty cycle values are expressed in pwm-dutycycle-unit. If not defined, &lt;0 100&gt; is assumed.</p>
</div>

**Shared schema rule (<code>&#36;ref</code>):** <span id="dt-4eae30f3a72d85848369">[<code>&#47;schemas&#47;types&#46;yaml&#35;&#47;definitions&#47;uint32&#45;array</code>](</kernel/hardware/devicetree-bindings/dt-shared/types.md#dt-03a03f95a666fe4b033c>)</span>

<a id="dt-fb6bec2d3ccd95d7a80b"></a>

#### Array item rules (<code>items</code>)

<a id="dt-7e4ebcc5d757ecee5218"></a>

**Item 1**

> <div id="dt-29add71dbede63c2b230">
> <p style="white-space: pre-wrap">the dutycycle for regulator-min-microvolt</p>
> </div>

<a id="dt-bc9f1a5670411a241806"></a>

**Item 2**

> <div id="dt-962fee405e3db80fa05b">
> <p style="white-space: pre-wrap">the dutycycle for regulator-max-microvolt</p>
> </div>

**Default value (<code>default</code>):** <a id="dt-b2dde9894abe9597be98"></a> <span id="dt-45a7a1551916ebd92f30"><code>&#34;0 100&#34;</code></span>

**Required in this object (<code>required</code>):** <a id="dt-8313173ff1c9b300d560"></a> <span id="dt-048b70ee865d6847aa3d"><code>&#34;compatible&#34;</code></span>, <span id="dt-ee7433925c1528c16b99"><code>&#34;pwms&#34;</code></span>

<a id="dt-63ab525a9812ac23c446"></a>

## Properties not evaluated by applicable rules (<code>unevaluatedProperties</code>)

<code>false</code>

Not allowed by this rule.

<a id="dt-1a130cabaa8a47b058bf"></a>

## Examples (<code>examples</code>)

<pre id="dt-0bd6510295af0c95ff2d"><code class="language-dts">#include &lt;dt-bindings/gpio/gpio.h&gt;

// Continuous Voltage With Enable GPIO Example:
regulator {
    compatible = "pwm-regulator";
    pwms = &lt;&amp;pwm1 0 8448 0&gt;;
    enable-gpios = &lt;&amp;gpio0 23 GPIO_ACTIVE_HIGH&gt;;
    regulator-min-microvolt = &lt;1016000&gt;;
    regulator-max-microvolt = &lt;1114000&gt;;
    regulator-name = "vdd_logic";
    /* unit == per-mille */
    pwm-dutycycle-unit = &lt;1000&gt;;
    /*
    * Inverted PWM logic, and the duty cycle range is limited
    * to 30%-70%.
    */
    pwm-dutycycle-range = &lt;700 300&gt;; /* */
};
</code></pre>

<pre id="dt-bae0d43ea48e35208b4a"><code class="language-dts">// Voltage Table Example:
regulator {
    compatible = "pwm-regulator";
    pwms = &lt;&amp;pwm1 0 8448 0&gt;;
    regulator-min-microvolt = &lt;1016000&gt;;
    regulator-max-microvolt = &lt;1114000&gt;;
    regulator-name = "vdd_logic";

            /* Voltage Duty-Cycle */
    voltage-table = &lt;1114000 0&gt;,
        &lt;1095000 10&gt;,
        &lt;1076000 20&gt;,
        &lt;1056000 30&gt;,
        &lt;1036000 40&gt;,
        &lt;1016000 50&gt;;
};
</code></pre>

## Source notes

<details>
<summary>Annotations retained from the schema source</summary>

<p id="dt-comment-0"><strong>Line 1:</strong> <span> SPDX-License-Identifier: GPL-2.0</span></p>

<p id="dt-comment-1"><strong>Line 60:</strong> <span> Optional properties for Continuous mode:</span></p>

</details>
