summaryrefslogtreecommitdiff
path: root/Documentation/devicetree/bindings/input/mediatek,pmic-keys.yaml
blob: 037c3ae9f1c33748c8a6fa506afc05419ea2fd7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/input/mediatek,pmic-keys.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: MediaTek PMIC Keys

maintainers:
  - Chen Zhong <chen.zhong@mediatek.com>

allOf:
  - $ref: input.yaml#

description: |
  There are two key functions provided by MT6397, MT6323 and other MediaTek
  PMICs: pwrkey and homekey.
  The key functions are defined as the subnode of the function node provided
  by the PMIC that is defined as a Multi-Function Device (MFD).

  For MediaTek MT6323/MT6397 PMIC bindings see
  Documentation/devicetree/bindings/mfd/mt6397.txt

properties:
  compatible:
    enum:
      - mediatek,mt6323-keys
      - mediatek,mt6331-keys
      - mediatek,mt6357-keys
      - mediatek,mt6358-keys
      - mediatek,mt6397-keys

  power-off-time-sec: true

  mediatek,long-press-mode:
    description: |
      Key long-press force shutdown setting
      0 - disabled
      1 - pwrkey
      2 - pwrkey+homekey
    $ref: /schemas/types.yaml#/definitions/uint32
    default: 0
    maximum: 2

patternProperties:
  "^((power|home)|(key-[a-z0-9-]+|[a-z0-9-]+-key))$":
    $ref: input.yaml#

    properties:
      interrupts:
        minItems: 1
        items:
          - description: Key press interrupt
          - description: Key release interrupt

      interrupt-names: true

      linux-keycodes:
        maxItems: 1

      wakeup-source: true

    required:
      - linux,keycodes

    if:
      properties:
        interrupt-names:
          contains:
            const: powerkey
    then:
      properties:
        interrupt-names:
          minItems: 1
          items:
            - const: powerkey
            - const: powerkey_r
    else:
      properties:
        interrupt-names:
          minItems: 1
          items:
            - const: homekey
            - const: homekey_r

    unevaluatedProperties: false

required:
  - compatible

unevaluatedProperties: false

examples:
  - |
    #include <dt-bindings/input/input.h>
    #include <dt-bindings/interrupt-controller/arm-gic.h>

    pmic {
        compatible = "mediatek,mt6397";

        keys {
          compatible = "mediatek,mt6397-keys";
          mediatek,long-press-mode = <1>;
          power-off-time-sec = <0>;

          key-power {
            linux,keycodes = <KEY_POWER>;
            wakeup-source;
          };

          key-home {
            linux,keycodes = <KEY_VOLUMEDOWN>;
          };
        };
    };