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

title: Qualcomm Technologies, Inc. AMOLED ECM binding

maintainers:
  - David Collins <quic_collinsd@quicinc.com>

description: |
  Qualcomm Technologies, Inc. AMOLED ECM supports measurement of OLED display
  power/current consumption with a time granularity of sub-frame or multiple
  frames of image data. A power measurement can be for a shorter period or for
  a longer period.

properties:
  compatible:
    const: qcom,amoled-ecm

  reg:
    maxItems: 1
    description: Base address of the PMIC AMOLED AB module. Registers of AMOLED
      ECM are part of AMOLED AB module.

  nvmem:
    minItems: 1
    items:
      - description: AMOLED ECM SDAM0 nvmem device phandle
      - description: AMOLED ECM SDAM1 nvmem device phandle
      - description: AMOLED ECM SDAM2 nvmem device phandle

  nvmem-names:
    minItems: 1
    items:
      - const: amoled-ecm-sdam0
      - const: amoled-ecm-sdam1
      - const: amoled-ecm-sdam2

  interrupts:
    minItems: 1
    items:
      - description: AMOLED ECM SDAM0 nvmem device interrupt
      - description: AMOLED ECM SDAM1 nvmem device interrupt
      - description: AMOLED ECM SDAM2 nvmem device interrupt

  interrupt-names:
    minItems: 1
    items:
      - const: ecm-sdam0
      - const: ecm-sdam1
      - const: ecm-sdam2

  display-panels:
    minItems: 1
    description: Array of one or more phandles of the display panel(s) that
      sends the DRM blank/unblank notifications.
    $ref: /schemas/types.yaml#/definitions/phandle-array

required:
  - compatible
  - reg
  - nvmem
  - nvmem-names
  - interrupts
  - interrupt-names

additionalProperties: false

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

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

        qcom,amoled-ecm@f900 {
            compatible = "qcom,amoled-ecm";
            reg = <0xf900>;
            nvmem = <&pmk8350_sdam_13>, <&pmk8350_sdam_14>;
            nvmem-names = "amoled-ecm-sdam0", "amoled-ecm-sdam1";
            interrupts = <0x0 0x7c 0x1 IRQ_TYPE_EDGE_RISING>,
                         <0x0 0x7d 0x1 IRQ_TYPE_EDGE_RISING>;
            interrupt-names = "ecm-sdam0", "ecm-sdam1";
        };
    };
