# LEDs connected to GPIO lines

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

> Device-tree binding reference for LEDs connected to GPIO lines.

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


<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;leds&#47;leds&#45;gpio&#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;Jacek Anaszewski &#60;jacek&#46;anaszewski&#64;gmail&#46;com&#62;&#34;</code></span>, <span id="dt-0f999bb9185dbf6b58d8"><code>&#34;Pavel Machek &#60;pavel&#64;ucw&#46;cz&#62;&#34;</code></span>

<div id="dt-6d1c5ef59f0239d38c02">
<p style="white-space: pre-wrap">Each LED is represented as a sub-node of the gpio-leds device.  Each node's name represents the name of the corresponding LED.</p>
</div>

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

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

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

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

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

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

## Properties matching a name pattern (<code>patternProperties</code>)

<a id="dt-8e289f4e4510d4eb2938"></a>

### <code>&#40;&#94;led&#45;&#91;0&#45;9a&#45;f&#93;&#36;&#124;led&#41;</code> — name matches this regular expression

**Value type (<code>type</code>):** <span id="dt-7a63f1c3af3d4c79dc45"><code>&#34;object&#34;</code></span>

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

<a id="dt-24c9714e7cbe5ac325dc"></a>

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

<code>false</code>

Not allowed by this rule.

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

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

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

**<code>gpios</code> — required here**

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

<a id="dt-78fd83a1b81841608dfe"></a>

**<code>retain&#45;state&#45;suspended</code> — not listed as required here**

<div id="dt-57d7872fb88a00bd0923">
<p style="white-space: pre-wrap">The suspend state can be retained.Such as charge-led gpio.</p>
</div>

**Value type (<code>type</code>):** <span id="dt-7c2fb1ddf43551451050"><code>&#34;boolean&#34;</code></span>

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

**<code>retain&#45;state&#45;shutdown</code> — not listed as required here**

<div id="dt-8547e1b0809a2c0b515b">
<p style="white-space: pre-wrap">Retain the state of the LED on shutdown. Useful in BMC systems, for example when the BMC is rebooted while the host remains up.</p>
</div>

**Value type (<code>type</code>):** <span id="dt-198e57ad9b0d31751db7"><code>&#34;boolean&#34;</code></span>

**Required in this object (<code>required</code>):** <a id="dt-97ffc9c8fc137ddf3f2a"></a> <span id="dt-d7ab57b28cf4fa419049"><code>&#34;gpios&#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;
#include &lt;dt-bindings/leds/common.h&gt;

leds {
    compatible = "gpio-leds";
    led-0 {
        gpios = &lt;&amp;mcu_pio 0 GPIO_ACTIVE_LOW&gt;;
        linux,default-trigger = "disk-activity";
        function = LED_FUNCTION_DISK;
    };

    led-1 {
        gpios = &lt;&amp;mcu_pio 1 GPIO_ACTIVE_HIGH&gt;;
        /* Keep LED on if BIOS detected hardware fault */
        default-state = "keep";
        function = LED_FUNCTION_FAULT;
    };
};

run-control {
    compatible = "gpio-leds";
    led-0 {
        gpios = &lt;&amp;mpc8572 6 GPIO_ACTIVE_HIGH&gt;;
        color = &lt;LED_COLOR_ID_RED&gt;;
        default-state = "off";
    };
    led-1 {
        gpios = &lt;&amp;mpc8572 7 GPIO_ACTIVE_HIGH&gt;;
        color = &lt;LED_COLOR_ID_GREEN&gt;;
        default-state = "on";
    };
};
</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-only</span></p>

<p id="dt-comment-1"><strong>Line 22:</strong> <span> The first form is preferred, but fall back to just 'led' anywhere in the</span></p>

<p id="dt-comment-2"><strong>Line 23:</strong> <span> node name to at least catch some child nodes.</span></p>

</details>
