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
7title: MediaTek PMIC Keys
8
9maintainers:
10  - Chen Zhong <chen.zhong@mediatek.com>
11
12allOf:
13  - $ref: input.yaml#
14
15description: |
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
24properties:
25  compatible:
26    enum:
27      - mediatek,mt6323-keys
28      - mediatek,mt6358-keys
29      - mediatek,mt6397-keys
30
31  power-off-time-sec: true
32
33  mediatek,long-press-mode:
34    description: |
35      Key long-press force shutdown setting
36      0 - disabled
37      1 - pwrkey
38      2 - pwrkey+homekey
39    $ref: /schemas/types.yaml#/definitions/uint32
40    default: 0
41    maximum: 2
42
43patternProperties:
44  "^((power|home)|(key-[a-z0-9-]+|[a-z0-9-]+-key))$":
45    $ref: input.yaml#
46
47    properties:
48      interrupts:
49        minItems: 1
50        items:
51          - description: Key press interrupt
52          - description: Key release interrupt
53
54      interrupt-names: true
55
56      linux-keycodes:
57        maxItems: 1
58
59      wakeup-source: true
60
61    required:
62      - linux,keycodes
63
64    if:
65      properties:
66        interrupt-names:
67          contains:
68            const: powerkey
69    then:
70      properties:
71        interrupt-names:
72          minItems: 1
73          items:
74            - const: powerkey
75            - const: powerkey_r
76    else:
77      properties:
78        interrupt-names:
79          minItems: 1
80          items:
81            - const: homekey
82            - const: homekey_r
83
84    unevaluatedProperties: false
85
86required:
87  - compatible
88
89unevaluatedProperties: false
90
91examples:
92  - |
93    #include <dt-bindings/input/input.h>
94    #include <dt-bindings/interrupt-controller/arm-gic.h>
95
96    pmic {
97        compatible = "mediatek,mt6397";
98
99        keys {
100          compatible = "mediatek,mt6397-keys";
101          mediatek,long-press-mode = <1>;
102          power-off-time-sec = <0>;
103
104          key-power {
105            linux,keycodes = <KEY_POWER>;
106            wakeup-source;
107          };
108
109          key-home {
110            linux,keycodes = <KEY_VOLUMEDOWN>;
111          };
112        };
113    };
114