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

title: Dialog DA9063/DA9063L Power Management Integrated Circuit (PMIC)

maintainers:
  - Steve Twiss <stwiss.opensource@diasemi.com>

description: |
  For device-tree bindings of other sub-modules refer to the binding documents
  under the respective sub-system directories.
  Using regulator-{uv,ov}-{warn,error,protection}-microvolt requires special
  handling: First, when GP_FB2 is used, it must be ensured that there is no
  moment where all voltage monitors are disabled. Next, as da9063 only supports
  UV *and* OV monitoring, both must be set to the same severity and value
  (0: disable, 1: enable).

properties:
  compatible:
    enum:
      - dlg,da9063
      - dlg,da9063l

  reg:
    maxItems: 1

  interrupts:
    maxItems: 1

  interrupt-controller: true

  "#interrupt-cells":
    const: 2

  dlg,use-sw-pm:
    type: boolean
    description:
      Disable the watchdog during suspend.
      Only use this option if you can't use the watchdog automatic suspend
      function during a suspend (see register CONTROL_B).

  watchdog:
    type: object
    $ref: /schemas/watchdog/watchdog.yaml#
    unevaluatedProperties: false
    properties:
      compatible:
        const: dlg,da9063-watchdog

  rtc:
    type: object
    $ref: /schemas/rtc/rtc.yaml#
    unevaluatedProperties: false
    properties:
      compatible:
        const: dlg,da9063-rtc

  onkey:
    type: object
    $ref: /schemas/input/input.yaml#
    unevaluatedProperties: false
    properties:
      compatible:
        const: dlg,da9063-onkey

      dlg,disable-key-power:
        type: boolean
        description: |
          Disable power-down using a long key-press.
          If this entry does not exist then by default the key-press triggered
          power down is enabled and the OnKey will support both KEY_POWER and
          KEY_SLEEP.

  regulators:
    type: object
    additionalProperties: false
    patternProperties:
      "^(ldo([1-9]|1[01])|bcore([1-2]|s-merged)|b(pro|mem|io|peri)|bmem-bio-merged)$":
        $ref: /schemas/regulator/regulator.yaml
        unevaluatedProperties: false

required:
  - compatible
  - reg
  - interrupts
  - interrupt-controller

additionalProperties: false

examples:
  - |
    #include <dt-bindings/interrupt-controller/irq.h>
    i2c {
      #address-cells = <1>;
      #size-cells = <0>;
      pmic@58 {
        compatible = "dlg,da9063";
        reg = <0x58>;
        #interrupt-cells = <2>;
        interrupt-parent = <&gpio6>;
        interrupts = <11 IRQ_TYPE_LEVEL_LOW>;
        interrupt-controller;

        rtc {
          compatible = "dlg,da9063-rtc";
        };

        watchdog {
          compatible = "dlg,da9063-watchdog";
        };

        onkey {
          compatible = "dlg,da9063-onkey";
          dlg,disable-key-power;
        };

        regulators {
          bcore1 {
            regulator-name = "BCORE1";
            regulator-min-microvolt = <300000>;
            regulator-max-microvolt = <1570000>;
            regulator-min-microamp = <500000>;
            regulator-max-microamp = <2000000>;
            regulator-boot-on;
          };
          ldo6 {
            /* UNUSED */
            regulator-name = "LDO_6";
            regulator-uv-protection-microvolt = <0>;
            regulator-ov-protection-microvolt = <0>;
          };
          ldo11 {
            regulator-name = "LDO_11";
            regulator-min-microvolt = <900000>;
            regulator-max-microvolt = <900000>;
            regulator-uv-protection-microvolt = <1>;
            regulator-ov-protection-microvolt = <1>;
            regulator-always-on;
          };
        };
      };
    };
...