mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-23 05:56:14 -04:00
dt-bindings: input: Convert gpio-keys bindings to schema
Convert the gpio-keys and gpio-keys-polled bindings to a DT schema. As both bindings are almost the same, combine them into a single schema. The binding said 'interrupts' was required, but testing on dts files showed that it isn't required. 'linux,input-value' was only documented for gpio-keys-polled, but there doesn't seem to be any reason for it to be specific to that. It can work for gpio-keys too if the GPIO line(s) are available. Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Rob Herring <robh@kernel.org>
This commit is contained in:
152
Documentation/devicetree/bindings/input/gpio-keys.yaml
Normal file
152
Documentation/devicetree/bindings/input/gpio-keys.yaml
Normal file
@@ -0,0 +1,152 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: http://devicetree.org/schemas/input/gpio-keys.yaml#
|
||||
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
|
||||
title: Device-Tree bindings for GPIO attached keys
|
||||
|
||||
maintainers:
|
||||
- Rob Herring <robh@kernel.org>
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
enum:
|
||||
- gpio-keys
|
||||
- gpio-keys-polled
|
||||
|
||||
patternProperties:
|
||||
".*":
|
||||
if:
|
||||
type: object
|
||||
then:
|
||||
allOf:
|
||||
- $ref: input.yaml#
|
||||
|
||||
properties:
|
||||
gpios:
|
||||
maxItems: 1
|
||||
|
||||
interrupts:
|
||||
maxItems: 1
|
||||
|
||||
label:
|
||||
description: Descriptive name of the key.
|
||||
|
||||
linux,code:
|
||||
description: Key / Axis code to emit.
|
||||
$ref: /schemas/types.yaml#definitions/uint32
|
||||
|
||||
linux,input-type:
|
||||
description:
|
||||
Specify event type this button/key generates. If not specified defaults to
|
||||
<1> == EV_KEY.
|
||||
allOf:
|
||||
- $ref: /schemas/types.yaml#definitions/uint32
|
||||
default: 1
|
||||
|
||||
linux,input-value:
|
||||
description: |
|
||||
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:
|
||||
|
||||
linux,input-value = <0xffffffff>; /* -1 */
|
||||
|
||||
allOf:
|
||||
- $ref: /schemas/types.yaml#definitions/uint32
|
||||
|
||||
debounce-interval:
|
||||
description:
|
||||
Debouncing interval time in milliseconds. If not specified defaults to 5.
|
||||
allOf:
|
||||
- $ref: /schemas/types.yaml#definitions/uint32
|
||||
default: 5
|
||||
|
||||
wakeup-source:
|
||||
description: Button can wake-up the system.
|
||||
|
||||
wakeup-event-action:
|
||||
description: |
|
||||
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).
|
||||
|
||||
Supported values are defined in linux-event-codes.h:
|
||||
|
||||
EV_ACT_ANY - both asserted and deasserted
|
||||
EV_ACT_ASSERTED - asserted
|
||||
EV_ACT_DEASSERTED - deasserted
|
||||
allOf:
|
||||
- $ref: /schemas/types.yaml#definitions/uint32
|
||||
enum: [ 0, 1, 2 ]
|
||||
|
||||
linux,can-disable:
|
||||
description:
|
||||
Indicates that button is connected to dedicated (not shared) interrupt
|
||||
which can be disabled to suppress events from the button.
|
||||
type: boolean
|
||||
|
||||
pinctrl-0:
|
||||
maxItems: 1
|
||||
|
||||
pinctrl-names:
|
||||
maxItems: 1
|
||||
|
||||
required:
|
||||
- linux,code
|
||||
|
||||
anyOf:
|
||||
- required:
|
||||
- interrupts
|
||||
- required:
|
||||
- gpios
|
||||
|
||||
dependencies:
|
||||
wakeup-event-action: [ wakeup-source ]
|
||||
linux,input-value: [ gpios ]
|
||||
|
||||
unevaluatedProperties: false
|
||||
|
||||
if:
|
||||
properties:
|
||||
compatible:
|
||||
const: gpio-keys-polled
|
||||
then:
|
||||
properties:
|
||||
poll-interval:
|
||||
description:
|
||||
Poll interval time in milliseconds
|
||||
$ref: /schemas/types.yaml#definitions/uint32
|
||||
|
||||
required:
|
||||
- poll-interval
|
||||
|
||||
additionalProperties: false
|
||||
|
||||
examples:
|
||||
- |
|
||||
#include <dt-bindings/interrupt-controller/irq.h>
|
||||
|
||||
gpio-keys {
|
||||
compatible = "gpio-keys";
|
||||
autorepeat;
|
||||
|
||||
up {
|
||||
label = "GPIO Key UP";
|
||||
linux,code = <103>;
|
||||
gpios = <&gpio1 0 1>;
|
||||
};
|
||||
|
||||
down {
|
||||
label = "GPIO Key DOWN";
|
||||
linux,code = <108>;
|
||||
interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
|
||||
};
|
||||
};
|
||||
|
||||
...
|
||||
Reference in New Issue
Block a user