# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/mfd/iqs62x.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Azoteq IQS620A/621/622/624/625 Multi-Function Sensors

maintainers:
  - Jeff LaBundy <jeff@labundy.com>

description: |
  The Azoteq IQS620A, IQS621, IQS622, IQS624 and IQS625 multi-function sensors
  integrate multiple sensing technologies in a single package.

  Link to datasheets: https://www.azoteq.com/

properties:
  compatible:
    enum:
      - azoteq,iqs620a
      - azoteq,iqs621
      - azoteq,iqs622
      - azoteq,iqs624
      - azoteq,iqs625

  reg:
    maxItems: 1

  interrupts:
    maxItems: 1

  firmware-name:
    $ref: /schemas/types.yaml#/definitions/string
    description:
      Specifies the name of the calibration and configuration file selected by
      the driver. If this property is omitted, the name is chosen based on the
      device name with ".bin" as the extension (e.g. iqs620a.bin for IQS620A).

  keys:
    $ref: ../input/iqs62x-keys.yaml

  pwm:
    $ref: ../pwm/iqs620a-pwm.yaml

required:
  - compatible
  - reg
  - interrupts

additionalProperties: false

examples:
  - |
    /*
     * Dual capacitive buttons with proximity-activated function, unipolar lid
     * switch and panel-mounted LED.
     */
    #include <dt-bindings/input/input.h>
    #include <dt-bindings/interrupt-controller/irq.h>

    i2c {
            #address-cells = <1>;
            #size-cells = <0>;

            iqs620a@44 {
                    compatible = "azoteq,iqs620a";
                    reg = <0x44>;
                    interrupt-parent = <&gpio>;
                    interrupts = <17 IRQ_TYPE_LEVEL_LOW>;

                    keys {
                            compatible = "azoteq,iqs620a-keys";

                            linux,keycodes = <KEY_SELECT>,
                                             <KEY_MENU>,
                                             <KEY_OK>,
                                             <KEY_MENU>;

                            hall-switch-south {
                                    linux,code = <SW_LID>;
                                    azoteq,use-prox;
                            };
                    };

                    iqs620a_pwm: pwm {
                            compatible = "azoteq,iqs620a-pwm";
                            #pwm-cells = <2>;
                    };
            };
    };

    pwmleds {
            compatible = "pwm-leds";

            led-1 {
                    pwms = <&iqs620a_pwm 0 1000000>;
                    max-brightness = <255>;
            };
    };

  - |
    /* Single inductive button with bipolar dock/tablet-mode switch. */
    #include <dt-bindings/input/input.h>
    #include <dt-bindings/interrupt-controller/irq.h>

    i2c {
            #address-cells = <1>;
            #size-cells = <0>;

            iqs620a@44 {
                    compatible = "azoteq,iqs620a";
                    reg = <0x44>;
                    interrupt-parent = <&gpio>;
                    interrupts = <17 IRQ_TYPE_LEVEL_LOW>;

                    firmware-name = "iqs620a_coil.bin";

                    keys {
                            compatible = "azoteq,iqs620a-keys";

                            linux,keycodes = <0>,
                                             <0>,
                                             <0>,
                                             <0>,
                                             <0>,
                                             <0>,
                                             <KEY_MUTE>;

                            hall-switch-north {
                                    linux,code = <SW_DOCK>;
                            };

                            hall-switch-south {
                                    linux,code = <SW_TABLET_MODE>;
                            };
                    };
            };
    };

  - |
    /* Dual capacitive buttons with volume knob. */
    #include <dt-bindings/input/input.h>
    #include <dt-bindings/interrupt-controller/irq.h>

    i2c {
            #address-cells = <1>;
            #size-cells = <0>;

            iqs624@44 {
                    compatible = "azoteq,iqs624";
                    reg = <0x44>;
                    interrupt-parent = <&gpio>;
                    interrupts = <17 IRQ_TYPE_LEVEL_LOW>;

                    keys {
                            compatible = "azoteq,iqs624-keys";

                            linux,keycodes = <BTN_0>,
                                             <0>,
                                             <BTN_1>,
                                             <0>,
                                             <0>,
                                             <0>,
                                             <0>,
                                             <0>,
                                             <0>,
                                             <0>,
                                             <0>,
                                             <0>,
                                             <0>,
                                             <0>,
                                             <KEY_VOLUMEUP>,
                                             <KEY_VOLUMEDOWN>;
                    };
            };
    };

...
