Merge tag 'tags/platform-drivers-x86-surface-aggregator-v5.13-1' into psy-next
authorSebastian Reichel <sebastian.reichel@collabora.com>
Thu, 8 Apr 2021 12:30:07 +0000 (14:30 +0200)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Thu, 8 Apr 2021 12:30:07 +0000 (14:30 +0200)
Signed tag for the immutable platform-surface-aggregator-registry
branch for merging into other sub-systems.

Note this is based on v5.12-rc2.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
131 files changed:
Documentation/devicetree/bindings/power/reset/ltc2952-poweroff.txt
Documentation/devicetree/bindings/power/supply/ab8500/btemp.txt [deleted file]
Documentation/devicetree/bindings/power/supply/ab8500/chargalg.txt [deleted file]
Documentation/devicetree/bindings/power/supply/ab8500/charger.txt [deleted file]
Documentation/devicetree/bindings/power/supply/ab8500/fg.txt [deleted file]
Documentation/devicetree/bindings/power/supply/act8945a-charger.txt [deleted file]
Documentation/devicetree/bindings/power/supply/active-semi,act8945a-charger.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/axp20x_ac_power.txt [deleted file]
Documentation/devicetree/bindings/power/supply/axp20x_battery.txt [deleted file]
Documentation/devicetree/bindings/power/supply/axp20x_usb_power.txt [deleted file]
Documentation/devicetree/bindings/power/supply/battery.txt [deleted file]
Documentation/devicetree/bindings/power/supply/bq2415x.txt [deleted file]
Documentation/devicetree/bindings/power/supply/bq2415x.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/bq24190.txt [deleted file]
Documentation/devicetree/bindings/power/supply/bq24190.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/bq24257.txt [deleted file]
Documentation/devicetree/bindings/power/supply/bq24257.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/bq24735.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/bq25890.txt [deleted file]
Documentation/devicetree/bindings/power/supply/bq25890.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/bq27xxx.yaml
Documentation/devicetree/bindings/power/supply/cpcap-battery.txt [deleted file]
Documentation/devicetree/bindings/power/supply/cpcap-battery.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/cpcap-charger.txt [deleted file]
Documentation/devicetree/bindings/power/supply/cpcap-charger.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/da9150-charger.txt [deleted file]
Documentation/devicetree/bindings/power/supply/da9150-fg.txt [deleted file]
Documentation/devicetree/bindings/power/supply/dlg,da9150-charger.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/dlg,da9150-fuel-gauge.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/isp1704.txt [deleted file]
Documentation/devicetree/bindings/power/supply/isp1704.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/lego,ev3-battery.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/lego_ev3_battery.txt [deleted file]
Documentation/devicetree/bindings/power/supply/lltc,lt3651-charger.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/lltc,ltc294x.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/lp8727_charger.txt [deleted file]
Documentation/devicetree/bindings/power/supply/lt3651-charger.txt [deleted file]
Documentation/devicetree/bindings/power/supply/ltc2941.txt [deleted file]
Documentation/devicetree/bindings/power/supply/max17040_battery.txt [deleted file]
Documentation/devicetree/bindings/power/supply/max17042_battery.txt [deleted file]
Documentation/devicetree/bindings/power/supply/max8903-charger.txt [deleted file]
Documentation/devicetree/bindings/power/supply/maxim,ds2760.txt [deleted file]
Documentation/devicetree/bindings/power/supply/maxim,ds2760.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/maxim,max14656.txt [deleted file]
Documentation/devicetree/bindings/power/supply/maxim,max14656.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/maxim,max17040.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/maxim,max17042.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/maxim,max8903.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/microchip,ucs1002.txt [deleted file]
Documentation/devicetree/bindings/power/supply/microchip,ucs1002.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/nokia,n900-battery.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/olpc-battery.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/olpc_battery.txt [deleted file]
Documentation/devicetree/bindings/power/supply/power_supply.txt [deleted file]
Documentation/devicetree/bindings/power/supply/qcom,coincell-charger.txt [deleted file]
Documentation/devicetree/bindings/power/supply/qcom,pm8941-charger.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/qcom,pm8941-coincell.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/qcom_smbb.txt [deleted file]
Documentation/devicetree/bindings/power/supply/richtek,rt9455.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/rohm,bd99954.yaml
Documentation/devicetree/bindings/power/supply/rt9455_charger.txt [deleted file]
Documentation/devicetree/bindings/power/supply/rx51-battery.txt [deleted file]
Documentation/devicetree/bindings/power/supply/sbs,sbs-battery.yaml
Documentation/devicetree/bindings/power/supply/sbs,sbs-charger.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/sbs,sbs-manager.txt [deleted file]
Documentation/devicetree/bindings/power/supply/sbs,sbs-manager.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/sbs_sbs-charger.txt [deleted file]
Documentation/devicetree/bindings/power/supply/sc2731-charger.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/sc2731_charger.txt [deleted file]
Documentation/devicetree/bindings/power/supply/sc27xx-fg.txt [deleted file]
Documentation/devicetree/bindings/power/supply/sc27xx-fg.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/stericsson,ab8500-battery.txt [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/stericsson,ab8500-btemp.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/stericsson,ab8500-chargalg.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/stericsson,ab8500-charger.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/stericsson,ab8500-fg.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/ti,bq24735.txt [deleted file]
Documentation/devicetree/bindings/power/supply/ti,lp8727.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/tps65090-charger.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/tps65090.txt [deleted file]
Documentation/devicetree/bindings/power/supply/tps65217-charger.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/tps65217_charger.txt [deleted file]
Documentation/devicetree/bindings/power/supply/twl-charger.txt [deleted file]
Documentation/devicetree/bindings/power/supply/twl4030-charger.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/x-powers,axp20x-ac-power-supply.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/x-powers,axp20x-battery-power-supply.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/x-powers,axp20x-usb-power-supply.yaml [new file with mode: 0644]
Documentation/power/power_supply_class.rst
MAINTAINERS
drivers/mfd/ab8500-core.c
drivers/power/reset/Makefile
drivers/power/reset/at91-reset.c
drivers/power/reset/hisi-reboot.c
drivers/power/reset/ltc2952-poweroff.c
drivers/power/reset/vexpress-poweroff.c
drivers/power/supply/88pm860x_battery.c
drivers/power/supply/Kconfig
drivers/power/supply/ab8500-bm.h [new file with mode: 0644]
drivers/power/supply/ab8500-chargalg.h [new file with mode: 0644]
drivers/power/supply/ab8500_bmdata.c
drivers/power/supply/ab8500_btemp.c
drivers/power/supply/ab8500_charger.c
drivers/power/supply/ab8500_fg.c
drivers/power/supply/abx500_chargalg.c
drivers/power/supply/axp20x_usb_power.c
drivers/power/supply/bq25980_charger.c
drivers/power/supply/bq27xxx_battery.c
drivers/power/supply/bq27xxx_battery_i2c.c
drivers/power/supply/charger-manager.c
drivers/power/supply/cpcap-charger.c
drivers/power/supply/cw2015_battery.c
drivers/power/supply/ds2781_battery.c
drivers/power/supply/lp8788-charger.c
drivers/power/supply/max17042_battery.c
drivers/power/supply/max1721x_battery.c
drivers/power/supply/max8997_charger.c
drivers/power/supply/pm2301_charger.c
drivers/power/supply/power_supply_core.c
drivers/power/supply/s3c_adc_battery.c
drivers/power/supply/sbs-battery.c
drivers/power/supply/sbs-charger.c
drivers/power/supply/sbs-manager.c
drivers/power/supply/smb347-charger.c
drivers/power/supply/tps65090-charger.c
drivers/power/supply/tps65217_charger.c
drivers/power/supply/z2_battery.c
include/linux/mfd/abx500.h
include/linux/mfd/abx500/ab8500-bm.h [deleted file]
include/linux/mfd/abx500/ux500_chargalg.h [deleted file]
include/linux/power/bq27xxx_battery.h
include/linux/power_supply.h

index cd2d7f5..38e54b3 100644 (file)
@@ -17,6 +17,9 @@ Optional properties:
                        chip's trigger line. If this property is not set, the
                        trigger function is ignored and the chip is kept alive
                        until an explicit kill signal is received
+- trigger-delay-ms     The number of milliseconds to wait after trigger line
+                       assertion before executing shut down procedure.
+                       The default is 2500ms.
 
 Example:
 
@@ -24,6 +27,7 @@ ltc2952 {
        compatible = "lltc,ltc2952";
 
        trigger-gpios = <&gpio0 1 GPIO_ACTIVE_LOW>;
+       trigger-delay-ms = <2000>;
        watchdog-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
        kill-gpios = <&gpio0 2 GPIO_ACTIVE_LOW>;
 };
diff --git a/Documentation/devicetree/bindings/power/supply/ab8500/btemp.txt b/Documentation/devicetree/bindings/power/supply/ab8500/btemp.txt
deleted file mode 100644 (file)
index f181e46..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-=== AB8500 Battery Temperature Monitor Driver ===
-
-The properties below describes the node for btemp driver.
-
-Required Properties:
-- compatible = Shall be: "stericsson,ab8500-btemp"
-- battery = Shall be battery specific information
-
-       Example:
-       ab8500_btemp {
-               compatible = "stericsson,ab8500-btemp";
-               battery    = <&ab8500_battery>;
-       };
-
-For information on battery specific node, Ref:
-Documentation/devicetree/bindings/power/supply/ab8500/fg.txt
diff --git a/Documentation/devicetree/bindings/power/supply/ab8500/chargalg.txt b/Documentation/devicetree/bindings/power/supply/ab8500/chargalg.txt
deleted file mode 100644 (file)
index 56636f9..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-=== AB8500 Charging Algorithm Driver ===
-
-The properties below describes the node for chargalg driver.
-
-Required Properties:
-- compatible = Shall be: "stericsson,ab8500-chargalg"
-- battery = Shall be battery specific information
-
-Example:
-ab8500_chargalg {
-       compatible = "stericsson,ab8500-chargalg";
-       battery    = <&ab8500_battery>;
-};
-
-For information on battery specific node, Ref:
-Documentation/devicetree/bindings/power/supply/ab8500/fg.txt
diff --git a/Documentation/devicetree/bindings/power/supply/ab8500/charger.txt b/Documentation/devicetree/bindings/power/supply/ab8500/charger.txt
deleted file mode 100644 (file)
index 24ada03..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-=== AB8500 Charger Driver ===
-
-Required Properties:
-- compatible = Shall be "stericsson,ab8500-charger"
-- battery = Shall be battery specific information
-       Example:
-       ab8500_charger {
-               compatible = "stericsson,ab8500-charger";
-               battery    = <&ab8500_battery>;
-       };
-
-- vddadc-supply: Supply for USB and Main charger
-       Example:
-       ab8500-charger {
-               vddadc-supply   = <&ab8500_ldo_tvout_reg>;
-       }
-- autopower_cfg:
-       Boolean value depicting the presence of 'automatic poweron after powerloss'
-       Example:
-       ab8500-charger {
-               autopower_cfg;
-       };
-
-For information on battery specific node, Ref:
-Documentation/devicetree/bindings/power/supply/ab8500/fg.txt
diff --git a/Documentation/devicetree/bindings/power/supply/ab8500/fg.txt b/Documentation/devicetree/bindings/power/supply/ab8500/fg.txt
deleted file mode 100644 (file)
index ccafcb9..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-=== AB8500 Fuel Gauge Driver ===
-
-AB8500 is a mixed signal multimedia and power management
-device comprising: power and energy-management-module,
-wall-charger, usb-charger, audio codec, general purpose adc,
-tvout, clock management and sim card interface.
-
-Fuelgauge support is part of energy-management-modules, other
-components of this module are:
-main-charger, usb-combo-charger and battery-temperature-monitoring.
-
-The properties below describes the node for fuelgauge driver.
-
-Required Properties:
-- compatible = This shall be: "stericsson,ab8500-fg"
-- battery = Shall be battery specific information
-       Example:
-       ab8500_fg {
-               compatible = "stericsson,ab8500-fg";
-               battery    = <&ab8500_battery>;
-       };
-
-dependent node:
-       ab8500_battery: ab8500_battery {
-       };
-       This node will provide information on 'thermistor interface' and
-       'battery technology type' used.
-
-Properties of this node are:
-thermistor-on-batctrl:
-       A boolean value indicating thermistor interface to battery
-
-       Note:
-       'btemp' and 'batctrl' are the pins interfaced for battery temperature
-       measurement, 'btemp' signal is used when NTC(negative temperature
-       coefficient) resister is interfaced external to battery whereas
-       'batctrl' pin is used when NTC resister is internal to battery.
-
-       Example:
-       ab8500_battery: ab8500_battery {
-               thermistor-on-batctrl;
-       };
-       indicates: NTC resister is internal to battery, 'batctrl' is used
-               for thermal measurement.
-
-       The absence of property 'thermal-on-batctrl' indicates
-       NTC resister is external to battery and  'btemp' signal is used
-       for thermal measurement.
-
-battery-type:
-       This shall be the battery manufacturing technology type,
-       allowed types are:
-               "UNKNOWN" "NiMH" "LION" "LIPO" "LiFe" "NiCd" "LiMn"
-       Example:
-       ab8500_battery: ab8500_battery {
-               stericsson,battery-type = "LIPO";
-       }
-
diff --git a/Documentation/devicetree/bindings/power/supply/act8945a-charger.txt b/Documentation/devicetree/bindings/power/supply/act8945a-charger.txt
deleted file mode 100644 (file)
index cb737a9..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-Device-Tree bindings for charger of Active-semi ACT8945A Multi-Function Device
-
-Required properties:
- - compatible: "active-semi,act8945a-charger".
- - active-semi,chglev-gpios: charge current level phandle with args
-   as described in ../gpio/gpio.txt.
- - active-semi,lbo-gpios: specify the low battery voltage detect phandle
-   with args as as described in ../gpio/gpio.txt.
- - interrupts: <a b> where a is the interrupt number and b is a
-   field that represents an encoding of the sense and level
-   information for the interrupt.
-
-Optional properties:
- - active-semi,input-voltage-threshold-microvolt: unit: mV;
-   Specifies the charger's input over-voltage threshold value;
-   The value can be: 6600, 7000, 7500, 8000; default: 6600
- - active-semi,precondition-timeout: unit: minutes;
-   Specifies the charger's PRECONDITION safety timer setting value;
-   The value can be: 40, 60, 80, 0; If 0, it means to disable this timer;
-   default: 40.
- - active-semi,total-timeout: unit: hours;
-   Specifies the charger's total safety timer setting value;
-   The value can be: 3, 4, 5, 0; If 0, it means to disable this timer;
-   default: 3.
-
-Example:
-       pmic@5b {
-               compatible = "active-semi,act8945a";
-               reg = <0x5b>;
-
-               charger {
-                       compatible = "active-semi,act8945a-charger";
-                       pinctrl-names = "default";
-                       pinctrl-0 = <&pinctrl_charger_chglev &pinctrl_charger_lbo &pinctrl_charger_irq>;
-                       interrupt-parent = <&pioA>;
-                       interrupts = <45 IRQ_TYPE_LEVEL_LOW>;
-
-                       active-semi,chglev-gpios = <&pioA 12 GPIO_ACTIVE_HIGH>;
-                       active-semi,lbo-gpios = <&pioA 72 GPIO_ACTIVE_LOW>;
-                       active-semi,input-voltage-threshold-microvolt = <6600>;
-                       active-semi,precondition-timeout = <40>;
-                       active-semi,total-timeout = <3>;
-               };
-       };
diff --git a/Documentation/devicetree/bindings/power/supply/active-semi,act8945a-charger.yaml b/Documentation/devicetree/bindings/power/supply/active-semi,act8945a-charger.yaml
new file mode 100644 (file)
index 0000000..3f74bc1
--- /dev/null
@@ -0,0 +1,76 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/active-semi,act8945a-charger.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Active-semi ACT8945A Charger Function
+
+maintainers:
+  - Sebastian Reichel <sre@kernel.org>
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    const: active-semi,act8945a-charger
+
+  interrupts:
+    maxItems: 1
+
+  active-semi,chglev-gpios:
+    maxItems: 1
+    description: charge current level GPIO
+
+  active-semi,lbo-gpios:
+    maxItems: 1
+    description: low battery voltage detect GPIO
+
+  active-semi,input-voltage-threshold-microvolt:
+    description: |
+      Specifies the charger's input over-voltage threshold value.
+      Despite the name, specified values are in millivolt (mV).
+      Defaults to 6.6 V
+    enum: [ 6600, 7000, 7500, 8000 ]
+
+  active-semi,precondition-timeout:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      Specifies the charger's PRECONDITION safety timer setting value in minutes.
+      If 0, it means to disable this timer.
+      Defaults to 40 minutes.
+    enum: [ 0, 40, 60, 80 ]
+
+  active-semi,total-timeout:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      Specifies the charger's total safety timer setting value in hours;
+      If 0, it means to disable this timer;
+      Defaults to 3 hours.
+    enum: [ 0, 3, 4, 5 ]
+
+required:
+  - compatible
+  - interrupts
+  - active-semi,chglev-gpios
+  - active-semi,lbo-gpios
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+    pmic {
+      charger {
+        compatible = "active-semi,act8945a-charger";
+        interrupt-parent = <&pioA>;
+        interrupts = <45 IRQ_TYPE_LEVEL_LOW>;
+        active-semi,chglev-gpios = <&pioA 12 GPIO_ACTIVE_HIGH>;
+        active-semi,lbo-gpios = <&pioA 72 GPIO_ACTIVE_LOW>;
+        active-semi,input-voltage-threshold-microvolt = <6600>;
+        active-semi,precondition-timeout = <40>;
+        active-semi,total-timeout = <3>;
+      };
+    };
diff --git a/Documentation/devicetree/bindings/power/supply/axp20x_ac_power.txt b/Documentation/devicetree/bindings/power/supply/axp20x_ac_power.txt
deleted file mode 100644 (file)
index 7a1fb53..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-AXP20X and AXP22X PMICs' AC power supply
-
-Required Properties:
- - compatible: One of:
-                       "x-powers,axp202-ac-power-supply"
-                       "x-powers,axp221-ac-power-supply"
-                       "x-powers,axp813-ac-power-supply"
-
-This node is a subnode of the axp20x PMIC.
-
-The AXP20X can read the current current and voltage supplied by AC by
-reading ADC channels from the AXP20X ADC.
-
-The AXP22X is only able to tell if an AC power supply is present and
-usable.
-
-AXP813/AXP803 are able to limit current and supply voltage
-
-Example:
-
-&axp209 {
-       ac_power_supply: ac-power-supply {
-               compatible = "x-powers,axp202-ac-power-supply";
-       };
-};
diff --git a/Documentation/devicetree/bindings/power/supply/axp20x_battery.txt b/Documentation/devicetree/bindings/power/supply/axp20x_battery.txt
deleted file mode 100644 (file)
index 41916f6..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-AXP20x and AXP22x battery power supply
-
-Required Properties:
- - compatible, one of:
-                       "x-powers,axp209-battery-power-supply"
-                       "x-powers,axp221-battery-power-supply"
-                       "x-powers,axp813-battery-power-supply"
-
-This node is a subnode of its respective PMIC DT node.
-
-The supported devices can read the battery voltage, charge and discharge
-currents of the battery by reading ADC channels from the ADC.
-
-Example:
-
-&axp209 {
-       battery_power_supply: battery-power-supply {
-               compatible = "x-powers,axp209-battery-power-supply";
-       }
-};
diff --git a/Documentation/devicetree/bindings/power/supply/axp20x_usb_power.txt b/Documentation/devicetree/bindings/power/supply/axp20x_usb_power.txt
deleted file mode 100644 (file)
index b2d4968..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-AXP20x USB power supply
-
-Required Properties:
--compatible: One of: "x-powers,axp202-usb-power-supply"
-                     "x-powers,axp221-usb-power-supply"
-                     "x-powers,axp223-usb-power-supply"
-                    "x-powers,axp813-usb-power-supply"
-
-The AXP223 PMIC shares most of its behaviour with the AXP221 but has slight
-variations such as the former being able to set the VBUS power supply max
-current to 100mA, unlike the latter.
-
-This node is a subnode of the axp20x PMIC.
-
-Example:
-
-axp209: pmic@34 {
-       compatible = "x-powers,axp209";
-       reg = <0x34>;
-       interrupt-parent = <&nmi_intc>;
-       interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
-       interrupt-controller;
-       #interrupt-cells = <1>;
-
-       regulators {
-               x-powers,dcdc-freq = <1500>;
-
-               vdd_cpu: dcdc2 {
-                       regulator-always-on;
-                       regulator-min-microvolt = <1000000>;
-                       regulator-max-microvolt = <1450000>;
-                       regulator-name = "vdd-cpu";
-               };
-
-               ...
-       };
-
-       usb-power-supply: usb-power-supply {
-               compatible = "x-powers,axp202-usb-power-supply";
-       };
-};
diff --git a/Documentation/devicetree/bindings/power/supply/battery.txt b/Documentation/devicetree/bindings/power/supply/battery.txt
deleted file mode 100644 (file)
index a9f80cc..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-The contents of this file has been moved to battery.yaml
-
-Please note that not all charger drivers respect all of the properties.
diff --git a/Documentation/devicetree/bindings/power/supply/bq2415x.txt b/Documentation/devicetree/bindings/power/supply/bq2415x.txt
deleted file mode 100644 (file)
index d0327f0..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-Binding for TI bq2415x Li-Ion Charger
-
-Required properties:
-- compatible: Should contain one of the following:
- * "ti,bq24150"
- * "ti,bq24150"
- * "ti,bq24150a"
- * "ti,bq24151"
- * "ti,bq24151a"
- * "ti,bq24152"
- * "ti,bq24153"
- * "ti,bq24153a"
- * "ti,bq24155"
- * "ti,bq24156"
- * "ti,bq24156a"
- * "ti,bq24158"
-- reg:                    integer, i2c address of the device.
-- ti,current-limit:       integer, initial maximum current charger can pull
-                          from power supply in mA.
-- ti,weak-battery-voltage: integer, weak battery voltage threshold in mV.
-                          The chip will use slow precharge if battery voltage
-                          is below this value.
-- ti,battery-regulation-voltage: integer, maximum charging voltage in mV.
-- ti,charge-current:      integer, maximum charging current in mA.
-- ti,termination-current:  integer, charge will be terminated when current in
-                          constant-voltage phase drops below this value (in mA).
-- ti,resistor-sense:      integer, value of sensing resistor in milliohm.
-
-Optional properties:
-- ti,usb-charger-detection: phandle to usb charger detection device.
-                           (required for auto mode)
-
-Example from Nokia N900:
-
-bq24150a {
-       compatible = "ti,bq24150a";
-       reg = <0x6b>;
-
-       ti,current-limit = <100>;
-       ti,weak-battery-voltage = <3400>;
-       ti,battery-regulation-voltage = <4200>;
-       ti,charge-current = <650>;
-       ti,termination-current = <100>;
-       ti,resistor-sense = <68>;
-
-       ti,usb-charger-detection = <&isp1704>;
-};
diff --git a/Documentation/devicetree/bindings/power/supply/bq2415x.yaml b/Documentation/devicetree/bindings/power/supply/bq2415x.yaml
new file mode 100644 (file)
index 0000000..f8461f0
--- /dev/null
@@ -0,0 +1,98 @@
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2021 Sebastian Reichel
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/bq2415x.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Binding for TI bq2415x Li-Ion Charger
+
+maintainers:
+  - Sebastian Reichel <sre@kernel.org>
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    enum:
+      - ti,bq24150
+      - ti,bq24150
+      - ti,bq24150a
+      - ti,bq24151
+      - ti,bq24151a
+      - ti,bq24152
+      - ti,bq24153
+      - ti,bq24153a
+      - ti,bq24155
+      - ti,bq24156
+      - ti,bq24156a
+      - ti,bq24158
+
+  reg:
+    maxItems: 1
+
+  ti,current-limit:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: initial maximum current charger can pull from power supply in mA.
+
+  ti,weak-battery-voltage:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      weak battery voltage threshold in mV.
+      The chip will use slow precharge if battery voltage is below this value.
+
+  ti,battery-regulation-voltage:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: maximum charging voltage in mV.
+
+  ti,charge-current:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: maximum charging current in mA.
+
+  ti,termination-current:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      charge will be terminated when current in constant-voltage phase drops
+      below this value (in mA).
+
+  ti,resistor-sense:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: value of sensing resistor in milliohm.
+
+  ti,usb-charger-detection:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: phandle to usb charger detection device (required for auto mode)
+
+required:
+  - compatible
+  - reg
+  - ti,current-limit
+  - ti,weak-battery-voltage
+  - ti,battery-regulation-voltage
+  - ti,charge-current
+  - ti,termination-current
+  - ti,resistor-sense
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c0 {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      charger@6b {
+        compatible = "ti,bq24150a";
+        reg = <0x6b>;
+
+        ti,current-limit = <100>;
+        ti,weak-battery-voltage = <3400>;
+        ti,battery-regulation-voltage = <4200>;
+        ti,charge-current = <650>;
+        ti,termination-current = <100>;
+        ti,resistor-sense = <68>;
+
+        ti,usb-charger-detection = <&isp1704>;
+      };
+    };
diff --git a/Documentation/devicetree/bindings/power/supply/bq24190.txt b/Documentation/devicetree/bindings/power/supply/bq24190.txt
deleted file mode 100644 (file)
index ffe2be4..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-TI BQ24190 Li-Ion Battery Charger
-
-Required properties:
-- compatible: contains one of the following:
-    * "ti,bq24190"
-    * "ti,bq24192"
-    * "ti,bq24192i"
-    * "ti,bq24196"
-- reg: integer, I2C address of the charger.
-- interrupts[-extended]: configuration for charger INT pin.
-
-Optional properties:
-- monitored-battery: phandle of battery characteristics devicetree node
-  The charger uses the following battery properties:
-    + precharge-current-microamp: maximum charge current during precharge
-      phase (typically 20% of battery capacity).
-    + charge-term-current-microamp: a charge cycle terminates when the
-      battery voltage is above recharge threshold, and the current is below
-      this setting (typically 10% of battery capacity).
-  See also Documentation/devicetree/bindings/power/supply/battery.txt
-- ti,system-minimum-microvolt: when power is connected and the battery is below
-  minimum system voltage, the system will be regulated above this setting.
-
-child nodes:
-- usb-otg-vbus:
-  Usage: optional
-  Description: Regulator that is used to control the VBUS voltage direction for
-               either USB host mode or for charging on the OTG port.
-
-Notes:
-- Some circuit boards wire the chip's "OTG" pin high (enabling 500mA default
-  charge current on USB SDP ports, among other features). To simulate this on
-  boards that wire the pin to a GPIO, set a gpio-hog.
-
-Example:
-
-       bat: battery {
-               compatible = "simple-battery";
-               precharge-current-microamp = <256000>;
-               charge-term-current-microamp = <128000>;
-               // etc.
-       };
-
-       bq24190: charger@6a {
-               compatible = "ti,bq24190";
-               reg = <0x6a>;
-               interrupts-extended = <&gpiochip 10 IRQ_TYPE_EDGE_FALLING>;
-               monitored-battery = <&bat>;
-               ti,system-minimum-microvolt = <3200000>;
-
-               usb_otg_vbus: usb-otg-vbus { };
-       };
-
-       &twl_gpio {
-               otg {
-                       gpio-hog;
-                       gpios = <6 0>;
-                       output-high;
-                       line-name = "otg-gpio";
-               };
-       };
diff --git a/Documentation/devicetree/bindings/power/supply/bq24190.yaml b/Documentation/devicetree/bindings/power/supply/bq24190.yaml
new file mode 100644 (file)
index 0000000..0d7cbbd
--- /dev/null
@@ -0,0 +1,92 @@
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2021 Sebastian Reichel
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/bq24190.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Binding for TI BQ2419x Li-Ion Battery Charger
+
+maintainers:
+  - Sebastian Reichel <sre@kernel.org>
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    enum:
+      - ti,bq24190
+      - ti,bq24192
+      - ti,bq24192i
+      - ti,bq24196
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  usb-otg-vbus:
+    type: object
+    description: |
+      Regulator that is used to control the VBUS voltage direction for
+      either USB host mode or for charging on the OTG port
+
+  ti,system-minimum-microvolt:
+    description: |
+      when power is connected and the battery is below minimum system voltage,
+      the system will be regulated above this setting.
+
+  omit-battery-class:
+    type: boolean
+    description: |
+      If this property is set, the operating system does not try to create a
+      battery device.
+
+  monitored-battery:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: |
+      phandle to a "simple-battery" compatible node.
+
+      This property must be a phandle to a node using the format described
+      in battery.yaml, with the following properties being required:
+      - precharge-current-microamp: maximum charge current during precharge phase
+                                    (typically 20% of battery capacity).
+      - charge-term-current-microamp: a charge cycle terminates when the battery voltage is
+                                      above recharge threshold, and the current is below this
+                                      setting (typically 10% of battery capacity).
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    bat: battery {
+      compatible = "simple-battery";
+      precharge-current-microamp = <256000>;
+      charge-term-current-microamp = <128000>;
+    };
+
+    i2c0 {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      charger@6a {
+        compatible = "ti,bq24190";
+        reg = <0x6a>;
+        interrupt-parent = <&gpiochip>;
+        interrupts = <10 IRQ_TYPE_EDGE_FALLING>;
+        monitored-battery = <&bat>;
+        ti,system-minimum-microvolt = <3200000>;
+
+        usb_otg_vbus: usb-otg-vbus { };
+      };
+    };
diff --git a/Documentation/devicetree/bindings/power/supply/bq24257.txt b/Documentation/devicetree/bindings/power/supply/bq24257.txt
deleted file mode 100644 (file)
index f8f5a16..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-Binding for TI bq24250/bq24251/bq24257 Li-Ion Charger
-
-Required properties:
-- compatible: Should contain one of the following:
- * "ti,bq24250"
- * "ti,bq24251"
- * "ti,bq24257"
-- reg: integer, i2c address of the device.
-- interrupts: Interrupt mapping for GPIO IRQ (configure for both edges). Use in
-    conjunction with "interrupt-parent".
-- ti,battery-regulation-voltage: integer, maximum charging voltage in uV.
-- ti,charge-current: integer, maximum charging current in uA.
-- ti,termination-current: integer, charge will be terminated when current in
-    constant-voltage phase drops below this value (in uA).
-
-Optional properties:
-- pg-gpios: GPIO used for connecting the bq2425x device PG (Power Good) pin.
-    This pin is not available on all devices however it should be used if
-    possible as this is the recommended way to obtain the charger's input PG
-    state. If this pin is not specified a software-based approach for PG
-    detection is used.
-- ti,current-limit: The maximum current to be drawn from the charger's input
-    (in uA). If this property is not specified, the input limit current is
-    set automatically using USB D+/D- signal based charger type detection.
-    If the hardware does not support the D+/D- based detection, a default
-    of 500,000 is used (=500mA) instead.
-- ti,ovp-voltage: Configures the over voltage protection voltage (in uV). If
-    not specified a default of 6,5000,000 (=6.5V) is used.
-- ti,in-dpm-voltage: Configures the threshold input voltage for the dynamic
-    power path management (in uV). If not specified a default of 4,360,000
-    (=4.36V) is used.
-
-Example:
-
-bq24257 {
-       compatible = "ti,bq24257";
-       reg = <0x6a>;
-       interrupt-parent = <&gpio1>;
-       interrupts = <16 IRQ_TYPE_EDGE_BOTH>;
-
-       pg-gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>;
-
-       ti,battery-regulation-voltage = <4200000>;
-       ti,charge-current = <1000000>;
-       ti,termination-current = <50000>;
-};
-
-Example:
-
-bq24250 {
-       compatible = "ti,bq24250";
-       reg = <0x6a>;
-       interrupt-parent = <&gpio1>;
-       interrupts = <16 IRQ_TYPE_EDGE_BOTH>;
-
-       ti,battery-regulation-voltage = <4200000>;
-       ti,charge-current = <500000>;
-       ti,termination-current = <50000>;
-       ti,current-limit = <900000>;
-       ti,ovp-voltage = <9500000>;
-       ti,in-dpm-voltage = <4440000>;
-};
diff --git a/Documentation/devicetree/bindings/power/supply/bq24257.yaml b/Documentation/devicetree/bindings/power/supply/bq24257.yaml
new file mode 100644 (file)
index 0000000..3a0f6cd
--- /dev/null
@@ -0,0 +1,124 @@
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2021 Sebastian Reichel
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/bq24257.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Binding for bq24250, bq24251 and bq24257 Li-Ion Charger
+
+maintainers:
+  - Sebastian Reichel <sre@kernel.org>
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    enum:
+      - ti,bq24250
+      - ti,bq24251
+      - ti,bq24257
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  ti,battery-regulation-voltage:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: maximum charging voltage in uV
+
+  ti,charge-current:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: maximum charging current in uA
+
+  ti,termination-current:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      charge will be terminated when current in constant-voltage phase
+      drops below this value (in uA)
+
+  pg-gpios:
+    description: |
+      GPIO used for connecting the bq2425x device PG (Power Good) pin.
+      This pin is not available on all devices however it should be used if
+      possible as this is the recommended way to obtain the charger's input PG
+      state. If this pin is not specified a software-based approach for PG
+      detection is used.
+    maxItems: 1
+
+  ti,current-limit:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      The maximum current to be drawn from the charger's input (in uA).
+      If this property is not specified, the input limit current is set
+      automatically using USB D+/D- signal based charger type detection.
+      If the hardware does not support the D+/D- based detection, a default
+      of 500,000 is used (=500mA) instead.
+
+  ti,ovp-voltage:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      Configures the over voltage protection voltage (in uV).
+      If not specified a default of 6,5000,000 (=6.5V) is used.
+
+  ti,in-dpm-voltage:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      Configures the threshold input voltage for the dynamic power path management (in uV).
+      If not specified a default of 4,360,000 (=4.36V) is used.
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - ti,battery-regulation-voltage
+  - ti,charge-current
+  - ti,termination-current
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+    i2c0 {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      charger@6a {
+        compatible = "ti,bq24257";
+        reg = <0x6a>;
+        interrupt-parent = <&gpio1>;
+        interrupts = <16 IRQ_TYPE_EDGE_BOTH>;
+
+        pg-gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>;
+
+        ti,battery-regulation-voltage = <4200000>;
+        ti,charge-current = <1000000>;
+        ti,termination-current = <50000>;
+      };
+    };
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+    i2c0 {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      charger@6a {
+        compatible = "ti,bq24250";
+        reg = <0x6a>;
+        interrupt-parent = <&gpio1>;
+        interrupts = <16 IRQ_TYPE_EDGE_BOTH>;
+
+        ti,battery-regulation-voltage = <4200000>;
+        ti,charge-current = <500000>;
+        ti,termination-current = <50000>;
+        ti,current-limit = <900000>;
+        ti,ovp-voltage = <9500000>;
+        ti,in-dpm-voltage = <4440000>;
+      };
+    };
diff --git a/Documentation/devicetree/bindings/power/supply/bq24735.yaml b/Documentation/devicetree/bindings/power/supply/bq24735.yaml
new file mode 100644 (file)
index 0000000..131be67
--- /dev/null
@@ -0,0 +1,89 @@
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2021 Sebastian Reichel
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/bq24735.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Binding for TI BQ24735 Li-Ion Battery Charger
+
+maintainers:
+  - Sebastian Reichel <sre@kernel.org>
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    const: ti,bq24735
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    description: AC adapter plug event interrupt
+    maxItems: 1
+
+  ti,ac-detect-gpios:
+    maxItems: 1
+    description: |
+      This GPIO is optionally used to read the AC adapter status. This is a Host GPIO
+      that is configured as an input and connected to the ACOK pin on the bq24735.
+      Note: for backwards compatibility reasons, the GPIO must be active on AC adapter
+      absence despite ACOK being active (high) on AC adapter presence.
+
+  ti,charge-current:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      Used to control and set the charging current.
+      This value must be between 128mA and 8.128A with a 64mA step resolution.
+      The POR value is 0x0000h. This number is in mA (e.g. 8192).
+      See spec for more information about the ChargeCurrent (0x14h) register.
+
+  ti,charge-voltage:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      Used to control and set the charging voltage.
+      This value must be between 1.024V and 19.2V with a 16mV step resolution.
+      The POR value is 0x0000h. This number is in mV (e.g. 19200).
+      See spec for more information about the ChargeVoltage (0x15h) register.
+
+  ti,input-current:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      Used to control and set the charger input current.
+      This value must be between 128mA and 8.064A with a 128mA step resolution.
+      The POR value is 0x1000h. This number is in mA (e.g. 8064).
+      See the spec for more information about the InputCurrent (0x3fh) register.
+
+  ti,external-control:
+    type: boolean
+    description: |
+      Indicates that the charger is configured externally and that the host should not
+      attempt to enable/disable charging or set the charge voltage/current.
+
+  poll-interval:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      If 'interrupts' is not specified, poll AC adapter presence with this interval (milliseconds).
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    i2c0 {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      charger@9 {
+        compatible = "ti,bq24735";
+        reg = <0x9>;
+        ti,ac-detect-gpios = <&gpio 72 0x1>;
+      };
+    };
diff --git a/Documentation/devicetree/bindings/power/supply/bq25890.txt b/Documentation/devicetree/bindings/power/supply/bq25890.txt
deleted file mode 100644 (file)
index 805040c..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-Binding for TI bq25890 Li-Ion Charger
-
-This driver will support the bq25892, the bq25896 and the bq25890. There are
-other ICs in the same family but those have not been tested.
-
-Required properties:
-- compatible: Should contain one of the following:
-    * "ti,bq25890"
-    * "ti,bq25892"
-    * "ti,bq25895"
-    * "ti,bq25896"
-- reg: integer, i2c address of the device.
-- interrupts: interrupt line;
-- ti,battery-regulation-voltage: integer, maximum charging voltage (in uV);
-- ti,charge-current: integer, maximum charging current (in uA);
-- ti,termination-current: integer, charge will be terminated when current in
-    constant-voltage phase drops below this value (in uA);
-- ti,precharge-current: integer, maximum charge current during precharge
-    phase (in uA);
-- ti,minimum-sys-voltage: integer, when battery is charging and it is below
-    minimum system voltage, the system will be regulated above
-    minimum-sys-voltage setting (in uV);
-- ti,boost-voltage: integer, VBUS voltage level in boost mode (in uV);
-- ti,boost-max-current: integer, maximum allowed current draw in boost mode
-    (in uA).
-
-Optional properties:
-- ti,boost-low-freq: boolean, if present boost mode frequency will be 500kHz,
-    otherwise 1.5MHz;
-- ti,use-ilim-pin: boolean, if present the ILIM resistor will be used and the
-    input current will be the lower between the resistor setting and the IINLIM
-    register setting;
-- ti,thermal-regulation-threshold: integer, temperature above which the charge
-    current is lowered, to avoid overheating (in degrees Celsius). If omitted,
-    the default setting will be used (120 degrees);
-- ti,ibatcomp-micro-ohms: integer, value of a resistor in series with
-    the battery;
-- ti,ibatcomp-clamp-microvolt: integer, maximum charging voltage adjustment due
-    to expected voltage drop on in-series resistor;
-
-Example:
-
-bq25890 {
-       compatible = "ti,bq25890";
-       reg = <0x6a>;
-
-       interrupt-parent = <&gpio1>;
-       interrupts = <16 IRQ_TYPE_EDGE_FALLING>;
-
-       ti,battery-regulation-voltage = <4200000>;
-       ti,charge-current = <1000000>;
-       ti,termination-current = <50000>;
-       ti,precharge-current = <128000>;
-       ti,minimum-sys-voltage = <3600000>;
-       ti,boost-voltage = <5000000>;
-       ti,boost-max-current = <1000000>;
-
-       ti,use-ilim-pin;
-       ti,thermal-regulation-threshold = <120>;
-};
diff --git a/Documentation/devicetree/bindings/power/supply/bq25890.yaml b/Documentation/devicetree/bindings/power/supply/bq25890.yaml
new file mode 100644 (file)
index 0000000..bf823b6
--- /dev/null
@@ -0,0 +1,123 @@
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2021 Sebastian Reichel
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/bq25890.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Binding for bq25890, bq25892, bq25895 and bq25896 Li-Ion Charger
+
+maintainers:
+  - Sebastian Reichel <sre@kernel.org>
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    enum:
+      - ti,bq25890
+      - ti,bq25892
+      - ti,bq25895
+      - ti,bq25896
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  ti,battery-regulation-voltage:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: maximum charging voltage (in uV)
+
+  ti,charge-current:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: maximum charging current (in uA)
+
+  ti,termination-current:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      charge will be terminated when current in constant-voltage phase
+      drops below this value (in uA)
+
+  ti,precharge-current:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: maximum charge current during precharge phase (in uA)
+
+  ti,minimum-sys-voltage:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      when battery is charging and it is below minimum system voltage,
+      the system will be regulated above minimum-sys-voltage setting (in uV)
+
+  ti,boost-voltage:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: VBUS voltage level in boost mode (in uV)
+
+  ti,boost-max-current:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: maximum allowed current draw in boost mode (in uA)
+
+  ti,boost-low-freq:
+    description: boost mode frequency will be 500kHz, otherwise 1.5MHz
+    type: boolean
+
+  ti,use-ilim-pin:
+    description: |
+      ILIM resistor will be used and the input current will be the lower
+      between the resistor setting and the IINLIM register setting
+    type: boolean
+
+  ti,thermal-regulation-threshold:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      temperature above which the charge current is lowered, to avoid overheating
+      (in degrees Celsius). If omitted, the default setting will be used (120 degrees)
+
+  ti,ibatcomp-micro-ohms:
+    description: value of a resistor in series with the battery (in Micro Ohms)
+
+  ti,ibatcomp-clamp-microvolt:
+    description: max. charging voltage adjustment due to expected voltage drop on in-series resistor
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - ti,battery-regulation-voltage
+  - ti,charge-current
+  - ti,termination-current
+  - ti,precharge-current
+  - ti,minimum-sys-voltage
+  - ti,boost-voltage
+  - ti,boost-max-current
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    i2c0 {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      charger@6a {
+        compatible = "ti,bq25890";
+        reg = <0x6a>;
+
+        interrupt-parent = <&gpio1>;
+        interrupts = <16 IRQ_TYPE_EDGE_FALLING>;
+
+        ti,battery-regulation-voltage = <4200000>;
+        ti,charge-current = <1000000>;
+        ti,termination-current = <50000>;
+        ti,precharge-current = <128000>;
+        ti,minimum-sys-voltage = <3600000>;
+        ti,boost-voltage = <5000000>;
+        ti,boost-max-current = <1000000>;
+
+        ti,use-ilim-pin;
+        ti,thermal-regulation-threshold = <120>;
+      };
+    };
index 45beefc..6af41da 100644 (file)
@@ -52,6 +52,7 @@ properties:
       - ti,bq27z561
       - ti,bq28z610
       - ti,bq34z100
+      - ti,bq78z100
 
   reg:
     maxItems: 1
@@ -65,7 +66,7 @@ properties:
        - charge-full-design-microamp-hours
        - voltage-min-design-microvolt
        Both or neither of the *-full-design-*-hours properties must be set.
-       See Documentation/devicetree/bindings/power/supply/battery.txt
+       See Documentation/devicetree/bindings/power/supply/battery.yaml
 
   power-supplies: true
 
diff --git a/Documentation/devicetree/bindings/power/supply/cpcap-battery.txt b/Documentation/devicetree/bindings/power/supply/cpcap-battery.txt
deleted file mode 100644 (file)
index a04efa2..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-Motorola CPCAP PMIC battery driver binding
-
-Required properties:
-- compatible: Shall be "motorola,cpcap-battery"
-- interrupts: Interrupt specifier for each name in interrupt-names
-- interrupt-names: Should contain the following entries:
-                  "lowbph", "lowbpl", "chrgcurr1", "battdetb"
-- io-channels: IIO ADC channel specifier for each name in io-channel-names
-- io-channel-names: Should contain the following entries:
-                   "battdetb", "battp", "chg_isense", "batti"
-- power-supplies: List of phandles for power-supplying devices, as
-                 described in power_supply.txt. Typically a reference
-                 to cpcap_charger.
-
-Example:
-
-cpcap_battery: battery {
-       compatible = "motorola,cpcap-battery";
-       interrupts-extended = <
-               &cpcap 5 0 &cpcap 3 0
-               &cpcap 20 0 &cpcap 54 0
-       >;
-       interrupt-names =
-               "lowbph", "lowbpl",
-               "chrgcurr1", "battdetb";
-       io-channels = <&cpcap_adc 0 &cpcap_adc 1
-                      &cpcap_adc 5 &cpcap_adc 6>;
-       io-channel-names = "battdetb", "battp",
-                          "chg_isense", "batti";
-       power-supplies = <&cpcap_charger>;
-};
diff --git a/Documentation/devicetree/bindings/power/supply/cpcap-battery.yaml b/Documentation/devicetree/bindings/power/supply/cpcap-battery.yaml
new file mode 100644 (file)
index 0000000..7153fd4
--- /dev/null
@@ -0,0 +1,87 @@
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2021 Sebastian Reichel
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/cpcap-battery.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Motorola CPCAP PMIC battery
+
+maintainers:
+  - Tony Lindgren <tony@atomide.com>
+  - Sebastian Reichel <sre@kernel.org>
+
+description: |
+  Motorola CPCAP is a PMIC found in some mobile phones, e.g.
+  the Droid 4. This binding describes its battery fuel gauge
+  sub-function.
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    const: motorola,cpcap-battery
+
+  interrupts:
+    items:
+      - description: eol interrupt
+      - description: low battery percentage interrupt
+      - description: critical battery percentage interrupt
+      - description: charger detect interrupt
+      - description: battery detect interrupt
+      - description: coulomb counter calibration interrupt
+
+  interrupt-names:
+    items:
+      - const: eol
+      - const: lowbph
+      - const: lowbpl
+      - const: chrgcurr1
+      - const: battdetb
+      - const: cccal
+
+  io-channels:
+    items:
+      - description: battery temperature
+      - description: battery voltage
+      - description: battery charge current
+      - description: battery current
+
+  io-channel-names:
+    items:
+      - const: battdetb
+      - const: battp
+      - const: chg_isense
+      - const: batti
+
+  power-supplies: true
+
+required:
+  - compatible
+  - interrupts
+  - interrupt-names
+  - io-channels
+  - io-channel-names
+  - power-supplies
+
+additionalProperties: false
+
+examples:
+  - |
+    cpcap {
+      battery {
+        compatible = "motorola,cpcap-battery";
+        interrupts-extended =
+                <&cpcap 6 0>, <&cpcap 5 0>, <&cpcap 3 0>,
+                <&cpcap 20 0>, <&cpcap 54 0>, <&cpcap 57 0>;
+        interrupt-names =
+                "eol", "lowbph", "lowbpl",
+                "chrgcurr1", "battdetb", "cccal";
+        io-channels = <&cpcap_adc 0>, <&cpcap_adc 1>,
+                      <&cpcap_adc 5>, <&cpcap_adc 6>;
+        io-channel-names = "battdetb", "battp",
+                           "chg_isense", "batti";
+        power-supplies = <&cpcap_charger>;
+      };
+    };
diff --git a/Documentation/devicetree/bindings/power/supply/cpcap-charger.txt b/Documentation/devicetree/bindings/power/supply/cpcap-charger.txt
deleted file mode 100644 (file)
index 6048f63..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-Motorola CPCAP PMIC battery charger binding
-
-Required properties:
-- compatible: Shall be "motorola,mapphone-cpcap-charger"
-- interrupts: Interrupt specifier for each name in interrupt-names
-- interrupt-names: Should contain the following entries:
-                  "chrg_det", "rvrs_chrg", "chrg_se1b", "se0conn",
-                  "rvrs_mode", "chrgcurr2", "chrgcurr1", "vbusvld",
-                  "battdetb"
-- io-channels: IIO ADC channel specifier for each name in io-channel-names
-- io-channel-names: Should contain the following entries:
-                   "battdetb", "battp", "vbus", "chg_isense", "batti"
-
-Optional properties:
-- mode-gpios: Optionally CPCAP charger can have a companion wireless
-             charge controller that is controlled with two GPIOs
-             that are active low.
-
-Example:
-
-cpcap_charger: charger {
-       compatible = "motorola,mapphone-cpcap-charger";
-       interrupts-extended = <
-               &cpcap 13 0 &cpcap 12 0 &cpcap 29 0 &cpcap 28 0
-               &cpcap 22 0 &cpcap 21 0 &cpcap 20 0 &cpcap 19 0
-               &cpcap 54 0
-       >;
-       interrupt-names =
-               "chrg_det", "rvrs_chrg", "chrg_se1b", "se0conn",
-               "rvrs_mode", "chrgcurr2", "chrgcurr1", "vbusvld",
-               "battdetb";
-       mode-gpios = <&gpio3 29 GPIO_ACTIVE_LOW
-                     &gpio3 23 GPIO_ACTIVE_LOW>;
-       io-channels = <&cpcap_adc 0 &cpcap_adc 1
-                      &cpcap_adc 2 &cpcap_adc 5
-                      &cpcap_adc 6>;
-       io-channel-names = "battdetb", "battp",
-                          "vbus", "chg_isense",
-                          "batti";
-};
diff --git a/Documentation/devicetree/bindings/power/supply/cpcap-charger.yaml b/Documentation/devicetree/bindings/power/supply/cpcap-charger.yaml
new file mode 100644 (file)
index 0000000..cb63536
--- /dev/null
@@ -0,0 +1,106 @@
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2021 Sebastian Reichel
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/cpcap-charger.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Motorola CPCAP PMIC charger
+
+maintainers:
+  - Tony Lindgren <tony@atomide.com>
+  - Sebastian Reichel <sre@kernel.org>
+
+description: |
+  Motorola CPCAP is a PMIC found in some mobile phones, e.g.
+  the Droid 4. This binding describes its battery charger
+  sub-function.
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    const: motorola,mapphone-cpcap-charger
+
+  interrupts:
+    items:
+      - description: charger detection interrupt
+      - description: reverse charge interrupt
+      - description: SE1 charger detection interrupt
+      - description: SE0 charger detection interrupt
+      - description: reverse mode interrupt
+      - description: charge current 2 interrupt
+      - description: charge current 1 interrupt
+      - description: VBUS valid interrupt
+      - description: battery detect interrupt
+
+  interrupt-names:
+    items:
+      - const: chrg_det
+      - const: rvrs_chrg
+      - const: chrg_se1b
+      - const: se0conn
+      - const: rvrs_mode
+      - const: chrgcurr2
+      - const: chrgcurr1
+      - const: vbusvld
+      - const: battdetb
+
+  io-channels:
+    items:
+      - description: battery temperature
+      - description: battery voltage
+      - description: VBUS voltage
+      - description: battery charge current
+      - description: battery current
+
+  io-channel-names:
+    items:
+      - const: battdetb
+      - const: battp
+      - const: vbus
+      - const: chg_isense
+      - const: batti
+
+  mode-gpios:
+    description: |
+      Optionally CPCAP charger can have a companion wireless
+      charge controller that is controlled with two GPIOs
+      that are active low.
+    minItems: 2
+    maxItems: 2
+
+required:
+  - compatible
+  - interrupts
+  - interrupt-names
+  - io-channels
+  - io-channel-names
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    cpcap {
+      charger {
+        compatible = "motorola,mapphone-cpcap-charger";
+        interrupts-extended =
+                <&cpcap 13 0>, <&cpcap 12 0>, <&cpcap 29 0>, <&cpcap 28 0>,
+                <&cpcap 22 0>, <&cpcap 21 0>, <&cpcap 20 0>, <&cpcap 19 0>,
+                <&cpcap 54 0>;
+        interrupt-names =
+                "chrg_det", "rvrs_chrg", "chrg_se1b", "se0conn",
+                "rvrs_mode", "chrgcurr2", "chrgcurr1", "vbusvld",
+                "battdetb";
+        mode-gpios = <&gpio3 29 GPIO_ACTIVE_LOW>,
+                     <&gpio3 23 GPIO_ACTIVE_LOW>;
+        io-channels = <&cpcap_adc 0>, <&cpcap_adc 1>,
+                      <&cpcap_adc 2>, <&cpcap_adc 5>,
+                      <&cpcap_adc 6>;
+        io-channel-names = "battdetb", "battp",
+                           "vbus", "chg_isense",
+                           "batti";
+      };
+    };
diff --git a/Documentation/devicetree/bindings/power/supply/da9150-charger.txt b/Documentation/devicetree/bindings/power/supply/da9150-charger.txt
deleted file mode 100644 (file)
index f390666..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-Dialog Semiconductor DA9150 Charger Power Supply bindings
-
-Required properties:
-- compatible: "dlg,da9150-charger" for DA9150 Charger Power Supply
-
-Optional properties:
-- io-channels: List of phandle and IIO specifier pairs
-- io-channel-names: List of channel names used by charger
-      ["CHAN_IBUS", "CHAN_VBUS", "CHAN_TJUNC", "CHAN_VBAT"]
-  (See Documentation/devicetree/bindings/iio/iio-bindings.txt for further info)
-
-
-Example:
-
-       da9150-charger {
-               compatible = "dlg,da9150-charger";
-
-               io-channels = <&gpadc 0>,
-                             <&gpadc 2>,
-                             <&gpadc 8>,
-                             <&gpadc 5>;
-               io-channel-names = "CHAN_IBUS",
-                                  "CHAN_VBUS",
-                                  "CHAN_TJUNC",
-                                  "CHAN_VBAT";
-       };
diff --git a/Documentation/devicetree/bindings/power/supply/da9150-fg.txt b/Documentation/devicetree/bindings/power/supply/da9150-fg.txt
deleted file mode 100644 (file)
index 00236fe..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-Dialog Semiconductor DA9150 Fuel-Gauge Power Supply bindings
-
-Required properties:
-- compatible: "dlg,da9150-fuel-gauge" for DA9150 Fuel-Gauge Power Supply
-
-Optional properties:
-- dlg,update-interval: Interval time (milliseconds) between battery level checks.
-- dlg,warn-soc-level: Battery discharge level (%) where warning event raised.
-      [1 - 100]
-- dlg,crit-soc-level: Battery discharge level (%) where critical event raised.
-  This value should be lower than the warning level.
-      [1 - 100]
-
-
-Example:
-
-       fuel-gauge {
-               compatible = "dlg,da9150-fuel-gauge";
-
-               dlg,update-interval = <10000>;
-               dlg,warn-soc-level = /bits/ 8 <15>;
-               dlg,crit-soc-level = /bits/ 8 <5>;
-       };
diff --git a/Documentation/devicetree/bindings/power/supply/dlg,da9150-charger.yaml b/Documentation/devicetree/bindings/power/supply/dlg,da9150-charger.yaml
new file mode 100644 (file)
index 0000000..96336b0
--- /dev/null
@@ -0,0 +1,52 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/dlg,da9150-charger.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Dialog Semiconductor DA9150 Charger Power Supply bindings
+
+maintainers:
+  - Sebastian Reichel <sre@kernel.org>
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    const: dlg,da9150-charger
+
+  io-channels:
+    items:
+      - description: ADC channel for current
+      - description: ADC channel for bus voltage
+      - description: ADC channel for junction temperature
+      - description: ADC channel for battery voltage
+
+  io-channel-names:
+    items:
+      - const: CHAN_IBUS
+      - const: CHAN_VBUS
+      - const: CHAN_TJUNC
+      - const: CHAN_VBAT
+
+required:
+  - compatible
+
+additionalProperties: false
+
+examples:
+  - |
+    pmic {
+      charger {
+        compatible = "dlg,da9150-charger";
+        io-channels = <&gpadc 0>,
+                      <&gpadc 2>,
+                      <&gpadc 8>,
+                      <&gpadc 5>;
+        io-channel-names = "CHAN_IBUS",
+                           "CHAN_VBUS",
+                           "CHAN_TJUNC",
+                           "CHAN_VBAT";
+      };
+    };
diff --git a/Documentation/devicetree/bindings/power/supply/dlg,da9150-fuel-gauge.yaml b/Documentation/devicetree/bindings/power/supply/dlg,da9150-fuel-gauge.yaml
new file mode 100644 (file)
index 0000000..30c2fff
--- /dev/null
@@ -0,0 +1,51 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/dlg,da9150-fuel-gauge.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Dialog Semiconductor DA9150 Fuel-Gauge Power Supply bindings
+
+maintainers:
+  - Sebastian Reichel <sre@kernel.org>
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    const: dlg,da9150-fuel-gauge
+
+  dlg,update-interval:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: Interval time (milliseconds) between battery level checks.
+
+  dlg,warn-soc-level:
+    $ref: /schemas/types.yaml#/definitions/uint8
+    minimum: 1
+    maximum: 100
+    description: Battery discharge level (%) where warning event raised.
+
+  dlg,crit-soc-level:
+    $ref: /schemas/types.yaml#/definitions/uint8
+    minimum: 1
+    maximum: 100
+    description: |
+      Battery discharge level (%) where critical event raised.
+      This value should be lower than the warning level.
+
+required:
+  - compatible
+
+additionalProperties: false
+
+examples:
+  - |
+    pmic {
+      battery {
+        compatible = "dlg,da9150-fuel-gauge";
+        dlg,update-interval = <10000>;
+        dlg,warn-soc-level = /bits/ 8 <15>;
+        dlg,crit-soc-level = /bits/ 8 <5>;
+      };
+    };
diff --git a/Documentation/devicetree/bindings/power/supply/isp1704.txt b/Documentation/devicetree/bindings/power/supply/isp1704.txt
deleted file mode 100644 (file)
index fa35969..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-Binding for NXP ISP1704 USB Charger Detection
-
-Required properties:
-- compatible: Should contain one of the following:
- * "nxp,isp1704"
-- nxp,enable-gpio: Should contain a phandle + gpio-specifier
-  to the GPIO pin connected to the chip's enable pin.
-- usb-phy: Should contain a phandle to the USB PHY
-  the ISP1704 is connected to.
-
-Example:
-
-isp1704 {
-       compatible = "nxp,isp1704";
-       nxp,enable-gpio = <&gpio3 3 GPIO_ACTIVE_LOW>;
-       usb-phy = <&usb2_phy>;
-};
diff --git a/Documentation/devicetree/bindings/power/supply/isp1704.yaml b/Documentation/devicetree/bindings/power/supply/isp1704.yaml
new file mode 100644 (file)
index 0000000..4c91da7
--- /dev/null
@@ -0,0 +1,42 @@
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2021 Sebastian Reichel
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/isp1704.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Binding for NXP ISP1704 USB Charger Detection
+
+maintainers:
+  - Sebastian Reichel <sre@kernel.org>
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    const: nxp,isp1704
+
+  nxp,enable-gpio:
+    maxItems: 1
+    description: GPIO connected to the chip's enable pin
+
+  usb-phy:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: USB PHY the ISP1704 is connected to
+
+required:
+  - compatible
+  - nxp,enable-gpio
+  - usb-phy
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    charger-detect {
+      compatible = "nxp,isp1704";
+      nxp,enable-gpio = <&gpio3 3 GPIO_ACTIVE_LOW>;
+      usb-phy = <&usb2_phy>;
+    };
diff --git a/Documentation/devicetree/bindings/power/supply/lego,ev3-battery.yaml b/Documentation/devicetree/bindings/power/supply/lego,ev3-battery.yaml
new file mode 100644 (file)
index 0000000..518eabb
--- /dev/null
@@ -0,0 +1,55 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/lego,ev3-battery.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: LEGO MINDSTORMS EV3 Battery
+
+maintainers:
+  - David Lechner <david@lechnology.com>
+  - Sebastian Reichel <sre@kernel.org>
+
+description: |
+  LEGO MINDSTORMS EV3 has some built-in capability for monitoring the battery.
+  It uses 6 AA batteries or a special Li-ion rechargeable battery pack that is
+  detected by a key switch in the battery compartment.
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    const: lego,ev3-battery
+
+  io-channels:
+    items:
+      - description: ADC channel for battery voltage
+      - description: ADC channel for battery current
+
+  io-channel-names:
+    items:
+      - const: voltage
+      - const: current
+
+  rechargeable-gpios:
+    maxItems: 1
+    description: Rechargeable battery indication gpio
+
+required:
+  - compatible
+  - io-channels
+  - io-channel-names
+  - rechargeable-gpios
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    battery {
+      compatible = "lego,ev3-battery";
+      io-channels = <&adc 4>, <&adc 3>;
+      io-channel-names = "voltage", "current";
+      rechargeable-gpios = <&gpio 136 GPIO_ACTIVE_LOW>;
+    };
diff --git a/Documentation/devicetree/bindings/power/supply/lego_ev3_battery.txt b/Documentation/devicetree/bindings/power/supply/lego_ev3_battery.txt
deleted file mode 100644 (file)
index 5485633..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-LEGO MINDSTORMS EV3 Battery
-~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-LEGO MINDSTORMS EV3 has some built-in capability for monitoring the battery.
-It uses 6 AA batteries or a special Li-ion rechargeable battery pack that is
-detected by a key switch in the battery compartment.
-
-Required properties:
- - compatible: Must be "lego,ev3-battery"
- - io-channels: phandles to analog inputs for reading voltage and current
- - io-channel-names: Must be "voltage", "current"
- - rechargeable-gpios: phandle to the rechargeable battery indication gpio
-
-Example:
-
-       battery {
-               compatible = "lego,ev3-battery";
-               io-channels = <&adc 4>, <&adc 3>;
-               io-channel-names = "voltage", "current";
-               rechargeable-gpios = <&gpio 136 GPIO_ACTIVE_LOW>;
-       };
diff --git a/Documentation/devicetree/bindings/power/supply/lltc,lt3651-charger.yaml b/Documentation/devicetree/bindings/power/supply/lltc,lt3651-charger.yaml
new file mode 100644 (file)
index 0000000..e2d8d2a
--- /dev/null
@@ -0,0 +1,44 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/lltc,lt3651-charger.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Analog Devices LT3651 Charger Power Supply bindings
+
+maintainers:
+  - Sebastian Reichel <sre@kernel.org>
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    enum:
+      - lltc,lt3651-charger
+      - lltc,ltc3651-charger  # deprecated, use lltc,lt3651-charger
+
+  lltc,acpr-gpios:
+    maxItems: 1
+
+  lltc,fault-gpios:
+    maxItems: 1
+
+  lltc,chrg-gpios:
+    maxItems: 1
+
+required:
+  - compatible
+  - lltc,acpr-gpios
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    charger {
+      compatible = "lltc,lt3651-charger";
+      lltc,acpr-gpios = <&gpio0 68 GPIO_ACTIVE_LOW>;
+      lltc,fault-gpios = <&gpio0 64 GPIO_ACTIVE_LOW>;
+      lltc,chrg-gpios = <&gpio0 63 GPIO_ACTIVE_LOW>;
+    };
diff --git a/Documentation/devicetree/bindings/power/supply/lltc,ltc294x.yaml b/Documentation/devicetree/bindings/power/supply/lltc,ltc294x.yaml
new file mode 100644 (file)
index 0000000..043bf37
--- /dev/null
@@ -0,0 +1,66 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/lltc,ltc294x.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Binding for LTC2941, LTC2942, LTC2943 and LTC2944 battery fuel gauges
+
+description: |
+  All chips measure battery capacity.
+  The LTC2942 is pin compatible with the LTC2941, it adds voltage and
+  temperature monitoring, and is runtime detected. LTC2943 and LTC2944
+  are software compatible, uses a slightly different conversion formula
+  for the charge counter and adds voltage, current and temperature monitoring.
+
+maintainers:
+  - Sebastian Reichel <sre@kernel.org>
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    enum:
+      - lltc,ltc2941
+      - lltc,ltc2942
+      - lltc,ltc2943
+      - lltc,ltc2944
+
+  reg:
+    maxItems: 1
+
+  lltc,resistor-sense:
+    $ref: /schemas/types.yaml#/definitions/int32
+    description: |
+      Sense resistor value in milli-ohms.
+      Can be negative value when the battery has been connected to the wrong end of the resistor.
+
+  lltc,prescaler-exponent:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      The prescaler exponent as explained in the datasheet.
+      This determines the range and accuracy of the gauge.
+      The value is programmed into the chip only if it differs from the current setting.
+      The setting is lost when the battery is disconnected.
+
+required:
+  - compatible
+  - reg
+  - lltc,resistor-sense
+  - lltc,prescaler-exponent
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c0 {
+      #address-cells = <1>;
+      #size-cells = <0>;
+      battery@64 {
+        compatible = "lltc,ltc2943";
+        reg = <0x64>;
+        lltc,resistor-sense = <15>;
+        lltc,prescaler-exponent = <5>; /* 2^(2*5) = 1024 */
+      };
+    };
diff --git a/Documentation/devicetree/bindings/power/supply/lp8727_charger.txt b/Documentation/devicetree/bindings/power/supply/lp8727_charger.txt
deleted file mode 100644 (file)
index 0355a4b..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-Binding for TI/National Semiconductor LP8727 Charger
-
-Required properties:
-- compatible: "ti,lp8727"
-- reg: I2C slave address 27h
-
-Optional properties:
-- interrupts: interrupt specifier (see interrupt binding[0])
-- debounce-ms: interrupt debounce time. (u32)
-
-AC and USB charging parameters
-- charger-type: "ac" or "usb" (string)
-- eoc-level: value of 'enum lp8727_eoc_level' (u8)
-- charging-current: value of 'enum lp8727_ichg' (u8)
-
-[0]: Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
-
-Example)
-
-lp8727@27 {
-       compatible = "ti,lp8727";
-       reg = <0x27>;
-
-       /* GPIO 134 is used for LP8728 interrupt pin */
-       interrupt-parent = <&gpio5>;    /* base = 128 */
-       interrupts = <6 0x2>;           /* offset = 6, falling edge type */
-
-       debounce-ms = <300>;
-
-       /* AC charger: 5% EOC and 500mA charging current */
-       ac {
-               charger-type = "ac";
-               eoc-level = /bits/ 8 <0>;
-               charging-current = /bits/ 8 <4>;
-       };
-
-       /* USB charger: 10% EOC and 400mA charging current */
-       usb {
-               charger-type = "usb";
-               eoc-level = /bits/ 8 <1>;
-               charging-current = /bits/ 8 <2>;
-       };
-};
diff --git a/Documentation/devicetree/bindings/power/supply/lt3651-charger.txt b/Documentation/devicetree/bindings/power/supply/lt3651-charger.txt
deleted file mode 100644 (file)
index 40811ff..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-Analog Devices LT3651 Charger Power Supply bindings: lt3651-charger
-
-Required properties:
-- compatible: Should contain one of the following:
- * "lltc,ltc3651-charger", (DEPRECATED: Use "lltc,lt3651-charger")
- * "lltc,lt3651-charger"
- - lltc,acpr-gpios: Connect to ACPR output. See remark below.
-
-Optional properties:
- - lltc,fault-gpios: Connect to FAULT output. See remark below.
- - lltc,chrg-gpios: Connect to CHRG output. See remark below.
-
-The lt3651 outputs are open-drain type and active low. The driver assumes the
-GPIO reports "active" when the output is asserted, so if the pins have been
-connected directly, the GPIO flags should be set to active low also.
-
-The driver will attempt to aquire interrupts for all GPIOs to detect changes in
-line state. If the system is not capabale of providing interrupts, the driver
-cannot report changes and userspace will need to periodically read the sysfs
-attributes to detect changes.
-
-Example:
-
-       charger: battery-charger {
-               compatible = "lltc,lt3651-charger";
-               lltc,acpr-gpios = <&gpio0 68 GPIO_ACTIVE_LOW>;
-               lltc,fault-gpios = <&gpio0 64 GPIO_ACTIVE_LOW>;
-               lltc,chrg-gpios = <&gpio0 63 GPIO_ACTIVE_LOW>;
-       };
diff --git a/Documentation/devicetree/bindings/power/supply/ltc2941.txt b/Documentation/devicetree/bindings/power/supply/ltc2941.txt
deleted file mode 100644 (file)
index 3b9ba14..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-binding for LTC2941, LTC2942, LTC2943 and LTC2944 battery gauges
-
-All chips measure battery capacity.
-The LTC2942 is pin compatible with the LTC2941, it adds voltage and
-temperature monitoring, and is runtime detected. LTC2943 and LTC2944
-is software compatible, uses a slightly different conversion formula
-for the charge counter and adds voltage, current and temperature monitoring.
-
-Required properties:
-- compatible: Should contain "lltc,ltc2941", "lltc,ltc2942", "lltc,ltc2943"
-    or "lltc,ltc2944" which also indicates the type of I2C chip attached.
-- reg: The 7-bit I2C address.
-- lltc,resistor-sense: The sense resistor value in milli-ohms. Can be a 32-bit
-    negative value when the battery has been connected to the wrong end of the
-    resistor.
-- lltc,prescaler-exponent: The prescaler exponent as explained in the datasheet.
-    This determines the range and accuracy of the gauge. The value is programmed
-    into the chip only if it differs from the current setting. The setting is
-    lost when the battery is disconnected.
-
-Example from the Topic Miami Florida board:
-
-       fuelgauge: ltc2943@64 {
-               compatible = "lltc,ltc2943";
-               reg = <0x64>;
-               lltc,resistor-sense = <15>;
-               lltc,prescaler-exponent = <5>; /* 2^(2*5) = 1024 */
-       };
diff --git a/Documentation/devicetree/bindings/power/supply/max17040_battery.txt b/Documentation/devicetree/bindings/power/supply/max17040_battery.txt
deleted file mode 100644 (file)
index c802f66..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-max17040_battery
-~~~~~~~~~~~~~~~~
-
-Required properties :
- - compatible : "maxim,max17040", "maxim,max17041", "maxim,max17043",
-               "maxim,max17044", "maxim,max17048", "maxim,max17049",
-               "maxim,max17058", "maxim,max17059" or "maxim,max77836-battery"
- - reg: i2c slave address
-
-Optional properties :
-- maxim,alert-low-soc-level :  The alert threshold that sets the state of
-                               charge level (%) where an interrupt is
-                               generated. Can be configured from 1 up to 32
-                               (%). If skipped the power up default value of
-                               4 (%) will be used.
-- maxim,double-soc :           Certain devices return double the capacity.
-                               Specify this boolean property to divide the
-                               reported value in 2 and thus normalize it.
-                               SOC == State of Charge == Capacity.
-- maxim,rcomp :                        A value to compensate readings for various
-                               battery chemistries and operating temperatures.
-                               max17040,41 have 2 byte rcomp, default to
-                               0x97 0x00. All other devices have one byte
-                               rcomp, default to 0x97.
-- interrupts :                         Interrupt line see Documentation/devicetree/
-                               bindings/interrupt-controller/interrupts.txt
-- wakeup-source :              This device has wakeup capabilities. Use this
-                               property to use alert low SOC level interrupt
-                               as wake up source.
-
-Optional properties support interrupt functionality for alert low state of
-charge level, present in some ICs in the same family, and should be used with
-compatible "maxim,max77836-battery".
-
-Example:
-
-       battery-fuel-gauge@36 {
-               compatible = "maxim,max77836-battery";
-               reg = <0x36>;
-               maxim,alert-low-soc-level = <10>;
-               interrupt-parent = <&gpio7>;
-               interrupts = <2 IRQ_TYPE_EDGE_FALLING>;
-               wakeup-source;
-       };
-
-       battery-fuel-gauge@36 {
-               compatible = "maxim,max17048";
-               reg = <0x36>;
-               maxim,rcomp = /bits/ 8 <0x56>;
-               maxim,alert-low-soc-level = <10>;
-               maxim,double-soc;
-       };
diff --git a/Documentation/devicetree/bindings/power/supply/max17042_battery.txt b/Documentation/devicetree/bindings/power/supply/max17042_battery.txt
deleted file mode 100644 (file)
index f34c5da..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-max17042_battery
-~~~~~~~~~~~~~~~~
-
-Required properties :
- - compatible : one of the following
- * "maxim,max17042"
- * "maxim,max17047"
- * "maxim,max17050"
- * "maxim,max17055"
-
-Optional properties :
- - maxim,rsns-microohm : Resistance of rsns resistor in micro Ohms
-                         (datasheet-recommended value is 10000).
-   Defining this property enables current-sense functionality.
-
-Optional threshold properties :
- If skipped the condition won't be reported.
- - maxim,cold-temp :      Temperature threshold to report battery
-                          as cold (in tenths of degree Celsius).
- - maxim,over-heat-temp : Temperature threshold to report battery
-                          as over heated (in tenths of degree Celsius).
- - maxim,dead-volt :      Voltage threshold to report battery
-                          as dead (in mV).
- - maxim,over-volt :      Voltage threshold to report battery
-                          as over voltage (in mV).
-
-Example:
-
-       battery-charger@36 {
-               compatible = "maxim,max17042";
-               reg = <0x36>;
-               maxim,rsns-microohm = <10000>;
-               maxim,over-heat-temp = <600>;
-               maxim,over-volt = <4300>;
-       };
diff --git a/Documentation/devicetree/bindings/power/supply/max8903-charger.txt b/Documentation/devicetree/bindings/power/supply/max8903-charger.txt
deleted file mode 100644 (file)
index bab947f..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-Maxim Semiconductor MAX8903 Battery Charger bindings
-
-Required properties:
-- compatible: "maxim,max8903" for MAX8903 Battery Charger
-- dok-gpios: Valid DC power has been detected (active low, input), optional if uok-gpios is provided
-- uok-gpios: Valid USB power has been detected (active low, input), optional if dok-gpios is provided
-
-Optional properties:
-- cen-gpios: Charge enable pin (active low, output)
-- chg-gpios: Charger status pin (active low, input)
-- flt-gpios: Fault pin (active low, output)
-- dcm-gpios: Current limit mode setting (DC=1 or USB=0, output)
-- usus-gpios: USB suspend pin (active high, output)
-
-
-Example:
-
-       max8903-charger {
-               compatible = "maxim,max8903";
-               dok-gpios = <&gpio2 3 GPIO_ACTIVE_LOW>;
-               flt-gpios = <&gpio2 2 GPIO_ACTIVE_LOW>;
-               chg-gpios = <&gpio3 15 GPIO_ACTIVE_LOW>;
-               cen-gpios = <&gpio2 5 GPIO_ACTIVE_LOW>;
-       };
diff --git a/Documentation/devicetree/bindings/power/supply/maxim,ds2760.txt b/Documentation/devicetree/bindings/power/supply/maxim,ds2760.txt
deleted file mode 100644 (file)
index 55967a0..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-Devicetree bindings for Maxim DS2760
-====================================
-
-The ds2760 is a w1 slave device and must hence have its sub-node in DT
-under a w1 bus master node.
-
-The device exposes a power supply, so the details described in
-Documentation/devicetree/bindings/power/supply/power_supply.txt apply.
-
-Required properties:
-- compatible: must be "maxim,ds2760"
-
-Optional properties:
-- power-supplies:      Refers to one or more power supplies connected to
-                       this battery.
-- maxim,pmod-enabled:  This boolean property enables the DS2760 to enter
-                       sleep mode when the DQ line goes low for greater
-                       than 2 seconds and leave sleep Mode when the DQ
-                       line goes high.
-- maxim,cache-time-ms: Time im milliseconds to cache the data for. When
-                       this time expires, the values are read again from
-                       the hardware. Defaults to 1000.
-- rated-capacity-microamp-hours:
-                       The rated capacity of the battery, in mAh.
-                       If not specified, the value stored in the
-                       non-volatile chip memory is used.
diff --git a/Documentation/devicetree/bindings/power/supply/maxim,ds2760.yaml b/Documentation/devicetree/bindings/power/supply/maxim,ds2760.yaml
new file mode 100644 (file)
index 0000000..818647e
--- /dev/null
@@ -0,0 +1,43 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/maxim,ds2760.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Maxim DS2760 DT bindings
+
+maintainers:
+  - Sebastian Reichel <sre@kernel.org>
+
+description: |
+  The ds2760 is a w1 slave device and must hence have its sub-node in
+  DT under a w1 bus master node.
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    const: maxim,ds2760
+
+  maxim,pmod-enabled:
+    description: |
+      Allow the DS2760 to enter sleep mode when the DQ line goes low for more than 2 seconds
+      and leave sleep Mode when the DQ line goes high.
+    type: boolean
+
+  maxim,cache-time-ms:
+    description: |
+      Time im milliseconds to cache the data for.
+      When this time expires, the values are read again from the hardware.
+      Defaults to 1000.
+
+  rated-capacity-microamp-hours:
+    description: |
+      The rated capacity of the battery, in mAh.
+      If not specified, the value stored in the non-volatile chip memory is used.
+
+required:
+  - compatible
+
+unevaluatedProperties: false
diff --git a/Documentation/devicetree/bindings/power/supply/maxim,max14656.txt b/Documentation/devicetree/bindings/power/supply/maxim,max14656.txt
deleted file mode 100644 (file)
index f956247..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-Maxim MAX14656 / AL32 USB Charger Detector
-
-Required properties :
-- compatible : "maxim,max14656";
-- reg: i2c slave address
-- interrupts: interrupt line
-
-Example:
-
-&i2c2 {
-       clock-frequency = <50000>;
-       pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_i2c2>;
-
-       max14656@35 {
-               compatible = "maxim,max14656";
-               reg = <0x35>;
-               pinctrl-names = "default";
-               pinctrl-0 = <&pinctrl_charger_detect>;
-               interrupt-parent = <&gpio6>;
-               interrupts = <26 IRQ_TYPE_LEVEL_HIGH>;
-       };
-};
diff --git a/Documentation/devicetree/bindings/power/supply/maxim,max14656.yaml b/Documentation/devicetree/bindings/power/supply/maxim,max14656.yaml
new file mode 100644 (file)
index 0000000..0a41078
--- /dev/null
@@ -0,0 +1,45 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/maxim,max14656.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Maxim MAX14656 DT bindings
+
+maintainers:
+  - Sebastian Reichel <sre@kernel.org>
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    const: maxim,max14656
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    i2c0 {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      charger-detector@35 {
+        compatible = "maxim,max14656";
+        reg = <0x35>;
+        interrupt-parent = <&gpio6>;
+        interrupts = <26 IRQ_TYPE_LEVEL_HIGH>;
+      };
+    };
diff --git a/Documentation/devicetree/bindings/power/supply/maxim,max17040.yaml b/Documentation/devicetree/bindings/power/supply/maxim,max17040.yaml
new file mode 100644 (file)
index 0000000..de91cf3
--- /dev/null
@@ -0,0 +1,95 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/maxim,max17040.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Maxim 17040 fuel gauge series
+
+maintainers:
+  - Sebastian Reichel <sre@kernel.org>
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    enum:
+      - maxim,max17040
+      - maxim,max17041
+      - maxim,max17043
+      - maxim,max17044
+      - maxim,max17048
+      - maxim,max17049
+      - maxim,max17058
+      - maxim,max17059
+      - maxim,max77836-battery
+
+  reg:
+    maxItems: 1
+
+  maxim,alert-low-soc-level:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 1
+    maximum: 32
+    description: |
+      The alert threshold that sets the state of charge level (%) where an interrupt is generated.
+      If skipped the power up default value of 4 (%) will be used.
+
+  maxim,double-soc:
+    type: boolean
+    description: |
+      Certain devices return double the capacity.
+      Specify this to divide the reported value in 2 and thus normalize it.
+      SoC == State of Charge == Capacity.
+
+  maxim,rcomp:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      A value to compensate readings for various battery chemistries and operating temperatures.
+      max17040,41 have 2 byte rcomp, default to 0x97 0x00.
+      All other devices have one byte rcomp, default to 0x97.
+
+  interrupts:
+    maxItems: 1
+
+  wakeup-source:
+    type: boolean
+    description: |
+      Use this property to use alert low SoC level interrupt as wake up source.
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c0 {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      battery@36 {
+        compatible = "maxim,max17048";
+        reg = <0x36>;
+        maxim,rcomp = /bits/ 8 <0x56>;
+        maxim,alert-low-soc-level = <10>;
+        maxim,double-soc;
+      };
+    };
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    i2c0 {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      battery@36 {
+        compatible = "maxim,max77836-battery";
+        reg = <0x36>;
+        maxim,alert-low-soc-level = <10>;
+        interrupt-parent = <&gpio7>;
+        interrupts = <2 IRQ_TYPE_EDGE_FALLING>;
+        wakeup-source;
+      };
+    };
diff --git a/Documentation/devicetree/bindings/power/supply/maxim,max17042.yaml b/Documentation/devicetree/bindings/power/supply/maxim,max17042.yaml
new file mode 100644 (file)
index 0000000..c70f05e
--- /dev/null
@@ -0,0 +1,78 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/maxim,max17042.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Maxim 17042 fuel gauge series
+
+maintainers:
+  - Sebastian Reichel <sre@kernel.org>
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    enum:
+      - maxim,max17042
+      - maxim,max17047
+      - maxim,max17050
+      - maxim,max17055
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  maxim,rsns-microohm:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      Resistance of rsns resistor in micro Ohms (datasheet-recommended value is 10000).
+      Defining this property enables current-sense functionality.
+
+  maxim,cold-temp:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      Temperature threshold to report battery as cold (in tenths of degree Celsius).
+      Default is not to report cold events.
+
+  maxim,over-heat-temp:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      Temperature threshold to report battery as over heated (in tenths of degree Celsius).
+      Default is not to report over heating events.
+
+  maxim,dead-volt:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      Voltage threshold to report battery as dead (in mV).
+      Default is not to report dead battery events.
+
+  maxim,over-volt:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      Voltage threshold to report battery as over voltage (in mV).
+      Default is not to report over-voltage events.
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c0 {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      battery@36 {
+        compatible = "maxim,max17042";
+        reg = <0x36>;
+        maxim,rsns-microohm = <10000>;
+        maxim,over-heat-temp = <600>;
+        maxim,over-volt = <4300>;
+      };
+    };
diff --git a/Documentation/devicetree/bindings/power/supply/maxim,max8903.yaml b/Documentation/devicetree/bindings/power/supply/maxim,max8903.yaml
new file mode 100644 (file)
index 0000000..4828ca0
--- /dev/null
@@ -0,0 +1,67 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/maxim,max8903.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Maxim Semiconductor MAX8903 Battery Charger
+
+maintainers:
+  - Sebastian Reichel <sre@kernel.org>
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    const: maxim,max8903
+
+  dok-gpios:
+    maxItems: 1
+    description: Valid DC power has been detected (active low, input)
+
+  uok-gpios:
+    maxItems: 1
+    description: Valid USB power has been detected (active low, input)
+
+  cen-gpios:
+    maxItems: 1
+    description: Charge enable pin (active low, output)
+
+  chg-gpios:
+    maxItems: 1
+    description: Charger status pin (active low, input)
+
+  flt-gpios:
+    maxItems: 1
+    description: Fault pin (active low, output)
+
+  dcm-gpios:
+    maxItems: 1
+    description: Current limit mode setting (DC=1 or USB=0, output)
+
+  usus-gpios:
+    maxItems: 1
+    description: USB suspend pin (active high, output)
+
+required:
+  - compatible
+
+anyOf:
+  - required:
+      - dok-gpios
+  - required:
+      - uok-gpios
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    charger {
+      compatible = "maxim,max8903";
+      dok-gpios = <&gpio2 3 GPIO_ACTIVE_LOW>;
+      flt-gpios = <&gpio2 2 GPIO_ACTIVE_LOW>;
+      chg-gpios = <&gpio3 15 GPIO_ACTIVE_LOW>;
+      cen-gpios = <&gpio2 5 GPIO_ACTIVE_LOW>;
+    };
diff --git a/Documentation/devicetree/bindings/power/supply/microchip,ucs1002.txt b/Documentation/devicetree/bindings/power/supply/microchip,ucs1002.txt
deleted file mode 100644 (file)
index 1d284ad..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-Microchip UCS1002 USB Port Power Controller
-
-Required properties:
-- compatible           : Should be "microchip,ucs1002";
-- reg                  : I2C slave address
-
-Optional properties:
-- interrupts           : A list of interrupts lines present (could be either
-                         corresponding to A_DET# pin, ALERT# pin, or both)
-- interrupt-names      : A list of interrupt names. Should contain (if
-                         present):
-                         - "a_det" for line connected to A_DET# pin
-                         - "alert" for line connected to ALERT# pin
-                         Both are expected to be IRQ_TYPE_EDGE_BOTH
-Example:
-
-&i2c3 {
-       charger@32 {
-               compatible = "microchip,ucs1002";
-               pinctrl-names = "default";
-               pinctrl-0 = <&pinctrl_ucs1002_pins>;
-               reg = <0x32>;
-               interrupts-extended = <&gpio5 2 IRQ_TYPE_EDGE_BOTH>,
-                                     <&gpio3 21 IRQ_TYPE_EDGE_BOTH>;
-               interrupt-names = "a_det", "alert";
-       };
-};
diff --git a/Documentation/devicetree/bindings/power/supply/microchip,ucs1002.yaml b/Documentation/devicetree/bindings/power/supply/microchip,ucs1002.yaml
new file mode 100644 (file)
index 0000000..b9bd159
--- /dev/null
@@ -0,0 +1,51 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/supply/microchip,ucs1002.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Microchip UCS1002 USB Port Power Controller
+
+maintainers:
+  - Sebastian Reichel <sre@kernel.org>
+
+properties:
+  compatible:
+    const: microchip,ucs1002
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 2
+
+  interrupt-names:
+    oneOf:
+      - items:
+          - const: a_det
+          - const: alert
+      - const: a_det
+      - const: alert
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        charger@32 {
+            compatible = "microchip,ucs1002";
+            reg = <0x32>;
+            interrupts-extended = <&gpio5 2 IRQ_TYPE_EDGE_BOTH>,
+                                  <&gpio3 21 IRQ_TYPE_EDGE_BOTH>;
+            interrupt-names = "a_det", "alert";
+       };
+    };
diff --git a/Documentation/devicetree/bindings/power/supply/nokia,n900-battery.yaml b/Documentation/devicetree/bindings/power/supply/nokia,n900-battery.yaml
new file mode 100644 (file)
index 0000000..4a1489f
--- /dev/null
@@ -0,0 +1,49 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/nokia,n900-battery.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Nokia N900 battery
+
+maintainers:
+  - Pali Rohár <pali@kernel.org>
+  - Sebastian Reichel <sre@kernel.org>
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    const: nokia,n900-battery
+
+  io-channels:
+    items:
+      - description: ADC channel for temperature reading
+      - description: ADC channel for battery size identification
+      - description: ADC channel to measure the battery voltage
+
+  io-channel-names:
+    items:
+      - const: temp
+      - const: bsi
+      - const: vbat
+
+required:
+  - compatible
+  - io-channels
+  - io-channel-names
+
+additionalProperties: false
+
+examples:
+  - |
+    battery {
+      compatible = "nokia,n900-battery";
+      io-channels = <&twl4030_madc 0>,
+                    <&twl4030_madc 4>,
+                    <&twl4030_madc 12>;
+      io-channel-names = "temp",
+                         "bsi",
+                         "vbat";
+    };
diff --git a/Documentation/devicetree/bindings/power/supply/olpc-battery.yaml b/Documentation/devicetree/bindings/power/supply/olpc-battery.yaml
new file mode 100644 (file)
index 0000000..0bd7bf3
--- /dev/null
@@ -0,0 +1,27 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/olpc-battery.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: OLPC Battery
+
+maintainers:
+  - Sebastian Reichel <sre@kernel.org>
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - const: olpc,xo1.5-battery
+          - const: olpc,xo1-battery
+      - items:
+          - const: olpc,xo1-battery
+
+required:
+  - compatible
+
+additionalProperties: false
diff --git a/Documentation/devicetree/bindings/power/supply/olpc_battery.txt b/Documentation/devicetree/bindings/power/supply/olpc_battery.txt
deleted file mode 100644 (file)
index 8d87d6b..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-OLPC battery
-~~~~~~~~~~~~
-
-Required properties:
-  - compatible : "olpc,xo1-battery" or "olpc,xo1.5-battery"
diff --git a/Documentation/devicetree/bindings/power/supply/power_supply.txt b/Documentation/devicetree/bindings/power/supply/power_supply.txt
deleted file mode 100644 (file)
index d9693e0..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-This binding has been converted to yaml please see power-supply.yaml in this
-directory.
diff --git a/Documentation/devicetree/bindings/power/supply/qcom,coincell-charger.txt b/Documentation/devicetree/bindings/power/supply/qcom,coincell-charger.txt
deleted file mode 100644 (file)
index 7478992..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-Qualcomm Coincell Charger:
-
-The hardware block controls charging for a coincell or capacitor that is
-used to provide power backup for certain features of the power management
-IC (PMIC)
-
-- compatible:
-       Usage: required
-       Value type: <string>
-       Definition: must be: "qcom,pm8941-coincell"
-
-- reg:
-       Usage: required
-       Value type: <u32>
-       Definition: base address of the coincell charger registers
-
-- qcom,rset-ohms:
-       Usage: required
-       Value type: <u32>
-       Definition: resistance (in ohms) for current-limiting resistor
-               must be one of: 800, 1200, 1700, 2100
-
-- qcom,vset-millivolts:
-       Usage: required
-       Value type: <u32>
-       Definition: voltage (in millivolts) to apply for charging
-               must be one of: 2500, 3000, 3100, 3200
-
-- qcom,charger-disable:
-       Usage: optional
-       Value type: <boolean>
-       Definition: defining this property disables charging
-
-This charger is a sub-node of one of the 8941 PMIC blocks, and is specified
-as a child node in DTS of that node.  See ../mfd/qcom,spmi-pmic.txt and
-../mfd/qcom-pm8xxx.txt
-
-Example:
-
-       pm8941@0 {
-               coincell@2800 {
-                       compatible = "qcom,pm8941-coincell";
-                       reg = <0x2800>;
-
-                       qcom,rset-ohms = <2100>;
-                       qcom,vset-millivolts = <3000>;
-               };
-       };
diff --git a/Documentation/devicetree/bindings/power/supply/qcom,pm8941-charger.yaml b/Documentation/devicetree/bindings/power/supply/qcom,pm8941-charger.yaml
new file mode 100644 (file)
index 0000000..bc89048
--- /dev/null
@@ -0,0 +1,169 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/supply/qcom,pm8941-charger.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm Switch-Mode Battery Charger and Boost
+
+maintainers:
+  - Sebastian Reichel <sre@kernel.org>
+
+properties:
+  compatible:
+    const: qcom,pm8941-charger
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    items:
+      - description: charge done
+      - description: charge fast mode
+      - description: charge trickle mode
+      - description: battery temperature ok
+      - description: battery present
+      - description: charger disconnected
+      - description: USB-in valid
+      - description: DC-in valid
+
+  interrupt-names:
+    items:
+      - const: chg-done
+      - const: chg-fast
+      - const: chg-trkl
+      - const: bat-temp-ok
+      - const: bat-present
+      - const: chg-gone
+      - const: usb-valid
+      - const: dc-valid
+
+  qcom,fast-charge-current-limit:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 100000
+    maximum: 3000000
+    description: Maximum charge current in uA; May be clamped to safety limits; Defaults to 1A
+
+  qcom,fast-charge-low-threshold-voltage:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 2100000
+    maximum: 3600000
+    description: |
+      Battery voltage limit in uV above which fast charging may operate; Defaults to 3.2V
+      Below this value linear or switch-mode auto-trickle-charging will operate.
+
+  qcom,fast-charge-high-threshold-voltage:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 3240000
+    maximum: 5000000
+    description: |
+      Battery voltage limit in uV below which fast charging may operate; Defaults to 4.2V
+      The fast charger will attempt to charge the battery to this voltage.
+      May be clamped to safety limits.
+
+  qcom,fast-charge-safe-voltage:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 3240000
+    maximum: 5000000
+    description: |
+      Maximum safe battery voltage in uV; May be pre-set by bootloader, in which case,
+      setting this will harmlessly fail. The property 'fast-charge-high-watermark' will
+      be clamped by this value. Defaults to 4.2V.
+
+  qcom,fast-charge-safe-current:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 100000
+    maximum: 3000000
+    description: |
+      Maximum safe battery charge current in uA; May pre-set by bootloader, in which case,
+      setting this will harmlessly fail. The property 'qcom,fast-charge-current-limit'
+      will be clamped by this value. Defaults to 1A.
+
+  qcom,auto-recharge-threshold-voltage:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 3240000
+    maximum: 5000000
+    description: |
+      Battery voltage limit in uV below which auto-recharge functionality will restart charging
+      after end-of-charge; The high cutoff limit for auto-recharge is 5% above this value.
+      Defaults to 4.1V.
+
+  qcom,minimum-input-voltage:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 4200000
+    maximum: 9600000
+    description: |
+      Input voltage level in uV above which charging may operate. Defaults to 4.3V.
+
+  qcom,dc-current-limit:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 100000
+    maximum: 2500000
+    description: |
+      Default DC charge current limit in uA. Defaults to 100mA.
+
+  qcom,disable-dc:
+    type: boolean
+    description: Disable DC charger
+
+  qcom,jeita-extended-temp-range:
+    type: boolean
+    description: |
+      Enable JEITA extended temperature range;  This does *not* adjust the maximum charge
+      voltage or current in the extended temperature range. It only allows charging when
+      the battery is in the extended temperature range. Voltage/current regulation must
+      be done externally to fully comply with the JEITA safety guidelines if this flag
+      is set.
+
+  usb-otg-in-supply:
+    description: Reference to the regulator supplying power to the USB_OTG_IN pin.
+
+  otg-vbus:
+    type: object
+    description: |
+      This node defines a regulator used to control the direction of VBUS voltage.
+      Specifically whether to supply voltage to VBUS for host mode operation of the OTG port,
+      or allow input voltage from external VBUS for charging. In the hardware, the supply for
+      this regulator comes from usb_otg_in-supply.
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - interrupt-names
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    pmic {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      charger@1000 {
+        compatible = "qcom,pm8941-charger";
+        reg = <0x1000>;
+        interrupts = <0x0 0x10 7 IRQ_TYPE_EDGE_BOTH>,
+                     <0x0 0x10 5 IRQ_TYPE_EDGE_BOTH>,
+                     <0x0 0x10 4 IRQ_TYPE_EDGE_BOTH>,
+                     <0x0 0x12 1 IRQ_TYPE_EDGE_BOTH>,
+                     <0x0 0x12 0 IRQ_TYPE_EDGE_BOTH>,
+                     <0x0 0x13 2 IRQ_TYPE_EDGE_BOTH>,
+                     <0x0 0x13 1 IRQ_TYPE_EDGE_BOTH>,
+                     <0x0 0x14 1 IRQ_TYPE_EDGE_BOTH>;
+        interrupt-names = "chg-done",
+                          "chg-fast",
+                          "chg-trkl",
+                          "bat-temp-ok",
+                          "bat-present",
+                          "chg-gone",
+                          "usb-valid",
+                          "dc-valid";
+        qcom,fast-charge-current-limit = <1000000>;
+        qcom,dc-current-limit = <1000000>;
+        usb-otg-in-supply = <&pm8941_5vs1>;
+
+        otg-vbus {};
+      };
+    };
diff --git a/Documentation/devicetree/bindings/power/supply/qcom,pm8941-coincell.yaml b/Documentation/devicetree/bindings/power/supply/qcom,pm8941-coincell.yaml
new file mode 100644 (file)
index 0000000..0450f4d
--- /dev/null
@@ -0,0 +1,57 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/supply/qcom,pm8941-coincell.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm Coincell Charger
+
+description: |
+  The hardware block controls charging for a coincell or capacitor that is
+  used to provide power backup for certain features of the power management
+  IC (PMIC)
+
+maintainers:
+  - Sebastian Reichel <sre@kernel.org>
+
+properties:
+  compatible:
+    const: qcom,pm8941-coincell
+
+  reg:
+    maxItems: 1
+
+  qcom,rset-ohms:
+    description: resistance (in ohms) for current-limiting resistor
+    enum: [ 800, 1200, 1700, 2100 ]
+
+  qcom,vset-millivolts:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: voltage (in millivolts) to apply for charging
+    enum: [ 2500, 3000, 3100, 3200 ]
+
+  qcom,charger-disable:
+    type: boolean
+    description: defining this property disables charging
+
+required:
+  - compatible
+  - reg
+  - qcom,rset-ohms
+  - qcom,vset-millivolts
+
+additionalProperties: false
+
+examples:
+  - |
+    pmic {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      charger@2800 {
+        compatible = "qcom,pm8941-coincell";
+        reg = <0x2800>;
+        qcom,rset-ohms = <2100>;
+        qcom,vset-millivolts = <3000>;
+      };
+    };
diff --git a/Documentation/devicetree/bindings/power/supply/qcom_smbb.txt b/Documentation/devicetree/bindings/power/supply/qcom_smbb.txt
deleted file mode 100644 (file)
index 06f8a5d..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-Qualcomm Switch-Mode Battery Charger and Boost
-
-PROPERTIES
-- compatible:
-  Usage: required
-  Value type: <stringlist>
-  Description: Must be one of:
-               - "qcom,pm8941-charger"
-
-- reg:
-  Usage: required
-  Value type: <prop-encoded-array>
-  Description: Base address of registers for SMBB block
-
-- interrupts:
-  Usage: required
-  Value type: <prop-encoded-array>
-  Description: The format of the specifier is defined by the binding document
-               describing the node's interrupt parent.  Must contain one
-               specifier for each of the following interrupts, in order:
-               - charge done
-               - charge fast mode
-               - charge trickle mode
-               - battery temperature ok
-               - battery present
-               - charger disconnected
-               - USB-in valid
-               - DC-in valid
-
-- interrupt-names:
-  Usage: required
-  Value type: <stringlist>
-  Description: Must contain the following list, strictly ordered:
-               "chg-done",
-               "chg-fast",
-               "chg-trkl",
-               "bat-temp-ok",
-               "bat-present",
-               "chg-gone",
-               "usb-valid",
-               "dc-valid"
-
-- qcom,fast-charge-current-limit:
-  Usage: optional (default: 1A, or pre-configured value)
-  Value type: <u32>; uA; range [100mA : 3A]
-  Description: Maximum charge current; May be clamped to safety limits.
-
-- qcom,fast-charge-low-threshold-voltage:
-  Usage: optional (default: 3.2V, or pre-configured value)
-  Value type: <u32>; uV; range [2.1V : 3.6V]
-  Description: Battery voltage limit above which fast charging may operate;
-               Below this value linear or switch-mode auto-trickle-charging
-               will operate.
-
-- qcom,fast-charge-high-threshold-voltage:
-  Usage: optional (default: 4.2V, or pre-configured value)
-  Value type: <u32>; uV; range [3.24V : 5V]
-  Description: Battery voltage limit below which fast charging may operate;
-               The fast charger will attempt to charge the battery to this
-               voltage.  May be clamped to safety limits.
-
-- qcom,fast-charge-safe-voltage:
-  Usage: optional (default: 4.2V, or pre-configured value)
-  Value type: <u32>; uV; range [3.24V : 5V]
-  Description: Maximum safe battery voltage; May be pre-set by bootloader, in
-               which case, setting this will harmlessly fail. The property
-               'fast-charge-high-watermark' will be clamped by this value.
-
-- qcom,fast-charge-safe-current:
-  Usage: optional (default: 1A, or pre-configured value)
-  Value type: <u32>; uA; range [100mA : 3A]
-  Description: Maximum safe battery charge current; May pre-set by bootloader,
-               in which case, setting this will harmlessly fail. The property
-               'qcom,fast-charge-current-limit' will be clamped by this value.
-
-- qcom,auto-recharge-threshold-voltage:
-  Usage: optional (default: 4.1V, or pre-configured value)
-  Value type: <u32>; uV; range [3.24V : 5V]
-  Description: Battery voltage limit below which auto-recharge functionality
-               will restart charging after end-of-charge;  The high cutoff
-               limit for auto-recharge is 5% above this value.
-
-- qcom,minimum-input-voltage:
-  Usage: optional (default: 4.3V, or pre-configured value)
-  Value type: <u32>; uV; range [4.2V : 9.6V]
-  Description: Input voltage level above which charging may operate
-
-- qcom,dc-current-limit:
-  Usage: optional (default: 100mA, or pre-configured value)
-  Value type: <u32>; uA; range [100mA : 2.5A]
-  Description: Default DC charge current limit
-
-- qcom,disable-dc:
-  Usage: optional (default: false)
-  Value type: boolean: <u32> or <empty>
-  Description: Disable DC charger
-
-- qcom,jeita-extended-temp-range:
-  Usage: optional (default: false)
-  Value type: boolean: <u32> or <empty>
-  Description: Enable JEITA extended temperature range;  This does *not*
-               adjust the maximum charge voltage or current in the extended
-               temperature range.  It only allows charging when the battery
-               is in the extended temperature range.  Voltage/current
-               regulation must be done externally to fully comply with
-               the JEITA safety guidelines if this flag is set.
-
-- usb_otg_in-supply:
-  Usage: optional
-  Value type: <phandle>
-  Description: Reference to the regulator supplying power to the USB_OTG_IN
-               pin.
-
-child nodes:
-- otg-vbus:
-  Usage: optional
-  Description: This node defines a regulator used to control the direction
-               of VBUS voltage - specifically: whether to supply voltage
-               to VBUS for host mode operation of the OTG port, or allow
-               input voltage from external VBUS for charging.  In the
-               hardware, the supply for this regulator comes from
-               usb_otg_in-supply.
-
-EXAMPLE
-charger@1000 {
-       compatible = "qcom,pm8941-charger";
-       reg = <0x1000 0x700>;
-       interrupts = <0x0 0x10 7 IRQ_TYPE_EDGE_BOTH>,
-                       <0x0 0x10 5 IRQ_TYPE_EDGE_BOTH>,
-                       <0x0 0x10 4 IRQ_TYPE_EDGE_BOTH>,
-                       <0x0 0x12 1 IRQ_TYPE_EDGE_BOTH>,
-                       <0x0 0x12 0 IRQ_TYPE_EDGE_BOTH>,
-                       <0x0 0x13 2 IRQ_TYPE_EDGE_BOTH>,
-                       <0x0 0x13 1 IRQ_TYPE_EDGE_BOTH>,
-                       <0x0 0x14 1 IRQ_TYPE_EDGE_BOTH>;
-       interrupt-names = "chg-done",
-                       "chg-fast",
-                       "chg-trkl",
-                       "bat-temp-ok",
-                       "bat-present",
-                       "chg-gone",
-                       "usb-valid",
-                       "dc-valid";
-
-       qcom,fast-charge-current-limit = <1000000>;
-       qcom,dc-charge-current-limit = <1000000>;
-       usb_otg_in-supply = <&pm8941_5vs1>;
-
-       otg-vbus {};
-};
diff --git a/Documentation/devicetree/bindings/power/supply/richtek,rt9455.yaml b/Documentation/devicetree/bindings/power/supply/richtek,rt9455.yaml
new file mode 100644 (file)
index 0000000..e1c2334
--- /dev/null
@@ -0,0 +1,90 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/richtek,rt9455.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Binding for Richtek rt9455 battery charger
+
+maintainers:
+  - Sebastian Reichel <sre@kernel.org>
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    const: richtek,rt9455
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  richtek,output-charge-current:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: output current from the charger to the battery, in uA.
+
+  richtek,end-of-charge-percentage:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      percent of the output charge current. When the current in constant-voltage phase drops
+      below output_charge_current x end-of-charge-percentage, charge is terminated.
+
+  richtek,battery-regulation-voltage:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: maximum battery voltage in uV.
+
+  richtek,boost-output-voltage:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      maximum voltage provided to consumer devices, when the charger is in boost mode, in uV.
+
+  richtek,min-input-voltage-regulation:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      input voltage level in uV, used to decrease voltage level when the over current of the
+      input power source occurs. This prevents input voltage drop due to insufficient
+      current provided by the power source. Defaults to 4500000 uV (4.5V).
+
+  richtek,avg-input-current-regulation:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      input current value in uA drained by the charger from the power source.
+      Defaults to 500000 uA (500mA).
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - richtek,output-charge-current
+  - richtek,end-of-charge-percentage
+  - richtek,battery-regulation-voltage
+  - richtek,boost-output-voltage
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    i2c0 {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      charger@22 {
+        compatible = "richtek,rt9455";
+        reg = <0x22>;
+
+        interrupt-parent = <&gpio1>;
+        interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+
+        richtek,output-charge-current      = <500000>;
+        richtek,end-of-charge-percentage    = <10>;
+        richtek,battery-regulation-voltage  = <4200000>;
+        richtek,boost-output-voltage       = <5050000>;
+
+        richtek,min-input-voltage-regulation = <4500000>;
+        richtek,avg-input-current-regulation = <500000>;
+      };
+    };
index 9852d2f..24b0695 100644 (file)
@@ -110,7 +110,7 @@ properties:
 #     multipleOf: 64000
 #     a charge cycle terminates when the battery voltage is above recharge
 #     threshold, and the current is below this setting (7 in above chart)
-#   See also Documentation/devicetree/bindings/power/supply/battery.txt
+#   See also Documentation/devicetree/bindings/power/supply/battery.yaml
 
   reg:
     maxItems: 1
diff --git a/Documentation/devicetree/bindings/power/supply/rt9455_charger.txt b/Documentation/devicetree/bindings/power/supply/rt9455_charger.txt
deleted file mode 100644 (file)
index 1e6107c..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-Binding for Richtek rt9455 battery charger
-
-Required properties:
-- compatible:                          it should contain one of the following:
-                                       "richtek,rt9455".
-- reg:                                 integer, i2c address of the device.
-- interrupts:                          interrupt mapping for GPIO IRQ, it should be
-                                       configured with IRQ_TYPE_LEVEL_LOW flag.
-- richtek,output-charge-current:       integer, output current from the charger to the
-                                       battery, in uA.
-- richtek,end-of-charge-percentage:    integer, percent of the output charge current.
-                                       When the current in constant-voltage phase drops
-                                       below output_charge_current x end-of-charge-percentage,
-                                       charge is terminated.
-- richtek,battery-regulation-voltage:  integer, maximum battery voltage in uV.
-- richtek,boost-output-voltage:                integer, maximum voltage provided to consumer
-                                       devices, when the charger is in boost mode, in uV.
-
-Optional properties:
-- richtek,min-input-voltage-regulation: integer, input voltage level in uV, used to
-                                       decrease voltage level when the over current
-                                       of the input power source occurs.
-                                       This prevents input voltage drop due to insufficient
-                                       current provided by the power source.
-                                       Default: 4500000 uV (4.5V)
-- richtek,avg-input-current-regulation: integer, input current value in uA drained by the
-                                       charger from the power source.
-                                       Default: 500000 uA (500mA)
-
-Example:
-
-rt9455@22 {
-       compatible = "richtek,rt9455";
-       reg = <0x22>;
-
-       interrupt-parent = <&gpio1>;
-       interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
-
-       richtek,output-charge-current       = <500000>;
-       richtek,end-of-charge-percentage    = <10>;
-       richtek,battery-regulation-voltage  = <4200000>;
-       richtek,boost-output-voltage        = <5050000>;
-
-       richtek,min-input-voltage-regulation = <4500000>;
-       richtek,avg-input-current-regulation = <500000>;
-};
diff --git a/Documentation/devicetree/bindings/power/supply/rx51-battery.txt b/Documentation/devicetree/bindings/power/supply/rx51-battery.txt
deleted file mode 100644 (file)
index 9043845..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-Binding for Nokia N900 battery
-
-The Nokia N900 battery status can be read via the TWL4030's A/D converter.
-
-Required properties:
-- compatible: Should contain one of the following:
- * "nokia,n900-battery"
-- io-channels: Should contain IIO channel specifiers
-               for each element in io-channel-names.
-- io-channel-names: Should contain the following values:
- * "temp" - The ADC channel for temperature reading
- * "bsi"  - The ADC channel for battery size identification
- * "vbat" - The ADC channel to measure the battery voltage
-
-Example from Nokia N900:
-
-battery: n900-battery {
-       compatible = "nokia,n900-battery";
-       io-channels = <&twl4030_madc 0>,
-                     <&twl4030_madc 4>,
-                     <&twl4030_madc 12>;
-       io-channel-names = "temp",
-                          "bsi",
-                          "vbat";
-};
index a90b360..90b9d3d 100644 (file)
@@ -12,12 +12,15 @@ maintainers:
 description: |
   Battery compatible with the smart battery system specifications
 
-properties:
+allOf:
+  - $ref: power-supply.yaml#
 
+properties:
   compatible:
     oneOf:
       - items:
           - enum:
+              - ti,bq20z45
               - ti,bq20z65
               - ti,bq20z75
           - enum:
@@ -60,7 +63,7 @@ required:
   - compatible
   - reg
 
-additionalProperties: false
+unevaluatedProperties: false
 
 examples:
   - |
diff --git a/Documentation/devicetree/bindings/power/supply/sbs,sbs-charger.yaml b/Documentation/devicetree/bindings/power/supply/sbs,sbs-charger.yaml
new file mode 100644 (file)
index 0000000..cb73ffa
--- /dev/null
@@ -0,0 +1,55 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/supply/sbs,sbs-charger.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: SBS compliant charger
+
+maintainers:
+  - Sebastian Reichel <sre@kernel.org>
+
+description: |
+  Charger compatible with the smart battery system specifications
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - enum:
+              - lltc,ltc4100
+          - enum:
+              - sbs,sbs-charger
+      - items:
+          - const: sbs,sbs-charger
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        charger@9 {
+            compatible = "lltc,ltc4100", "sbs,sbs-charger";
+            reg = <0x9>;
+            interrupt-parent = <&gpio6>;
+            interrupts = <7 IRQ_TYPE_LEVEL_LOW>;
+       };
+    };
diff --git a/Documentation/devicetree/bindings/power/supply/sbs,sbs-manager.txt b/Documentation/devicetree/bindings/power/supply/sbs,sbs-manager.txt
deleted file mode 100644 (file)
index 4b21955..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-Binding for sbs-manager
-
-Required properties:
-- compatible: "<vendor>,<part-number>", "sbs,sbs-charger" as fallback. The part
-  number compatible string might be used in order to take care of vendor
-  specific registers.
-- reg: integer, i2c address of the device. Should be <0xa>.
-Optional properties:
-- gpio-controller: Marks the port as GPIO controller.
-  See "gpio-specifier" in .../devicetree/bindings/gpio/gpio.txt.
-- #gpio-cells: Should be <2>. The first cell is the pin number, the second cell
-  is used to specify optional parameters:
-  See "gpio-specifier" in .../devicetree/bindings/gpio/gpio.txt.
-
-From OS view the device is basically an i2c-mux used to communicate with up to
-four smart battery devices at address 0xb. The driver actually implements this
-behaviour. So standard i2c-mux nodes can be used to register up to four slave
-batteries. Channels will be numerated starting from 1 to 4.
-
-Example:
-
-batman@a {
-    compatible = "lltc,ltc1760", "sbs,sbs-manager";
-    reg = <0x0a>;
-    #address-cells = <1>;
-    #size-cells = <0>;
-
-    gpio-controller;
-    #gpio-cells = <2>;
-
-    i2c@1 {
-        #address-cells = <1>;
-        #size-cells = <0>;
-        reg = <1>;
-
-        battery@b {
-            compatible = "ti,bq2060", "sbs,sbs-battery";
-            reg = <0x0b>;
-            sbs,battery-detect-gpios = <&batman 1 1>;
-        };
-    };
-
-    i2c@2 {
-        #address-cells = <1>;
-        #size-cells = <0>;
-        reg = <2>;
-
-        battery@b {
-            compatible = "ti,bq2060", "sbs,sbs-battery";
-            reg = <0x0b>;
-            sbs,battery-detect-gpios = <&batman 2 1>;
-        };
-    };
-
-    i2c@3 {
-        #address-cells = <1>;
-        #size-cells = <0>;
-        reg = <3>;
-
-        battery@b {
-            compatible = "ti,bq2060", "sbs,sbs-battery";
-            reg = <0x0b>;
-            sbs,battery-detect-gpios = <&batman 3 1>;
-        };
-    };
-};
diff --git a/Documentation/devicetree/bindings/power/supply/sbs,sbs-manager.yaml b/Documentation/devicetree/bindings/power/supply/sbs,sbs-manager.yaml
new file mode 100644 (file)
index 0000000..72e8f27
--- /dev/null
@@ -0,0 +1,107 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/supply/sbs,sbs-manager.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: SBS compliant manger
+
+maintainers:
+  - Sebastian Reichel <sre@kernel.org>
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - enum:
+              - lltc,ltc1760
+          - enum:
+              - sbs,sbs-manager
+      - items:
+          - const: sbs,sbs-manager
+
+  reg:
+    const: 0xa
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+  gpio-controller: true
+
+  "#gpio-cells":
+    const: 2
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+patternProperties:
+  "^i2c@[1-4]$":
+    type: object
+
+    allOf:
+      - $ref: /schemas/i2c/i2c-controller.yaml#
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/gpio/gpio.h>
+
+    i2c {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      batman: battery-manager@a {
+        compatible = "lltc,ltc1760", "sbs,sbs-manager";
+        reg = <0x0a>;
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        gpio-controller;
+        #gpio-cells = <2>;
+
+        i2c@1 {
+          #address-cells = <1>;
+          #size-cells = <0>;
+          reg = <1>;
+
+          battery@b {
+            compatible = "ti,bq20z65", "sbs,sbs-battery";
+            reg = <0x0b>;
+            sbs,battery-detect-gpios = <&batman 1 1>;
+          };
+        };
+
+        i2c@2 {
+          #address-cells = <1>;
+          #size-cells = <0>;
+          reg = <2>;
+
+          battery@b {
+            compatible = "ti,bq20z65", "sbs,sbs-battery";
+            reg = <0x0b>;
+            sbs,battery-detect-gpios = <&batman 2 1>;
+          };
+        };
+
+        i2c@3 {
+          #address-cells = <1>;
+          #size-cells = <0>;
+          reg = <3>;
+
+          battery@b {
+            compatible = "ti,bq20z65", "sbs,sbs-battery";
+            reg = <0x0b>;
+            sbs,battery-detect-gpios = <&batman 3 1>;
+          };
+        };
+      };
+    };
diff --git a/Documentation/devicetree/bindings/power/supply/sbs_sbs-charger.txt b/Documentation/devicetree/bindings/power/supply/sbs_sbs-charger.txt
deleted file mode 100644 (file)
index 84e7415..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-SBS sbs-charger
-~~~~~~~~~~
-
-Required properties:
- - compatible: "<vendor>,<part-number>", "sbs,sbs-charger" as fallback. The part
-     number compatible string might be used in order to take care of vendor
-     specific registers.
-
-Optional properties:
-- interrupts: Interrupt mapping for GPIO IRQ. Use in conjunction with
-    "interrupt-parent". If an interrupt is not provided the driver will switch
-    automatically to polling.
-
-Example:
-
-       ltc4100@9 {
-               compatible = "lltc,ltc4100", "sbs,sbs-charger";
-               reg = <0x9>;
-               interrupt-parent = <&gpio6>;
-               interrupts = <7 IRQ_TYPE_LEVEL_LOW>;
-       };
diff --git a/Documentation/devicetree/bindings/power/supply/sc2731-charger.yaml b/Documentation/devicetree/bindings/power/supply/sc2731-charger.yaml
new file mode 100644 (file)
index 0000000..db1aa23
--- /dev/null
@@ -0,0 +1,53 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/sc2731-charger.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Spreadtrum SC2731 PMICs battery charger binding
+
+maintainers:
+  - Sebastian Reichel <sre@kernel.org>
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    const: sprd,sc2731-charger
+
+  reg:
+    maxItems: 1
+
+  phys:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: phandle to the USB phy
+
+  monitored-battery:
+    description: |
+      The charger uses the following battery properties
+      - charge-term-current-microamp: current for charge termination phase.
+      - constant-charge-voltage-max-microvolt: maximum constant input voltage.
+      See Documentation/devicetree/bindings/power/supply/battery.yaml
+
+additionalProperties: false
+
+examples:
+  - |
+    bat: battery {
+      compatible = "simple-battery";
+      charge-term-current-microamp = <120000>;
+      constant-charge-voltage-max-microvolt = <4350000>;
+    };
+
+    pmic {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      battery@a00 {
+        compatible = "sprd,sc2731-charger";
+        reg = <0x0>;
+        phys = <&ssphy>;
+        monitored-battery = <&bat>;
+      };
+    };
diff --git a/Documentation/devicetree/bindings/power/supply/sc2731_charger.txt b/Documentation/devicetree/bindings/power/supply/sc2731_charger.txt
deleted file mode 100644 (file)
index 5266fab..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-Spreadtrum SC2731 PMIC battery charger binding
-
-Required properties:
- - compatible: Should be "sprd,sc2731-charger".
- - reg: Address offset of charger register.
- - phys: Contains a phandle to the USB phy.
-
-Optional Properties:
-- monitored-battery: phandle of battery characteristics devicetree node.
-  The charger uses the following battery properties:
-- charge-term-current-microamp: current for charge termination phase.
-- constant-charge-voltage-max-microvolt: maximum constant input voltage.
-  See Documentation/devicetree/bindings/power/supply/battery.txt
-
-Example:
-
-       bat: battery {
-               compatible = "simple-battery";
-               charge-term-current-microamp = <120000>;
-               constant-charge-voltage-max-microvolt = <4350000>;
-               ......
-       };
-
-       sc2731_pmic: pmic@0 {
-               compatible = "sprd,sc2731";
-               reg = <0>;
-               spi-max-frequency = <26000000>;
-               interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
-               interrupt-controller;
-               #interrupt-cells = <2>;
-               #address-cells = <1>;
-               #size-cells = <0>;
-
-               charger@0 {
-                       compatible = "sprd,sc2731-charger";
-                       reg = <0x0>;
-                       phys = <&ssphy>;
-                       monitored-battery = <&bat>;
-               };
-       };
diff --git a/Documentation/devicetree/bindings/power/supply/sc27xx-fg.txt b/Documentation/devicetree/bindings/power/supply/sc27xx-fg.txt
deleted file mode 100644 (file)
index b6359b5..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-Spreadtrum SC27XX PMICs Fuel Gauge Unit Power Supply Bindings
-
-Required properties:
-- compatible: Should be one of the following:
-  "sprd,sc2720-fgu",
-  "sprd,sc2721-fgu",
-  "sprd,sc2723-fgu",
-  "sprd,sc2730-fgu",
-  "sprd,sc2731-fgu".
-- reg: The address offset of fuel gauge unit.
-- battery-detect-gpios: GPIO for battery detection.
-- io-channels: Specify the IIO ADC channels to get temperature and charge voltage.
-- io-channel-names: Should be "bat-temp" or "charge-vol".
-- nvmem-cells: A phandle to the calibration cells provided by eFuse device.
-- nvmem-cell-names: Should be "fgu_calib".
-- sprd,calib-resistance-micro-ohms: Specify the real resistance of coulomb counter
-  chip in micro Ohms.
-- monitored-battery: Phandle of battery characteristics devicetree node.
-  See Documentation/devicetree/bindings/power/supply/battery.txt
-
-Example:
-
-       bat: battery {
-               compatible = "simple-battery";
-               charge-full-design-microamp-hours = <1900000>;
-               constant-charge-voltage-max-microvolt = <4350000>;
-               ocv-capacity-celsius = <20>;
-               ocv-capacity-table-0 = <4185000 100>, <4113000 95>, <4066000 90>,
-                                       <4022000 85>, <3983000 80>, <3949000 75>,
-                                       <3917000 70>, <3889000 65>, <3864000 60>,
-                                       <3835000 55>, <3805000 50>, <3787000 45>,
-                                       <3777000 40>, <3773000 35>, <3770000 30>,
-                                       <3765000 25>, <3752000 20>, <3724000 15>,
-                                       <3680000 10>, <3605000 5>, <3400000 0>;
-               ......
-       };
-
-       sc2731_pmic: pmic@0 {
-               compatible = "sprd,sc2731";
-               reg = <0>;
-               spi-max-frequency = <26000000>;
-               interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
-               interrupt-controller;
-               #interrupt-cells = <2>;
-               #address-cells = <1>;
-               #size-cells = <0>;
-
-               fgu@a00 {
-                       compatible = "sprd,sc2731-fgu";
-                       reg = <0xa00>;
-                       battery-detect-gpios = <&pmic_eic 9 GPIO_ACTIVE_HIGH>;
-                       io-channels = <&pmic_adc 5>, <&pmic_adc 14>;
-                       io-channel-names = "bat-temp", "charge-vol";
-                       nvmem-cells = <&fgu_calib>;
-                       nvmem-cell-names = "fgu_calib";
-                       monitored-battery = <&bat>;
-                       sprd,calib-resistance-micro-ohms = <21500>;
-               };
-       };
diff --git a/Documentation/devicetree/bindings/power/supply/sc27xx-fg.yaml b/Documentation/devicetree/bindings/power/supply/sc27xx-fg.yaml
new file mode 100644 (file)
index 0000000..e019cff
--- /dev/null
@@ -0,0 +1,98 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/sc27xx-fg.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Spreadtrum SC27XX PMICs Fuel Gauge Unit Power Supply Bindings
+
+maintainers:
+  - Sebastian Reichel <sre@kernel.org>
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    enum:
+      - sprd,sc2720-fgu
+      - sprd,sc2721-fgu
+      - sprd,sc2723-fgu
+      - sprd,sc2730-fgu
+      - sprd,sc2731-fgu
+
+  reg:
+    maxItems: 1
+
+  battery-detect-gpios:
+    maxItems: 1
+
+  io-channels:
+    items:
+      - description: Battery Temperature ADC
+      - description: Battery Charge Voltage ADC
+
+  io-channel-names:
+    items:
+      - const: bat-temp
+      - const: charge-vol
+
+  nvmem-cells:
+    maxItems: 1
+    description: Calibration cells provided by eFuse device
+
+  nvmem-cell-names:
+    const: fgu_calib
+
+  sprd,calib-resistance-micro-ohms:
+    description: real resistance of coulomb counter chip in micro Ohms
+
+  monitored-battery: true
+
+required:
+  - compatible
+  - reg
+  - battery-detect-gpios
+  - io-channels
+  - io-channel-names
+  - nvmem-cells
+  - nvmem-cell-names
+  - sprd,calib-resistance-micro-ohms
+  - monitored-battery
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    bat: battery {
+      compatible = "simple-battery";
+      charge-full-design-microamp-hours = <1900000>;
+      constant-charge-voltage-max-microvolt = <4350000>;
+      ocv-capacity-celsius = <20>;
+      ocv-capacity-table-0 = <4185000 100>, <4113000 95>, <4066000 90>,
+                             <4022000 85>, <3983000 80>, <3949000 75>,
+                             <3917000 70>, <3889000 65>, <3864000 60>,
+                             <3835000 55>, <3805000 50>, <3787000 45>,
+                             <3777000 40>, <3773000 35>, <3770000 30>,
+                             <3765000 25>, <3752000 20>, <3724000 15>,
+                             <3680000 10>, <3605000 5>, <3400000 0>;
+                             // ...
+    };
+
+    pmic {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      battery@a00 {
+        compatible = "sprd,sc2731-fgu";
+        reg = <0xa00>;
+        battery-detect-gpios = <&pmic_eic 9 GPIO_ACTIVE_HIGH>;
+        io-channels = <&pmic_adc 5>, <&pmic_adc 14>;
+        io-channel-names = "bat-temp", "charge-vol";
+        nvmem-cells = <&fgu_calib>;
+        nvmem-cell-names = "fgu_calib";
+        monitored-battery = <&bat>;
+        sprd,calib-resistance-micro-ohms = <21500>;
+      };
+    };
diff --git a/Documentation/devicetree/bindings/power/supply/stericsson,ab8500-battery.txt b/Documentation/devicetree/bindings/power/supply/stericsson,ab8500-battery.txt
new file mode 100644 (file)
index 0000000..ee125cb
--- /dev/null
@@ -0,0 +1,34 @@
+AB85000 PMIC contains a node, which contains shared
+information about the battery connected to the PMIC.
+The node has no compatible property.
+
+Properties of this node are:
+
+thermistor-on-batctrl:
+       A boolean value indicating thermistor interface to battery
+
+       Note:
+       'btemp' and 'batctrl' are the pins interfaced for battery temperature
+       measurement, 'btemp' signal is used when NTC(negative temperature
+       coefficient) resister is interfaced external to battery whereas
+       'batctrl' pin is used when NTC resister is internal to battery.
+
+       Example:
+       ab8500_battery: ab8500_battery {
+               thermistor-on-batctrl;
+       };
+       indicates: NTC resister is internal to battery, 'batctrl' is used
+               for thermal measurement.
+
+       The absence of property 'thermal-on-batctrl' indicates
+       NTC resister is external to battery and  'btemp' signal is used
+       for thermal measurement.
+
+battery-type:
+       This shall be the battery manufacturing technology type,
+       allowed types are:
+               "UNKNOWN" "NiMH" "LION" "LIPO" "LiFe" "NiCd" "LiMn"
+       Example:
+       ab8500_battery: ab8500_battery {
+               stericsson,battery-type = "LIPO";
+       }
diff --git a/Documentation/devicetree/bindings/power/supply/stericsson,ab8500-btemp.yaml b/Documentation/devicetree/bindings/power/supply/stericsson,ab8500-btemp.yaml
new file mode 100644 (file)
index 0000000..2f57aa5
--- /dev/null
@@ -0,0 +1,73 @@
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2021 Sebastian Reichel
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/stericsson,ab8500-btemp.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: AB8500 Battery Temperature Monitor
+
+maintainers:
+  - Sebastian Reichel <sre@kernel.org>
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    const: stericsson,ab8500-btemp
+
+  battery:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: phandle to battery node
+
+  interrupts:
+    maxItems: 5
+
+  interrupt-names:
+    items:
+      - const: BAT_CTRL_INDB
+      - const: BTEMP_LOW
+      - const: BTEMP_HIGH
+      - const: BTEMP_LOW_MEDIUM
+      - const: BTEMP_MEDIUM_HIGH
+
+  io-channels:
+    maxItems: 2
+
+  io-channel-names:
+    items:
+      - const: btemp_ball
+      - const: bat_ctrl
+
+required:
+  - compatible
+  - battery
+  - interrupts
+  - interrupt-names
+  - io-channels
+  - io-channel-names
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    pmic {
+      battery-temperature {
+        compatible = "stericsson,ab8500-btemp";
+        battery = <&ab8500_battery>;
+        interrupts = <20 IRQ_TYPE_LEVEL_HIGH>,
+                     <80 IRQ_TYPE_LEVEL_HIGH>,
+                     <83 IRQ_TYPE_LEVEL_HIGH>,
+                     <81 IRQ_TYPE_LEVEL_HIGH>,
+                     <82 IRQ_TYPE_LEVEL_HIGH>;
+        interrupt-names = "BAT_CTRL_INDB",
+                          "BTEMP_LOW",
+                          "BTEMP_HIGH",
+                          "BTEMP_LOW_MEDIUM",
+                          "BTEMP_MEDIUM_HIGH";
+        io-channels = <&gpadc 0x02>, <&gpadc 0x01>;
+        io-channel-names = "btemp_ball", "bat_ctrl";
+      };
+    };
diff --git a/Documentation/devicetree/bindings/power/supply/stericsson,ab8500-chargalg.yaml b/Documentation/devicetree/bindings/power/supply/stericsson,ab8500-chargalg.yaml
new file mode 100644 (file)
index 0000000..0897231
--- /dev/null
@@ -0,0 +1,37 @@
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2021 Sebastian Reichel
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/stericsson,ab8500-chargalg.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: AB8500 Charging Algorithm
+
+maintainers:
+  - Sebastian Reichel <sre@kernel.org>
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    const: stericsson,ab8500-chargalg
+
+  battery:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: phandle to battery node
+
+required:
+  - compatible
+  - battery
+
+additionalProperties: false
+
+examples:
+  - |
+    pmic {
+      charging-algorithm {
+        compatible = "stericsson,ab8500-chargalg";
+        battery = <&ab8500_battery>;
+      };
+    };
diff --git a/Documentation/devicetree/bindings/power/supply/stericsson,ab8500-charger.yaml b/Documentation/devicetree/bindings/power/supply/stericsson,ab8500-charger.yaml
new file mode 100644 (file)
index 0000000..e13305a
--- /dev/null
@@ -0,0 +1,123 @@
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2021 Sebastian Reichel
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/stericsson,ab8500-charger.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: AB8500 Charger
+
+maintainers:
+  - Sebastian Reichel <sre@kernel.org>
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    const: stericsson,ab8500-charger
+
+  battery:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: phandle to battery node
+
+  vddadc-supply:
+    description: Supply for USB and Main charger
+
+  autopower_cfg:
+    type: boolean
+    description: automatic poweron after powerloss
+
+  interrupts:
+    maxItems: 14
+
+  interrupt-names:
+    items:
+      - const: MAIN_CH_UNPLUG_DET
+      - const: MAIN_CHARGE_PLUG_DET
+      - const: MAIN_EXT_CH_NOT_OK
+      - const: MAIN_CH_TH_PROT_R
+      - const: MAIN_CH_TH_PROT_F
+      - const: VBUS_DET_F
+      - const: VBUS_DET_R
+      - const: USB_LINK_STATUS
+      - const: USB_CH_TH_PROT_R
+      - const: USB_CH_TH_PROT_F
+      - const: USB_CHARGER_NOT_OKR
+      - const: VBUS_OVV
+      - const: CH_WD_EXP
+      - const: VBUS_CH_DROP_END
+
+  io-channels:
+    minItems: 2
+    maxItems: 4
+
+  io-channel-names:
+    oneOf:
+      - items:
+          - const: main_charger_v
+          - const: main_charger_c
+          - const: vbus_v
+          - const: usb_charger_c
+      - items:
+          - const: vbus_v
+          - const: usb_charger_c
+
+
+required:
+  - compatible
+  - battery
+  - vddadc-supply
+  - interrupts
+  - interrupt-names
+  - io-channels
+  - io-channel-names
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    pmic {
+      charger {
+        compatible = "stericsson,ab8500-charger";
+        battery = <&ab8500_battery>;
+        vddadc-supply = <&ab8500_ldo_tvout_reg>;
+        interrupts = <10 IRQ_TYPE_LEVEL_HIGH>,
+                     <11 IRQ_TYPE_LEVEL_HIGH>,
+                     <0 IRQ_TYPE_LEVEL_HIGH>,
+                     <107 IRQ_TYPE_LEVEL_HIGH>,
+                     <106 IRQ_TYPE_LEVEL_HIGH>,
+                     <14 IRQ_TYPE_LEVEL_HIGH>,
+                     <15 IRQ_TYPE_LEVEL_HIGH>,
+                     <79 IRQ_TYPE_LEVEL_HIGH>,
+                     <105 IRQ_TYPE_LEVEL_HIGH>,
+                     <104 IRQ_TYPE_LEVEL_HIGH>,
+                     <89 IRQ_TYPE_LEVEL_HIGH>,
+                     <22 IRQ_TYPE_LEVEL_HIGH>,
+                     <21 IRQ_TYPE_LEVEL_HIGH>,
+                     <16 IRQ_TYPE_LEVEL_HIGH>;
+        interrupt-names = "MAIN_CH_UNPLUG_DET",
+                          "MAIN_CHARGE_PLUG_DET",
+                          "MAIN_EXT_CH_NOT_OK",
+                          "MAIN_CH_TH_PROT_R",
+                          "MAIN_CH_TH_PROT_F",
+                          "VBUS_DET_F",
+                          "VBUS_DET_R",
+                          "USB_LINK_STATUS",
+                          "USB_CH_TH_PROT_R",
+                          "USB_CH_TH_PROT_F",
+                          "USB_CHARGER_NOT_OKR",
+                          "VBUS_OVV",
+                          "CH_WD_EXP",
+                          "VBUS_CH_DROP_END";
+        io-channels = <&gpadc 0x03>,
+                      <&gpadc 0x0a>,
+                      <&gpadc 0x09>,
+                      <&gpadc 0x0b>;
+        io-channel-names = "main_charger_v",
+                           "main_charger_c",
+                           "vbus_v",
+                           "usb_charger_c";
+      };
+    };
diff --git a/Documentation/devicetree/bindings/power/supply/stericsson,ab8500-fg.yaml b/Documentation/devicetree/bindings/power/supply/stericsson,ab8500-fg.yaml
new file mode 100644 (file)
index 0000000..db342e5
--- /dev/null
@@ -0,0 +1,72 @@
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2021 Sebastian Reichel
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/stericsson,ab8500-fg.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: AB8500 Fuel Gauge
+
+maintainers:
+  - Sebastian Reichel <sre@kernel.org>
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    const: stericsson,ab8500-fg
+
+  battery:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: phandle to battery node
+
+  interrupts:
+    maxItems: 5
+
+  interrupt-names:
+    items:
+      - const: NCONV_ACCU
+      - const: BATT_OVV
+      - const: LOW_BAT_F
+      - const: CC_INT_CALIB
+      - const: CCEOC
+
+  io-channels:
+    maxItems: 1
+
+  io-channel-names:
+    items:
+      - const: main_bat_v
+
+required:
+  - compatible
+  - battery
+  - interrupts
+  - interrupt-names
+  - io-channels
+  - io-channel-names
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    pmic {
+      fuel-gauge {
+        compatible = "stericsson,ab8500-fg";
+        battery = <&ab8500_battery>;
+        interrupts = <24 IRQ_TYPE_LEVEL_HIGH>,
+                     <8 IRQ_TYPE_LEVEL_HIGH>,
+                     <28 IRQ_TYPE_LEVEL_HIGH>,
+                     <27 IRQ_TYPE_LEVEL_HIGH>,
+                     <26 IRQ_TYPE_LEVEL_HIGH>;
+        interrupt-names = "NCONV_ACCU",
+                          "BATT_OVV",
+                          "LOW_BAT_F",
+                          "CC_INT_CALIB",
+                          "CCEOC";
+        io-channels = <&gpadc 0x08>;
+        io-channel-names = "main_bat_v";
+      };
+    };
diff --git a/Documentation/devicetree/bindings/power/supply/ti,bq24735.txt b/Documentation/devicetree/bindings/power/supply/ti,bq24735.txt
deleted file mode 100644 (file)
index de45e1a..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-TI BQ24735 Charge Controller
-~~~~~~~~~~
-
-Required properties :
- - compatible : "ti,bq24735"
-
-Optional properties :
- - interrupts : Specify the interrupt to be used to trigger when the AC
-   adapter is either plugged in or removed.
- - ti,ac-detect-gpios : This GPIO is optionally used to read the AC adapter
-   status. This is a Host GPIO that is configured as an input and connected
-   to the ACOK pin on the bq24735. Note: for backwards compatibility reasons,
-   the GPIO must be active on AC adapter absence despite ACOK being active
-   (high) on AC adapter presence.
- - ti,charge-current : Used to control and set the charging current. This value
-   must be between 128mA and 8.128A with a 64mA step resolution. The POR value
-   is 0x0000h. This number is in mA (e.g. 8192), see spec for more information
-   about the ChargeCurrent (0x14h) register.
- - ti,charge-voltage : Used to control and set the charging voltage. This value
-   must be between 1.024V and 19.2V with a 16mV step resolution. The POR value
-   is 0x0000h. This number is in mV (e.g. 19200), see spec for more information
-   about the ChargeVoltage (0x15h) register.
- - ti,input-current : Used to control and set the charger input current. This
-   value must be between 128mA and 8.064A with a 128mA step resolution. The
-   POR value is 0x1000h. This number is in mA (e.g. 8064), see the spec for
-   more information about the InputCurrent (0x3fh) register.
- - ti,external-control : Indicates that the charger is configured externally
-   and that the host should not attempt to enable/disable charging or set the
-   charge voltage/current.
- - poll-interval : In case 'interrupts' is not specified, poll AC adapter
-   presence with this interval (milliseconds).
-
-Example:
-
-       bq24735@9 {
-               compatible = "ti,bq24735";
-               reg = <0x9>;
-               ti,ac-detect-gpios = <&gpio 72 0x1>;
-       }
diff --git a/Documentation/devicetree/bindings/power/supply/ti,lp8727.yaml b/Documentation/devicetree/bindings/power/supply/ti,lp8727.yaml
new file mode 100644 (file)
index 0000000..a23f665
--- /dev/null
@@ -0,0 +1,90 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/supply/ti,lp8727.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Binding for TI/National Semiconductor LP8727 Charger
+
+maintainers:
+  - Sebastian Reichel <sre@kernel.org>
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    const: ti,lp8727
+
+  reg:
+    const: 0x27
+
+  interrupts:
+    maxItems: 1
+
+  debounce-ms:
+    description: interrupt debounce time in ms
+
+patternProperties:
+  '^(ac|usb)$':
+    type: object
+    description: USB/AC charging parameters
+    properties:
+      charger-type:
+        enum:
+          - ac
+          - usb
+
+      eoc-level:
+        $ref: /schemas/types.yaml#/definitions/uint8
+        minimum: 0
+        maximum: 6
+        description: |
+          End of Charge Percentage with the following mapping:
+          0 = 5%, 1 = 10%, 2 = 16%, 3 = 20%, 4 = 25%, 5 = 33%, 6 = 50%
+
+      charging-current:
+        $ref: /schemas/types.yaml#/definitions/uint8
+        minimum: 0
+        maximum: 9
+        description: |
+          Charging current with the following mapping:
+          0 = 90mA, 1 = 100mA, 2 = 400mA, 3 = 450mA, 4 = 500mA, 5 = 600mA,
+          6 = 700mA, 7 = 800mA, 8 = 900mA, 9 = 1000mA
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    i2c0 {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      lp8727: charger@27 {
+        compatible = "ti,lp8727";
+        reg = <0x27>;
+        interrupt-parent = <&gpio5>;
+        interrupts = <6 IRQ_TYPE_EDGE_FALLING>;
+        debounce-ms = <300>;
+
+        /* AC charger: 5% EOC and 500mA charging current */
+        ac {
+          charger-type = "ac";
+          eoc-level = /bits/ 8 <0>;
+          charging-current = /bits/ 8 <4>;
+        };
+
+        /* USB charger: 10% EOC and 400mA charging current */
+        usb {
+          charger-type = "usb";
+          eoc-level = /bits/ 8 <1>;
+          charging-current = /bits/ 8 <2>;
+        };
+      };
+    };
+
diff --git a/Documentation/devicetree/bindings/power/supply/tps65090-charger.yaml b/Documentation/devicetree/bindings/power/supply/tps65090-charger.yaml
new file mode 100644 (file)
index 0000000..f2dd38b
--- /dev/null
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/tps65090-charger.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: TPS65090 Frontend PMU with Switchmode Charger
+
+maintainers:
+  - Sebastian Reichel <sre@kernel.org>
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    const: ti,tps65090-charger
+
+  ti,enable-low-current-chrg:
+    type: boolean
+    description: |
+      Enables charging when a low current is detected while the default logic is to stop charging.
+
+required:
+  - compatible
+
+additionalProperties: false
+
+examples:
+  - |
+    pmic {
+      charger {
+        compatible = "ti,tps65090-charger";
+        ti,enable-low-current-chrg;
+      };
+    };
diff --git a/Documentation/devicetree/bindings/power/supply/tps65090.txt b/Documentation/devicetree/bindings/power/supply/tps65090.txt
deleted file mode 100644 (file)
index 8e5e0d3..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-TPS65090 Frontend PMU with Switchmode Charger
-
-Required Properties:
--compatible: "ti,tps65090-charger"
-
-Optional Properties:
--ti,enable-low-current-chrg: Enables charging when a low current is detected
- while the default logic is to stop charging.
-
-This node is a subnode of the tps65090 PMIC.
-
-Example:
-
-       tps65090-charger {
-               compatible = "ti,tps65090-charger";
-               ti,enable-low-current-chrg;
-       };
diff --git a/Documentation/devicetree/bindings/power/supply/tps65217-charger.yaml b/Documentation/devicetree/bindings/power/supply/tps65217-charger.yaml
new file mode 100644 (file)
index 0000000..a33408c
--- /dev/null
@@ -0,0 +1,43 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/tps65217-charger.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: TPS65217 Charger
+
+maintainers:
+  - Sebastian Reichel <sre@kernel.org>
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    const: ti,tps65217-charger
+
+  interrupts:
+    minItems: 2
+    maxItems: 2
+
+  interrupt-names:
+    items:
+      - const: USB
+      - const: AC
+      
+required:
+  - compatible
+  - interrupts
+  - interrupt-names
+
+additionalProperties: false
+
+examples:
+  - |
+    pmic {
+      charger {
+        compatible = "ti,tps65217-charger";
+        interrupts = <0>, <1>;
+        interrupt-names = "USB", "AC";
+      };
+    };
diff --git a/Documentation/devicetree/bindings/power/supply/tps65217_charger.txt b/Documentation/devicetree/bindings/power/supply/tps65217_charger.txt
deleted file mode 100644 (file)
index a11072c..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-TPS65217 Charger
-
-Required Properties:
--compatible: "ti,tps65217-charger"
--interrupts: TPS65217 interrupt numbers for the AC and USB charger input change.
-             Should be <0> for the USB charger and <1> for the AC adapter.
--interrupt-names: Should be "USB" and "AC"
-
-This node is a subnode of the tps65217 PMIC.
-
-Example:
-
-       tps65217-charger {
-               compatible = "ti,tps65217-charger";
-               interrupts = <0>, <1>;
-               interrupt-names = "USB", "AC";
-       };
diff --git a/Documentation/devicetree/bindings/power/supply/twl-charger.txt b/Documentation/devicetree/bindings/power/supply/twl-charger.txt
deleted file mode 100644 (file)
index 3b4ea1b..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-TWL BCI (Battery Charger Interface)
-
-The battery charger needs to interact with the USB phy in order
-to know when charging is permissible, and when there is a connection
-or disconnection.
-
-The choice of phy cannot be configured at a hardware level, so there
-is no value in explicit configuration in device-tree.  Rather
-if there is a sibling of the BCI node which is compatible with
-"ti,twl4030-usb", then that is used to determine when and how
-use USB power for charging.
-
-Required properties:
-- compatible:
-  - "ti,twl4030-bci"
-- interrupts: two interrupt lines from the TWL SIH (secondary
-  interrupt handler) - interrupts 9 and 2.
-
-Optional properties:
-- ti,bb-uvolt: microvolts for charging the backup battery.
-- ti,bb-uamp: microamps for charging the backup battery.
-
-Examples:
-
-bci {
-   compatible = "ti,twl4030-bci";
-   interrupts = <9>, <2>;
-   ti,bb-uvolt = <3200000>;
-   ti,bb-uamp = <150>;
-};
diff --git a/Documentation/devicetree/bindings/power/supply/twl4030-charger.yaml b/Documentation/devicetree/bindings/power/supply/twl4030-charger.yaml
new file mode 100644 (file)
index 0000000..fe3f32a
--- /dev/null
@@ -0,0 +1,68 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/twl4030-charger.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: TWL4030 BCI (Battery Charger Interface)
+
+description: |
+  The battery charger needs to interact with the USB phy in order to know when
+  charging is permissible, and when there is a connection or disconnection.
+
+  The choice of phy cannot be configured at a hardware level, so there is no
+  value in explicit configuration in device-tree. Rather if there is a sibling
+  of the BCI node which is compatible with "ti,twl4030-usb", then that is used
+  to determine when and how use USB power for charging.
+
+maintainers:
+  - Sebastian Reichel <sre@kernel.org>
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    const: ti,twl4030-bci
+
+  interrupts:
+    minItems: 2
+    maxItems: 2
+
+  ti,bb-uvolt:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: microvolts for charging the backup battery
+
+  ti,bb-uamp:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: microamps for charging the backup battery
+
+  io-channels:
+    items:
+      - description: Accessory Charger Voltage Channel
+
+  io-channel-names:
+    items:
+      - const: vac
+
+  bci3v1-supply:
+    description: 3.1V USB regulator
+
+required:
+  - compatible
+  - interrupts
+
+additionalProperties: false
+
+examples:
+  - |
+    pmic {
+      charger {
+        compatible = "ti,twl4030-bci";
+        interrupts = <9>, <2>;
+        ti,bb-uvolt = <3200000>;
+        ti,bb-uamp = <150>;
+        io-channels = <&twl_madc 11>;
+        io-channel-names = "vac";
+      };
+    };
diff --git a/Documentation/devicetree/bindings/power/supply/x-powers,axp20x-ac-power-supply.yaml b/Documentation/devicetree/bindings/power/supply/x-powers,axp20x-ac-power-supply.yaml
new file mode 100644 (file)
index 0000000..dcda666
--- /dev/null
@@ -0,0 +1,32 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/x-powers,axp20x-ac-power-supply.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: AXP20x AC power-supply
+
+description: |
+  The AXP20X can read the current current and voltage supplied by AC by
+  reading ADC channels from the AXP20X ADC. The AXP22X is only able to
+  tell if an AC power supply is present and usable. AXP813/AXP803 are
+  able to limit current and supply voltage
+
+maintainers:
+  - Chen-Yu Tsai <wens@csie.org>
+  - Sebastian Reichel <sre@kernel.org>
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    enum:
+      - x-powers,axp202-ac-power-supply
+      - x-powers,axp221-ac-power-supply
+      - x-powers,axp813-ac-power-supply
+
+required:
+  - compatible
+
+additionalProperties: false
diff --git a/Documentation/devicetree/bindings/power/supply/x-powers,axp20x-battery-power-supply.yaml b/Documentation/devicetree/bindings/power/supply/x-powers,axp20x-battery-power-supply.yaml
new file mode 100644 (file)
index 0000000..86e8a71
--- /dev/null
@@ -0,0 +1,30 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/x-powers,axp20x-battery-power-supply.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: AXP20x Battery power-supply
+
+description: |
+  The supported devices can read the battery voltage, charge and discharge
+  currents of the battery by reading ADC channels from the ADC.
+
+maintainers:
+  - Chen-Yu Tsai <wens@csie.org>
+  - Sebastian Reichel <sre@kernel.org>
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    enum:
+      - x-powers,axp209-battery-power-supply
+      - x-powers,axp221-battery-power-supply
+      - x-powers,axp813-battery-power-supply
+
+required:
+  - compatible
+
+additionalProperties: false
diff --git a/Documentation/devicetree/bindings/power/supply/x-powers,axp20x-usb-power-supply.yaml b/Documentation/devicetree/bindings/power/supply/x-powers,axp20x-usb-power-supply.yaml
new file mode 100644 (file)
index 0000000..61f1b32
--- /dev/null
@@ -0,0 +1,33 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/x-powers,axp20x-usb-power-supply.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: AXP20x USB power-supply
+
+description: |
+  The AXP223 PMIC shares most of its behaviour with the AXP221 but has slight
+  variations such as the former being able to set the VBUS power supply max
+  current to 100mA, unlike the latter.
+
+maintainers:
+  - Chen-Yu Tsai <wens@csie.org>
+  - Sebastian Reichel <sre@kernel.org>
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    enum:
+      - x-powers,axp202-usb-power-supply
+      - x-powers,axp221-usb-power-supply
+      - x-powers,axp223-usb-power-supply
+      - x-powers,axp813-usb-power-supply
+
+
+required:
+  - compatible
+
+additionalProperties: false
index 7b8c42f..c04fabe 100644 (file)
@@ -233,7 +233,7 @@ Devicetree battery characteristics
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Drivers should call power_supply_get_battery_info() to obtain battery
 characteristics from a devicetree battery node, defined in
-Documentation/devicetree/bindings/power/supply/battery.txt. This is
+Documentation/devicetree/bindings/power/supply/battery.yaml. This is
 implemented in drivers/power/supply/bq27xxx_battery.c.
 
 Properties in struct power_supply_battery_info and their counterparts in the
index 4d433fd..0215d2b 100644 (file)
@@ -10047,7 +10047,7 @@ F:      drivers/misc/eeprom/eeprom.c
 LEGO MINDSTORMS EV3
 R:     David Lechner <david@lechnology.com>
 S:     Maintained
-F:     Documentation/devicetree/bindings/power/supply/lego_ev3_battery.txt
+F:     Documentation/devicetree/bindings/power/supply/lego,ev3-battery.yaml
 F:     arch/arm/boot/dts/da850-lego-ev3.dts
 F:     drivers/power/supply/lego_ev3_battery.c
 
@@ -15679,6 +15679,13 @@ S:     Supported
 W:     http://www.ibm.com/developerworks/linux/linux390/
 F:     drivers/s390/scsi/zfcp_*
 
+S3C ADC BATTERY DRIVER
+M:     Krzysztof Kozlowski <krzk@kernel.org>
+L:     linux-samsung-soc@vger.kernel.org
+S:     Odd Fixes
+F:     drivers/power/supply/s3c_adc_battery.c
+F:     include/linux/s3c_adc_battery.h
+
 S3C24XX SD/MMC Driver
 M:     Ben Dooks <ben-linux@fluff.org>
 L:     linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
index a903791..22c0e3d 100644 (file)
@@ -19,7 +19,6 @@
 #include <linux/mfd/core.h>
 #include <linux/mfd/abx500.h>
 #include <linux/mfd/abx500/ab8500.h>
-#include <linux/mfd/abx500/ab8500-bm.h>
 #include <linux/mfd/dbx500-prcmu.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
@@ -609,14 +608,14 @@ int ab8500_suspend(struct ab8500 *ab8500)
 }
 
 static const struct mfd_cell ab8500_bm_devs[] = {
-       MFD_CELL_OF("ab8500-charger", NULL, &ab8500_bm_data,
-                   sizeof(ab8500_bm_data), 0, "stericsson,ab8500-charger"),
-       MFD_CELL_OF("ab8500-btemp", NULL, &ab8500_bm_data,
-                   sizeof(ab8500_bm_data), 0, "stericsson,ab8500-btemp"),
-       MFD_CELL_OF("ab8500-fg", NULL, &ab8500_bm_data,
-                   sizeof(ab8500_bm_data), 0, "stericsson,ab8500-fg"),
-       MFD_CELL_OF("ab8500-chargalg", NULL, &ab8500_bm_data,
-                   sizeof(ab8500_bm_data), 0, "stericsson,ab8500-chargalg"),
+       MFD_CELL_OF("ab8500-charger", NULL, NULL, 0, 0,
+                   "stericsson,ab8500-charger"),
+       MFD_CELL_OF("ab8500-btemp", NULL, NULL, 0, 0,
+                   "stericsson,ab8500-btemp"),
+       MFD_CELL_OF("ab8500-fg", NULL, NULL, 0, 0,
+                   "stericsson,ab8500-fg"),
+       MFD_CELL_OF("ab8500-chargalg", NULL, NULL, 0, 0,
+                   "stericsson,ab8500-chargalg"),
 };
 
 static const struct mfd_cell ab8500_devs[] = {
index 4f959b6..cf3f4d0 100644 (file)
@@ -11,7 +11,7 @@ obj-$(CONFIG_POWER_RESET_GEMINI_POWEROFF) += gemini-poweroff.o
 obj-$(CONFIG_POWER_RESET_GPIO) += gpio-poweroff.o
 obj-$(CONFIG_POWER_RESET_GPIO_RESTART) += gpio-restart.o
 obj-$(CONFIG_POWER_RESET_HISI) += hisi-reboot.o
-obj-${CONFIG_POWER_RESET_LINKSTATION} += linkstation-poweroff.o
+obj-$(CONFIG_POWER_RESET_LINKSTATION) += linkstation-poweroff.o
 obj-$(CONFIG_POWER_RESET_MSM) += msm-poweroff.o
 obj-$(CONFIG_POWER_RESET_MT6323) += mt6323-poweroff.o
 obj-$(CONFIG_POWER_RESET_OXNAS) += oxnas-restart.o
index 3ff9d93..0266494 100644 (file)
@@ -192,7 +192,7 @@ static int __init at91_reset_probe(struct platform_device *pdev)
        if (!reset)
                return -ENOMEM;
 
-       reset->rstc_base = of_iomap(pdev->dev.of_node, 0);
+       reset->rstc_base = devm_of_iomap(&pdev->dev, pdev->dev.of_node, 0, NULL);
        if (!reset->rstc_base) {
                dev_err(&pdev->dev, "Could not map reset controller address\n");
                return -ENODEV;
@@ -202,7 +202,7 @@ static int __init at91_reset_probe(struct platform_device *pdev)
                /* we need to shutdown the ddr controller, so get ramc base */
                for_each_matching_node_and_match(np, at91_ramc_of_match, &match) {
                        reset->ramc_lpr = (u32)match->data;
-                       reset->ramc_base[idx] = of_iomap(np, 0);
+                       reset->ramc_base[idx] = devm_of_iomap(&pdev->dev, np, 0, NULL);
                        if (!reset->ramc_base[idx]) {
                                dev_err(&pdev->dev, "Could not map ram controller address\n");
                                of_node_put(np);
index 0ba5fdc..5abc5f6 100644 (file)
@@ -1,8 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Hisilicon SoC reset code
+ * HiSilicon SoC reset code
  *
- * Copyright (c) 2014 Hisilicon Ltd.
+ * Copyright (c) 2014 HiSilicon Ltd.
  * Copyright (c) 2014 Linaro Ltd.
  *
  * Author: Haojian Zhuang <haojian.zhuang@linaro.org>
index 3189279..d1495af 100644 (file)
@@ -55,6 +55,7 @@
 #include <linux/mod_devicetable.h>
 #include <linux/gpio/consumer.h>
 #include <linux/reboot.h>
+#include <linux/property.h>
 
 struct ltc2952_poweroff {
        struct hrtimer timer_trigger;
@@ -172,10 +173,17 @@ static void ltc2952_poweroff_default(struct ltc2952_poweroff *data)
 static int ltc2952_poweroff_init(struct platform_device *pdev)
 {
        int ret;
+       u32 trigger_delay_ms;
        struct ltc2952_poweroff *data = platform_get_drvdata(pdev);
 
        ltc2952_poweroff_default(data);
 
+       if (!device_property_read_u32(&pdev->dev, "trigger-delay-ms",
+                                     &trigger_delay_ms)) {
+               data->trigger_delay = ktime_set(trigger_delay_ms / MSEC_PER_SEC,
+                       (trigger_delay_ms % MSEC_PER_SEC) * NSEC_PER_MSEC);
+       }
+
        data->gpio_watchdog = devm_gpiod_get(&pdev->dev, "watchdog",
                                             GPIOD_OUT_LOW);
        if (IS_ERR(data->gpio_watchdog)) {
index 1fdbcbd..447ffda 100644 (file)
@@ -133,7 +133,7 @@ static int vexpress_reset_probe(struct platform_device *pdev)
        case FUNC_REBOOT:
                ret = _vexpress_register_restart_handler(&pdev->dev);
                break;
-       };
+       }
 
        return ret;
 }
index 590da88..f3f3f8c 100644 (file)
@@ -109,8 +109,8 @@ struct pm860x_battery_info {
 };
 
 struct ccnt {
-       unsigned long long int pos;
-       unsigned long long int neg;
+       unsigned long long pos;
+       unsigned long long neg;
        unsigned int spos;
        unsigned int sneg;
 
index 006b95e..b9e1050 100644 (file)
@@ -698,17 +698,17 @@ config BATTERY_GAUGE_LTC2941
 
 config AB8500_BM
        bool "AB8500 Battery Management Driver"
-       depends on AB8500_CORE && AB8500_GPADC && (IIO = y)
+       depends on AB8500_CORE && AB8500_GPADC && (IIO = y) && OF
        help
          Say Y to include support for AB8500 battery management.
 
 config BATTERY_GOLDFISH
        tristate "Goldfish battery driver"
-       depends on GOLDFISH || COMPILE_TEST
        depends on HAS_IOMEM
        help
-         Say Y to enable support for the battery and AC power in the
-         Goldfish emulator.
+         Say Y to enable support for the Goldfish battery and AC power
+         driver. Originated in the Android Studio Emulator (goldfish) it is
+         going to be used in other emulators.
 
 config BATTERY_RT5033
        tristate "RT5033 fuel gauge support"
diff --git a/drivers/power/supply/ab8500-bm.h b/drivers/power/supply/ab8500-bm.h
new file mode 100644 (file)
index 0000000..41c69a4
--- /dev/null
@@ -0,0 +1,733 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef _AB8500_CHARGER_H_
+#define _AB8500_CHARGER_H_
+
+#include <linux/kernel.h>
+
+/*
+ * System control 2 register offsets.
+ * bank = 0x02
+ */
+#define AB8500_MAIN_WDOG_CTRL_REG      0x01
+#define AB8500_LOW_BAT_REG             0x03
+#define AB8500_BATT_OK_REG             0x04
+/*
+ * USB/ULPI register offsets
+ * Bank : 0x5
+ */
+#define AB8500_USB_LINE_STAT_REG       0x80
+#define AB8500_USB_LINE_CTRL2_REG      0x82
+#define AB8500_USB_LINK1_STAT_REG      0x94
+
+/*
+ * Charger / status register offfsets
+ * Bank : 0x0B
+ */
+#define AB8500_CH_STATUS1_REG          0x00
+#define AB8500_CH_STATUS2_REG          0x01
+#define AB8500_CH_USBCH_STAT1_REG      0x02
+#define AB8500_CH_USBCH_STAT2_REG      0x03
+#define AB8540_CH_USBCH_STAT3_REG      0x04
+#define AB8500_CH_STAT_REG             0x05
+
+/*
+ * Charger / control register offfsets
+ * Bank : 0x0B
+ */
+#define AB8500_CH_VOLT_LVL_REG         0x40
+#define AB8500_CH_VOLT_LVL_MAX_REG     0x41  /*Only in Cut2.0*/
+#define AB8500_CH_OPT_CRNTLVL_REG      0x42
+#define AB8500_CH_OPT_CRNTLVL_MAX_REG  0x43  /*Only in Cut2.0*/
+#define AB8500_CH_WD_TIMER_REG         0x50
+#define AB8500_CHARG_WD_CTRL           0x51
+#define AB8500_BTEMP_HIGH_TH           0x52
+#define AB8500_LED_INDICATOR_PWM_CTRL  0x53
+#define AB8500_LED_INDICATOR_PWM_DUTY  0x54
+#define AB8500_BATT_OVV                        0x55
+#define AB8500_CHARGER_CTRL            0x56
+#define AB8500_BAT_CTRL_CURRENT_SOURCE 0x60  /*Only in Cut2.0*/
+
+/*
+ * Charger / main control register offsets
+ * Bank : 0x0B
+ */
+#define AB8500_MCH_CTRL1               0x80
+#define AB8500_MCH_CTRL2               0x81
+#define AB8500_MCH_IPT_CURLVL_REG      0x82
+#define AB8500_CH_WD_REG               0x83
+
+/*
+ * Charger / USB control register offsets
+ * Bank : 0x0B
+ */
+#define AB8500_USBCH_CTRL1_REG         0xC0
+#define AB8500_USBCH_CTRL2_REG         0xC1
+#define AB8500_USBCH_IPT_CRNTLVL_REG   0xC2
+#define AB8540_USB_PP_MODE_REG         0xC5
+#define AB8540_USB_PP_CHR_REG          0xC6
+
+/*
+ * Gas Gauge register offsets
+ * Bank : 0x0C
+ */
+#define AB8500_GASG_CC_CTRL_REG                0x00
+#define AB8500_GASG_CC_ACCU1_REG       0x01
+#define AB8500_GASG_CC_ACCU2_REG       0x02
+#define AB8500_GASG_CC_ACCU3_REG       0x03
+#define AB8500_GASG_CC_ACCU4_REG       0x04
+#define AB8500_GASG_CC_SMPL_CNTRL_REG  0x05
+#define AB8500_GASG_CC_SMPL_CNTRH_REG  0x06
+#define AB8500_GASG_CC_SMPL_CNVL_REG   0x07
+#define AB8500_GASG_CC_SMPL_CNVH_REG   0x08
+#define AB8500_GASG_CC_CNTR_AVGOFF_REG 0x09
+#define AB8500_GASG_CC_OFFSET_REG      0x0A
+#define AB8500_GASG_CC_NCOV_ACCU       0x10
+#define AB8500_GASG_CC_NCOV_ACCU_CTRL  0x11
+#define AB8500_GASG_CC_NCOV_ACCU_LOW   0x12
+#define AB8500_GASG_CC_NCOV_ACCU_MED   0x13
+#define AB8500_GASG_CC_NCOV_ACCU_HIGH  0x14
+
+/*
+ * Interrupt register offsets
+ * Bank : 0x0E
+ */
+#define AB8500_IT_SOURCE2_REG          0x01
+#define AB8500_IT_SOURCE21_REG         0x14
+
+/*
+ * RTC register offsets
+ * Bank: 0x0F
+ */
+#define AB8500_RTC_BACKUP_CHG_REG      0x0C
+#define AB8500_RTC_CC_CONF_REG         0x01
+#define AB8500_RTC_CTRL_REG            0x0B
+#define AB8500_RTC_CTRL1_REG           0x11
+
+/*
+ * OTP register offsets
+ * Bank : 0x15
+ */
+#define AB8500_OTP_CONF_15             0x0E
+
+/* GPADC constants from AB8500 spec, UM0836 */
+#define ADC_RESOLUTION                 1024
+#define ADC_CH_MAIN_MIN                        0
+#define ADC_CH_MAIN_MAX                        20030
+#define ADC_CH_VBUS_MIN                        0
+#define ADC_CH_VBUS_MAX                        20030
+#define ADC_CH_VBAT_MIN                        2300
+#define ADC_CH_VBAT_MAX                        4800
+#define ADC_CH_BKBAT_MIN               0
+#define ADC_CH_BKBAT_MAX               3200
+
+/* Main charge i/p current */
+#define MAIN_CH_IP_CUR_0P9A            0x80
+#define MAIN_CH_IP_CUR_1P0A            0x90
+#define MAIN_CH_IP_CUR_1P1A            0xA0
+#define MAIN_CH_IP_CUR_1P2A            0xB0
+#define MAIN_CH_IP_CUR_1P3A            0xC0
+#define MAIN_CH_IP_CUR_1P4A            0xD0
+#define MAIN_CH_IP_CUR_1P5A            0xE0
+
+/* ChVoltLevel */
+#define CH_VOL_LVL_3P5                 0x00
+#define CH_VOL_LVL_4P0                 0x14
+#define CH_VOL_LVL_4P05                        0x16
+#define CH_VOL_LVL_4P1                 0x1B
+#define CH_VOL_LVL_4P15                        0x20
+#define CH_VOL_LVL_4P2                 0x25
+#define CH_VOL_LVL_4P6                 0x4D
+
+/* ChOutputCurrentLevel */
+#define CH_OP_CUR_LVL_0P1              0x00
+#define CH_OP_CUR_LVL_0P2              0x01
+#define CH_OP_CUR_LVL_0P3              0x02
+#define CH_OP_CUR_LVL_0P4              0x03
+#define CH_OP_CUR_LVL_0P5              0x04
+#define CH_OP_CUR_LVL_0P6              0x05
+#define CH_OP_CUR_LVL_0P7              0x06
+#define CH_OP_CUR_LVL_0P8              0x07
+#define CH_OP_CUR_LVL_0P9              0x08
+#define CH_OP_CUR_LVL_1P4              0x0D
+#define CH_OP_CUR_LVL_1P5              0x0E
+#define CH_OP_CUR_LVL_1P6              0x0F
+#define CH_OP_CUR_LVL_2P               0x3F
+
+/* BTEMP High thermal limits */
+#define BTEMP_HIGH_TH_57_0             0x00
+#define BTEMP_HIGH_TH_52               0x01
+#define BTEMP_HIGH_TH_57_1             0x02
+#define BTEMP_HIGH_TH_62               0x03
+
+/* current is mA */
+#define USB_0P1A                       100
+#define USB_0P2A                       200
+#define USB_0P3A                       300
+#define USB_0P4A                       400
+#define USB_0P5A                       500
+
+#define LOW_BAT_3P1V                   0x20
+#define LOW_BAT_2P3V                   0x00
+#define LOW_BAT_RESET                  0x01
+#define LOW_BAT_ENABLE                 0x01
+
+/* Backup battery constants */
+#define BUP_ICH_SEL_50UA               0x00
+#define BUP_ICH_SEL_150UA              0x04
+#define BUP_ICH_SEL_300UA              0x08
+#define BUP_ICH_SEL_700UA              0x0C
+
+enum bup_vch_sel {
+       BUP_VCH_SEL_2P5V,
+       BUP_VCH_SEL_2P6V,
+       BUP_VCH_SEL_2P8V,
+       BUP_VCH_SEL_3P1V,
+       /*
+        * Note that the following 5 values 2.7v, 2.9v, 3.0v, 3.2v, 3.3v
+        * are only available on ab8540. You can't choose these 5
+        * voltage on ab8500/ab8505/ab9540.
+        */
+       BUP_VCH_SEL_2P7V,
+       BUP_VCH_SEL_2P9V,
+       BUP_VCH_SEL_3P0V,
+       BUP_VCH_SEL_3P2V,
+       BUP_VCH_SEL_3P3V,
+};
+
+#define BUP_VCH_RANGE          0x02
+#define VBUP33_VRTCN           0x01
+
+/* Battery OVV constants */
+#define BATT_OVV_ENA                   0x02
+#define BATT_OVV_TH_3P7                        0x00
+#define BATT_OVV_TH_4P75               0x01
+
+/* A value to indicate over voltage */
+#define BATT_OVV_VALUE                 4750
+
+/* VBUS OVV constants */
+#define VBUS_OVV_SELECT_MASK           0x78
+#define VBUS_OVV_SELECT_5P6V           0x00
+#define VBUS_OVV_SELECT_5P7V           0x08
+#define VBUS_OVV_SELECT_5P8V           0x10
+#define VBUS_OVV_SELECT_5P9V           0x18
+#define VBUS_OVV_SELECT_6P0V           0x20
+#define VBUS_OVV_SELECT_6P1V           0x28
+#define VBUS_OVV_SELECT_6P2V           0x30
+#define VBUS_OVV_SELECT_6P3V           0x38
+
+#define VBUS_AUTO_IN_CURR_LIM_ENA      0x04
+
+/* Fuel Gauge constants */
+#define RESET_ACCU                     0x02
+#define READ_REQ                       0x01
+#define CC_DEEP_SLEEP_ENA              0x02
+#define CC_PWR_UP_ENA                  0x01
+#define CC_SAMPLES_40                  0x28
+#define RD_NCONV_ACCU_REQ              0x01
+#define CC_CALIB                       0x08
+#define CC_INTAVGOFFSET_ENA            0x10
+#define CC_MUXOFFSET                   0x80
+#define CC_INT_CAL_N_AVG_MASK          0x60
+#define CC_INT_CAL_SAMPLES_16          0x40
+#define CC_INT_CAL_SAMPLES_8           0x20
+#define CC_INT_CAL_SAMPLES_4           0x00
+
+/* RTC constants */
+#define RTC_BUP_CH_ENA                 0x10
+
+/* BatCtrl Current Source Constants */
+#define BAT_CTRL_7U_ENA                        0x01
+#define BAT_CTRL_20U_ENA               0x02
+#define BAT_CTRL_18U_ENA               0x01
+#define BAT_CTRL_16U_ENA               0x02
+#define BAT_CTRL_CMP_ENA               0x04
+#define FORCE_BAT_CTRL_CMP_HIGH                0x08
+#define BAT_CTRL_PULL_UP_ENA           0x10
+
+/* Battery type */
+#define BATTERY_UNKNOWN                        00
+
+/* Registers for pcut feature in ab8505 and ab9540 */
+#define AB8505_RTC_PCUT_CTL_STATUS_REG 0x12
+#define AB8505_RTC_PCUT_TIME_REG       0x13
+#define AB8505_RTC_PCUT_MAX_TIME_REG   0x14
+#define AB8505_RTC_PCUT_FLAG_TIME_REG  0x15
+#define AB8505_RTC_PCUT_RESTART_REG    0x16
+#define AB8505_RTC_PCUT_DEBOUNCE_REG   0x17
+
+/* USB Power Path constants for ab8540 */
+#define BUS_VSYS_VOL_SELECT_MASK               0x06
+#define BUS_VSYS_VOL_SELECT_3P6V               0x00
+#define BUS_VSYS_VOL_SELECT_3P325V             0x02
+#define BUS_VSYS_VOL_SELECT_3P9V               0x04
+#define BUS_VSYS_VOL_SELECT_4P3V               0x06
+#define BUS_POWER_PATH_MODE_ENA                        0x01
+#define BUS_PP_PRECHG_CURRENT_MASK             0x0E
+#define BUS_POWER_PATH_PRECHG_ENA              0x01
+
+/*
+ * ADC for the battery thermistor.
+ * When using the ABx500_ADC_THERM_BATCTRL the battery ID resistor is combined
+ * with a NTC resistor to both identify the battery and to measure its
+ * temperature. Different phone manufactures uses different techniques to both
+ * identify the battery and to read its temperature.
+ */
+enum abx500_adc_therm {
+       ABx500_ADC_THERM_BATCTRL,
+       ABx500_ADC_THERM_BATTEMP,
+};
+
+/**
+ * struct abx500_res_to_temp - defines one point in a temp to res curve. To
+ * be used in battery packs that combines the identification resistor with a
+ * NTC resistor.
+ * @temp:                      battery pack temperature in Celsius
+ * @resist:                    NTC resistor net total resistance
+ */
+struct abx500_res_to_temp {
+       int temp;
+       int resist;
+};
+
+/**
+ * struct abx500_v_to_cap - Table for translating voltage to capacity
+ * @voltage:           Voltage in mV
+ * @capacity:          Capacity in percent
+ */
+struct abx500_v_to_cap {
+       int voltage;
+       int capacity;
+};
+
+/* Forward declaration */
+struct abx500_fg;
+
+/**
+ * struct abx500_fg_parameters - Fuel gauge algorithm parameters, in seconds
+ * if not specified
+ * @recovery_sleep_timer:      Time between measurements while recovering
+ * @recovery_total_time:       Total recovery time
+ * @init_timer:                        Measurement interval during startup
+ * @init_discard_time:         Time we discard voltage measurement at startup
+ * @init_total_time:           Total init time during startup
+ * @high_curr_time:            Time current has to be high to go to recovery
+ * @accu_charging:             FG accumulation time while charging
+ * @accu_high_curr:            FG accumulation time in high current mode
+ * @high_curr_threshold:       High current threshold, in mA
+ * @lowbat_threshold:          Low battery threshold, in mV
+ * @overbat_threshold:         Over battery threshold, in mV
+ * @battok_falling_th_sel0     Threshold in mV for battOk signal sel0
+ *                             Resolution in 50 mV step.
+ * @battok_raising_th_sel1     Threshold in mV for battOk signal sel1
+ *                             Resolution in 50 mV step.
+ * @user_cap_limit             Capacity reported from user must be within this
+ *                             limit to be considered as sane, in percentage
+ *                             points.
+ * @maint_thres                        This is the threshold where we stop reporting
+ *                             battery full while in maintenance, in per cent
+ * @pcut_enable:                       Enable power cut feature in ab8505
+ * @pcut_max_time:             Max time threshold
+ * @pcut_flag_time:            Flagtime threshold
+ * @pcut_max_restart:          Max number of restarts
+ * @pcut_debounce_time:                Sets battery debounce time
+ */
+struct abx500_fg_parameters {
+       int recovery_sleep_timer;
+       int recovery_total_time;
+       int init_timer;
+       int init_discard_time;
+       int init_total_time;
+       int high_curr_time;
+       int accu_charging;
+       int accu_high_curr;
+       int high_curr_threshold;
+       int lowbat_threshold;
+       int overbat_threshold;
+       int battok_falling_th_sel0;
+       int battok_raising_th_sel1;
+       int user_cap_limit;
+       int maint_thres;
+       bool pcut_enable;
+       u8 pcut_max_time;
+       u8 pcut_flag_time;
+       u8 pcut_max_restart;
+       u8 pcut_debounce_time;
+};
+
+/**
+ * struct abx500_charger_maximization - struct used by the board config.
+ * @use_maxi:          Enable maximization for this battery type
+ * @maxi_chg_curr:     Maximum charger current allowed
+ * @maxi_wait_cycles:  cycles to wait before setting charger current
+ * @charger_curr_step  delta between two charger current settings (mA)
+ */
+struct abx500_maxim_parameters {
+       bool ena_maxi;
+       int chg_curr;
+       int wait_cycles;
+       int charger_curr_step;
+};
+
+/**
+ * struct abx500_battery_type - different batteries supported
+ * @name:                      battery technology
+ * @resis_high:                        battery upper resistance limit
+ * @resis_low:                 battery lower resistance limit
+ * @charge_full_design:                Maximum battery capacity in mAh
+ * @nominal_voltage:           Nominal voltage of the battery in mV
+ * @termination_vol:           max voltage upto which battery can be charged
+ * @termination_curr           battery charging termination current in mA
+ * @recharge_cap               battery capacity limit that will trigger a new
+ *                             full charging cycle in the case where maintenan-
+ *                             -ce charging has been disabled
+ * @normal_cur_lvl:            charger current in normal state in mA
+ * @normal_vol_lvl:            charger voltage in normal state in mV
+ * @maint_a_cur_lvl:           charger current in maintenance A state in mA
+ * @maint_a_vol_lvl:           charger voltage in maintenance A state in mV
+ * @maint_a_chg_timer_h:       charge time in maintenance A state
+ * @maint_b_cur_lvl:           charger current in maintenance B state in mA
+ * @maint_b_vol_lvl:           charger voltage in maintenance B state in mV
+ * @maint_b_chg_timer_h:       charge time in maintenance B state
+ * @low_high_cur_lvl:          charger current in temp low/high state in mA
+ * @low_high_vol_lvl:          charger voltage in temp low/high state in mV'
+ * @battery_resistance:                battery inner resistance in mOhm.
+ * @n_r_t_tbl_elements:                number of elements in r_to_t_tbl
+ * @r_to_t_tbl:                        table containing resistance to temp points
+ * @n_v_cap_tbl_elements:      number of elements in v_to_cap_tbl
+ * @v_to_cap_tbl:              Voltage to capacity (in %) table
+ * @n_batres_tbl_elements      number of elements in the batres_tbl
+ * @batres_tbl                 battery internal resistance vs temperature table
+ */
+struct abx500_battery_type {
+       int name;
+       int resis_high;
+       int resis_low;
+       int charge_full_design;
+       int nominal_voltage;
+       int termination_vol;
+       int termination_curr;
+       int recharge_cap;
+       int normal_cur_lvl;
+       int normal_vol_lvl;
+       int maint_a_cur_lvl;
+       int maint_a_vol_lvl;
+       int maint_a_chg_timer_h;
+       int maint_b_cur_lvl;
+       int maint_b_vol_lvl;
+       int maint_b_chg_timer_h;
+       int low_high_cur_lvl;
+       int low_high_vol_lvl;
+       int battery_resistance;
+       int n_temp_tbl_elements;
+       const struct abx500_res_to_temp *r_to_t_tbl;
+       int n_v_cap_tbl_elements;
+       const struct abx500_v_to_cap *v_to_cap_tbl;
+       int n_batres_tbl_elements;
+       const struct batres_vs_temp *batres_tbl;
+};
+
+/**
+ * struct abx500_bm_capacity_levels - abx500 capacity level data
+ * @critical:          critical capacity level in percent
+ * @low:               low capacity level in percent
+ * @normal:            normal capacity level in percent
+ * @high:              high capacity level in percent
+ * @full:              full capacity level in percent
+ */
+struct abx500_bm_capacity_levels {
+       int critical;
+       int low;
+       int normal;
+       int high;
+       int full;
+};
+
+/**
+ * struct abx500_bm_charger_parameters - Charger specific parameters
+ * @usb_volt_max:      maximum allowed USB charger voltage in mV
+ * @usb_curr_max:      maximum allowed USB charger current in mA
+ * @ac_volt_max:       maximum allowed AC charger voltage in mV
+ * @ac_curr_max:       maximum allowed AC charger current in mA
+ */
+struct abx500_bm_charger_parameters {
+       int usb_volt_max;
+       int usb_curr_max;
+       int ac_volt_max;
+       int ac_curr_max;
+};
+
+/**
+ * struct abx500_bm_data - abx500 battery management data
+ * @temp_under         under this temp, charging is stopped
+ * @temp_low           between this temp and temp_under charging is reduced
+ * @temp_high          between this temp and temp_over charging is reduced
+ * @temp_over          over this temp, charging is stopped
+ * @temp_now           present battery temperature
+ * @temp_interval_chg  temperature measurement interval in s when charging
+ * @temp_interval_nochg        temperature measurement interval in s when not charging
+ * @main_safety_tmr_h  safety timer for main charger
+ * @usb_safety_tmr_h   safety timer for usb charger
+ * @bkup_bat_v         voltage which we charge the backup battery with
+ * @bkup_bat_i         current which we charge the backup battery with
+ * @no_maintenance     indicates that maintenance charging is disabled
+ * @capacity_scaling    indicates whether capacity scaling is to be used
+ * @abx500_adc_therm   placement of thermistor, batctrl or battemp adc
+ * @chg_unknown_bat    flag to enable charging of unknown batteries
+ * @enable_overshoot   flag to enable VBAT overshoot control
+ * @auto_trig          flag to enable auto adc trigger
+ * @fg_res             resistance of FG resistor in 0.1mOhm
+ * @n_btypes           number of elements in array bat_type
+ * @batt_id            index of the identified battery in array bat_type
+ * @interval_charging  charge alg cycle period time when charging (sec)
+ * @interval_not_charging charge alg cycle period time when not charging (sec)
+ * @temp_hysteresis    temperature hysteresis
+ * @gnd_lift_resistance        Battery ground to phone ground resistance (mOhm)
+ * @n_chg_out_curr             number of elements in array chg_output_curr
+ * @n_chg_in_curr              number of elements in array chg_input_curr
+ * @chg_output_curr    charger output current level map
+ * @chg_input_curr             charger input current level map
+ * @maxi               maximization parameters
+ * @cap_levels         capacity in percent for the different capacity levels
+ * @bat_type           table of supported battery types
+ * @chg_params         charger parameters
+ * @fg_params          fuel gauge parameters
+ */
+struct abx500_bm_data {
+       int temp_under;
+       int temp_low;
+       int temp_high;
+       int temp_over;
+       int temp_now;
+       int temp_interval_chg;
+       int temp_interval_nochg;
+       int main_safety_tmr_h;
+       int usb_safety_tmr_h;
+       int bkup_bat_v;
+       int bkup_bat_i;
+       bool autopower_cfg;
+       bool ac_enabled;
+       bool usb_enabled;
+       bool no_maintenance;
+       bool capacity_scaling;
+       bool chg_unknown_bat;
+       bool enable_overshoot;
+       bool auto_trig;
+       enum abx500_adc_therm adc_therm;
+       int fg_res;
+       int n_btypes;
+       int batt_id;
+       int interval_charging;
+       int interval_not_charging;
+       int temp_hysteresis;
+       int gnd_lift_resistance;
+       int n_chg_out_curr;
+       int n_chg_in_curr;
+       int *chg_output_curr;
+       int *chg_input_curr;
+       const struct abx500_maxim_parameters *maxi;
+       const struct abx500_bm_capacity_levels *cap_levels;
+       struct abx500_battery_type *bat_type;
+       const struct abx500_bm_charger_parameters *chg_params;
+       const struct abx500_fg_parameters *fg_params;
+};
+
+enum {
+       NTC_EXTERNAL = 0,
+       NTC_INTERNAL,
+};
+
+/**
+ * struct res_to_temp - defines one point in a temp to res curve. To
+ * be used in battery packs that combines the identification resistor with a
+ * NTC resistor.
+ * @temp:                      battery pack temperature in Celsius
+ * @resist:                    NTC resistor net total resistance
+ */
+struct res_to_temp {
+       int temp;
+       int resist;
+};
+
+/**
+ * struct batres_vs_temp - defines one point in a temp vs battery internal
+ * resistance curve.
+ * @temp:                      battery pack temperature in Celsius
+ * @resist:                    battery internal reistance in mOhm
+ */
+struct batres_vs_temp {
+       int temp;
+       int resist;
+};
+
+/* Forward declaration */
+struct ab8500_fg;
+
+/**
+ * struct ab8500_fg_parameters - Fuel gauge algorithm parameters, in seconds
+ * if not specified
+ * @recovery_sleep_timer:      Time between measurements while recovering
+ * @recovery_total_time:       Total recovery time
+ * @init_timer:                        Measurement interval during startup
+ * @init_discard_time:         Time we discard voltage measurement at startup
+ * @init_total_time:           Total init time during startup
+ * @high_curr_time:            Time current has to be high to go to recovery
+ * @accu_charging:             FG accumulation time while charging
+ * @accu_high_curr:            FG accumulation time in high current mode
+ * @high_curr_threshold:       High current threshold, in mA
+ * @lowbat_threshold:          Low battery threshold, in mV
+ * @battok_falling_th_sel0     Threshold in mV for battOk signal sel0
+ *                             Resolution in 50 mV step.
+ * @battok_raising_th_sel1     Threshold in mV for battOk signal sel1
+ *                             Resolution in 50 mV step.
+ * @user_cap_limit             Capacity reported from user must be within this
+ *                             limit to be considered as sane, in percentage
+ *                             points.
+ * @maint_thres                        This is the threshold where we stop reporting
+ *                             battery full while in maintenance, in per cent
+ * @pcut_enable:                       Enable power cut feature in ab8505
+ * @pcut_max_time:             Max time threshold
+ * @pcut_flag_time:            Flagtime threshold
+ * @pcut_max_restart:          Max number of restarts
+ * @pcut_debunce_time: Sets battery debounce time
+ */
+struct ab8500_fg_parameters {
+       int recovery_sleep_timer;
+       int recovery_total_time;
+       int init_timer;
+       int init_discard_time;
+       int init_total_time;
+       int high_curr_time;
+       int accu_charging;
+       int accu_high_curr;
+       int high_curr_threshold;
+       int lowbat_threshold;
+       int battok_falling_th_sel0;
+       int battok_raising_th_sel1;
+       int user_cap_limit;
+       int maint_thres;
+       bool pcut_enable;
+       u8 pcut_max_time;
+       u8 pcut_flag_time;
+       u8 pcut_max_restart;
+       u8 pcut_debunce_time;
+};
+
+/**
+ * struct ab8500_charger_maximization - struct used by the board config.
+ * @use_maxi:          Enable maximization for this battery type
+ * @maxi_chg_curr:     Maximum charger current allowed
+ * @maxi_wait_cycles:  cycles to wait before setting charger current
+ * @charger_curr_step  delta between two charger current settings (mA)
+ */
+struct ab8500_maxim_parameters {
+       bool ena_maxi;
+       int chg_curr;
+       int wait_cycles;
+       int charger_curr_step;
+};
+
+/**
+ * struct ab8500_bm_capacity_levels - ab8500 capacity level data
+ * @critical:          critical capacity level in percent
+ * @low:               low capacity level in percent
+ * @normal:            normal capacity level in percent
+ * @high:              high capacity level in percent
+ * @full:              full capacity level in percent
+ */
+struct ab8500_bm_capacity_levels {
+       int critical;
+       int low;
+       int normal;
+       int high;
+       int full;
+};
+
+/**
+ * struct ab8500_bm_charger_parameters - Charger specific parameters
+ * @usb_volt_max:      maximum allowed USB charger voltage in mV
+ * @usb_curr_max:      maximum allowed USB charger current in mA
+ * @ac_volt_max:       maximum allowed AC charger voltage in mV
+ * @ac_curr_max:       maximum allowed AC charger current in mA
+ */
+struct ab8500_bm_charger_parameters {
+       int usb_volt_max;
+       int usb_curr_max;
+       int ac_volt_max;
+       int ac_curr_max;
+};
+
+/**
+ * struct ab8500_bm_data - ab8500 battery management data
+ * @temp_under         under this temp, charging is stopped
+ * @temp_low           between this temp and temp_under charging is reduced
+ * @temp_high          between this temp and temp_over charging is reduced
+ * @temp_over          over this temp, charging is stopped
+ * @temp_interval_chg  temperature measurement interval in s when charging
+ * @temp_interval_nochg        temperature measurement interval in s when not charging
+ * @main_safety_tmr_h  safety timer for main charger
+ * @usb_safety_tmr_h   safety timer for usb charger
+ * @bkup_bat_v         voltage which we charge the backup battery with
+ * @bkup_bat_i         current which we charge the backup battery with
+ * @no_maintenance     indicates that maintenance charging is disabled
+ * @capacity_scaling    indicates whether capacity scaling is to be used
+ * @adc_therm          placement of thermistor, batctrl or battemp adc
+ * @chg_unknown_bat    flag to enable charging of unknown batteries
+ * @enable_overshoot   flag to enable VBAT overshoot control
+ * @fg_res             resistance of FG resistor in 0.1mOhm
+ * @n_btypes           number of elements in array bat_type
+ * @batt_id            index of the identified battery in array bat_type
+ * @interval_charging  charge alg cycle period time when charging (sec)
+ * @interval_not_charging charge alg cycle period time when not charging (sec)
+ * @temp_hysteresis    temperature hysteresis
+ * @gnd_lift_resistance        Battery ground to phone ground resistance (mOhm)
+ * @maxi:              maximization parameters
+ * @cap_levels         capacity in percent for the different capacity levels
+ * @bat_type           table of supported battery types
+ * @chg_params         charger parameters
+ * @fg_params          fuel gauge parameters
+ */
+struct ab8500_bm_data {
+       int temp_under;
+       int temp_low;
+       int temp_high;
+       int temp_over;
+       int temp_interval_chg;
+       int temp_interval_nochg;
+       int main_safety_tmr_h;
+       int usb_safety_tmr_h;
+       int bkup_bat_v;
+       int bkup_bat_i;
+       bool no_maintenance;
+       bool capacity_scaling;
+       bool chg_unknown_bat;
+       bool enable_overshoot;
+       enum abx500_adc_therm adc_therm;
+       int fg_res;
+       int n_btypes;
+       int batt_id;
+       int interval_charging;
+       int interval_not_charging;
+       int temp_hysteresis;
+       int gnd_lift_resistance;
+       const struct ab8500_maxim_parameters *maxi;
+       const struct ab8500_bm_capacity_levels *cap_levels;
+       const struct ab8500_bm_charger_parameters *chg_params;
+       const struct ab8500_fg_parameters *fg_params;
+};
+
+extern struct abx500_bm_data ab8500_bm_data;
+
+void ab8500_charger_usb_state_changed(u8 bm_usb_state, u16 mA);
+struct ab8500_fg *ab8500_fg_get(void);
+int ab8500_fg_inst_curr_blocking(struct ab8500_fg *dev);
+int ab8500_fg_inst_curr_start(struct ab8500_fg *di);
+int ab8500_fg_inst_curr_finalize(struct ab8500_fg *di, int *res);
+int ab8500_fg_inst_curr_started(struct ab8500_fg *di);
+int ab8500_fg_inst_curr_done(struct ab8500_fg *di);
+int ab8500_bm_of_probe(struct device *dev,
+                      struct device_node *np,
+                      struct abx500_bm_data *bm);
+
+#endif /* _AB8500_CHARGER_H_ */
diff --git a/drivers/power/supply/ab8500-chargalg.h b/drivers/power/supply/ab8500-chargalg.h
new file mode 100644 (file)
index 0000000..94a6f90
--- /dev/null
@@ -0,0 +1,51 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) ST-Ericsson SA 2012
+ * Author: Johan Gardsmark <johan.gardsmark@stericsson.com> for ST-Ericsson.
+ */
+
+#ifndef _AB8500_CHARGALG_H_
+#define _AB8500_CHARGALG_H_
+
+#include <linux/power_supply.h>
+
+/*
+ * Valid only for supplies of type:
+ * - POWER_SUPPLY_TYPE_MAINS,
+ * - POWER_SUPPLY_TYPE_USB,
+ * because only them store as drv_data pointer to struct ux500_charger.
+ */
+#define psy_to_ux500_charger(x) power_supply_get_drvdata(psy)
+
+/* Forward declaration */
+struct ux500_charger;
+
+struct ux500_charger_ops {
+       int (*enable) (struct ux500_charger *, int, int, int);
+       int (*check_enable) (struct ux500_charger *, int, int);
+       int (*kick_wd) (struct ux500_charger *);
+       int (*update_curr) (struct ux500_charger *, int);
+};
+
+/**
+ * struct ux500_charger - power supply ux500 charger sub class
+ * @psy                        power supply base class
+ * @ops                        ux500 charger operations
+ * @max_out_volt       maximum output charger voltage in mV
+ * @max_out_curr       maximum output charger current in mA
+ * @enabled            indicates if this charger is used or not
+ * @external           external charger unit (pm2xxx)
+ */
+struct ux500_charger {
+       struct power_supply *psy;
+       struct ux500_charger_ops ops;
+       int max_out_volt;
+       int max_out_curr;
+       int wdt_refresh;
+       bool enabled;
+       bool external;
+};
+
+extern struct blocking_notifier_head charger_notifier_list;
+
+#endif /* _AB8500_CHARGALG_H_ */
index f6a6697..c2b8c0b 100644 (file)
@@ -4,7 +4,8 @@
 #include <linux/of.h>
 #include <linux/mfd/abx500.h>
 #include <linux/mfd/abx500/ab8500.h>
-#include <linux/mfd/abx500/ab8500-bm.h>
+
+#include "ab8500-bm.h"
 
 /*
  * These are the defined batteries that uses a NTC and ID resistor placed
index d203453..fdfcd59 100644 (file)
 #include <linux/mfd/core.h>
 #include <linux/mfd/abx500.h>
 #include <linux/mfd/abx500/ab8500.h>
-#include <linux/mfd/abx500/ab8500-bm.h>
 #include <linux/iio/consumer.h>
 
+#include "ab8500-bm.h"
+
 #define VTVOUT_V                       1800
 
 #define BTEMP_THERMAL_LOW_LIMIT                -10
@@ -119,16 +120,6 @@ static enum power_supply_property ab8500_btemp_props[] = {
 
 static LIST_HEAD(ab8500_btemp_list);
 
-/**
- * ab8500_btemp_get() - returns a reference to the primary AB8500 BTEMP
- * (i.e. the first BTEMP in the instance list)
- */
-struct ab8500_btemp *ab8500_btemp_get(void)
-{
-       return list_first_entry(&ab8500_btemp_list, struct ab8500_btemp, node);
-}
-EXPORT_SYMBOL(ab8500_btemp_get);
-
 /**
  * ab8500_btemp_batctrl_volt_to_res() - convert batctrl voltage to resistance
  * @di:                pointer to the ab8500_btemp structure
@@ -754,7 +745,7 @@ static void ab8500_btemp_periodic(struct ab8500_btemp *di,
  *
  * Returns battery temperature
  */
-int ab8500_btemp_get_temp(struct ab8500_btemp *di)
+static int ab8500_btemp_get_temp(struct ab8500_btemp *di)
 {
        int temp = 0;
 
@@ -790,19 +781,6 @@ int ab8500_btemp_get_temp(struct ab8500_btemp *di)
        }
        return temp;
 }
-EXPORT_SYMBOL(ab8500_btemp_get_temp);
-
-/**
- * ab8500_btemp_get_batctrl_temp() - get the temperature
- * @btemp:      pointer to the btemp structure
- *
- * Returns the batctrl temperature in millidegrees
- */
-int ab8500_btemp_get_batctrl_temp(struct ab8500_btemp *btemp)
-{
-       return btemp->bat_temp * 1000;
-}
-EXPORT_SYMBOL(ab8500_btemp_get_batctrl_temp);
 
 /**
  * ab8500_btemp_get_property() - get the btemp properties
@@ -991,7 +969,6 @@ static const struct power_supply_desc ab8500_btemp_desc = {
 static int ab8500_btemp_probe(struct platform_device *pdev)
 {
        struct device_node *np = pdev->dev.of_node;
-       struct abx500_bm_data *plat = pdev->dev.platform_data;
        struct power_supply_config psy_cfg = {};
        struct device *dev = &pdev->dev;
        struct ab8500_btemp *di;
@@ -1002,18 +979,12 @@ static int ab8500_btemp_probe(struct platform_device *pdev)
        if (!di)
                return -ENOMEM;
 
-       if (!plat) {
-               dev_err(dev, "no battery management data supplied\n");
-               return -EINVAL;
-       }
-       di->bm = plat;
+       di->bm = &ab8500_bm_data;
 
-       if (np) {
-               ret = ab8500_bm_of_probe(dev, np, di->bm);
-               if (ret) {
-                       dev_err(dev, "failed to get battery information\n");
-                       return ret;
-               }
+       ret = ab8500_bm_of_probe(dev, np, di->bm);
+       if (ret) {
+               dev_err(dev, "failed to get battery information\n");
+               return ret;
        }
 
        /* get parent data */
index ac77c88..a9be10e 100644 (file)
 #include <linux/mfd/core.h>
 #include <linux/mfd/abx500/ab8500.h>
 #include <linux/mfd/abx500.h>
-#include <linux/mfd/abx500/ab8500-bm.h>
-#include <linux/mfd/abx500/ux500_chargalg.h>
 #include <linux/usb/otg.h>
 #include <linux/mutex.h>
 #include <linux/iio/consumer.h>
 
+#include "ab8500-bm.h"
+#include "ab8500-chargalg.h"
+
 /* Charger constants */
 #define NO_PW_CONN                     0
 #define AC_PW_CONN                     1
@@ -3344,7 +3345,6 @@ static const struct power_supply_desc ab8500_usb_chg_desc = {
 static int ab8500_charger_probe(struct platform_device *pdev)
 {
        struct device_node *np = pdev->dev.of_node;
-       struct abx500_bm_data *plat = pdev->dev.platform_data;
        struct power_supply_config ac_psy_cfg = {}, usb_psy_cfg = {};
        struct ab8500_charger *di;
        int irq, i, charger_status, ret = 0, ch_stat;
@@ -3354,21 +3354,14 @@ static int ab8500_charger_probe(struct platform_device *pdev)
        if (!di)
                return -ENOMEM;
 
-       if (!plat) {
-               dev_err(dev, "no battery management data supplied\n");
-               return -EINVAL;
-       }
-       di->bm = plat;
+       di->bm = &ab8500_bm_data;
 
-       if (np) {
-               ret = ab8500_bm_of_probe(dev, np, di->bm);
-               if (ret) {
-                       dev_err(dev, "failed to get battery information\n");
-                       return ret;
-               }
-               di->autopower_cfg = of_property_read_bool(np, "autopower_cfg");
-       } else
-               di->autopower_cfg = false;
+       ret = ab8500_bm_of_probe(dev, np, di->bm);
+       if (ret) {
+               dev_err(dev, "failed to get battery information\n");
+               return ret;
+       }
+       di->autopower_cfg = of_property_read_bool(np, "autopower_cfg");
 
        /* get parent data */
        di->dev = dev;
index 06ff42c..0c7c01a 100644 (file)
 #include <linux/mfd/core.h>
 #include <linux/mfd/abx500.h>
 #include <linux/mfd/abx500/ab8500.h>
-#include <linux/mfd/abx500/ab8500-bm.h>
 #include <linux/iio/consumer.h>
 #include <linux/kernel.h>
 
+#include "ab8500-bm.h"
+
 #define MILLI_TO_MICRO                 1000
 #define FG_LSB_IN_MA                   1627
 #define QLSB_NANO_AMP_HOURS_X10                1071
@@ -3026,7 +3027,6 @@ static const struct power_supply_desc ab8500_fg_desc = {
 static int ab8500_fg_probe(struct platform_device *pdev)
 {
        struct device_node *np = pdev->dev.of_node;
-       struct abx500_bm_data *plat = pdev->dev.platform_data;
        struct power_supply_config psy_cfg = {};
        struct device *dev = &pdev->dev;
        struct ab8500_fg *di;
@@ -3037,18 +3037,12 @@ static int ab8500_fg_probe(struct platform_device *pdev)
        if (!di)
                return -ENOMEM;
 
-       if (!plat) {
-               dev_err(dev, "no battery management data supplied\n");
-               return -EINVAL;
-       }
-       di->bm = plat;
+       di->bm = &ab8500_bm_data;
 
-       if (np) {
-               ret = ab8500_bm_of_probe(dev, np, di->bm);
-               if (ret) {
-                       dev_err(dev, "failed to get battery information\n");
-                       return ret;
-               }
+       ret = ab8500_bm_of_probe(dev, np, di->bm);
+       if (ret) {
+               dev_err(dev, "failed to get battery information\n");
+               return ret;
        }
 
        mutex_init(&di->cc_lock);
index a9d84d8..f5b7922 100644 (file)
 #include <linux/mfd/core.h>
 #include <linux/mfd/abx500.h>
 #include <linux/mfd/abx500/ab8500.h>
-#include <linux/mfd/abx500/ux500_chargalg.h>
-#include <linux/mfd/abx500/ab8500-bm.h>
 #include <linux/notifier.h>
 
+#include "ab8500-bm.h"
+#include "ab8500-chargalg.h"
+
 /* Watchdog kick interval */
 #define CHG_WD_INTERVAL                        (6 * HZ)
 
@@ -1980,7 +1981,6 @@ static const struct power_supply_desc abx500_chargalg_desc = {
 static int abx500_chargalg_probe(struct platform_device *pdev)
 {
        struct device_node *np = pdev->dev.of_node;
-       struct abx500_bm_data *plat = pdev->dev.platform_data;
        struct power_supply_config psy_cfg = {};
        struct abx500_chargalg *di;
        int ret = 0;
@@ -1991,18 +1991,12 @@ static int abx500_chargalg_probe(struct platform_device *pdev)
                return -ENOMEM;
        }
 
-       if (!plat) {
-               dev_err(&pdev->dev, "no battery management data supplied\n");
-               return -EINVAL;
-       }
-       di->bm = plat;
+       di->bm = &ab8500_bm_data;
 
-       if (np) {
-               ret = ab8500_bm_of_probe(&pdev->dev, np, di->bm);
-               if (ret) {
-                       dev_err(&pdev->dev, "failed to get battery information\n");
-                       return ret;
-               }
+       ret = ab8500_bm_of_probe(&pdev->dev, np, di->bm);
+       if (ret) {
+               dev_err(&pdev->dev, "failed to get battery information\n");
+               return ret;
        }
 
        /* get device struct and parent */
index 8933ae2..7ed76ee 100644 (file)
@@ -614,8 +614,10 @@ static int axp20x_usb_power_probe(struct platform_device *pdev)
 
        if (power->axp20x_id == AXP813_ID) {
                /* Enable USB Battery Charging specification detection */
-               regmap_update_bits(axp20x->regmap, AXP288_BC_GLOBAL,
+               ret = regmap_update_bits(axp20x->regmap, AXP288_BC_GLOBAL,
                                   AXP813_BC_EN, AXP813_BC_EN);
+               if (ret)
+                       return ret;
        }
 
        psy_cfg.of_node = pdev->dev.of_node;
index 530ff40..0008c22 100644 (file)
@@ -606,33 +606,6 @@ static int bq25980_get_state(struct bq25980_device *bq,
        return 0;
 }
 
-static int bq25980_set_battery_property(struct power_supply *psy,
-                               enum power_supply_property psp,
-                               const union power_supply_propval *val)
-{
-       struct bq25980_device *bq = power_supply_get_drvdata(psy);
-       int ret = 0;
-
-       switch (psp) {
-       case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT:
-               ret = bq25980_set_const_charge_curr(bq, val->intval);
-               if (ret)
-                       return ret;
-               break;
-
-       case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE:
-               ret = bq25980_set_const_charge_volt(bq, val->intval);
-               if (ret)
-                       return ret;
-               break;
-
-       default:
-               return -EINVAL;
-       }
-
-       return ret;
-}
-
 static int bq25980_get_battery_property(struct power_supply *psy,
                                enum power_supply_property psp,
                                union power_supply_propval *val)
@@ -701,6 +674,18 @@ static int bq25980_set_charger_property(struct power_supply *psy,
                        return ret;
                break;
 
+       case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT:
+               ret = bq25980_set_const_charge_curr(bq, val->intval);
+               if (ret)
+                       return ret;
+               break;
+
+       case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE:
+               ret = bq25980_set_const_charge_volt(bq, val->intval);
+               if (ret)
+                       return ret;
+               break;
+
        default:
                return -EINVAL;
        }
@@ -922,7 +907,6 @@ static struct power_supply_desc bq25980_battery_desc = {
        .name                   = "bq25980-battery",
        .type                   = POWER_SUPPLY_TYPE_BATTERY,
        .get_property           = bq25980_get_battery_property,
-       .set_property           = bq25980_set_battery_property,
        .properties             = bq25980_battery_props,
        .num_properties         = ARRAY_SIZE(bq25980_battery_props),
        .property_is_writeable  = bq25980_property_is_writeable,
index 4c4a7b1..7e5e24b 100644 (file)
@@ -39,6 +39,7 @@
  * https://www.ti.com/product/bq27z561
  * https://www.ti.com/product/bq28z610
  * https://www.ti.com/product/bq34z100-g1
+ * https://www.ti.com/product/bq78z100
  */
 
 #include <linux/device.h>
@@ -515,6 +516,27 @@ static u8
                [BQ27XXX_REG_DCAP] = 0x3c,
                [BQ27XXX_REG_AP] = 0x22,
                BQ27XXX_DM_REG_ROWS,
+       },
+       bq78z100_regs[BQ27XXX_REG_MAX] = {
+               [BQ27XXX_REG_CTRL] = 0x00,
+               [BQ27XXX_REG_TEMP] = 0x06,
+               [BQ27XXX_REG_INT_TEMP] = 0x28,
+               [BQ27XXX_REG_VOLT] = 0x08,
+               [BQ27XXX_REG_AI] = 0x14,
+               [BQ27XXX_REG_FLAGS] = 0x0a,
+               [BQ27XXX_REG_TTE] = 0x16,
+               [BQ27XXX_REG_TTF] = 0x18,
+               [BQ27XXX_REG_TTES] = 0x1c,
+               [BQ27XXX_REG_TTECP] = INVALID_REG_ADDR,
+               [BQ27XXX_REG_NAC] = INVALID_REG_ADDR,
+               [BQ27XXX_REG_RC] = 0x10,
+               [BQ27XXX_REG_FCC] = 0x12,
+               [BQ27XXX_REG_CYCT] = 0x2a,
+               [BQ27XXX_REG_AE] = INVALID_REG_ADDR,
+               [BQ27XXX_REG_SOC] = 0x2c,
+               [BQ27XXX_REG_DCAP] = 0x3c,
+               [BQ27XXX_REG_AP] = 0x22,
+               BQ27XXX_DM_REG_ROWS,
        };
 
 static enum power_supply_property bq27000_props[] = {
@@ -813,6 +835,26 @@ static enum power_supply_property bq34z100_props[] = {
        POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq78z100_props[] = {
+       POWER_SUPPLY_PROP_STATUS,
+       POWER_SUPPLY_PROP_PRESENT,
+       POWER_SUPPLY_PROP_VOLTAGE_NOW,
+       POWER_SUPPLY_PROP_CURRENT_NOW,
+       POWER_SUPPLY_PROP_CAPACITY,
+       POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+       POWER_SUPPLY_PROP_TEMP,
+       POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+       POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
+       POWER_SUPPLY_PROP_TECHNOLOGY,
+       POWER_SUPPLY_PROP_CHARGE_FULL,
+       POWER_SUPPLY_PROP_CHARGE_NOW,
+       POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+       POWER_SUPPLY_PROP_CYCLE_COUNT,
+       POWER_SUPPLY_PROP_POWER_AVG,
+       POWER_SUPPLY_PROP_HEALTH,
+       POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 struct bq27xxx_dm_reg {
        u8 subclass_id;
        u8 offset;
@@ -911,6 +953,7 @@ static struct bq27xxx_dm_reg bq27621_dm_regs[] = {
 #define bq27z561_dm_regs 0
 #define bq28z610_dm_regs 0
 #define bq34z100_dm_regs 0
+#define bq78z100_dm_regs 0
 
 #define BQ27XXX_O_ZERO         BIT(0)
 #define BQ27XXX_O_OTDC         BIT(1) /* has OTC/OTD overtemperature flags */
@@ -969,6 +1012,7 @@ static struct {
        [BQ28Z610]  = BQ27XXX_DATA(bq28z610,  0         , BQ27Z561_O_BITS),
        [BQ34Z100]  = BQ27XXX_DATA(bq34z100,  0         , BQ27XXX_O_OTDC | BQ27XXX_O_SOC_SI | \
                                                          BQ27XXX_O_HAS_CI | BQ27XXX_O_MUL_CHEM),
+       [BQ78Z100]  = BQ27XXX_DATA(bq78z100,  0         , BQ27Z561_O_BITS),
 };
 
 static DEFINE_MUTEX(bq27xxx_list_lock);
@@ -1661,27 +1705,6 @@ static int bq27xxx_battery_read_time(struct bq27xxx_device_info *di, u8 reg)
        return tval * 60;
 }
 
-/*
- * Read an average power register.
- * Return < 0 if something fails.
- */
-static int bq27xxx_battery_read_pwr_avg(struct bq27xxx_device_info *di)
-{
-       int tval;
-
-       tval = bq27xxx_read(di, BQ27XXX_REG_AP, false);
-       if (tval < 0) {
-               dev_err(di->dev, "error reading average power register  %02x: %d\n",
-                       BQ27XXX_REG_AP, tval);
-               return tval;
-       }
-
-       if (di->opts & BQ27XXX_O_ZERO)
-               return (tval * BQ27XXX_POWER_CONSTANT) / BQ27XXX_RS;
-       else
-               return tval;
-}
-
 /*
  * Returns true if a battery over temperature condition is detected
  */
@@ -1769,8 +1792,6 @@ void bq27xxx_battery_update(struct bq27xxx_device_info *di)
                }
                if (di->regs[BQ27XXX_REG_CYCT] != INVALID_REG_ADDR)
                        cache.cycle_count = bq27xxx_battery_read_cyct(di);
-               if (di->regs[BQ27XXX_REG_AP] != INVALID_REG_ADDR)
-                       cache.power_avg = bq27xxx_battery_read_pwr_avg(di);
 
                /* We only have to read charge design full once */
                if (di->charge_design_full <= 0)
@@ -1800,14 +1821,27 @@ static void bq27xxx_battery_poll(struct work_struct *work)
                schedule_delayed_work(&di->work, poll_interval * HZ);
 }
 
+static bool bq27xxx_battery_is_full(struct bq27xxx_device_info *di, int flags)
+{
+       if (di->opts & BQ27XXX_O_ZERO)
+               return (flags & BQ27000_FLAG_FC);
+       else if (di->opts & BQ27Z561_O_BITS)
+               return (flags & BQ27Z561_FLAG_FC);
+       else
+               return (flags & BQ27XXX_FLAG_FC);
+}
+
 /*
- * Return the battery average current in ÂµA
+ * Return the battery average current in ÂµA and the status
  * Note that current can be negative signed as well
  * Or 0 if something fails.
  */
-static int bq27xxx_battery_current(struct bq27xxx_device_info *di,
-                                  union power_supply_propval *val)
+static int bq27xxx_battery_current_and_status(
+       struct bq27xxx_device_info *di,
+       union power_supply_propval *val_curr,
+       union power_supply_propval *val_status)
 {
+       bool single_flags = (di->opts & BQ27XXX_O_ZERO);
        int curr;
        int flags;
 
@@ -1817,55 +1851,66 @@ static int bq27xxx_battery_current(struct bq27xxx_device_info *di,
                return curr;
        }
 
+       flags = bq27xxx_read(di, BQ27XXX_REG_FLAGS, single_flags);
+       if (flags < 0) {
+               dev_err(di->dev, "error reading flags\n");
+               return flags;
+       }
+
        if (di->opts & BQ27XXX_O_ZERO) {
-               flags = bq27xxx_read(di, BQ27XXX_REG_FLAGS, true);
                if (!(flags & BQ27000_FLAG_CHGS)) {
                        dev_dbg(di->dev, "negative current!\n");
                        curr = -curr;
                }
 
-               val->intval = curr * BQ27XXX_CURRENT_CONSTANT / BQ27XXX_RS;
+               curr = curr * BQ27XXX_CURRENT_CONSTANT / BQ27XXX_RS;
        } else {
                /* Other gauges return signed value */
-               val->intval = -(int)((s16)curr) * 1000;
+               curr = (int)((s16)curr) * 1000;
+       }
+
+       if (val_curr)
+               val_curr->intval = curr;
+
+       if (val_status) {
+               if (curr > 0) {
+                       val_status->intval = POWER_SUPPLY_STATUS_CHARGING;
+               } else if (curr < 0) {
+                       val_status->intval = POWER_SUPPLY_STATUS_DISCHARGING;
+               } else {
+                       if (bq27xxx_battery_is_full(di, flags))
+                               val_status->intval = POWER_SUPPLY_STATUS_FULL;
+                       else
+                               val_status->intval =
+                                       POWER_SUPPLY_STATUS_NOT_CHARGING;
+               }
        }
 
        return 0;
 }
 
-static int bq27xxx_battery_status(struct bq27xxx_device_info *di,
-                                 union power_supply_propval *val)
+/*
+ * Get the average power in ÂµW
+ * Return < 0 if something fails.
+ */
+static int bq27xxx_battery_pwr_avg(struct bq27xxx_device_info *di,
+                                  union power_supply_propval *val)
 {
-       int status;
-
-       if (di->opts & BQ27XXX_O_ZERO) {
-               if (di->cache.flags & BQ27000_FLAG_FC)
-                       status = POWER_SUPPLY_STATUS_FULL;
-               else if (di->cache.flags & BQ27000_FLAG_CHGS)
-                       status = POWER_SUPPLY_STATUS_CHARGING;
-               else
-                       status = POWER_SUPPLY_STATUS_DISCHARGING;
-       } else if (di->opts & BQ27Z561_O_BITS) {
-               if (di->cache.flags & BQ27Z561_FLAG_FC)
-                       status = POWER_SUPPLY_STATUS_FULL;
-               else if (di->cache.flags & BQ27Z561_FLAG_DIS_CH)
-                       status = POWER_SUPPLY_STATUS_DISCHARGING;
-               else
-                       status = POWER_SUPPLY_STATUS_CHARGING;
-       } else {
-               if (di->cache.flags & BQ27XXX_FLAG_FC)
-                       status = POWER_SUPPLY_STATUS_FULL;
-               else if (di->cache.flags & BQ27XXX_FLAG_DSC)
-                       status = POWER_SUPPLY_STATUS_DISCHARGING;
-               else
-                       status = POWER_SUPPLY_STATUS_CHARGING;
+       int power;
+
+       power = bq27xxx_read(di, BQ27XXX_REG_AP, false);
+       if (power < 0) {
+               dev_err(di->dev,
+                       "error reading average power register %02x: %d\n",
+                       BQ27XXX_REG_AP, power);
+               return power;
        }
 
-       if ((status == POWER_SUPPLY_STATUS_DISCHARGING) &&
-           (power_supply_am_i_supplied(di->bat) > 0))
-               status = POWER_SUPPLY_STATUS_NOT_CHARGING;
-
-       val->intval = status;
+       if (di->opts & BQ27XXX_O_ZERO)
+               val->intval = (power * BQ27XXX_POWER_CONSTANT) / BQ27XXX_RS;
+       else
+               /* Other gauges return a signed value in units of 10mW */
+               val->intval = (int)((s16)power) * 10000;
 
        return 0;
 }
@@ -1957,7 +2002,7 @@ static int bq27xxx_battery_get_property(struct power_supply *psy,
 
        switch (psp) {
        case POWER_SUPPLY_PROP_STATUS:
-               ret = bq27xxx_battery_status(di, val);
+               ret = bq27xxx_battery_current_and_status(di, NULL, val);
                break;
        case POWER_SUPPLY_PROP_VOLTAGE_NOW:
                ret = bq27xxx_battery_voltage(di, val);
@@ -1966,7 +2011,7 @@ static int bq27xxx_battery_get_property(struct power_supply *psy,
                val->intval = di->cache.flags < 0 ? 0 : 1;
                break;
        case POWER_SUPPLY_PROP_CURRENT_NOW:
-               ret = bq27xxx_battery_current(di, val);
+               ret = bq27xxx_battery_current_and_status(di, val, NULL);
                break;
        case POWER_SUPPLY_PROP_CAPACITY:
                ret = bq27xxx_simple_value(di->cache.capacity, val);
@@ -2020,7 +2065,7 @@ static int bq27xxx_battery_get_property(struct power_supply *psy,
                ret = bq27xxx_simple_value(di->cache.energy, val);
                break;
        case POWER_SUPPLY_PROP_POWER_AVG:
-               ret = bq27xxx_simple_value(di->cache.power_avg, val);
+               ret = bq27xxx_battery_pwr_avg(di, val);
                break;
        case POWER_SUPPLY_PROP_HEALTH:
                ret = bq27xxx_simple_value(di->cache.health, val);
index eb4f428..46f0783 100644 (file)
@@ -248,6 +248,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
        { "bq27z561", BQ27Z561 },
        { "bq28z610", BQ28Z610 },
        { "bq34z100", BQ34Z100 },
+       { "bq78z100", BQ78Z100 },
        {},
 };
 MODULE_DEVICE_TABLE(i2c, bq27xxx_i2c_id_table);
@@ -284,6 +285,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
        { .compatible = "ti,bq27z561" },
        { .compatible = "ti,bq28z610" },
        { .compatible = "ti,bq34z100" },
+       { .compatible = "ti,bq78z100" },
        {},
 };
 MODULE_DEVICE_TABLE(of, bq27xxx_battery_i2c_of_match_table);
index 4dea8ec..45da870 100644 (file)
@@ -1604,7 +1604,7 @@ static int charger_manager_probe(struct platform_device *pdev)
        mutex_unlock(&cm_list_mtx);
 
        /*
-        * Charger-manager is capable of waking up the systme from sleep
+        * Charger-manager is capable of waking up the system from sleep
         * when event is happened through cm_notify_event()
         */
        device_init_wakeup(&pdev->dev, true);
index 641dcad..df01abc 100644 (file)
@@ -318,7 +318,7 @@ static int cpcap_charger_current_to_regval(int microamp)
                return CPCAP_REG_CRM_ICHRG(0x0);
        if (miliamp < 177)
                return CPCAP_REG_CRM_ICHRG(0x1);
-       if (miliamp > 1596)
+       if (miliamp >= 1596)
                return CPCAP_REG_CRM_ICHRG(0xe);
 
        res = microamp / 88666;
@@ -465,7 +465,7 @@ static bool cpcap_charger_vbus_valid(struct cpcap_charger_ddata *ddata)
 
        error = iio_read_channel_processed(channel, &value);
        if (error >= 0)
-               return value > 3900 ? true : false;
+               return value > 3900;
 
        dev_err(ddata->dev, "error reading VBUS: %i\n", error);
 
@@ -668,6 +668,9 @@ static void cpcap_usb_detect(struct work_struct *work)
                return;
        }
 
+       /* Delay for 80ms to avoid vbus bouncing when usb cable is plugged in */
+       usleep_range(80000, 120000);
+
        /* Throttle chrgcurr2 interrupt for charger done and retry */
        switch (ddata->status) {
        case POWER_SUPPLY_STATUS_CHARGING:
index 0146f1b..d110597 100644 (file)
@@ -511,6 +511,11 @@ static int cw_battery_get_property(struct power_supply *psy,
                        val->intval = 0;
                break;
 
+       case POWER_SUPPLY_PROP_CHARGE_NOW:
+               val->intval = cw_bat->battery.charge_full_design_uah;
+               val->intval = val->intval * cw_bat->soc / 100;
+               break;
+
        case POWER_SUPPLY_PROP_CURRENT_NOW:
                if (cw_battery_valid_time_to_empty(cw_bat) &&
                    cw_bat->battery.charge_full_design_uah > 0) {
@@ -542,6 +547,7 @@ static enum power_supply_property cw_battery_properties[] = {
        POWER_SUPPLY_PROP_CHARGE_COUNTER,
        POWER_SUPPLY_PROP_CHARGE_FULL,
        POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+       POWER_SUPPLY_PROP_CHARGE_NOW,
        POWER_SUPPLY_PROP_CURRENT_NOW,
 };
 
index 3df3c82..05b859b 100644 (file)
@@ -626,7 +626,7 @@ static ssize_t ds2781_read_param_eeprom_bin(struct file *filp,
                                struct bin_attribute *bin_attr,
                                char *buf, loff_t off, size_t count)
 {
-       struct device *dev = container_of(kobj, struct device, kobj);
+       struct device *dev = kobj_to_dev(kobj);
        struct power_supply *psy = to_power_supply(dev);
        struct ds2781_device_info *dev_info = to_ds2781_device_info(psy);
 
@@ -639,7 +639,7 @@ static ssize_t ds2781_write_param_eeprom_bin(struct file *filp,
                                struct bin_attribute *bin_attr,
                                char *buf, loff_t off, size_t count)
 {
-       struct device *dev = container_of(kobj, struct device, kobj);
+       struct device *dev = kobj_to_dev(kobj);
        struct power_supply *psy = to_power_supply(dev);
        struct ds2781_device_info *dev_info = to_ds2781_device_info(psy);
        int ret;
@@ -671,7 +671,7 @@ static ssize_t ds2781_read_user_eeprom_bin(struct file *filp,
                                struct bin_attribute *bin_attr,
                                char *buf, loff_t off, size_t count)
 {
-       struct device *dev = container_of(kobj, struct device, kobj);
+       struct device *dev = kobj_to_dev(kobj);
        struct power_supply *psy = to_power_supply(dev);
        struct ds2781_device_info *dev_info = to_ds2781_device_info(psy);
 
@@ -685,7 +685,7 @@ static ssize_t ds2781_write_user_eeprom_bin(struct file *filp,
                                struct bin_attribute *bin_attr,
                                char *buf, loff_t off, size_t count)
 {
-       struct device *dev = container_of(kobj, struct device, kobj);
+       struct device *dev = kobj_to_dev(kobj);
        struct power_supply *psy = to_power_supply(dev);
        struct ds2781_device_info *dev_info = to_ds2781_device_info(psy);
        int ret;
index e7931ff..397e5a0 100644 (file)
@@ -501,7 +501,7 @@ static int lp8788_set_irqs(struct platform_device *pdev,
 
                ret = request_threaded_irq(virq, NULL,
                                        lp8788_charger_irq_thread,
-                                       0, name, pchg);
+                                       IRQF_ONESHOT, name, pchg);
                if (ret)
                        break;
        }
index 79d4b59..1d7326c 100644 (file)
@@ -131,7 +131,7 @@ static int max17042_get_status(struct max17042_chip *chip, int *status)
         *
         * When this cycle the battery gets charged to a higher (calculated)
         * capacity then the previous cycle then FullCAP will get updated
-        * contineously once end-of-charge detection kicks in, so allow the
+        * continuously once end-of-charge detection kicks in, so allow the
         * 2 to differ a bit.
         */
 
@@ -739,7 +739,7 @@ static void max17042_load_new_capacity_params(struct max17042_chip *chip)
 
 /*
  * Block write all the override values coming from platform data.
- * This function MUST be called before the POR initialization proceedure
+ * This function MUST be called before the POR initialization procedure
  * specified by maxim.
  */
 static inline void max17042_override_por_values(struct max17042_chip *chip)
@@ -811,7 +811,7 @@ static int max17042_init_chip(struct max17042_chip *chip)
         */
        msleep(500);
 
-       /* Initialize configaration */
+       /* Initialize configuration */
        max17042_write_config_regs(chip);
 
        /* write cell characterization data */
@@ -855,7 +855,7 @@ static void max17042_set_soc_threshold(struct max17042_chip *chip, u16 off)
        struct regmap *map = chip->regmap;
        u32 soc, soc_tr;
 
-       /* program interrupt thesholds such that we should
+       /* program interrupt thresholds such that we should
         * get interrupt for every 'off' perc change in the soc
         */
        regmap_read(map, MAX17042_RepSOC, &soc);
index 1b1a36f..473e53c 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * 1-Wire implementation for Maxim Semiconductor
- * MAX7211/MAX17215 stanalone fuel gauge chip
+ * MAX7211/MAX17215 standalone fuel gauge chip
  *
  * Copyright (C) 2017 Radioavionica Corporation
  * Author: Alex A. Mihaylov <minimumlaw@rambler.ru>
@@ -28,7 +28,7 @@
 /* Number of valid register addresses in W1 mode */
 #define MAX1721X_MAX_REG_NR    0x1EF
 
-/* Factory settings (nonvilatile registers) (W1 specific) */
+/* Factory settings (nonvolatile registers) (W1 specific) */
 #define MAX1721X_REG_NRSENSE   0x1CF   /* RSense in 10^-5 Ohm */
 /* Strings */
 #define MAX1721X_REG_MFG_STR   0x1CC
@@ -105,7 +105,7 @@ static inline int max172xx_temperature_to_ps(unsigned int reg)
 /*
  * Calculating current registers resolution:
  *
- * RSense stored in 10^-5 Ohm, so mesaurment voltage must be
+ * RSense stored in 10^-5 Ohm, so measurement voltage must be
  * in 10^-11 Volts for get current in uA.
  * 16 bit current reg fullscale +/-51.2mV is 102400 uV.
  * So: 102400 / 65535 * 10^5 = 156252
@@ -137,7 +137,7 @@ static int max1721x_battery_get_property(struct power_supply *psy,
                /*
                 * POWER_SUPPLY_PROP_PRESENT will always readable via
                 * sysfs interface. Value return 0 if battery not
-                * present or unaccesable via W1.
+                * present or unaccessible via W1.
                 */
                val->intval =
                        regmap_read(info->regmap, MAX172XX_REG_STATUS,
@@ -334,9 +334,9 @@ static int devm_w1_max1721x_add_device(struct w1_slave *sl)
 
        /*
         * power_supply class battery name translated from W1 slave device
-        * unical ID (look like 26-0123456789AB) to "max1721x-0123456789AB\0"
-        * so, 26 (device family) correcpondent to max1721x devices.
-        * Device name still unical for any numbers connected devices.
+        * unique ID (look like 26-0123456789AB) to "max1721x-0123456789AB\0"
+        * so, 26 (device family) correspond to max1721x devices.
+        * Device name still unique for any number of connected devices.
         */
        snprintf(info->name, sizeof(info->name),
                "max1721x-%012X", (unsigned int)sl->reg_num.id);
index 321bd6b..25207fe 100644 (file)
@@ -168,6 +168,7 @@ static int max8997_battery_probe(struct platform_device *pdev)
        int ret = 0;
        struct charger_data *charger;
        struct max8997_dev *iodev = dev_get_drvdata(pdev->dev.parent);
+       struct device_node *np = pdev->dev.of_node;
        struct i2c_client *i2c = iodev->i2c;
        struct max8997_platform_data *pdata = iodev->pdata;
        struct power_supply_config psy_cfg = {};
@@ -237,20 +238,23 @@ static int max8997_battery_probe(struct platform_device *pdev)
                return PTR_ERR(charger->battery);
        }
 
+       // grab regulator from parent device's node
+       pdev->dev.of_node = iodev->dev->of_node;
        charger->reg = devm_regulator_get_optional(&pdev->dev, "charger");
+       pdev->dev.of_node = np;
        if (IS_ERR(charger->reg)) {
                if (PTR_ERR(charger->reg) == -EPROBE_DEFER)
                        return -EPROBE_DEFER;
                dev_info(&pdev->dev, "couldn't get charger regulator\n");
        }
-       charger->edev = extcon_get_edev_by_phandle(&pdev->dev, 0);
-       if (IS_ERR(charger->edev)) {
-               if (PTR_ERR(charger->edev) == -EPROBE_DEFER)
+       charger->edev = extcon_get_extcon_dev("max8997-muic");
+       if (IS_ERR_OR_NULL(charger->edev)) {
+               if (!charger->edev)
                        return -EPROBE_DEFER;
                dev_info(charger->dev, "couldn't get extcon device\n");
        }
 
-       if (!IS_ERR(charger->reg) && !IS_ERR(charger->edev)) {
+       if (!IS_ERR(charger->reg) && !IS_ERR_OR_NULL(charger->edev)) {
                INIT_WORK(&charger->extcon_work, max8997_battery_extcon_evt_worker);
                ret = devm_add_action(&pdev->dev, max8997_battery_extcon_evt_stop_work, charger);
                if (ret) {
@@ -263,7 +267,7 @@ static int max8997_battery_probe(struct platform_device *pdev)
                if (ret) {
                        dev_err(&pdev->dev, "failed to register extcon notifier\n");
                        return ret;
-               };
+               }
        }
 
        return 0;
index ac06ecf..f86bbbe 100644 (file)
 #include <linux/i2c.h>
 #include <linux/workqueue.h>
 #include <linux/mfd/abx500/ab8500.h>
-#include <linux/mfd/abx500/ab8500-bm.h>
-#include <linux/mfd/abx500/ux500_chargalg.h>
 #include <linux/pm2301_charger.h>
 #include <linux/gpio.h>
 #include <linux/pm_runtime.h>
 #include <linux/pm.h>
 
+#include "ab8500-bm.h"
+#include "ab8500-chargalg.h"
 #include "pm2301_charger.h"
 
 #define to_pm2xxx_charger_ac_device_info(x) container_of((x), \
@@ -1089,7 +1089,7 @@ static int pm2xxx_wall_charger_probe(struct i2c_client *i2c_client,
        ret = request_threaded_irq(gpio_to_irq(pm2->pdata->gpio_irq_number),
                                NULL,
                                pm2xxx_charger_irq[0].isr,
-                               pm2->pdata->irq_type,
+                               pm2->pdata->irq_type | IRQF_ONESHOT,
                                pm2xxx_charger_irq[0].name, pm2);
 
        if (ret != 0) {
index 38e3aa6..d99e2f1 100644 (file)
@@ -169,7 +169,7 @@ static int __power_supply_populate_supplied_from(struct device *dev,
                        break;
 
                if (np == epsy->of_node) {
-                       dev_info(&psy->dev, "%s: Found supply : %s\n",
+                       dev_dbg(&psy->dev, "%s: Found supply : %s\n",
                                psy->desc->name, epsy->desc->name);
                        psy->supplied_from[i-1] = (char *)epsy->desc->name;
                        psy->num_supplies++;
@@ -1143,7 +1143,7 @@ __power_supply_register(struct device *parent,
 
        rc = power_supply_check_supplies(psy);
        if (rc) {
-               dev_info(dev, "Not all required supplies found, defer probe\n");
+               dev_dbg(dev, "Not all required supplies found, defer probe\n");
                goto check_supplies_failed;
        }
 
index a2addc2..dc70006 100644 (file)
@@ -1,13 +1,8 @@
-/*
- *     iPAQ h1930/h1940/rx1950 battery controller driver
- *     Copyright (c) Vasily Khoruzhick
- *     Based on h1940_battery.c by Arnaud Patard
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file COPYING in the main directory of this archive for
- * more details.
- *
- */
+// SPDX-License-Identifier: GPL-2.0
+//
+// iPAQ h1930/h1940/rx1950 battery controller driver
+// Copyright (c) Vasily Khoruzhick
+// Based on h1940_battery.c by Arnaud Patard
 
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
@@ -407,8 +402,6 @@ static int s3c_adc_bat_remove(struct platform_device *pdev)
 static int s3c_adc_bat_suspend(struct platform_device *pdev,
        pm_message_t state)
 {
-       struct s3c_adc_bat_pdata *pdata = pdev->dev.platform_data;
-
        if (main_bat.charge_finished) {
                if (device_may_wakeup(&pdev->dev))
                        enable_irq_wake(
@@ -424,8 +417,6 @@ static int s3c_adc_bat_suspend(struct platform_device *pdev,
 
 static int s3c_adc_bat_resume(struct platform_device *pdev)
 {
-       struct s3c_adc_bat_pdata *pdata = pdev->dev.platform_data;
-
        if (main_bat.charge_finished) {
                if (device_may_wakeup(&pdev->dev))
                        disable_irq_wake(
index b6a538e..4bf9283 100644 (file)
@@ -1123,11 +1123,9 @@ static int sbs_probe(struct i2c_client *client)
 
        chip->gpio_detect = devm_gpiod_get_optional(&client->dev,
                        "sbs,battery-detect", GPIOD_IN);
-       if (IS_ERR(chip->gpio_detect)) {
-               dev_err(&client->dev, "Failed to get gpio: %ld\n",
-                       PTR_ERR(chip->gpio_detect));
-               return PTR_ERR(chip->gpio_detect);
-       }
+       if (IS_ERR(chip->gpio_detect))
+               return dev_err_probe(&client->dev, PTR_ERR(chip->gpio_detect),
+                                    "Failed to get gpio\n");
 
        i2c_set_clientdata(client, chip);
 
@@ -1158,31 +1156,23 @@ skip_gpio:
 
                rc = sbs_get_battery_presence_and_health(
                                client, POWER_SUPPLY_PROP_PRESENT, &val);
-               if (rc < 0 || !val.intval) {
-                       dev_err(&client->dev, "Failed to get present status\n");
-                       rc = -ENODEV;
-                       goto exit_psupply;
-               }
+               if (rc < 0 || !val.intval)
+                       return dev_err_probe(&client->dev, -ENODEV,
+                                            "Failed to get present status\n");
        }
 
        INIT_DELAYED_WORK(&chip->work, sbs_delayed_work);
 
        chip->power_supply = devm_power_supply_register(&client->dev, sbs_desc,
                                                   &psy_cfg);
-       if (IS_ERR(chip->power_supply)) {
-               dev_err(&client->dev,
-                       "%s: Failed to register power supply\n", __func__);
-               rc = PTR_ERR(chip->power_supply);
-               goto exit_psupply;
-       }
+       if (IS_ERR(chip->power_supply))
+               return dev_err_probe(&client->dev, PTR_ERR(chip->power_supply),
+                                    "Failed to register power supply\n");
 
        dev_info(&client->dev,
                "%s: battery gas gauge device registered\n", client->name);
 
        return 0;
-
-exit_psupply:
-       return rc;
 }
 
 static int sbs_remove(struct i2c_client *client)
index fbfb6a6..6fa65d1 100644 (file)
@@ -16,9 +16,7 @@
 #include <linux/i2c.h>
 #include <linux/slab.h>
 #include <linux/interrupt.h>
-#include <linux/gpio.h>
 #include <linux/regmap.h>
-#include <linux/of_gpio.h>
 #include <linux/bitops.h>
 
 #define SBS_CHARGER_REG_SPEC_INFO              0x11
@@ -189,18 +187,14 @@ static int sbs_probe(struct i2c_client *client,
         * to the battery.
         */
        ret = regmap_read(chip->regmap, SBS_CHARGER_REG_STATUS, &val);
-       if (ret) {
-               dev_err(&client->dev, "Failed to get device status\n");
-               return ret;
-       }
+       if (ret)
+               return dev_err_probe(&client->dev, ret, "Failed to get device status\n");
        chip->last_state = val;
 
-       chip->power_supply = devm_power_supply_register(&client->dev, &sbs_desc,
-                                                       &psy_cfg);
-       if (IS_ERR(chip->power_supply)) {
-               dev_err(&client->dev, "Failed to register power supply\n");
-               return PTR_ERR(chip->power_supply);
-       }
+       chip->power_supply = devm_power_supply_register(&client->dev, &sbs_desc, &psy_cfg);
+       if (IS_ERR(chip->power_supply))
+               return dev_err_probe(&client->dev, PTR_ERR(chip->power_supply),
+                                    "Failed to register power supply\n");
 
        /*
         * The sbs-charger spec doesn't impose the use of an interrupt. So in
@@ -212,10 +206,8 @@ static int sbs_probe(struct i2c_client *client,
                                        NULL, sbs_irq_thread,
                                        IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
                                        dev_name(&client->dev), chip);
-               if (ret) {
-                       dev_err(&client->dev, "Failed to request irq, %d\n", ret);
-                       return ret;
-               }
+               if (ret)
+                       return dev_err_probe(&client->dev, ret, "Failed to request irq\n");
        } else {
                INIT_DELAYED_WORK(&chip->work, sbs_delayed_work);
                schedule_delayed_work(&chip->work,
index 666243d..71ec8f7 100644 (file)
@@ -13,7 +13,7 @@
  * Karl-Heinz Schneider <karl-heinz@schneider-inet.de>
  */
 
-#include <linux/gpio.h>
+#include <linux/gpio/driver.h>
 #include <linux/module.h>
 #include <linux/i2c.h>
 #include <linux/i2c-mux.h>
@@ -294,10 +294,8 @@ static int sbsm_gpio_setup(struct sbsm_data *data)
        gc->owner = THIS_MODULE;
 
        ret = devm_gpiochip_add_data(dev, gc, data);
-       if (ret) {
-               dev_err(dev, "devm_gpiochip_add_data failed: %d\n", ret);
-               return ret;
-       }
+       if (ret)
+               return dev_err_probe(dev, ret, "devm_gpiochip_add_data failed\n");
 
        return ret;
 }
@@ -311,6 +309,12 @@ static const struct power_supply_desc sbsm_default_psy_desc = {
        .property_is_writeable = &sbsm_prop_is_writeable,
 };
 
+static void sbsm_del_mux_adapter(void *data)
+{
+       struct sbsm_data *sbsm = data;
+       i2c_mux_del_adapters(sbsm->muxc);
+}
+
 static int sbsm_probe(struct i2c_client *client,
                      const struct i2c_device_id *id)
 {
@@ -343,13 +347,14 @@ static int sbsm_probe(struct i2c_client *client,
        data->supported_bats = ret & SBSM_MASK_BAT_SUPPORTED;
        data->muxc = i2c_mux_alloc(adapter, dev, SBSM_MAX_BATS, 0,
                                   I2C_MUX_LOCKED, &sbsm_select, NULL);
-       if (!data->muxc) {
-               dev_err(dev, "failed to alloc i2c mux\n");
-               ret = -ENOMEM;
-               goto err_mux_alloc;
-       }
+       if (!data->muxc)
+               return dev_err_probe(dev, -ENOMEM, "failed to alloc i2c mux\n");
        data->muxc->priv = data;
 
+       ret = devm_add_action_or_reset(dev, sbsm_del_mux_adapter, data);
+       if (ret)
+               return ret;
+
        /* register muxed i2c channels. One for each supported battery */
        for (i = 0; i < SBSM_MAX_BATS; ++i) {
                if (data->supported_bats & BIT(i)) {
@@ -358,54 +363,28 @@ static int sbsm_probe(struct i2c_client *client,
                                break;
                }
        }
-       if (ret) {
-               dev_err(dev, "failed to register i2c mux channel %d\n", i + 1);
-               goto err_mux_register;
-       }
+       if (ret)
+               return dev_err_probe(dev, ret, "failed to register i2c mux channel %d\n", i + 1);
 
-       psy_desc = devm_kmemdup(dev, &sbsm_default_psy_desc,
-                               sizeof(struct power_supply_desc),
-                               GFP_KERNEL);
-       if (!psy_desc) {
-               ret = -ENOMEM;
-               goto err_psy;
-       }
+       psy_desc = devm_kmemdup(dev, &sbsm_default_psy_desc, sizeof(*psy_desc), GFP_KERNEL);
+       if (!psy_desc)
+               return -ENOMEM;
+
+       psy_desc->name = devm_kasprintf(dev, GFP_KERNEL, "sbsm-%s", dev_name(&client->dev));
+       if (!psy_desc->name)
+               return -ENOMEM;
 
-       psy_desc->name = devm_kasprintf(dev, GFP_KERNEL, "sbsm-%s",
-                                       dev_name(&client->dev));
-       if (!psy_desc->name) {
-               ret = -ENOMEM;
-               goto err_psy;
-       }
        ret = sbsm_gpio_setup(data);
        if (ret < 0)
-               goto err_psy;
+               return ret;
 
        psy_cfg.drv_data = data;
        psy_cfg.of_node = dev->of_node;
        data->psy = devm_power_supply_register(dev, psy_desc, &psy_cfg);
-       if (IS_ERR(data->psy)) {
-               ret = PTR_ERR(data->psy);
-               dev_err(dev, "failed to register power supply %s\n",
-                       psy_desc->name);
-               goto err_psy;
-       }
-
-       return 0;
-
-err_psy:
-err_mux_register:
-       i2c_mux_del_adapters(data->muxc);
-
-err_mux_alloc:
-       return ret;
-}
-
-static int sbsm_remove(struct i2c_client *client)
-{
-       struct sbsm_data *data = i2c_get_clientdata(client);
+       if (IS_ERR(data->psy))
+               return dev_err_probe(dev, PTR_ERR(data->psy),
+                                    "failed to register power supply %s\n", psy_desc->name);
 
-       i2c_mux_del_adapters(data->muxc);
        return 0;
 }
 
@@ -431,7 +410,6 @@ static struct i2c_driver sbsm_driver = {
                .of_match_table = of_match_ptr(sbsm_dt_ids),
        },
        .probe          = sbsm_probe,
-       .remove         = sbsm_remove,
        .alert          = sbsm_alert,
        .id_table       = sbsm_ids
 };
index 8cfbd8d..3376f42 100644 (file)
@@ -911,11 +911,14 @@ static int smb347_irq_init(struct smb347_charger *smb,
 {
        int ret;
 
-       ret = devm_request_threaded_irq(smb->dev, client->irq, NULL,
-                                       smb347_interrupt, IRQF_ONESHOT,
-                                       client->name, smb);
-       if (ret < 0)
-               return ret;
+       smb->irq_unsupported = true;
+
+       /*
+        * Interrupt pin is optional. If it is connected, we setup the
+        * interrupt support here.
+        */
+       if (!client->irq)
+               return 0;
 
        ret = smb347_set_writable(smb, true);
        if (ret < 0)
@@ -931,7 +934,25 @@ static int smb347_irq_init(struct smb347_charger *smb,
 
        smb347_set_writable(smb, false);
 
-       return ret;
+       if (ret < 0) {
+               dev_warn(smb->dev, "failed to initialize IRQ: %d\n", ret);
+               dev_warn(smb->dev, "disabling IRQ support\n");
+               return 0;
+       }
+
+       ret = devm_request_threaded_irq(smb->dev, client->irq, NULL,
+                                       smb347_interrupt, IRQF_ONESHOT,
+                                       client->name, smb);
+       if (ret)
+               return ret;
+
+       smb->irq_unsupported = false;
+
+       ret = smb347_irq_enable(smb);
+       if (ret < 0)
+               return ret;
+
+       return 0;
 }
 
 /*
@@ -1120,9 +1141,13 @@ static int smb347_get_property(struct power_supply *psy,
        struct i2c_client *client = to_i2c_client(smb->dev);
        int ret;
 
-       disable_irq(client->irq);
+       if (!smb->irq_unsupported)
+               disable_irq(client->irq);
+
        ret = smb347_get_property_locked(psy, prop, val);
-       enable_irq(client->irq);
+
+       if (!smb->irq_unsupported)
+               enable_irq(client->irq);
 
        return ret;
 }
@@ -1339,20 +1364,9 @@ static int smb347_probe(struct i2c_client *client,
        if (ret < 0)
                return ret;
 
-       /*
-        * Interrupt pin is optional. If it is connected, we setup the
-        * interrupt support here.
-        */
-       if (client->irq) {
-               ret = smb347_irq_init(smb, client);
-               if (ret < 0) {
-                       dev_warn(dev, "failed to initialize IRQ: %d\n", ret);
-                       dev_warn(dev, "disabling IRQ support\n");
-                       smb->irq_unsupported = true;
-               } else {
-                       smb347_irq_enable(smb);
-               }
-       }
+       ret = smb347_irq_init(smb, client);
+       if (ret)
+               return ret;
 
        return 0;
 }
@@ -1387,11 +1401,10 @@ static struct i2c_driver smb347_driver = {
                .name = "smb347",
                .of_match_table = smb3xx_of_match,
        },
-       .probe        = smb347_probe,
-       .remove       = smb347_remove,
-       .id_table     = smb347_id,
+       .probe = smb347_probe,
+       .remove = smb347_remove,
+       .id_table = smb347_id,
 };
-
 module_i2c_driver(smb347_driver);
 
 MODULE_AUTHOR("Bruce E. Robertson <bruce.e.robertson@intel.com>");
index 6b0098e..0990b2f 100644 (file)
@@ -301,7 +301,7 @@ static int tps65090_charger_probe(struct platform_device *pdev)
 
        if (irq != -ENXIO) {
                ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
-                       tps65090_charger_isr, 0, "tps65090-charger", cdata);
+                       tps65090_charger_isr, IRQF_ONESHOT, "tps65090-charger", cdata);
                if (ret) {
                        dev_err(cdata->dev,
                                "Unable to register irq %d err %d\n", irq,
index 814c2b8..ba33d16 100644 (file)
@@ -238,7 +238,7 @@ static int tps65217_charger_probe(struct platform_device *pdev)
        for (i = 0; i < NUM_CHARGER_IRQS; i++) {
                ret = devm_request_threaded_irq(&pdev->dev, irq[i], NULL,
                                                tps65217_charger_irq,
-                                               0, "tps65217-charger",
+                                               IRQF_ONESHOT, "tps65217-charger",
                                                charger);
                if (ret) {
                        dev_err(charger->dev,
index b1508fe..7ed4e4b 100644 (file)
@@ -90,9 +90,6 @@ static void z2_batt_ext_power_changed(struct power_supply *batt_ps)
 static void z2_batt_update(struct z2_charger *charger)
 {
        int old_status = charger->bat_status;
-       struct z2_battery_info *info;
-
-       info = charger->info;
 
        mutex_lock(&charger->work_lock);
 
index 23040b6..7f07cfe 100644 (file)
@@ -28,282 +28,6 @@ struct abx500_init_settings {
        u8 setting;
 };
 
-/* Battery driver related data */
-/*
- * ADC for the battery thermistor.
- * When using the ABx500_ADC_THERM_BATCTRL the battery ID resistor is combined
- * with a NTC resistor to both identify the battery and to measure its
- * temperature. Different phone manufactures uses different techniques to both
- * identify the battery and to read its temperature.
- */
-enum abx500_adc_therm {
-       ABx500_ADC_THERM_BATCTRL,
-       ABx500_ADC_THERM_BATTEMP,
-};
-
-/**
- * struct abx500_res_to_temp - defines one point in a temp to res curve. To
- * be used in battery packs that combines the identification resistor with a
- * NTC resistor.
- * @temp:                      battery pack temperature in Celsius
- * @resist:                    NTC resistor net total resistance
- */
-struct abx500_res_to_temp {
-       int temp;
-       int resist;
-};
-
-/**
- * struct abx500_v_to_cap - Table for translating voltage to capacity
- * @voltage:           Voltage in mV
- * @capacity:          Capacity in percent
- */
-struct abx500_v_to_cap {
-       int voltage;
-       int capacity;
-};
-
-/* Forward declaration */
-struct abx500_fg;
-
-/**
- * struct abx500_fg_parameters - Fuel gauge algorithm parameters, in seconds
- * if not specified
- * @recovery_sleep_timer:      Time between measurements while recovering
- * @recovery_total_time:       Total recovery time
- * @init_timer:                        Measurement interval during startup
- * @init_discard_time:         Time we discard voltage measurement at startup
- * @init_total_time:           Total init time during startup
- * @high_curr_time:            Time current has to be high to go to recovery
- * @accu_charging:             FG accumulation time while charging
- * @accu_high_curr:            FG accumulation time in high current mode
- * @high_curr_threshold:       High current threshold, in mA
- * @lowbat_threshold:          Low battery threshold, in mV
- * @overbat_threshold:         Over battery threshold, in mV
- * @battok_falling_th_sel0     Threshold in mV for battOk signal sel0
- *                             Resolution in 50 mV step.
- * @battok_raising_th_sel1     Threshold in mV for battOk signal sel1
- *                             Resolution in 50 mV step.
- * @user_cap_limit             Capacity reported from user must be within this
- *                             limit to be considered as sane, in percentage
- *                             points.
- * @maint_thres                        This is the threshold where we stop reporting
- *                             battery full while in maintenance, in per cent
- * @pcut_enable:                       Enable power cut feature in ab8505
- * @pcut_max_time:             Max time threshold
- * @pcut_flag_time:            Flagtime threshold
- * @pcut_max_restart:          Max number of restarts
- * @pcut_debounce_time:                Sets battery debounce time
- */
-struct abx500_fg_parameters {
-       int recovery_sleep_timer;
-       int recovery_total_time;
-       int init_timer;
-       int init_discard_time;
-       int init_total_time;
-       int high_curr_time;
-       int accu_charging;
-       int accu_high_curr;
-       int high_curr_threshold;
-       int lowbat_threshold;
-       int overbat_threshold;
-       int battok_falling_th_sel0;
-       int battok_raising_th_sel1;
-       int user_cap_limit;
-       int maint_thres;
-       bool pcut_enable;
-       u8 pcut_max_time;
-       u8 pcut_flag_time;
-       u8 pcut_max_restart;
-       u8 pcut_debounce_time;
-};
-
-/**
- * struct abx500_charger_maximization - struct used by the board config.
- * @use_maxi:          Enable maximization for this battery type
- * @maxi_chg_curr:     Maximum charger current allowed
- * @maxi_wait_cycles:  cycles to wait before setting charger current
- * @charger_curr_step  delta between two charger current settings (mA)
- */
-struct abx500_maxim_parameters {
-       bool ena_maxi;
-       int chg_curr;
-       int wait_cycles;
-       int charger_curr_step;
-};
-
-/**
- * struct abx500_battery_type - different batteries supported
- * @name:                      battery technology
- * @resis_high:                        battery upper resistance limit
- * @resis_low:                 battery lower resistance limit
- * @charge_full_design:                Maximum battery capacity in mAh
- * @nominal_voltage:           Nominal voltage of the battery in mV
- * @termination_vol:           max voltage upto which battery can be charged
- * @termination_curr           battery charging termination current in mA
- * @recharge_cap               battery capacity limit that will trigger a new
- *                             full charging cycle in the case where maintenan-
- *                             -ce charging has been disabled
- * @normal_cur_lvl:            charger current in normal state in mA
- * @normal_vol_lvl:            charger voltage in normal state in mV
- * @maint_a_cur_lvl:           charger current in maintenance A state in mA
- * @maint_a_vol_lvl:           charger voltage in maintenance A state in mV
- * @maint_a_chg_timer_h:       charge time in maintenance A state
- * @maint_b_cur_lvl:           charger current in maintenance B state in mA
- * @maint_b_vol_lvl:           charger voltage in maintenance B state in mV
- * @maint_b_chg_timer_h:       charge time in maintenance B state
- * @low_high_cur_lvl:          charger current in temp low/high state in mA
- * @low_high_vol_lvl:          charger voltage in temp low/high state in mV'
- * @battery_resistance:                battery inner resistance in mOhm.
- * @n_r_t_tbl_elements:                number of elements in r_to_t_tbl
- * @r_to_t_tbl:                        table containing resistance to temp points
- * @n_v_cap_tbl_elements:      number of elements in v_to_cap_tbl
- * @v_to_cap_tbl:              Voltage to capacity (in %) table
- * @n_batres_tbl_elements      number of elements in the batres_tbl
- * @batres_tbl                 battery internal resistance vs temperature table
- */
-struct abx500_battery_type {
-       int name;
-       int resis_high;
-       int resis_low;
-       int charge_full_design;
-       int nominal_voltage;
-       int termination_vol;
-       int termination_curr;
-       int recharge_cap;
-       int normal_cur_lvl;
-       int normal_vol_lvl;
-       int maint_a_cur_lvl;
-       int maint_a_vol_lvl;
-       int maint_a_chg_timer_h;
-       int maint_b_cur_lvl;
-       int maint_b_vol_lvl;
-       int maint_b_chg_timer_h;
-       int low_high_cur_lvl;
-       int low_high_vol_lvl;
-       int battery_resistance;
-       int n_temp_tbl_elements;
-       const struct abx500_res_to_temp *r_to_t_tbl;
-       int n_v_cap_tbl_elements;
-       const struct abx500_v_to_cap *v_to_cap_tbl;
-       int n_batres_tbl_elements;
-       const struct batres_vs_temp *batres_tbl;
-};
-
-/**
- * struct abx500_bm_capacity_levels - abx500 capacity level data
- * @critical:          critical capacity level in percent
- * @low:               low capacity level in percent
- * @normal:            normal capacity level in percent
- * @high:              high capacity level in percent
- * @full:              full capacity level in percent
- */
-struct abx500_bm_capacity_levels {
-       int critical;
-       int low;
-       int normal;
-       int high;
-       int full;
-};
-
-/**
- * struct abx500_bm_charger_parameters - Charger specific parameters
- * @usb_volt_max:      maximum allowed USB charger voltage in mV
- * @usb_curr_max:      maximum allowed USB charger current in mA
- * @ac_volt_max:       maximum allowed AC charger voltage in mV
- * @ac_curr_max:       maximum allowed AC charger current in mA
- */
-struct abx500_bm_charger_parameters {
-       int usb_volt_max;
-       int usb_curr_max;
-       int ac_volt_max;
-       int ac_curr_max;
-};
-
-/**
- * struct abx500_bm_data - abx500 battery management data
- * @temp_under         under this temp, charging is stopped
- * @temp_low           between this temp and temp_under charging is reduced
- * @temp_high          between this temp and temp_over charging is reduced
- * @temp_over          over this temp, charging is stopped
- * @temp_now           present battery temperature
- * @temp_interval_chg  temperature measurement interval in s when charging
- * @temp_interval_nochg        temperature measurement interval in s when not charging
- * @main_safety_tmr_h  safety timer for main charger
- * @usb_safety_tmr_h   safety timer for usb charger
- * @bkup_bat_v         voltage which we charge the backup battery with
- * @bkup_bat_i         current which we charge the backup battery with
- * @no_maintenance     indicates that maintenance charging is disabled
- * @capacity_scaling    indicates whether capacity scaling is to be used
- * @abx500_adc_therm   placement of thermistor, batctrl or battemp adc
- * @chg_unknown_bat    flag to enable charging of unknown batteries
- * @enable_overshoot   flag to enable VBAT overshoot control
- * @auto_trig          flag to enable auto adc trigger
- * @fg_res             resistance of FG resistor in 0.1mOhm
- * @n_btypes           number of elements in array bat_type
- * @batt_id            index of the identified battery in array bat_type
- * @interval_charging  charge alg cycle period time when charging (sec)
- * @interval_not_charging charge alg cycle period time when not charging (sec)
- * @temp_hysteresis    temperature hysteresis
- * @gnd_lift_resistance        Battery ground to phone ground resistance (mOhm)
- * @n_chg_out_curr             number of elements in array chg_output_curr
- * @n_chg_in_curr              number of elements in array chg_input_curr
- * @chg_output_curr    charger output current level map
- * @chg_input_curr             charger input current level map
- * @maxi               maximization parameters
- * @cap_levels         capacity in percent for the different capacity levels
- * @bat_type           table of supported battery types
- * @chg_params         charger parameters
- * @fg_params          fuel gauge parameters
- */
-struct abx500_bm_data {
-       int temp_under;
-       int temp_low;
-       int temp_high;
-       int temp_over;
-       int temp_now;
-       int temp_interval_chg;
-       int temp_interval_nochg;
-       int main_safety_tmr_h;
-       int usb_safety_tmr_h;
-       int bkup_bat_v;
-       int bkup_bat_i;
-       bool autopower_cfg;
-       bool ac_enabled;
-       bool usb_enabled;
-       bool no_maintenance;
-       bool capacity_scaling;
-       bool chg_unknown_bat;
-       bool enable_overshoot;
-       bool auto_trig;
-       enum abx500_adc_therm adc_therm;
-       int fg_res;
-       int n_btypes;
-       int batt_id;
-       int interval_charging;
-       int interval_not_charging;
-       int temp_hysteresis;
-       int gnd_lift_resistance;
-       int n_chg_out_curr;
-       int n_chg_in_curr;
-       int *chg_output_curr;
-       int *chg_input_curr;
-       const struct abx500_maxim_parameters *maxi;
-       const struct abx500_bm_capacity_levels *cap_levels;
-       struct abx500_battery_type *bat_type;
-       const struct abx500_bm_charger_parameters *chg_params;
-       const struct abx500_fg_parameters *fg_params;
-};
-
-enum {
-       NTC_EXTERNAL = 0,
-       NTC_INTERNAL,
-};
-
-int ab8500_bm_of_probe(struct device *dev,
-                      struct device_node *np,
-                      struct abx500_bm_data *bm);
-
 int abx500_set_register_interruptible(struct device *dev, u8 bank, u8 reg,
        u8 value);
 int abx500_get_register_interruptible(struct device *dev, u8 bank, u8 reg,
diff --git a/include/linux/mfd/abx500/ab8500-bm.h b/include/linux/mfd/abx500/ab8500-bm.h
deleted file mode 100644 (file)
index 903e94c..0000000
+++ /dev/null
@@ -1,476 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Copyright ST-Ericsson 2012.
- *
- * Author: Arun Murthy <arun.murthy@stericsson.com>
- */
-
-#ifndef _AB8500_BM_H
-#define _AB8500_BM_H
-
-#include <linux/kernel.h>
-#include <linux/mfd/abx500.h>
-
-/*
- * System control 2 register offsets.
- * bank = 0x02
- */
-#define AB8500_MAIN_WDOG_CTRL_REG      0x01
-#define AB8500_LOW_BAT_REG             0x03
-#define AB8500_BATT_OK_REG             0x04
-/*
- * USB/ULPI register offsets
- * Bank : 0x5
- */
-#define AB8500_USB_LINE_STAT_REG       0x80
-#define AB8500_USB_LINE_CTRL2_REG      0x82
-#define AB8500_USB_LINK1_STAT_REG      0x94
-
-/*
- * Charger / status register offfsets
- * Bank : 0x0B
- */
-#define AB8500_CH_STATUS1_REG          0x00
-#define AB8500_CH_STATUS2_REG          0x01
-#define AB8500_CH_USBCH_STAT1_REG      0x02
-#define AB8500_CH_USBCH_STAT2_REG      0x03
-#define AB8540_CH_USBCH_STAT3_REG      0x04
-#define AB8500_CH_STAT_REG             0x05
-
-/*
- * Charger / control register offfsets
- * Bank : 0x0B
- */
-#define AB8500_CH_VOLT_LVL_REG         0x40
-#define AB8500_CH_VOLT_LVL_MAX_REG     0x41  /*Only in Cut2.0*/
-#define AB8500_CH_OPT_CRNTLVL_REG      0x42
-#define AB8500_CH_OPT_CRNTLVL_MAX_REG  0x43  /*Only in Cut2.0*/
-#define AB8500_CH_WD_TIMER_REG         0x50
-#define AB8500_CHARG_WD_CTRL           0x51
-#define AB8500_BTEMP_HIGH_TH           0x52
-#define AB8500_LED_INDICATOR_PWM_CTRL  0x53
-#define AB8500_LED_INDICATOR_PWM_DUTY  0x54
-#define AB8500_BATT_OVV                        0x55
-#define AB8500_CHARGER_CTRL            0x56
-#define AB8500_BAT_CTRL_CURRENT_SOURCE 0x60  /*Only in Cut2.0*/
-
-/*
- * Charger / main control register offsets
- * Bank : 0x0B
- */
-#define AB8500_MCH_CTRL1               0x80
-#define AB8500_MCH_CTRL2               0x81
-#define AB8500_MCH_IPT_CURLVL_REG      0x82
-#define AB8500_CH_WD_REG               0x83
-
-/*
- * Charger / USB control register offsets
- * Bank : 0x0B
- */
-#define AB8500_USBCH_CTRL1_REG         0xC0
-#define AB8500_USBCH_CTRL2_REG         0xC1
-#define AB8500_USBCH_IPT_CRNTLVL_REG   0xC2
-#define AB8540_USB_PP_MODE_REG         0xC5
-#define AB8540_USB_PP_CHR_REG          0xC6
-
-/*
- * Gas Gauge register offsets
- * Bank : 0x0C
- */
-#define AB8500_GASG_CC_CTRL_REG                0x00
-#define AB8500_GASG_CC_ACCU1_REG       0x01
-#define AB8500_GASG_CC_ACCU2_REG       0x02
-#define AB8500_GASG_CC_ACCU3_REG       0x03
-#define AB8500_GASG_CC_ACCU4_REG       0x04
-#define AB8500_GASG_CC_SMPL_CNTRL_REG  0x05
-#define AB8500_GASG_CC_SMPL_CNTRH_REG  0x06
-#define AB8500_GASG_CC_SMPL_CNVL_REG   0x07
-#define AB8500_GASG_CC_SMPL_CNVH_REG   0x08
-#define AB8500_GASG_CC_CNTR_AVGOFF_REG 0x09
-#define AB8500_GASG_CC_OFFSET_REG      0x0A
-#define AB8500_GASG_CC_NCOV_ACCU       0x10
-#define AB8500_GASG_CC_NCOV_ACCU_CTRL  0x11
-#define AB8500_GASG_CC_NCOV_ACCU_LOW   0x12
-#define AB8500_GASG_CC_NCOV_ACCU_MED   0x13
-#define AB8500_GASG_CC_NCOV_ACCU_HIGH  0x14
-
-/*
- * Interrupt register offsets
- * Bank : 0x0E
- */
-#define AB8500_IT_SOURCE2_REG          0x01
-#define AB8500_IT_SOURCE21_REG         0x14
-
-/*
- * RTC register offsets
- * Bank: 0x0F
- */
-#define AB8500_RTC_BACKUP_CHG_REG      0x0C
-#define AB8500_RTC_CC_CONF_REG         0x01
-#define AB8500_RTC_CTRL_REG            0x0B
-#define AB8500_RTC_CTRL1_REG           0x11
-
-/*
- * OTP register offsets
- * Bank : 0x15
- */
-#define AB8500_OTP_CONF_15             0x0E
-
-/* GPADC constants from AB8500 spec, UM0836 */
-#define ADC_RESOLUTION                 1024
-#define ADC_CH_MAIN_MIN                        0
-#define ADC_CH_MAIN_MAX                        20030
-#define ADC_CH_VBUS_MIN                        0
-#define ADC_CH_VBUS_MAX                        20030
-#define ADC_CH_VBAT_MIN                        2300
-#define ADC_CH_VBAT_MAX                        4800
-#define ADC_CH_BKBAT_MIN               0
-#define ADC_CH_BKBAT_MAX               3200
-
-/* Main charge i/p current */
-#define MAIN_CH_IP_CUR_0P9A            0x80
-#define MAIN_CH_IP_CUR_1P0A            0x90
-#define MAIN_CH_IP_CUR_1P1A            0xA0
-#define MAIN_CH_IP_CUR_1P2A            0xB0
-#define MAIN_CH_IP_CUR_1P3A            0xC0
-#define MAIN_CH_IP_CUR_1P4A            0xD0
-#define MAIN_CH_IP_CUR_1P5A            0xE0
-
-/* ChVoltLevel */
-#define CH_VOL_LVL_3P5                 0x00
-#define CH_VOL_LVL_4P0                 0x14
-#define CH_VOL_LVL_4P05                        0x16
-#define CH_VOL_LVL_4P1                 0x1B
-#define CH_VOL_LVL_4P15                        0x20
-#define CH_VOL_LVL_4P2                 0x25
-#define CH_VOL_LVL_4P6                 0x4D
-
-/* ChOutputCurrentLevel */
-#define CH_OP_CUR_LVL_0P1              0x00
-#define CH_OP_CUR_LVL_0P2              0x01
-#define CH_OP_CUR_LVL_0P3              0x02
-#define CH_OP_CUR_LVL_0P4              0x03
-#define CH_OP_CUR_LVL_0P5              0x04
-#define CH_OP_CUR_LVL_0P6              0x05
-#define CH_OP_CUR_LVL_0P7              0x06
-#define CH_OP_CUR_LVL_0P8              0x07
-#define CH_OP_CUR_LVL_0P9              0x08
-#define CH_OP_CUR_LVL_1P4              0x0D
-#define CH_OP_CUR_LVL_1P5              0x0E
-#define CH_OP_CUR_LVL_1P6              0x0F
-#define CH_OP_CUR_LVL_2P               0x3F
-
-/* BTEMP High thermal limits */
-#define BTEMP_HIGH_TH_57_0             0x00
-#define BTEMP_HIGH_TH_52               0x01
-#define BTEMP_HIGH_TH_57_1             0x02
-#define BTEMP_HIGH_TH_62               0x03
-
-/* current is mA */
-#define USB_0P1A                       100
-#define USB_0P2A                       200
-#define USB_0P3A                       300
-#define USB_0P4A                       400
-#define USB_0P5A                       500
-
-#define LOW_BAT_3P1V                   0x20
-#define LOW_BAT_2P3V                   0x00
-#define LOW_BAT_RESET                  0x01
-#define LOW_BAT_ENABLE                 0x01
-
-/* Backup battery constants */
-#define BUP_ICH_SEL_50UA               0x00
-#define BUP_ICH_SEL_150UA              0x04
-#define BUP_ICH_SEL_300UA              0x08
-#define BUP_ICH_SEL_700UA              0x0C
-
-enum bup_vch_sel {
-       BUP_VCH_SEL_2P5V,
-       BUP_VCH_SEL_2P6V,
-       BUP_VCH_SEL_2P8V,
-       BUP_VCH_SEL_3P1V,
-       /*
-        * Note that the following 5 values 2.7v, 2.9v, 3.0v, 3.2v, 3.3v
-        * are only available on ab8540. You can't choose these 5
-        * voltage on ab8500/ab8505/ab9540.
-        */
-       BUP_VCH_SEL_2P7V,
-       BUP_VCH_SEL_2P9V,
-       BUP_VCH_SEL_3P0V,
-       BUP_VCH_SEL_3P2V,
-       BUP_VCH_SEL_3P3V,
-};
-
-#define BUP_VCH_RANGE          0x02
-#define VBUP33_VRTCN           0x01
-
-/* Battery OVV constants */
-#define BATT_OVV_ENA                   0x02
-#define BATT_OVV_TH_3P7                        0x00
-#define BATT_OVV_TH_4P75               0x01
-
-/* A value to indicate over voltage */
-#define BATT_OVV_VALUE                 4750
-
-/* VBUS OVV constants */
-#define VBUS_OVV_SELECT_MASK           0x78
-#define VBUS_OVV_SELECT_5P6V           0x00
-#define VBUS_OVV_SELECT_5P7V           0x08
-#define VBUS_OVV_SELECT_5P8V           0x10
-#define VBUS_OVV_SELECT_5P9V           0x18
-#define VBUS_OVV_SELECT_6P0V           0x20
-#define VBUS_OVV_SELECT_6P1V           0x28
-#define VBUS_OVV_SELECT_6P2V           0x30
-#define VBUS_OVV_SELECT_6P3V           0x38
-
-#define VBUS_AUTO_IN_CURR_LIM_ENA      0x04
-
-/* Fuel Gauge constants */
-#define RESET_ACCU                     0x02
-#define READ_REQ                       0x01
-#define CC_DEEP_SLEEP_ENA              0x02
-#define CC_PWR_UP_ENA                  0x01
-#define CC_SAMPLES_40                  0x28
-#define RD_NCONV_ACCU_REQ              0x01
-#define CC_CALIB                       0x08
-#define CC_INTAVGOFFSET_ENA            0x10
-#define CC_MUXOFFSET                   0x80
-#define CC_INT_CAL_N_AVG_MASK          0x60
-#define CC_INT_CAL_SAMPLES_16          0x40
-#define CC_INT_CAL_SAMPLES_8           0x20
-#define CC_INT_CAL_SAMPLES_4           0x00
-
-/* RTC constants */
-#define RTC_BUP_CH_ENA                 0x10
-
-/* BatCtrl Current Source Constants */
-#define BAT_CTRL_7U_ENA                        0x01
-#define BAT_CTRL_20U_ENA               0x02
-#define BAT_CTRL_18U_ENA               0x01
-#define BAT_CTRL_16U_ENA               0x02
-#define BAT_CTRL_CMP_ENA               0x04
-#define FORCE_BAT_CTRL_CMP_HIGH                0x08
-#define BAT_CTRL_PULL_UP_ENA           0x10
-
-/* Battery type */
-#define BATTERY_UNKNOWN                        00
-
-/* Registers for pcut feature in ab8505 and ab9540 */
-#define AB8505_RTC_PCUT_CTL_STATUS_REG 0x12
-#define AB8505_RTC_PCUT_TIME_REG       0x13
-#define AB8505_RTC_PCUT_MAX_TIME_REG   0x14
-#define AB8505_RTC_PCUT_FLAG_TIME_REG  0x15
-#define AB8505_RTC_PCUT_RESTART_REG    0x16
-#define AB8505_RTC_PCUT_DEBOUNCE_REG   0x17
-
-/* USB Power Path constants for ab8540 */
-#define BUS_VSYS_VOL_SELECT_MASK               0x06
-#define BUS_VSYS_VOL_SELECT_3P6V               0x00
-#define BUS_VSYS_VOL_SELECT_3P325V             0x02
-#define BUS_VSYS_VOL_SELECT_3P9V               0x04
-#define BUS_VSYS_VOL_SELECT_4P3V               0x06
-#define BUS_POWER_PATH_MODE_ENA                        0x01
-#define BUS_PP_PRECHG_CURRENT_MASK             0x0E
-#define BUS_POWER_PATH_PRECHG_ENA              0x01
-
-/**
- * struct res_to_temp - defines one point in a temp to res curve. To
- * be used in battery packs that combines the identification resistor with a
- * NTC resistor.
- * @temp:                      battery pack temperature in Celsius
- * @resist:                    NTC resistor net total resistance
- */
-struct res_to_temp {
-       int temp;
-       int resist;
-};
-
-/**
- * struct batres_vs_temp - defines one point in a temp vs battery internal
- * resistance curve.
- * @temp:                      battery pack temperature in Celsius
- * @resist:                    battery internal reistance in mOhm
- */
-struct batres_vs_temp {
-       int temp;
-       int resist;
-};
-
-/* Forward declaration */
-struct ab8500_fg;
-
-/**
- * struct ab8500_fg_parameters - Fuel gauge algorithm parameters, in seconds
- * if not specified
- * @recovery_sleep_timer:      Time between measurements while recovering
- * @recovery_total_time:       Total recovery time
- * @init_timer:                        Measurement interval during startup
- * @init_discard_time:         Time we discard voltage measurement at startup
- * @init_total_time:           Total init time during startup
- * @high_curr_time:            Time current has to be high to go to recovery
- * @accu_charging:             FG accumulation time while charging
- * @accu_high_curr:            FG accumulation time in high current mode
- * @high_curr_threshold:       High current threshold, in mA
- * @lowbat_threshold:          Low battery threshold, in mV
- * @battok_falling_th_sel0     Threshold in mV for battOk signal sel0
- *                             Resolution in 50 mV step.
- * @battok_raising_th_sel1     Threshold in mV for battOk signal sel1
- *                             Resolution in 50 mV step.
- * @user_cap_limit             Capacity reported from user must be within this
- *                             limit to be considered as sane, in percentage
- *                             points.
- * @maint_thres                        This is the threshold where we stop reporting
- *                             battery full while in maintenance, in per cent
- * @pcut_enable:                       Enable power cut feature in ab8505
- * @pcut_max_time:             Max time threshold
- * @pcut_flag_time:            Flagtime threshold
- * @pcut_max_restart:          Max number of restarts
- * @pcut_debunce_time: Sets battery debounce time
- */
-struct ab8500_fg_parameters {
-       int recovery_sleep_timer;
-       int recovery_total_time;
-       int init_timer;
-       int init_discard_time;
-       int init_total_time;
-       int high_curr_time;
-       int accu_charging;
-       int accu_high_curr;
-       int high_curr_threshold;
-       int lowbat_threshold;
-       int battok_falling_th_sel0;
-       int battok_raising_th_sel1;
-       int user_cap_limit;
-       int maint_thres;
-       bool pcut_enable;
-       u8 pcut_max_time;
-       u8 pcut_flag_time;
-       u8 pcut_max_restart;
-       u8 pcut_debunce_time;
-};
-
-/**
- * struct ab8500_charger_maximization - struct used by the board config.
- * @use_maxi:          Enable maximization for this battery type
- * @maxi_chg_curr:     Maximum charger current allowed
- * @maxi_wait_cycles:  cycles to wait before setting charger current
- * @charger_curr_step  delta between two charger current settings (mA)
- */
-struct ab8500_maxim_parameters {
-       bool ena_maxi;
-       int chg_curr;
-       int wait_cycles;
-       int charger_curr_step;
-};
-
-/**
- * struct ab8500_bm_capacity_levels - ab8500 capacity level data
- * @critical:          critical capacity level in percent
- * @low:               low capacity level in percent
- * @normal:            normal capacity level in percent
- * @high:              high capacity level in percent
- * @full:              full capacity level in percent
- */
-struct ab8500_bm_capacity_levels {
-       int critical;
-       int low;
-       int normal;
-       int high;
-       int full;
-};
-
-/**
- * struct ab8500_bm_charger_parameters - Charger specific parameters
- * @usb_volt_max:      maximum allowed USB charger voltage in mV
- * @usb_curr_max:      maximum allowed USB charger current in mA
- * @ac_volt_max:       maximum allowed AC charger voltage in mV
- * @ac_curr_max:       maximum allowed AC charger current in mA
- */
-struct ab8500_bm_charger_parameters {
-       int usb_volt_max;
-       int usb_curr_max;
-       int ac_volt_max;
-       int ac_curr_max;
-};
-
-/**
- * struct ab8500_bm_data - ab8500 battery management data
- * @temp_under         under this temp, charging is stopped
- * @temp_low           between this temp and temp_under charging is reduced
- * @temp_high          between this temp and temp_over charging is reduced
- * @temp_over          over this temp, charging is stopped
- * @temp_interval_chg  temperature measurement interval in s when charging
- * @temp_interval_nochg        temperature measurement interval in s when not charging
- * @main_safety_tmr_h  safety timer for main charger
- * @usb_safety_tmr_h   safety timer for usb charger
- * @bkup_bat_v         voltage which we charge the backup battery with
- * @bkup_bat_i         current which we charge the backup battery with
- * @no_maintenance     indicates that maintenance charging is disabled
- * @capacity_scaling    indicates whether capacity scaling is to be used
- * @adc_therm          placement of thermistor, batctrl or battemp adc
- * @chg_unknown_bat    flag to enable charging of unknown batteries
- * @enable_overshoot   flag to enable VBAT overshoot control
- * @fg_res             resistance of FG resistor in 0.1mOhm
- * @n_btypes           number of elements in array bat_type
- * @batt_id            index of the identified battery in array bat_type
- * @interval_charging  charge alg cycle period time when charging (sec)
- * @interval_not_charging charge alg cycle period time when not charging (sec)
- * @temp_hysteresis    temperature hysteresis
- * @gnd_lift_resistance        Battery ground to phone ground resistance (mOhm)
- * @maxi:              maximization parameters
- * @cap_levels         capacity in percent for the different capacity levels
- * @bat_type           table of supported battery types
- * @chg_params         charger parameters
- * @fg_params          fuel gauge parameters
- */
-struct ab8500_bm_data {
-       int temp_under;
-       int temp_low;
-       int temp_high;
-       int temp_over;
-       int temp_interval_chg;
-       int temp_interval_nochg;
-       int main_safety_tmr_h;
-       int usb_safety_tmr_h;
-       int bkup_bat_v;
-       int bkup_bat_i;
-       bool no_maintenance;
-       bool capacity_scaling;
-       bool chg_unknown_bat;
-       bool enable_overshoot;
-       enum abx500_adc_therm adc_therm;
-       int fg_res;
-       int n_btypes;
-       int batt_id;
-       int interval_charging;
-       int interval_not_charging;
-       int temp_hysteresis;
-       int gnd_lift_resistance;
-       const struct ab8500_maxim_parameters *maxi;
-       const struct ab8500_bm_capacity_levels *cap_levels;
-       const struct ab8500_bm_charger_parameters *chg_params;
-       const struct ab8500_fg_parameters *fg_params;
-};
-
-struct ab8500_btemp;
-struct ab8500_gpadc;
-struct ab8500_fg;
-
-#ifdef CONFIG_AB8500_BM
-extern struct abx500_bm_data ab8500_bm_data;
-
-void ab8500_charger_usb_state_changed(u8 bm_usb_state, u16 mA);
-struct ab8500_btemp *ab8500_btemp_get(void);
-int ab8500_btemp_get_batctrl_temp(struct ab8500_btemp *btemp);
-int ab8500_btemp_get_temp(struct ab8500_btemp *btemp);
-struct ab8500_fg *ab8500_fg_get(void);
-int ab8500_fg_inst_curr_blocking(struct ab8500_fg *dev);
-int ab8500_fg_inst_curr_start(struct ab8500_fg *di);
-int ab8500_fg_inst_curr_finalize(struct ab8500_fg *di, int *res);
-int ab8500_fg_inst_curr_started(struct ab8500_fg *di);
-int ab8500_fg_inst_curr_done(struct ab8500_fg *di);
-
-#else
-static struct abx500_bm_data ab8500_bm_data;
-#endif
-#endif /* _AB8500_BM_H */
diff --git a/include/linux/mfd/abx500/ux500_chargalg.h b/include/linux/mfd/abx500/ux500_chargalg.h
deleted file mode 100644 (file)
index 9b97d28..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Copyright (C) ST-Ericsson SA 2012
- * Author: Johan Gardsmark <johan.gardsmark@stericsson.com> for ST-Ericsson.
- */
-
-#ifndef _UX500_CHARGALG_H
-#define _UX500_CHARGALG_H
-
-#include <linux/power_supply.h>
-
-/*
- * Valid only for supplies of type:
- * - POWER_SUPPLY_TYPE_MAINS,
- * - POWER_SUPPLY_TYPE_USB,
- * because only them store as drv_data pointer to struct ux500_charger.
- */
-#define psy_to_ux500_charger(x) power_supply_get_drvdata(psy)
-
-/* Forward declaration */
-struct ux500_charger;
-
-struct ux500_charger_ops {
-       int (*enable) (struct ux500_charger *, int, int, int);
-       int (*check_enable) (struct ux500_charger *, int, int);
-       int (*kick_wd) (struct ux500_charger *);
-       int (*update_curr) (struct ux500_charger *, int);
-};
-
-/**
- * struct ux500_charger - power supply ux500 charger sub class
- * @psy                        power supply base class
- * @ops                        ux500 charger operations
- * @max_out_volt       maximum output charger voltage in mV
- * @max_out_curr       maximum output charger current in mA
- * @enabled            indicates if this charger is used or not
- * @external           external charger unit (pm2xxx)
- */
-struct ux500_charger {
-       struct power_supply *psy;
-       struct ux500_charger_ops ops;
-       int max_out_volt;
-       int max_out_curr;
-       int wdt_refresh;
-       bool enabled;
-       bool external;
-};
-
-extern struct blocking_notifier_head charger_notifier_list;
-
-#endif
index 111a40d..a1aa681 100644 (file)
@@ -33,6 +33,7 @@ enum bq27xxx_chip {
        BQ27Z561,
        BQ28Z610,
        BQ34Z100,
+       BQ78Z100,
 };
 
 struct bq27xxx_device_info;
@@ -53,7 +54,6 @@ struct bq27xxx_reg_cache {
        int capacity;
        int energy;
        int flags;
-       int power_avg;
        int health;
 };
 
index 81a55e9..174a534 100644 (file)
@@ -381,8 +381,14 @@ struct power_supply_battery_info {
 extern struct atomic_notifier_head power_supply_notifier;
 extern int power_supply_reg_notifier(struct notifier_block *nb);
 extern void power_supply_unreg_notifier(struct notifier_block *nb);
+#if IS_ENABLED(CONFIG_POWER_SUPPLY)
 extern struct power_supply *power_supply_get_by_name(const char *name);
 extern void power_supply_put(struct power_supply *psy);
+#else
+static inline void power_supply_put(struct power_supply *psy) {}
+static inline struct power_supply *power_supply_get_by_name(const char *name)
+{ return NULL; }
+#endif
 #ifdef CONFIG_OF
 extern struct power_supply *power_supply_get_by_phandle(struct device_node *np,
                                                        const char *property);
@@ -476,12 +482,12 @@ static inline bool power_supply_is_amp_property(enum power_supply_property psp)
        case POWER_SUPPLY_PROP_CURRENT_NOW:
        case POWER_SUPPLY_PROP_CURRENT_AVG:
        case POWER_SUPPLY_PROP_CURRENT_BOOT:
-               return 1;
+               return true;
        default:
                break;
        }
 
-       return 0;
+       return false;
 }
 
 static inline bool power_supply_is_watt_property(enum power_supply_property psp)
@@ -504,12 +510,12 @@ static inline bool power_supply_is_watt_property(enum power_supply_property psp)
        case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE:
        case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX:
        case POWER_SUPPLY_PROP_POWER_NOW:
-               return 1;
+               return true;
        default:
                break;
        }
 
-       return 0;
+       return false;
 }
 
 #ifdef CONFIG_POWER_SUPPLY_HWMON