%YAML 1.2
---
$id: http://devicetree.org/schemas/bindings/hwmon/qcom,amoled-ecm.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Qualcomm Technologies, Inc. AMOLED ECM binding

maintainers:
  - Shyam Kumar Thella <sthella@qti.qualcomm.com>

description: |
  Qualcomm Technologies, Inc. AMOLED ECM supports measurement of OLED
  display power/current consumption with a time granularity in 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:
    description: Base address of AMOLED AB module. Registers of
      AMOLED ECM are part of AMOLED AB module.
    maxItems: 1

  nvmem-names:
    minItems: 1
    description: Array of one or more nvmem device name(s) for ECM
      measurement.
    items:
      - const: amoled-ecm-sdam0
      - const: amoled-ecm-sdam1
    $ref: /schemas/types.yaml#/definitions/string-array

  nvmem:
    minItems: 1
    description: Array of one or more phandles of the nvmem device(s)
      for ECM measurement.
    $ref: /schemas/nvmem/nvmem.yaml

  interrupts:
    description: Specifies the interrupts for nvmem devices used by
      AMOLED ECM.
    minItems: 1
    $ref: /schemas/interrupts.yaml

  interrupt-names:
    description: Specifies the interrupt names for nvmem devices used
      by AMOLED ECM.
    minItems: 1
    items:
      - const: ecm-sdam0
      - const: ecm-sdam1
    $ref: /schemas/types.yaml#/definitions/string-array

  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-names
  - nvmem
  - interrupt-names
  - interrupts

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