# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/input/samsung,s3c6410-keypad.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Samsung SoC series Keypad Controller

description:
  Samsung SoC Keypad controller is used to interface a SoC with a matrix-type
  keypad device. The keypad controller supports multiple row and column lines.
  A key can be placed at each intersection of a unique row and a unique column.
  The keypad controller can sense a key-press and key-release and report the
  event using a interrupt to the cpu.

maintainers:
  - Krzysztof Kozlowski <krzk@kernel.org>

properties:
  compatible:
    enum:
      - samsung,s3c6410-keypad
      - samsung,s5pv210-keypad

  reg:
    maxItems: 1

  clocks:
    maxItems: 1

  clock-names:
    items:
      - const: keypad

  interrupts:
    maxItems: 1

  wakeup-source: true

  linux,input-no-autorepeat:
    type: boolean
    description:
      Do no enable autorepeat feature.

  linux,input-wakeup:
    type: boolean
    deprecated: true

  samsung,keypad-num-columns:
    $ref: /schemas/types.yaml#/definitions/uint32
    description:
      Number of column lines connected to the keypad controller.

  samsung,keypad-num-rows:
    $ref: /schemas/types.yaml#/definitions/uint32
    description:
      Number of row lines connected to the keypad controller.

patternProperties:
  '^key-[0-9a-z]+$':
    type: object
    $ref: input.yaml#
    additionalProperties: false
    description:
      Each key connected to the keypad controller is represented as a child
      node to the keypad controller device node.

    properties:
      keypad,column:
        $ref: /schemas/types.yaml#/definitions/uint32
        description: The column number to which the key is connected.

      keypad,row:
        $ref: /schemas/types.yaml#/definitions/uint32
        description: The row number to which the key is connected.

      linux,code: true

    required:
      - keypad,column
      - keypad,row
      - linux,code

required:
  - compatible
  - reg
  - interrupts
  - samsung,keypad-num-columns
  - samsung,keypad-num-rows

additionalProperties: false

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

    keypad@100a0000 {
        compatible = "samsung,s5pv210-keypad";
        reg = <0x100a0000 0x100>;
        interrupts = <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>;
        clocks = <&clock CLK_KEYIF>;
        clock-names = "keypad";

        samsung,keypad-num-rows = <2>;
        samsung,keypad-num-columns = <8>;
        linux,input-no-autorepeat;
        wakeup-source;

        key-1 {
            keypad,row = <0>;
            keypad,column = <3>;
            linux,code = <2>;
        };

        key-2 {
            keypad,row = <0>;
            keypad,column = <4>;
            linux,code = <3>;
        };
    };
