Skip to contentSkip to conversation

power: supply: cpcap-charger: Limit voltage to 4.2V for battery

PATCH In review Tony Lindgren 2 participants 3 messages Oct 16, 2019 – Oct 21, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 power: supply: cpcap-charger: Limit voltage to 4.2V for battery

There have been some cases of droid4 battery bulging that seem to be related to being left connected to the charger for several weeks.

It is suspected that the 4.35V charge voltage configured for the battery is too much in the long run, so lets limit the charge voltage to 4.2V. It could also be that the batteries are just getting old.

We don't really want to just change the charge voltage to 4.2V as Android may have charged the battery to 4.35V as pointed out by Pavel Machek.

To add checks for battery voltage, the driver needs to understand the voltage it's charging at, and also needs to better understand it's charger state. Right now it only understands connect and disconnect, while now we need to know also a connected state but not charging.

So let's add better charger state handling with help of chrgcurr2 interrupt for detecting charge full and retry, and add a check for battery voltage before we start charging. And then we finally can lower the charge voltage to 4.2V.

Note that we've been using the same register values as the Android distros on droid4, so it is suspected that the same problem also exists in Android.

---

If this looks OK, I would appreciate an immutable branch against v5.4-rc1 with just this patch in it for merge conflicts with v5.5 dts changes.

Changes since v1:

- Fix up typos noted by Pavel for 3.51V while it sould be 4.35V

- Updated against v5.4-rc series instead of v5.3 as we do not want to apply this for earlier kernels automatically except maybe later on

---
 .../bindings/power/supply/cpcap-charger.txt   |   9 +-
 .../arm/boot/dts/motorola-cpcap-mapphone.dtsi |   6 +-
 drivers/power/supply/cpcap-charger.c          | 132 +++++++++++++++++-
 3 files changed, 140 insertions(+), 7 deletions(-)
Documentation/devicetree/bindings/power/supply/cpcap-charger.txt +6 -3
@@ -5,7 +5,8 @@ Required properties:
 - 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", "chrgcurr1", "vbusvld", "battdetb"
+		   "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"
@@ -21,11 +22,13 @@ 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 20 0 &cpcap 19 0 &cpcap 54 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", "chrgcurr1", "vbusvld", "battdetb";
+		"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
arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi +4 -2
@@ -43,11 +43,13 @@
 			compatible = "motorola,mapphone-cpcap-charger";
 			interrupts-extended = <
 				&cpcap 13 0 &cpcap 12 0 &cpcap 29 0 &cpcap 28 0
-				&cpcap 22 0 &cpcap 20 0 &cpcap 19 0 &cpcap 54 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", "chrgcurr1", "vbusvld", "battdetb";
+				"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
drivers/power/supply/cpcap-charger.c +130 -2

197 lines not on this page · raw message

Signature · 1 line
2.23.0
#1 lore raw

Hi Tony,

Quoted 23 lines · Tony Lindgren

There have been some cases of droid4 battery bulging that seem to be related to being left connected to the charger for several weeks.

It is suspected that the 4.35V charge voltage configured for the battery is too much in the long run, so lets limit the charge voltage to 4.2V. It could also be that the batteries are just getting old.

We don't really want to just change the charge voltage to 4.2V as Android may have charged the battery to 4.35V as pointed out by Pavel Machek.

To add checks for battery voltage, the driver needs to understand the voltage it's charging at, and also needs to better understand it's charger state. Right now it only understands connect and disconnect, while now we need to know also a connected state but not charging.

So let's add better charger state handling with help of chrgcurr2 interrupt for detecting charge full and retry, and add a check for battery voltage before we start charging. And then we finally can lower the charge voltage to 4.2V.

Note that we've been using the same register values as the Android distros on droid4, so it is suspected that the same problem also exists in Android.

Quoted 8 lines

---

If this looks OK, I would appreciate an immutable branch against v5.4-rc1 with just this patch in it for merge conflicts with v5.5 dts changes.

Thanks, I queued this to power-supply's for-next branch using the following signed immutable branch:

https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git/tag/?h=psy-cpcap-charge-volt-limit-signed

-- Sebastian

#2 lore raw
Quoted 32 lines · Sebastian Reichel

Hi Tony,

Quoted 29 lines · Tony Lindgren

There have been some cases of droid4 battery bulging that seem to be related to being left connected to the charger for several weeks.

It is suspected that the 4.35V charge voltage configured for the battery is too much in the long run, so lets limit the charge voltage to 4.2V. It could also be that the batteries are just getting old.

We don't really want to just change the charge voltage to 4.2V as Android may have charged the battery to 4.35V as pointed out by Pavel Machek.

To add checks for battery voltage, the driver needs to understand the voltage it's charging at, and also needs to better understand it's charger state. Right now it only understands connect and disconnect, while now we need to know also a connected state but not charging.

So let's add better charger state handling with help of chrgcurr2 interrupt for detecting charge full and retry, and add a check for battery voltage before we start charging. And then we finally can lower the charge voltage to 4.2V.

Note that we've been using the same register values as the Android distros on droid4, so it is suspected that the same problem also exists in Android.

---

Quoted 7 lines
Quoted 2 lines

If this looks OK, I would appreciate an immutable branch against v5.4-rc1 with just this patch in it for merge conflicts with v5.5 dts changes.

Thanks, I queued this to power-supply's for-next branch using the following signed immutable branch:

https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git/tag/?h=psy-cpcap-charge-volt-limit-signed

Thanks and sorry about that sparse issue it caused.

Regards,

Tony