From ef15bb1154c109e28202ebb613542ba3ab1e8d4f Mon Sep 17 00:00:00 2001 From: Aryan Modi Date: Wed, 23 Apr 2025 21:35:20 +0530 Subject: [PATCH] dt-bindings: qpnp-qg: Add DT binding for qpnp-qg device Add DT binding documentation for qpnp-qg Qguage device. Change-Id: I5b68e4b12f86bc2953d1369ff51d28aed26752b9 Signed-off-by: Aryan Modi --- bindings/power/supply/qcom/qpnp-qg.yaml | 187 ++++++++++++++++++++++++ 1 file changed, 187 insertions(+) create mode 100644 bindings/power/supply/qcom/qpnp-qg.yaml diff --git a/bindings/power/supply/qcom/qpnp-qg.yaml b/bindings/power/supply/qcom/qpnp-qg.yaml new file mode 100644 index 00000000..c2c8590f --- /dev/null +++ b/bindings/power/supply/qcom/qpnp-qg.yaml @@ -0,0 +1,187 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/power/supply/qcom/qpnp-qg.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm Technologies, Inc. QPNP PMIC QGAUGE (QG) Device + +maintainers: + - Rakesh Kota + - Jishnu Prakash + - Kamal Wadhwa + +description: | + QPNP PMIC QGAUGE device provides the ability to gauge the State-of-Charge + of the battery. It provides an interface to the clients to read various + battery related parameters. + + Required Node Structure: | + Qgauge device must be described in two level of nodes. The first level + describes the properties of the Qgauge device and the second level + describes the peripherals managed/used of the module. + +properties: + compatible: + enum: + - qcom,pm6150-qg + - qcom,qpnp-qg-lite + - qcom,pmi632-qg + - qcom,pm7250b-qg + + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + + "#io-channel-cells": + const: 1 + + qcom,vbatt-cutoff-mv: + description: | + The battery voltage threshold (in mV) at which the + the Qgauge algorithm converges to 0 SOC. If not specified + the default value is 3400 mV. + + qcom,vbatt-low-mv: + description: | + The battery voltage threshold (in mV) at which the + the VBAT_LOW interrupt fires. Software can take necessary + the action when this interrupt fires. If not specified + the default value is 3500 mV. + + qcom,vbatt-low-cold-mv: + description: | + The battery voltage threshold (in mV) at which the + the VBAT_LOW interrupt fires. The threshold is only + applied at cold temperature specified by + 'qcom,cold-temp-threshold'. Software can take necessary + the action when this interrupt fires. If not specified + the default value is 3800 mV. + + qcom,vbatt-empty-mv: + description: | + The battery voltage threshold (in mV) at which the + vbatt-empty interrupt fires. The SOC is forced to 0 + when this interrupt fires. If not specified, the + default value is 3200 mV. + + qcom,vbatt-empty-cold-mv: + description: | + The battery voltage threshold (in mV) at which the + vbatt-empty interrupt fires. This threshold is only + applied at cold temperature specified by + 'qcom,cold-temp-threshold'. The SOC is forced to 0 + when this interrupt fires. If not specified, the + default value is 3000 mV. + + qcom,s3-entry-fifo-length: + description: | + The minimum number if FIFO samples which have to qualify the + S3 IBAT entry threshold (qcom,s3-entry-ibat-ua) for QG + to enter into S3 state. + Minimum Value = 1 Maximum Value = 8. The hardware default + is configured to 3. + + io-channels: + description: | + IIO channel specifiers for each name in io-channel-names. + + io-channel-names: + description: | + Names of the IIO channels that are used by QG device. + +additionalProperties: false + +required: + - compatible + - io-channels + - io-channel-names + +patternProperties: + "^qcom,qgauge@[0-9a-f].*$": + type: object + + properties: + reg: + description: Addresses and sizes for the specified peripheral. + + interrupts: + description: Interrupt mapping as per the interrupt encoding. + + interrupt-names: + description: | + Interrupt names. This list must match up 1-to-1 with the + interrupts specified in the 'interrupts' property. + + required: + - reg + - interrupts + - interrupt-names + + additionalProperties: false + + "^qcom,qg-sdam@[0-9a-f].*$": + type: object + + properties: + reg: + description: Addresses and sizes for the specified peripheral. + + required: + - reg + + additionalProperties: false + +examples: + - | + qpnp,qg { + compatible = "qcom,pm6150-qg"; + depends-on-supply = <&pm6150_vadc>; + #address-cells = <1>; + #size-cells = <0>; + #io-channel-cells = <1>; + + qcom,vbatt-cutoff-mv = <3200>; + qcom,vbatt-low-mv = <3300>; + qcom,vbatt-low-cold-mv = <3700>; + qcom,vbatt-empty-mv = <3000>; + qcom,vbatt-empty-cold-mv = <3000>; + qcom,s3-entry-fifo-length = <2>; + + io-channels = <&pm6150_vadc ADC5_BAT_THERM_100K_PU>, + <&pm6150_vadc ADC5_BAT_ID_100K_PU>, + <&pm6150_charger PSY_IIO_INPUT_CURRENT_LIMITED>, + <&pm6150_charger PSY_IIO_RECHARGE_SOC>, + <&pm6150_charger PSY_IIO_FORCE_RECHARGE>, + <&pm6150_charger PSY_IIO_CHARGE_DONE>; + io-channel-names = "batt-therm", + "batt-id", + "input_current_limited", + "recharge_soc", + "force_recharge", + "charge_done"; + + qcom,qgauge@4800 { + status = "okay"; + reg = <0x4800>; + interrupts = + <0x0 0x48 0x0 IRQ_TYPE_EDGE_BOTH>, + <0x0 0x48 0x1 IRQ_TYPE_EDGE_BOTH>, + <0x0 0x48 0x2 IRQ_TYPE_EDGE_RISING>, + <0x0 0x48 0x3 IRQ_TYPE_EDGE_RISING>, + <0x0 0x48 0x4 IRQ_TYPE_EDGE_RISING>; + interrupt-names = "qg-batt-missing", + "qg-vbat-low", + "qg-vbat-empty", + "qg-fifo-done", + "qg-good-ocv"; + }; + + qcom,qg-sdam@b600 { + status = "okay"; + reg = <0xb600>; + }; + }; +...