# GPIO attached keys

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

> Device-tree binding reference for GPIO attached keys.

<!-- 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;input&#47;gpio&#45;keys&#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;Rob Herring &#60;robh&#64;kernel&#46;org&#62;&#34;</code></span>

<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

**Allowed values (<code>enum</code>):** <a id="dt-207128c21dbd6355c894"></a> <span id="dt-bd234eb96375d77ca611"><code>&#34;gpio&#45;keys&#34;</code></span>, <span id="dt-0d17ba1dd2e75413f7d4"><code>&#34;gpio&#45;keys&#45;polled&#34;</code></span>

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

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

<code>true</code> — No constraints added by this property rule.

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

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

<div id="dt-f7c1a813bb0d2e9dd066">
<p style="white-space: pre-wrap">Name of entire device</p>
</div>

<a id="dt-014743e3c59fc92ab9b6"></a>

### <code>poll&#45;interval</code> — not listed as required here

<code>true</code> — No constraints added by this property rule.

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

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

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

### <code>&#94;&#40;button&#124;event&#124;key&#124;switch&#124;&#40;button&#124;event&#124;key&#124;switch&#41;&#45;&#91;a&#45;z0&#45;9&#45;&#93;&#43;&#124;&#91;a&#45;z0&#45;9&#45;&#93;&#43;&#45;&#40;button&#124;event&#124;key&#124;switch&#41;&#41;&#36;</code> — name matches this regular expression

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

<a id="dt-47bb6e6ad54cc61dc5f3"></a>

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

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

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

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

<a id="dt-425804a5400be0cc879f"></a>

**<code>interrupts</code> — not listed as required here**

<a id="dt-80b797a29cb9ab84401e"></a>

**Exactly one of these rules must match (<code>oneOf</code>)**

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

**Rule 1**

> <a id="dt-2935f36633b966c149d9"></a>
>
> **Array item rules (<code>items</code>)**
>
> <a id="dt-790fc81500ba57b9c38c"></a>
>
> **Item 1**
>
> > <div id="dt-f336a6423f3709405fe4">
> > <p style="white-space: pre-wrap">Optional key interrupt or wakeup interrupt</p>
> > </div>

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

**Rule 2**

> <a id="dt-335b8d2f6900e9ec766f"></a>
>
> **Array item rules (<code>items</code>)**
>
> <a id="dt-190c7504a70e1963b586"></a>
>
> **Item 1**
>
> > <div id="dt-a428e712ed75e63d60a4">
> > <p style="white-space: pre-wrap">Key interrupt</p>
> > </div>
>
> <a id="dt-02c26d101040c09f81b6"></a>
>
> **Item 2**
>
> > <div id="dt-8e5cf5151fd9890b41fc">
> > <p style="white-space: pre-wrap">Wakeup interrupt</p>
> > </div>

<a id="dt-380ab7fe202f12268897"></a>

**<code>interrupt&#45;names</code> — not listed as required here**

<div id="dt-a96d7bef4b6dc90e3670">
<p style="white-space: pre-wrap">Optional interrupt names, can be used to specify a separate dedicated wake-up interrupt in addition to the gpio irq</p>
</div>

<a id="dt-72086229848923e0f160"></a>

**Exactly one of these rules must match (<code>oneOf</code>)**

<a id="dt-97f6fbb4738140773d2c"></a>

**Rule 1**

> <a id="dt-4ca54b996225d3287654"></a>
>
> **Array item rules (<code>items</code>)**
>
> <a id="dt-4145ef263ce2881ffbe3"></a>
>
> **Item 1**
>
> > **Allowed values (<code>enum</code>):** <a id="dt-36be9193dc45caf7819a"></a> <span id="dt-6b9febce993ef39100bc"><code>&#34;irq&#34;</code></span>, <span id="dt-6a7343b6e3e74e020c91"><code>&#34;wakeup&#34;</code></span>

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

**Rule 2**

> <a id="dt-8105b4c4fac95d972310"></a>
>
> **Array item rules (<code>items</code>)**
>
> <a id="dt-7d7ab49424245694f189"></a>
>
> **Item 1**
>
> > **Exact value (<code>const</code>):** <span id="dt-2974a7d4ec8112dbbb02"><code>&#34;irq&#34;</code></span>
>
> <a id="dt-2d0be547f5c5c451b3cd"></a>
>
> **Item 2**
>
> > **Exact value (<code>const</code>):** <span id="dt-c24e2d1df317ff22cc3a"><code>&#34;wakeup&#34;</code></span>

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

**<code>label</code> — not listed as required here**

<div id="dt-d004d01e85afcdf0ac3b">
<p style="white-space: pre-wrap">Descriptive name of the key.</p>
</div>

<a id="dt-357604e2948ce9cebb7b"></a>

**<code>linux&#44;code</code> — required here**

<div id="dt-f9fa9031f9c2885a9df7">
<p style="white-space: pre-wrap">Key / Axis code to emit.</p>
</div>

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

**<code>linux&#44;input&#45;type</code> — not listed as required here**

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

<a id="dt-66619126b6fae5736184"></a>

**<code>linux&#44;input&#45;value</code> — not listed as required here**

<div id="dt-3aba8953d5b8fe7b6f69">
<p style="white-space: pre-wrap">If linux,input-type is EV_ABS or EV_REL then this
value is sent for events this button generates when pressed.
EV_ABS/EV_REL axis will generate an event with a value of 0
when all buttons with linux,input-type == type and
linux,code == axis are released. This value is interpreted
as a signed 32 bit value, e.g. to make a button generate a
value of -1 use:</p>
<p style="white-space: pre-wrap">linux,input-value = &lt;0xffffffff&gt;; /* -1 */</p>
</div>

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

<a id="dt-43a293b82a11848602bf"></a>

**<code>debounce&#45;interval</code> — not listed as required here**

<div id="dt-94ebbf153a93b4006cdb">
<p style="white-space: pre-wrap">Debouncing interval time in milliseconds. If not specified defaults to 5.</p>
</div>

**Shared schema rule (<code>&#36;ref</code>):** <span id="dt-933710a7ff1bcaa56665">[<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-c4b2e65dd3c8159a9925"><code>5</code></span>

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

**<code>wakeup&#45;source</code> — not listed as required here**

<div id="dt-10ecf6360bd3fe2015cf">
<p style="white-space: pre-wrap">Button can wake-up the system.</p>
</div>

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

**<code>wakeup&#45;event&#45;action</code> — not listed as required here**

<div id="dt-4d48754ea00ccc843938">
<p style="white-space: pre-wrap">Specifies whether the key should wake the system when asserted, when
deasserted, or both. This property is only valid for keys that wake up the
system (e.g., when the "wakeup-source" property is also provided).</p>
<p style="white-space: pre-wrap">Supported values are defined in linux-event-codes.h:</p>
<pre><code>  EV_ACT_ANY        - both asserted and deasserted
  EV_ACT_ASSERTED   - asserted
  EV_ACT_DEASSERTED - deasserted</code></pre>
</div>

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

**Allowed values (<code>enum</code>):** <a id="dt-d042a012dd38e0d810d0"></a> <span id="dt-0214ad1ac67ac79c1463"><code>0</code></span>, <span id="dt-7c83ac12a5113fa49fe3"><code>1</code></span>, <span id="dt-48239a350480208e8cfb"><code>2</code></span>

<a id="dt-7148feb7b30e15e42999"></a>

**<code>linux&#44;can&#45;disable</code> — not listed as required here**

<div id="dt-0ec180657e4818e2465d">
<p style="white-space: pre-wrap">Indicates that button is connected to dedicated (not shared) interrupt which can be disabled to suppress events from the button.</p>
</div>

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

**Required in this object (<code>required</code>):** <a id="dt-6a45707f0cfb646eb8e7"></a> <span id="dt-0830d7caefe9e766abc1"><code>&#34;linux&#44;code&#34;</code></span>

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

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

<a id="dt-60c7c19f2745764fc703"></a>

**Rule 1**

> **Required in this object (<code>required</code>):** <a id="dt-6e4a30fc051e68fa8d98"></a> <span id="dt-1527e7beba8a4aa6d0ad"><code>&#34;interrupts&#34;</code></span>

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

**Rule 2**

> **Required in this object (<code>required</code>):** <a id="dt-205f47ae8b3770a9785a"></a> <span id="dt-bf8f8363e2294034a3f5"><code>&#34;interrupts&#45;extended&#34;</code></span>

<a id="dt-3800001b39ac526d6382"></a>

**Rule 3**

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

<a id="dt-54eb6b81580b16343e05"></a>

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

<a id="dt-93d2278b7f3ac162f146"></a>

**Rule 1**

> <a id="dt-c4ab12d01b46cff6a7b2"></a>
>
> **Condition (<code>if</code>)**
>
> > <a id="dt-8fe5d73502e44c2dedad"></a>
> >
> > **Properties and child nodes (<code>properties</code>)**
> >
> > <a id="dt-9543771b6b95c67d0a48"></a>
> >
> > **<code>interrupts</code> — required here**
> >
> > **Minimum number of items (<code>minItems</code>):** <span id="dt-25f1ba79021a5605b243"><code>2</code></span>
> >
> > **Required in this object (<code>required</code>):** <a id="dt-f80bbb98ec7ff11b3528"></a> <span id="dt-666efe3879fec24ea9a7"><code>&#34;interrupts&#34;</code></span>
>
> <a id="dt-015f3bac5cf902c8e31d"></a>
>
> **When the condition matches (<code>then</code>)**
>
> > <a id="dt-b0b5ea7845bed1aef276"></a>
> >
> > **Properties and child nodes (<code>properties</code>)**
> >
> > <a id="dt-5f8a06edd25458cbdcf2"></a>
> >
> > **<code>interrupt&#45;names</code> — required here**
> >
> > **Minimum number of items (<code>minItems</code>):** <span id="dt-138ebd052f8e40bdbcb7"><code>2</code></span>
> >
> > **Required in this object (<code>required</code>):** <a id="dt-f86e7fa87d11602666c5"></a> <span id="dt-c3fb759caacc2e930f41"><code>&#34;interrupt&#45;names&#34;</code></span>

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

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

<a id="dt-981c4a4e1b83ed0a1516"></a>

**<code>wakeup&#45;event&#45;action</code> — applies when this property is present**

Also requires: <span id="dt-43bd27bf157b40573891"><code>&#34;wakeup&#45;source&#34;</code></span>

<a id="dt-29da200f8179f19dd826"></a>

**<code>linux&#44;input&#45;value</code> — applies when this property is present**

Also requires: <span id="dt-80dd65e9e0299df55e68"><code>&#34;gpios&#34;</code></span>

<a id="dt-23fe71aa8c6a940053d7"></a>

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

<code>false</code>

Not allowed by this rule.

<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>input&#46;yaml&#35;</code>](</kernel/hardware/devicetree-bindings/dt-input/input.md#dt-root>)</span>

<a id="dt-22ca5ec5b89308748ecc"></a>

### Rule 2

> <a id="dt-ffbf5afb799d5f07b3e1"></a>
>
> #### Condition (<code>if</code>)
>
> > <a id="dt-05d9c37a1275e72a170e"></a>
> >
> > **Properties and child nodes (<code>properties</code>)**
> >
> > <a id="dt-e9866824361c1aee7933"></a>
> >
> > **<code>compatible</code> — not listed as required here**
> >
> > **Exact value (<code>const</code>):** <span id="dt-845f8d468c0609fc60ce"><code>&#34;gpio&#45;keys&#45;polled&#34;</code></span>
>
> <a id="dt-0971d01a730acc20e97a"></a>
>
> #### When the condition matches (<code>then</code>)
>
> > **Required in this object (<code>required</code>):** <a id="dt-ee96a18d4bb2a9d39bd9"></a> <span id="dt-96ee7f71687cd234a9f8"><code>&#34;poll&#45;interval&#34;</code></span>
>
> <a id="dt-56ef1e95d4edd6e6f24c"></a>
>
> #### When the condition does not match (<code>else</code>)
>
> > <a id="dt-f0255e6a88a00985d33b"></a>
> >
> > **Properties and child nodes (<code>properties</code>)**
> >
> > <a id="dt-11aa7ef2c91da6b4fe33"></a>
> >
> > **<code>poll&#45;interval</code> — not listed as required here**
> >
> > <code>false</code> — Not permitted by this property rule.

<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/interrupt-controller/irq.h&gt;

gpio-keys {
    compatible = "gpio-keys";
    autorepeat;

    key-up {
        label = "GPIO Key UP";
        linux,code = &lt;103&gt;;
        gpios = &lt;&amp;gpio1 0 1&gt;;
    };

    key-down {
        label = "GPIO Key DOWN";
        linux,code = &lt;108&gt;;
        interrupts = &lt;1 IRQ_TYPE_EDGE_FALLING&gt;;
    };

    key-wakeup {
        label = "GPIO Key WAKEUP";
        linux,code = &lt;143&gt;;
        interrupts-extended = &lt;&amp;intc 2 IRQ_TYPE_EDGE_FALLING&gt;,
                              &lt;&amp;intc_wakeup 0 IRQ_TYPE_LEVEL_HIGH&gt;;
        interrupt-names = "irq", "wakeup";
        wakeup-source;
    };
};
</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 59:</strong> <span> EV_KEY</span></p>

</details>
