Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
a8d149e
dt-bindings: power: supply: qcom,pmi8998-charger: add the PMI632
llg179 Jul 30, 2026
ea49dd4
dt-bindings: power: supply: battery: add id-resistor-ohms
llg179 Aug 12, 2026
0e562ba
dt-bindings: power: supply: qcom,pmi8998-charger: describe the chargi…
llg179 Aug 12, 2026
9ce3b87
dt-bindings: power: supply: drop the type refs the unit suffixes alre…
llg179 Aug 12, 2026
9e0fb1b
power: supply: qcom_smbx: add SMB5 (PMI632) support
llg179 Jul 25, 2026
d3ad58b
power: supply: qcom_smbx: report battery temperature
llg179 Jul 29, 2026
b6ba33a
power: supply: qcom_smbx: program the hardware JEITA thresholds
llg179 Jul 29, 2026
d72e57a
power: supply: qcom_smbx: expose the charge current as a cooling device
llg179 Jul 29, 2026
f789ee9
power: supply: qcom_smbx: let the battery set the fast-charge current
llg179 Jul 29, 2026
7ae20bd
power: supply: qcom_smbx: bound the charge current by hardware, not b…
llg179 Jul 29, 2026
3f66bb7
power: supply: qcom_smbx: read the JEITA description from the battery
llg179 Jul 29, 2026
3aea14d
power: supply: qcom_smbx: do not apply one battery's limits to another
llg179 Jul 29, 2026
5c1e9ee
power: supply: qcom_smbx: let thermal mitigation only ever reduce
llg179 Jul 29, 2026
e288b87
power: supply: qcom_smbx: fix three checkpatch --strict complaints
llg179 Jul 30, 2026
ab781e5
power: supply: qcom_smbx: gauge the battery from the PMIC's QG samples
llg179 Aug 8, 2026
594f86d
power: supply: qcom_smbx: decode the charge status per generation
llg179 Aug 8, 2026
aa39c0d
power: supply: qcom_smbx: only call a terminated charge full
llg179 Aug 8, 2026
143cfb3
power: supply: qcom_smbx: hold the pack full while the charger says i…
llg179 Aug 8, 2026
229e0a7
power: supply: qcom_smbx: restart a finished charge on pmi632
llg179 Aug 8, 2026
cc9c03d
power: supply: qcom_smbx: do not read the OCV table while the charger…
llg179 Aug 8, 2026
cb6b075
power: supply: qcom_smbx: correct the fuel gauge from rested readings…
llg179 Aug 10, 2026
610cfa8
power: supply: qcom_smbx: complete the charge-end path and report mor…
llg179 Aug 11, 2026
3018437
power: supply: qcom_smbx: let the charger terminate a charge on SMB5
llg179 Aug 12, 2026
9af02eb
power: supply: qcom_smbx: do not forget a charge because the input bl…
llg179 Aug 12, 2026
7e69898
power: supply: qcom_smbx: report how much charge the pack holds
llg179 Aug 12, 2026
2bbd765
power: supply: qcom_smbx: read the charging policy from the charger node
llg179 Aug 12, 2026
4789b6b
power: supply: qcom_smbx: learn what the pack actually holds
llg179 Aug 29, 2026
dfe96ab
arm64: dts: qcom: pmi632: add the charger node
llg179 Jul 25, 2026
ec0ea26
iio: adc: qcom-spmi-adc5: add the BAT_THERM channel
llg179 Jul 29, 2026
025c83a
arm64: dts: qcom: pmi632: read the battery thermistor
llg179 Jul 29, 2026
45212db
arm64: dts: qcom: pmi632: wire the QG good-OCV interrupt
llg179 Aug 10, 2026
d065d08
arm64: dts: qcom: pmi632: describe the charger's interrupts, and fix one
llg179 Aug 11, 2026
a9a20fc
arm64: dts: qcom: sdm429-lenovo-tbx505x: Enable charger and fuel gauge
lostsignal-502 Oct 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Documentation/devicetree/bindings/power/supply/battery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,16 @@ properties:
factory-internal-resistance-micro-ohms:
description: battery factory internal resistance

id-resistor-ohms:
maxItems: 1
description: |
Resistance of the identification resistor built into the pack, on boards
where more than one battery may be fitted and a charger can tell them
apart by measuring it. Naming it here lets a driver refuse to apply this
battery's limits to a pack that is demonstrably a different one; how the
resistance is measured is a property of the board and of the charger, not
of the cell.

resistance-temp-table:
$ref: /schemas/types.yaml#/definitions/uint32-matrix
items:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,23 @@
$id: http://devicetree.org/schemas/power/supply/qcom,pmi8998-charger.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Qualcomm PMI8998/PM660 Switch-Mode Battery Charger "2"
title: Qualcomm Switch-Mode Battery Charger "2" and "5"

maintainers:
- Casey Connolly <casey.connolly@linaro.org>

description: |
The charger peripheral of a Qualcomm PMIC, in either of two generations:
SMB2 on the PMI8998 and PM660, and SMB5 on the PMI632. They differ in the
register layout and in which analog channels the PMIC routes, not in the
shape of this binding.

properties:
compatible:
enum:
- qcom,pmi8998-charger
- qcom,pm660-charger
- qcom,pmi632-charger

reg:
maxItems: 1
Expand All @@ -29,17 +36,95 @@ properties:
- const: usbin-icl-change

io-channels:
minItems: 2
items:
- description: USB in current in uA
- description: USB in voltage in uV
- description: Battery voltage in uV
- description: Battery thermistor, as a raw ADC code
- description: Battery ID resistor divider voltage in uV

io-channel-names:
minItems: 2
items:
- const: usbin_i
- const: usbin_v
- const: vbat
- const: bat_therm
- const: bat_id

monitored-battery: true

qcom,batt-id-pullup-ohms:
maxItems: 1
description: |
Resistance of the pull-up from the PMIC reference to the BAT_ID net, in
ohms. Together with the voltage read on the bat_id channel this gives the
resistance of the identification resistor inside the pack, which is
compared against the id-resistor-ohms of the monitored battery. Describe
it only on boards that route BAT_ID.

qcom,batt-id-tolerance-percent:
maxItems: 1
description: |
How far, as a percentage, the resistance measured through that divider
may differ from the monitored battery's id-resistor-ohms and still count
as the same pack. The tolerance belongs here rather than to the cell
because it has to cover the divider and the ADC as well as the resistor
itself.

qcom,auto-recharge-microvolt:
description: |
Battery voltage, in microvolts, below which a finished charge is started
again. Must be below the monitored battery's
constant-charge-voltage-max-microvolt. Absent, the comparator keeps
whatever threshold it powers up with.

qcom,jeita-hard-thresholds:
$ref: /schemas/types.yaml#/definitions/uint32-array
minItems: 2
maxItems: 2
description: |
The pair of raw BAT_THERM ADC codes { cold, hot } outside which charging
stops outright, cold first. These are codes rather than temperatures
because the comparators take codes, and which code a temperature produces
depends on this PMIC's ADC full scale and on the board's pull-up as much
as on the cell - which is also why they are described here and not on the
battery.

qcom,jeita-soft-thresholds:
$ref: /schemas/types.yaml#/definitions/uint32-array
minItems: 2
maxItems: 2
description: |
The pair of raw BAT_THERM ADC codes { cold, hot } inside which the pack
may be charged at full current, in the same units and for the same reason
as qcom,jeita-hard-thresholds. Between a soft and a hard threshold the
charge current is reduced instead of stopped.

qcom,jeita-soft-fcc-microamp:
minItems: 2
maxItems: 2
description: |
Fast-charge current, in microamperes, to be left with in the cool and the
warm soft zone, in that order. The hardware subtracts a fixed offset from
whatever current is programmed, so describing the wanted result rather
than the offset keeps the property meaningful when the current changes.

qcom,thermal-mitigation:
$ref: /schemas/types.yaml#/definitions/uint32-array
minItems: 2
maxItems: 16
description: |
Fast-charge current limit, in microamperes, for each state of the cooling
device the charger registers. The first entry is cooling state 0 and must
be the most permissive; entries must not increase. A thermal zone reduces
the charge current by requesting a higher state, so state 0 is what the
charger falls back to when nothing is throttling it.

'#cooling-cells':
const: 2

required:
- compatible
- reg
Expand Down Expand Up @@ -80,3 +165,37 @@ examples:
monitored-battery = <&battery>;
};
};

- |
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/iio/qcom,spmi-vadc.h>

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

charger@1000 {
compatible = "qcom,pmi632-charger";
reg = <0x1000>;

interrupts = <0x2 0x13 0x4 IRQ_TYPE_EDGE_BOTH>,
<0x2 0x12 0x2 IRQ_TYPE_EDGE_BOTH>,
<0x2 0x16 0x1 IRQ_TYPE_EDGE_RISING>,
<0x2 0x13 0x6 IRQ_TYPE_EDGE_RISING>;
interrupt-names = "usb-plugin", "bat-ov", "wdog-bark", "usbin-icl-change";

io-channels = <&pmi632_adc ADC5_USB_IN_I>,
<&pmi632_adc ADC5_USB_IN_V_16>,
<&pmi632_adc ADC5_VBAT_SNS>,
<&pmi632_adc ADC5_BAT_THERM_100K_PU>,
<&pmi632_adc ADC5_BAT_ID_100K_PU>;
io-channel-names = "usbin_i", "usbin_v", "vbat",
"bat_therm", "bat_id";

monitored-battery = <&battery>;
qcom,batt-id-pullup-ohms = <100000>;
qcom,thermal-mitigation = <2000000 1500000 1000000 500000>;

#cooling-cells = <2>;
};
};
123 changes: 123 additions & 0 deletions arch/arm64/boot/dts/qcom/pmi632.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include <dt-bindings/iio/qcom,spmi-vadc.h>
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/leds/common.h>
#include <dt-bindings/spmi/spmi.h>

/ {
Expand Down Expand Up @@ -50,6 +51,114 @@
status = "disabled";
};

pmi632_charger: charger@1000 {
compatible = "qcom,pmi632-charger";
reg = <0x1000>;

/*
* The charger's interrupt sources, in the order the
* downstream qpnp-smb5 device tree gives them. SMB5
* renumbered the USB peripheral against SMB2 - vashdn
* and revi-change are new, which pushes src-change to
* 6 and icl-change to 7 - so the indices here are not
* the pmi8998 ones they were first copied from.
*/
interrupts = <0x2 0x13 0x4 IRQ_TYPE_EDGE_BOTH>,
<0x2 0x12 0x2 IRQ_TYPE_EDGE_BOTH>,
<0x2 0x16 0x1 IRQ_TYPE_EDGE_RISING>,
<0x2 0x13 0x7 IRQ_TYPE_EDGE_RISING>,
<0x2 0x48 0x4 IRQ_TYPE_EDGE_RISING>,
/* CHGR */
<0x2 0x10 0x0 IRQ_TYPE_EDGE_RISING>,
<0x2 0x10 0x1 IRQ_TYPE_EDGE_RISING>,
<0x2 0x10 0x2 IRQ_TYPE_EDGE_RISING>,
<0x2 0x10 0x3 IRQ_TYPE_EDGE_RISING>,
<0x2 0x10 0x4 IRQ_TYPE_EDGE_RISING>,
<0x2 0x10 0x5 IRQ_TYPE_EDGE_RISING>,
<0x2 0x10 0x6 IRQ_TYPE_EDGE_RISING>,
<0x2 0x10 0x7 IRQ_TYPE_EDGE_RISING>,
/* DCDC */
<0x2 0x11 0x0 IRQ_TYPE_EDGE_RISING>,
<0x2 0x11 0x1 IRQ_TYPE_EDGE_RISING>,
<0x2 0x11 0x2 IRQ_TYPE_EDGE_RISING>,
<0x2 0x11 0x3 IRQ_TYPE_EDGE_BOTH>,
<0x2 0x11 0x4 IRQ_TYPE_EDGE_BOTH>,
<0x2 0x11 0x5 IRQ_TYPE_EDGE_BOTH>,
<0x2 0x11 0x6 IRQ_TYPE_EDGE_RISING>,
<0x2 0x11 0x7 IRQ_TYPE_EDGE_BOTH>,
/* BATIF */
<0x2 0x12 0x0 IRQ_TYPE_EDGE_RISING>,
<0x2 0x12 0x3 IRQ_TYPE_EDGE_BOTH>,
<0x2 0x12 0x4 IRQ_TYPE_EDGE_BOTH>,
<0x2 0x12 0x5 IRQ_TYPE_EDGE_BOTH>,
<0x2 0x12 0x6 IRQ_TYPE_EDGE_BOTH>,
<0x2 0x12 0x7 IRQ_TYPE_EDGE_BOTH>,
/* USB */
<0x2 0x13 0x0 IRQ_TYPE_EDGE_BOTH>,
<0x2 0x13 0x1 IRQ_TYPE_EDGE_BOTH>,
<0x2 0x13 0x2 IRQ_TYPE_EDGE_RISING>,
<0x2 0x13 0x3 IRQ_TYPE_EDGE_BOTH>,
<0x2 0x13 0x5 IRQ_TYPE_EDGE_BOTH>,
<0x2 0x13 0x6 IRQ_TYPE_EDGE_RISING>,
/* MISC */
<0x2 0x16 0x0 IRQ_TYPE_EDGE_RISING>,
<0x2 0x16 0x2 IRQ_TYPE_EDGE_RISING>,
<0x2 0x16 0x3 IRQ_TYPE_EDGE_RISING>,
<0x2 0x16 0x4 IRQ_TYPE_EDGE_BOTH>,
<0x2 0x16 0x5 IRQ_TYPE_EDGE_RISING>,
<0x2 0x16 0x6 IRQ_TYPE_EDGE_RISING>,
<0x2 0x16 0x7 IRQ_TYPE_EDGE_RISING>;
interrupt-names = "usb-plugin",
"bat-ov",
"wdog-bark",
"usbin-icl-change",
"good-ocv",
"chgr-error",
"chg-state-change",
"step-chg-state-change",
"step-chg-soc-update-fail",
"step-chg-soc-update-req",
"fg-fvcal-qualified",
"vph-alarm",
"vph-drop-prechg",
"otg-fail",
"otg-oc-disable-sw",
"otg-oc-hiccup",
"bsm-active",
"high-duty-cycle",
"input-current-limiting",
"concurrent-mode-disable",
"switcher-power-ok",
"bat-temp",
"bat-low",
"bat-therm-or-id-missing",
"bat-terminal-missing",
"buck-oc",
"vph-ov",
"usbin-collapse",
"usbin-vashdn",
"usbin-uv",
"usbin-ov",
"usbin-revi-change",
"usbin-src-change",
"wdog-snarl",
"aicl-fail",
"aicl-done",
"smb-en",
"imp-trigger",
"temp-change",
"temp-change-smb";

io-channels = <&pmi632_adc ADC5_USB_IN_I>,
<&pmi632_adc ADC5_USB_IN_V_16>,
<&pmi632_adc ADC5_VBAT_SNS>,
<&pmi632_adc ADC5_BAT_THERM_100K_PU>;
io-channel-names = "usbin_i", "usbin_v", "vbat",
"bat_therm";

status = "disabled";
};

pmi632_typec: typec@1500 {
compatible = "qcom,pmi632-typec";
reg = <0x1500>;
Expand Down Expand Up @@ -125,6 +234,14 @@
label = "chg_temp";
};

channel@4a {
reg = <ADC5_BAT_THERM_100K_PU>;
qcom,hw-settle-time = <200>;
qcom,pre-scaling = <1 1>;
qcom,ratiometric;
label = "bat_therm";
};

channel@4b {
reg = <ADC5_BAT_ID_100K_PU>;
qcom,hw-settle-time = <200>;
Expand Down Expand Up @@ -205,5 +322,11 @@
reg = <0x5700>;
status = "disabled";
};

pmi632_flash: led-controller@d300 {
compatible = "qcom,pmi632-flash-led", "qcom,spmi-flash-led";
reg = <0xd300>;
status = "disabled";
};
};
};
Loading