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

title: FocalTech touch controller DTB

maintainers:
  - Maulik Shah <quic_mkshah@quicinc.com>

allOf:
  - $ref: touchscreen.yaml#

properties:
  compatible:
    enum:
      - focaltech,fts_ts

  reg:
    maxItems: 1

  interrupts:
    maxItems: 1
    description: irq gpio

  focaltech,reset-gpio:
    maxItems: 1

  focaltech,irq-gpio:
    description: GPIO pin used for IRQ. The driver uses the interrupt gpio pin
      as output to reset the device.

  irq-flags:
    description: IRQ trigger type config.
                1 - rising edge,
                2 - falling edge,
                4 - high level,
                5 - low level.

  focaltech,max-touch-number:
    description: maximum number of touches support
    $ref: /schemas/types.yaml#/definitions/uint32

  focaltech,display-coords:
    description: display resolution in pixels. A four tuple consisting of minX, minY, maxX and maxY.
    $ref: /schemas/types.yaml#/definitions/uint32

unevaluatedProperties: false

required:
  - compatible
  - reg
  - interrupts
  - focaltech,irq-gpio
  - focaltech,reset-gpio
  - focaltech,max-touch-number
  - focaltech,display-coords

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

    i2c@f9927000 {
            #address-cells = <1>;
            #size-cells = <0>;
            focaltech@38 {
                    compatible = "focaltech,fts_ts";
                    reg = <0x38>;
                    interrupt-parent = <&msm_gpio>;
                    interrupts = <13 0x02>;
                    focaltech,reset-gpio = <&msm_gpio 12 0x01>;
                    focaltech,irq-gpio = <&msm_gpio 13 0x02>;
                    focaltech,max-touch-number = <10>;
                    focaltech,display-coords =  <0 0 1080 1920>;
                    pinctrl-names = "pmx_ts_active","pmx_ts_suspend","pmx_ts_release";
                    pinctrl-0 = <&ts_int_active &ts_reset_active>;
                    pinctrl-1 = <&ts_int_suspend &ts_reset_suspend>;
                    pinctrl-2 = <&ts_release>;
                    /*
                    focaltech,have-key;
                    focaltech,key-number = <3>;
                    focaltech,keys = <139 102 158>;
                    focaltech,key-x-coords = <200 600 800>;
                    focaltech,key-y-coords = <2000 2000 2000>;
                    */
                    };
               };

    spi@78b9000 {
           focaltech@0 {
                   compatible = "focaltech,fts_ts";
                   reg = <0x0>;
                   spi-max-frequency = <6000000>;
                   interrupt-parent = <&msm_gpio>;
                   interrupts = <13 0x2>;
                   focaltech,reset-gpio = <&msm_gpio 12 0x01>;
                   focaltech,irq-gpio = <&msm_gpio 13 0x02>;
                   focaltech,max-touch-number = <10>;
                   focaltech,display-coords =  <0 0 1080 1920>;
                   pinctrl-names = "pmx_ts_active","pmx_ts_suspend","pmx_ts_release";
                   pinctrl-0 = <&ts_int_active &ts_reset_active>;
                   pinctrl-1 = <&ts_int_suspend &ts_reset_suspend>;
                   pinctrl-2 = <&ts_release>;
                       };
     };
