GNU Linux-libre 6.1.90-gnu
[releases.git] / Documentation / devicetree / bindings / input / mediatek,pmic-keys.yaml
1 # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2 %YAML 1.2
3 ---
4 $id: http://devicetree.org/schemas/input/mediatek,pmic-keys.yaml#
5 $schema: http://devicetree.org/meta-schemas/core.yaml#
6
7 title: MediaTek PMIC Keys
8
9 maintainers:
10   - Chen Zhong <chen.zhong@mediatek.com>
11
12 allOf:
13   - $ref: input.yaml#
14
15 description: |
16   There are two key functions provided by MT6397, MT6323 and other MediaTek
17   PMICs: pwrkey and homekey.
18   The key functions are defined as the subnode of the function node provided
19   by the PMIC that is defined as a Multi-Function Device (MFD).
20
21   For MediaTek MT6323/MT6397 PMIC bindings see
22   Documentation/devicetree/bindings/mfd/mt6397.txt
23
24 properties:
25   compatible:
26     enum:
27       - mediatek,mt6323-keys
28       - mediatek,mt6331-keys
29       - mediatek,mt6358-keys
30       - mediatek,mt6397-keys
31
32   power-off-time-sec: true
33
34   mediatek,long-press-mode:
35     description: |
36       Key long-press force shutdown setting
37       0 - disabled
38       1 - pwrkey
39       2 - pwrkey+homekey
40     $ref: /schemas/types.yaml#/definitions/uint32
41     default: 0
42     maximum: 2
43
44 patternProperties:
45   "^((power|home)|(key-[a-z0-9-]+|[a-z0-9-]+-key))$":
46     $ref: input.yaml#
47
48     properties:
49       interrupts:
50         minItems: 1
51         items:
52           - description: Key press interrupt
53           - description: Key release interrupt
54
55       interrupt-names: true
56
57       linux-keycodes:
58         maxItems: 1
59
60       wakeup-source: true
61
62     required:
63       - linux,keycodes
64
65     if:
66       properties:
67         interrupt-names:
68           contains:
69             const: powerkey
70     then:
71       properties:
72         interrupt-names:
73           minItems: 1
74           items:
75             - const: powerkey
76             - const: powerkey_r
77     else:
78       properties:
79         interrupt-names:
80           minItems: 1
81           items:
82             - const: homekey
83             - const: homekey_r
84
85     unevaluatedProperties: false
86
87 required:
88   - compatible
89
90 unevaluatedProperties: false
91
92 examples:
93   - |
94     #include <dt-bindings/input/input.h>
95     #include <dt-bindings/interrupt-controller/arm-gic.h>
96
97     pmic {
98         compatible = "mediatek,mt6397";
99
100         keys {
101           compatible = "mediatek,mt6397-keys";
102           mediatek,long-press-mode = <1>;
103           power-off-time-sec = <0>;
104
105           key-power {
106             linux,keycodes = <KEY_POWER>;
107             wakeup-source;
108           };
109
110           key-home {
111             linux,keycodes = <KEY_VOLUMEDOWN>;
112           };
113         };
114     };