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

title: Goodix Berlin series touchscreen controller

description: The Goodix Berlin series of touchscreen controllers
  be connected to either I2C or SPI buses.

maintainers:
  - Neil Armstrong <neil.armstrong@linaro.org>

allOf:
  - $ref: touchscreen.yaml#
  - $ref: /schemas/spi/spi-peripheral-props.yaml#

properties:
  compatible:
    enum:
      - goodix,gt9897
      - goodix,gt9916

  reg:
    maxItems: 1

  interrupts:
    maxItems: 1

  reset-gpios:
    maxItems: 1

  avdd-supply:
    description: Analog power supply regulator on AVDD pin

  vddio-supply:
    description: power supply regulator on VDDIO pin

  spi-max-frequency: true
  touchscreen-inverted-x: true
  touchscreen-inverted-y: true
  touchscreen-size-x: true
  touchscreen-size-y: true
  touchscreen-swapped-x-y: true

additionalProperties: false

required:
  - compatible
  - reg
  - interrupts
  - avdd-supply
  - touchscreen-size-x
  - touchscreen-size-y

examples:
  - |
    #include <dt-bindings/interrupt-controller/irq.h>
    #include <dt-bindings/gpio/gpio.h>
    i2c {
      #address-cells = <1>;
      #size-cells = <0>;
      touchscreen@5d {
        compatible = "goodix,gt9916";
        reg = <0x5d>;
        interrupt-parent = <&gpio>;
        interrupts = <25 IRQ_TYPE_LEVEL_LOW>;
        reset-gpios = <&gpio1 1 GPIO_ACTIVE_LOW>;
        avdd-supply = <&ts_avdd>;
        touchscreen-size-x = <1024>;
        touchscreen-size-y = <768>;
      };
    };
  - |
    #include <dt-bindings/interrupt-controller/irq.h>
    #include <dt-bindings/gpio/gpio.h>
    spi {
      #address-cells = <1>;
      #size-cells = <0>;
      num-cs = <1>;
      cs-gpios = <&gpio 2 GPIO_ACTIVE_HIGH>;
      touchscreen@0 {
        compatible = "goodix,gt9916";
        reg = <0>;
        interrupt-parent = <&gpio>;
        interrupts = <25 IRQ_TYPE_LEVEL_LOW>;
        reset-gpios = <&gpio1 1 GPIO_ACTIVE_LOW>;
        avdd-supply = <&ts_avdd>;
        spi-max-frequency = <1000000>;
        touchscreen-size-x = <1024>;
        touchscreen-size-y = <768>;
      };
    };

...
