# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/power/supply/richtek,rt5033-charger.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Richtek RT5033 PMIC Battery Charger

maintainers:
  - Jakob Hauser <jahau@rocketmail.com>

description:
  The battery charger of the multifunction device RT5033 has to be instantiated
  under sub-node named "charger" using the following format.

properties:
  compatible:
    const: richtek,rt5033-charger

  monitored-battery:
    description: |
      Phandle to the monitored battery according to battery.yaml. The battery
      node needs to contain five parameters.

      precharge-current-microamp:
      Current of pre-charge mode. The pre-charge current levels are 350 mA
      to 650 mA programmed by I2C per 100 mA.

      constant-charge-current-max-microamp:
      Current of fast-charge mode. The fast-charge current levels are 700 mA
      to 2000 mA programmed by I2C per 100 mA.

      charge-term-current-microamp:
      This property is end of charge current. Its level ranges from 150 mA
      to 600 mA. Between 150 mA and 300 mA in 50 mA steps, between 300 mA and
      600 mA in 100 mA steps.

      precharge-upper-limit-microvolt:
      Voltage of pre-charge mode. If the battery voltage is below the pre-charge
      threshold voltage, the charger is in pre-charge mode with pre-charge
      current. Its levels are 2.3 V to 3.8 V programmed by I2C per 0.1 V.

      constant-charge-voltage-max-microvolt:
      Battery regulation voltage of constant voltage mode. This voltage levels
      from 3.65 V to 4.4 V by I2C per 0.025 V.

  richtek,usb-connector:
    $ref: /schemas/types.yaml#/definitions/phandle
    description:
      Phandle to a USB connector according to usb-connector.yaml. The connector
      should be a child of the extcon device.

required:
  - monitored-battery

allOf:
  - $ref: power-supply.yaml#

additionalProperties: false

examples:
  - |
    charger {
        compatible = "richtek,rt5033-charger";
        monitored-battery = <&battery>;
        richtek,usb-connector = <&usb_con>;
    };
