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

title: Qualcomm Technologies, Inc. PM8941 USB ID Extcon device

maintainers:
  - Guru Das Srinagesh <gurus@codeaurora.org>

description: |
  Some Qualcomm PMICs have a "misc" module that can be used to detect when
  the USB ID pin has been pulled low or high.

properties:
  compatible:
    items:
      - const: qcom,pm8941-misc

  reg:
    maxItems: 1

  interrupts:
    minItems: 1
    maxItems: 2

  interrupt-names:
    minItems: 1
    anyOf:
      - items:
          - const: usb_id
          - const: usb_vbus
      - items:
          - const: usb_id
      - items:
          - const: usb_vbus
required:
  - compatible
  - reg
  - interrupts
  - interrupt-names

additionalProperties: false

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

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

            usb_id: usb-detect@900 {
                    compatible = "qcom,pm8941-misc";
                    reg = <0x900>;
                    interrupts = <0x0 0x9 0 IRQ_TYPE_EDGE_BOTH>;
                    interrupt-names = "usb_id";
            };
    };

    usb-controller {
           extcon = <&usb_id>;
    };