All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yassine Oudjana <yassine.oudjana@gmail.com>
To: Sebastian Reichel <sre@kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Andy Gross <agross@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Yassine Oudjana <y.oudjana@protonmail.com>,
	Yassine Oudjana <yassine.oudjana@gmail.com>,
	Alejandro Tafalla <atafalla@dnyon.com>,
	Konrad Dybcio <konrad.dybcio@somainline.org>,
	linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	devicetree@vger.kernel.org, phone-devel@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 1/8] dt-bindings: power: supply: Add DT schema for Qualcomm SMBCHG
Date: Mon,  8 Aug 2022 08:34:52 +0100	[thread overview]
Message-ID: <20220808073459.396278-2-y.oudjana@protonmail.com> (raw)
In-Reply-To: <20220808073459.396278-1-y.oudjana@protonmail.com>

From: Yassine Oudjana <y.oudjana@protonmail.com>

Add DT schema for the switch-mode battery charger found on Qualcomm
PMICs such as PMI8994. Due to lack of documentation, some interrupt
descriptions might be inaccurate.

Signed-off-by: Yassine Oudjana <y.oudjana@protonmail.com>
---
 .../bindings/power/supply/qcom,smbchg.yaml    | 205 ++++++++++++++++++
 MAINTAINERS                                   |   8 +
 2 files changed, 213 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/supply/qcom,smbchg.yaml

diff --git a/Documentation/devicetree/bindings/power/supply/qcom,smbchg.yaml b/Documentation/devicetree/bindings/power/supply/qcom,smbchg.yaml
new file mode 100644
index 000000000000..d825a9c10b3e
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/supply/qcom,smbchg.yaml
@@ -0,0 +1,205 @@
+# SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/supply/qcom,smbchg.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm PMIC Switch-Mode Battery Charger
+
+maintainers:
+  - Yassine Oudjana <y.oudjana@protonmail.com>
+  - Alejandro Tafalla <atafalla@dnyon.com>
+
+properties:
+  compatible:
+    enum:
+      - qcom,pmi8994-smbchg
+      - qcom,pmi8996-smbchg
+
+  reg:
+    maxItems: 1
+
+  monitored-battery:
+    description: |
+      phandle of battery characteristics node.
+      The charger uses the following properties:
+      - charge-term-current-microamp
+      - constant-charge-current-max-microamp
+      - voltage-max-design-microvolt
+      The constant-charge-current-max-microamp and voltage-max-design-microvolt
+      properties must be set.
+      See Documentation/devicetree/bindings/power/supply/battery.yaml
+
+  interrupts:
+    items:
+      - description: Charger error
+      - description: Charger inhibited
+      - description: Charger precharge safety timer timeout
+      - description: Charger charge safety timer timeout
+      - description: Charger pre to fast charging switch threshold reached
+      - description: Charger recharge threshold reached
+      - description: Charger taper threshold reached
+      - description: Charger charge termination threshold reached
+      - description: Battery hot
+      - description: Battery warm
+      - description: Battery cold
+      - description: Battery cool
+      - description: Battery overvoltage
+      - description: Battery low
+      - description: Battery missing
+      - description: Battery thermistor missing # unconfirmed
+      - description: USB input undervolt
+      - description: USB input overvolt
+      - description: USB input source detected
+      - description: OTG regulator failure
+      - description: OTG regulator overcurrent
+      - description: Automatic input current limiting done
+      - description: USB ID pin changed
+      - description: DC input undervolt
+      - description: DC input overvolt
+      - description: Power OK
+      - description: Temperature shutdown
+      - description: Watchdog timeout
+      - description: Flash failure
+      - description: OTST2 # unknown
+      - description: OTST3 # unknown
+
+  interrupt-names:
+    items:
+      - const: chg-error
+      - const: chg-inhibit
+      - const: chg-prechg-sft
+      - const: chg-complete-chg-sft
+      - const: chg-p2f-thr
+      - const: chg-rechg-thr
+      - const: chg-taper-thr
+      - const: chg-tcc-thr
+      - const: batt-hot
+      - const: batt-warm
+      - const: batt-cold
+      - const: batt-cool
+      - const: batt-ov
+      - const: batt-low
+      - const: batt-missing
+      - const: batt-term-missing
+      - const: usbin-uv
+      - const: usbin-ov
+      - const: usbin-src-det
+      - const: otg-fail
+      - const: otg-oc
+      - const: aicl-done
+      - const: usbid-change
+      - const: dcin-uv
+      - const: dcin-ov
+      - const: power-ok
+      - const: temp-shutdown
+      - const: wdog-timeout
+      - const: flash-fail
+      - const: otst2
+      - const: otst3
+
+  otg-vbus:
+    type: object
+
+    description:
+      OTG regulator subnode.
+
+required:
+  - compatible
+  - reg
+  - monitored-battery
+  - interrupts
+  - interrupt-names
+  - otg-vbus
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    battery: battery {
+        compatible = "simple-battery";
+
+        charge-full-design-microamp-hours = <4070000>;
+        charge-term-current-microamp = <100000>;
+        voltage-min-design-microvolt = <3400000>;
+        voltage-max-design-microvolt = <4400000>;
+    };
+
+    pmic {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        charger@1000 {
+            compatible = "qcom,pmi8996-smbchg";
+            reg = <0x1000>;
+
+            interrupts = <0x2 0x10 0x0 IRQ_TYPE_EDGE_BOTH>,
+                         <0x2 0x10 0x1 IRQ_TYPE_EDGE_BOTH>,
+                         <0x2 0x10 0x2 IRQ_TYPE_EDGE_BOTH>,
+                         <0x2 0x10 0x3 IRQ_TYPE_EDGE_BOTH>,
+                         <0x2 0x10 0x4 IRQ_TYPE_EDGE_BOTH>,
+                         <0x2 0x10 0x5 IRQ_TYPE_EDGE_BOTH>,
+                         <0x2 0x10 0x6 IRQ_TYPE_EDGE_RISING>,
+                         <0x2 0x10 0x7 IRQ_TYPE_EDGE_RISING>,
+                         <0x2 0x12 0x0 IRQ_TYPE_EDGE_BOTH>,
+                         <0x2 0x12 0x1 IRQ_TYPE_EDGE_BOTH>,
+                         <0x2 0x12 0x2 IRQ_TYPE_EDGE_BOTH>,
+                         <0x2 0x12 0x3 IRQ_TYPE_EDGE_BOTH>,
+                         <0x2 0x12 0x4 IRQ_TYPE_EDGE_BOTH>,
+                         <0x2 0x12 0x5 IRQ_TYPE_EDGE_BOTH>,
+                         <0x2 0x12 0x6 IRQ_TYPE_EDGE_BOTH>,
+                         <0x2 0x12 0x7 IRQ_TYPE_EDGE_BOTH>,
+                         <0x2 0x13 0x0 IRQ_TYPE_EDGE_BOTH>,
+                         <0x2 0x13 0x1 IRQ_TYPE_EDGE_BOTH>,
+                         <0x2 0x13 0x2 IRQ_TYPE_EDGE_BOTH>,
+                         <0x2 0x13 0x3 IRQ_TYPE_EDGE_BOTH>,
+                         <0x2 0x13 0x4 IRQ_TYPE_EDGE_RISING>,
+                         <0x2 0x13 0x5 IRQ_TYPE_EDGE_RISING>,
+                         <0x2 0x13 0x6 IRQ_TYPE_EDGE_FALLING>,
+                         <0x2 0x14 0x0 IRQ_TYPE_EDGE_BOTH>,
+                         <0x2 0x14 0x1 IRQ_TYPE_EDGE_BOTH>,
+                         <0x2 0x16 0x0 IRQ_TYPE_EDGE_BOTH>,
+                         <0x2 0x16 0x1 IRQ_TYPE_EDGE_BOTH>,
+                         <0x2 0x16 0x2 IRQ_TYPE_EDGE_BOTH>,
+                         <0x2 0x16 0x3 IRQ_TYPE_EDGE_BOTH>,
+                         <0x2 0x16 0x4 IRQ_TYPE_EDGE_BOTH>,
+                         <0x2 0x16 0x5 IRQ_TYPE_EDGE_BOTH>;
+            interrupt-names = "chg-error",
+                              "chg-inhibit",
+                              "chg-prechg-sft",
+                              "chg-complete-chg-sft",
+                              "chg-p2f-thr",
+                              "chg-rechg-thr",
+                              "chg-taper-thr",
+                              "chg-tcc-thr",
+                              "batt-hot",
+                              "batt-warm",
+                              "batt-cold",
+                              "batt-cool",
+                              "batt-ov",
+                              "batt-low",
+                              "batt-missing",
+                              "batt-term-missing",
+                              "usbin-uv",
+                              "usbin-ov",
+                              "usbin-src-det",
+                              "otg-fail",
+                              "otg-oc",
+                              "aicl-done",
+                              "usbid-change",
+                              "dcin-uv",
+                              "dcin-ov",
+                              "power-ok",
+                              "temp-shutdown",
+                              "wdog-timeout",
+                              "flash-fail",
+                              "otst2",
+                              "otst3";
+
+            monitored-battery = <&battery>;
+
+            otg-vbus { };
+        };
+    };
diff --git a/MAINTAINERS b/MAINTAINERS
index 3796fd700727..7e9f5893c0eb 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -16951,6 +16951,14 @@ F:	Documentation/networking/device_drivers/cellular/qualcomm/rmnet.rst
 F:	drivers/net/ethernet/qualcomm/rmnet/
 F:	include/linux/if_rmnet.h
 
+QUALCOMM SMBCHG DRIVER
+M:	Yassine Oudjana <y.oudjana@protonmail.com>
+M:	Alejandro Tafalla <atafalla@dnyon.com>
+L:	linux-pm@vger.kernel.org
+L:	linux-arm-msm@vger.kernel.org
+S:	Maintained
+F:	Documentation/devicetree/bindings/power/supply/qcom,smbchg.yaml
+
 QUALCOMM TSENS THERMAL DRIVER
 M:	Amit Kucheria <amitk@kernel.org>
 M:	Thara Gopinath <thara.gopinath@gmail.com>
-- 
2.37.1


  reply	other threads:[~2022-08-08  7:35 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-08  7:34 [PATCH 0/8] power: supply: Add driver for Qualcomm SMBCHG Yassine Oudjana
2022-08-08  7:34 ` Yassine Oudjana [this message]
2022-08-08  8:42   ` [PATCH 1/8] dt-bindings: power: supply: Add DT schema " Krzysztof Kozlowski
2022-11-20 15:46     ` Yassine Oudjana
2022-11-21  8:26       ` Krzysztof Kozlowski
2022-11-21 10:36         ` Yassine Oudjana
2022-11-21 17:07           ` Krzysztof Kozlowski
2022-11-22 13:30             ` Dmitry Baryshkov
2022-11-28 11:39               ` Krzysztof Kozlowski
2022-11-28 11:52                 ` Dmitry Baryshkov
2022-11-30 16:24   ` Krzysztof Kozlowski
2022-08-08  7:34 ` [PATCH 2/8] arm64: dts: qcom: pmi8994: Add SMBCHG Yassine Oudjana
2022-08-08  7:34 ` [PATCH 3/8] arm64: dts: qcom: pmi8996: " Yassine Oudjana
2022-08-08  7:34 ` [PATCH 5/8] arm64: dts: qcom: msm8996-xiaomi-*: Enable SMBCHG Yassine Oudjana
2022-08-08  7:34 ` [PATCH 6/8] soc: qcom: Add PMIC secure register write helpers Yassine Oudjana
2022-08-08  7:34 ` [PATCH 7/8] util_macros.h: Add macro to find closest smaller value in array Yassine Oudjana
2022-08-08  7:34 ` [PATCH 8/8] power: supply: Add driver for Qualcomm SMBCHG Yassine Oudjana
2022-08-08  8:55   ` Krzysztof Kozlowski
2022-08-08 10:05     ` Yassine Oudjana
2022-08-08 13:42       ` Krzysztof Kozlowski
2022-08-08  8:41 ` [PATCH 0/8] " Krzysztof Kozlowski
2022-08-08  9:39   ` Yassine Oudjana
2022-08-08 13:24     ` Caleb Connolly

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220808073459.396278-2-y.oudjana@protonmail.com \
    --to=yassine.oudjana@gmail.com \
    --cc=agross@kernel.org \
    --cc=atafalla@dnyon.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=konrad.dybcio@somainline.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=phone-devel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=sre@kernel.org \
    --cc=y.oudjana@protonmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.