# simple battery chargers only communicating through GPIOs

_Peios Kernel / Hardware and drivers / Device-tree binding reference / Power bindings / supply_

> Device-tree binding reference for simple battery chargers only communicating through GPIOs.

<!-- 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;power&#47;supply&#47;gpio&#45;charger&#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;Sebastian Reichel &#60;sre&#64;kernel&#46;org&#62;&#34;</code></span>

<div id="dt-6d1c5ef59f0239d38c02">
<p style="white-space: pre-wrap">This binding is for all chargers, which are working more or less autonomously, only providing some status GPIOs and possibly some GPIOs for limited control over the charging process.</p>
</div>

<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;gpio&#45;charger&#34;</code></span>

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

### <code>charger&#45;type</code> — not listed as required here

**Allowed values (<code>enum</code>):** <a id="dt-ddd973f4bce321aa4de4"></a> <span id="dt-56afd7713e6dd40e45d5"><code>&#34;unknown&#34;</code></span>, <span id="dt-9d69eb6b8a249ba4e9c2"><code>&#34;battery&#34;</code></span>, <span id="dt-fd06d3367aed6bf1ced8"><code>&#34;ups&#34;</code></span>, <span id="dt-b09ca7c166b9e7bc222a"><code>&#34;mains&#34;</code></span>, <span id="dt-b41d47fcd29d21835184"><code>&#34;usb&#45;sdp&#34;</code></span>, <span id="dt-2615b73d7ff0cff8062e"><code>&#34;usb&#45;dcp&#34;</code></span>, <span id="dt-a0bb38f20635e44ff40c"><code>&#34;usb&#45;cdp&#34;</code></span>, <span id="dt-d8a89c4c6733f95a4f66"><code>&#34;usb&#45;aca&#34;</code></span>

<div id="dt-2601b4d9701f294b3b1f">
<p style="white-space: pre-wrap">Type of the charger, e.g. "mains" for a wall charger.</p>
</div>

<a id="dt-6423357510c4f559d9df"></a>

### <code>gpios</code> — not listed as required here

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

<div id="dt-e9a56736b9784e1b506e">
<p style="white-space: pre-wrap">GPIO indicating the charger presence</p>
</div>

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

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

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

<div id="dt-fbd1dfe3c4d71f6329df">
<p style="white-space: pre-wrap">GPIO indicating the charging status</p>
</div>

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

### <code>charge&#45;current&#45;limit&#45;gpios</code> — not listed as required here

**Minimum number of items (<code>minItems</code>):** <span id="dt-d1e17e46c3a2b16c2880"><code>1</code></span>

**Maximum number of items (<code>maxItems</code>):** <span id="dt-c625ec763a37db5b3299"><code>32</code></span>

<div id="dt-f5b221bdf36ae2653c01">
<p style="white-space: pre-wrap">GPIOs used for current limiting</p>
</div>

<a id="dt-56b67483e1019d43ef28"></a>

### <code>charge&#45;current&#45;limit&#45;mapping</code> — not listed as required here

<div id="dt-f0c2857b6decff0c0385">
<p style="white-space: pre-wrap">List of tuples with current in uA and a GPIO bitmap (in this order). The tuples must be provided in descending order of the current limit.</p>
</div>

**Shared schema rule (<code>&#36;ref</code>):** <span id="dt-e665a0403cc5bca28586">[<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-3df07149f2979a340fe0"></a>

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

> <a id="dt-50d21098609b60c97aa0"></a>
>
> **Array item rules (<code>items</code>)**
>
> <a id="dt-30eea4b5b82ec88a562e"></a>
>
> **Item 1**
>
> > <div id="dt-ea49c2feb53244072b21">
> > <p style="white-space: pre-wrap">Current limit in uA</p>
> > </div>
>
> <a id="dt-e701c6ce759a06378132"></a>
>
> **Item 2**
>
> > <div id="dt-2eb071ef2fb364b1facc">
> > <p style="white-space: pre-wrap">Encoded GPIO setting. Bit 0 represents last GPIO from the charge-current-limit-gpios property. Bit 1 second to last GPIO and so on.</p>
> > </div>

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

### <code>charge&#45;current&#45;limit&#45;default&#45;microamp</code> — not listed as required here

<div id="dt-af8a2003510f1c24bd27">
<p style="white-space: pre-wrap">Default charge current limit. Must be listed in charge-current-limit-mapping.</p>
</div>

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

<a id="dt-413065af65ac6af8f24e"></a>

## At least one of these rules must match (<code>anyOf</code>)

<a id="dt-96eb361b08260472facb"></a>

### Rule 1

> **Required in this object (<code>required</code>):** <a id="dt-a3ce052275bac2469e04"></a> <span id="dt-396aa8b3d1b1aeeb2c7a"><code>&#34;gpios&#34;</code></span>

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

### Rule 2

> **Required in this object (<code>required</code>):** <a id="dt-bb61b4b3827abc4e9b85"></a> <span id="dt-cffc196e945e46f91e3a"><code>&#34;charge&#45;status&#45;gpios&#34;</code></span>

<a id="dt-604844a603b89bc24dae"></a>

### Rule 3

> **Required in this object (<code>required</code>):** <a id="dt-c2acffc92d010c18f5e1"></a> <span id="dt-1359536c869a5c387788"><code>&#34;charge&#45;current&#45;limit&#45;gpios&#34;</code></span>

<a id="dt-3d235861b18e278e9c09"></a>

## Property dependencies (<code>dependencies</code>)

<a id="dt-105543fa19af883de463"></a>

### <code>charge&#45;current&#45;limit&#45;gpios</code> — applies when this property is present

Also requires: <span id="dt-f802e5ee09b47557ddd7"><code>&#34;charge&#45;current&#45;limit&#45;mapping&#34;</code></span>

<a id="dt-83b2a230f2f5f24169ce"></a>

### <code>charge&#45;current&#45;limit&#45;mapping</code> — applies when this property is present

Also requires: <span id="dt-1f3a8fdc493c1c78a359"><code>&#34;charge&#45;current&#45;limit&#45;gpios&#34;</code></span>

<a id="dt-3e0e45818dd325b152cd"></a>

### <code>charge&#45;current&#45;limit&#45;default&#45;microamp</code> — applies when this property is present

Also requires: <span id="dt-059bee0be7882866180c"><code>&#34;charge&#45;current&#45;limit&#45;mapping&#34;</code></span>

<a id="dt-738c4b4f9e483441138b"></a>

## Properties not matched by properties or patternProperties in this schema (<code>additionalProperties</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;

charger {
  compatible = "gpio-charger";
  charger-type = "usb-sdp";

  gpios = &lt;&amp;gpd 28 GPIO_ACTIVE_LOW&gt;;
  charge-status-gpios = &lt;&amp;gpc 27 GPIO_ACTIVE_LOW&gt;;

  charge-current-limit-gpios = &lt;&amp;gpioA 11 GPIO_ACTIVE_HIGH&gt;,
                               &lt;&amp;gpioA 12 GPIO_ACTIVE_HIGH&gt;;
  charge-current-limit-mapping = &lt;2500000 0x00&gt;, // 2.5 A =&gt; both GPIOs low
                                 &lt;700000 0x01&gt;, // 700 mA =&gt; GPIO A.12 high
                                 &lt;0 0x02&gt;; // 0 mA =&gt; GPIO A.11 high
  charge-current-limit-default-microamp = &lt;700000&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 27:</strong> <span> USB standard downstream port</span></p>

<p id="dt-comment-2"><strong>Line 28:</strong> <span> USB dedicated charging port</span></p>

<p id="dt-comment-3"><strong>Line 29:</strong> <span> USB charging downstream port</span></p>

<p id="dt-comment-4"><strong>Line 30:</strong> <span> USB accessory charger adapter</span></p>

</details>
