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

title: Qualcomm Technologies, Inc. PM8008 PMIC

maintainers:
  - Guru Das Srinagesh <quic_gurus@quicinc.com>

description: |
  Qualcomm Technologies, Inc. PM8008 is a dedicated camera PMIC that integrates
  all the necessary power management, housekeeping, and interface support
  functions into a single IC.

properties:
  compatible:
    const: qcom,pm8008

  reg:
    maxItems: 1

  interrupts:
    maxItems: 1

  reset-gpios:
    maxItems: 1

  vdd-l1-l2-supply: true
  vdd-l3-l4-supply: true
  vdd-l5-supply: true
  vdd-l6-supply: true
  vdd-l7-supply: true

  gpio-controller: true

  "#gpio-cells":
    const: 2

  gpio-ranges:
    maxItems: 1

  interrupt-controller: true

  "#interrupt-cells":
    const: 2

  "#thermal-sensor-cells":
    const: 0

  pinctrl:
    type: object
    additionalProperties: false
    patternProperties:
      "-state$":
        type: object

        allOf:
          - $ref: /schemas/pinctrl/pinmux-node.yaml
          - $ref: /schemas/pinctrl/pincfg-node.yaml

        properties:
          pins:
            items:
              pattern: "^gpio[12]$"

          function:
            items:
              - enum:
                  - normal

        required:
          - pins
          - function

        additionalProperties: false

  regulators:
    type: object
    additionalProperties: false
    patternProperties:
      "^ldo[1-7]$":
        type: object
        $ref: /schemas/regulator/regulator.yaml#
        unevaluatedProperties: false

required:
  - compatible
  - reg
  - interrupts
  - vdd-l1-l2-supply
  - vdd-l3-l4-supply
  - vdd-l5-supply
  - vdd-l6-supply
  - vdd-l7-supply
  - gpio-controller
  - "#gpio-cells"
  - gpio-ranges
  - interrupt-controller
  - "#interrupt-cells"
  - "#thermal-sensor-cells"

additionalProperties: false

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

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

      pm8008: pmic@8 {
        compatible = "qcom,pm8008";
        reg = <0x8>;

        interrupt-parent = <&tlmm>;
        interrupts = <32 IRQ_TYPE_EDGE_RISING>;

        reset-gpios = <&tlmm 42 GPIO_ACTIVE_LOW>;

        vdd-l1-l2-supply = <&vreg_s8b_1p2>;
        vdd-l3-l4-supply = <&vreg_s1b_1p8>;
        vdd-l5-supply = <&vreg_bob>;
        vdd-l6-supply = <&vreg_bob>;
        vdd-l7-supply = <&vreg_bob>;

        gpio-controller;
        #gpio-cells = <2>;
        gpio-ranges = <&pm8008 0 0 2>;

        interrupt-controller;
        #interrupt-cells = <2>;

        #thermal-sensor-cells = <0>;

        pinctrl {
          gpio-keys-state {
            pins = "gpio1";
            function = "normal";
          };
        };

        regulators {
          ldo1 {
            regulator-name = "vreg_l1";
            regulator-min-microvolt = <950000>;
            regulator-max-microvolt = <1300000>;
          };
        };
      };
    };

...
