Skip to contentSkip to conversation

power: supply: qcom_battmgr: Recognize "LiP" as lithium-polymer

PATCH Superseded Val Packett 2 participants 4 messages Jan 17 – Jan 20

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 power: supply: qcom_battmgr: Recognize "LiP" as lithium-polymer

On the Dell Latitude 7455, the firmware uses "LiP" with a lowercase 'i' for the battery chemistry type, but only all-uppercase "LIP" was being recognized. Add the CamelCase variant to the check to fix the "Unknown battery technology" warning.

Fixes 202ac22b8e2e ("power: supply: qcom_battmgr: Add lithium-polymer entry")
---
 drivers/power/supply/qcom_battmgr.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/power/supply/qcom_battmgr.c +2 -1
index c8028606bba0..80e701c66434 100644
@@ -1240,7 +1240,8 @@ static unsigned int qcom_battmgr_sc8280xp_parse_technology(const char *chemistry
 	if ((!strncmp(chemistry, "LIO", BATTMGR_CHEMISTRY_LEN)) ||
 	    (!strncmp(chemistry, "OOI", BATTMGR_CHEMISTRY_LEN)))
 		return POWER_SUPPLY_TECHNOLOGY_LION;
-	if (!strncmp(chemistry, "LIP", BATTMGR_CHEMISTRY_LEN))
+	if (!strncmp(chemistry, "LIP", BATTMGR_CHEMISTRY_LEN) ||
+	    (!strncmp(chemistry, "LiP", BATTMGR_CHEMISTRY_LEN)))
 		return POWER_SUPPLY_TECHNOLOGY_LIPO;
 
 	pr_err("Unknown battery technology '%s'\n", chemistry);
Signature · 1 line
2.51.2
#1 lore raw
Quoted 16 lines · Val Packett

On the Dell Latitude 7455, the firmware uses "LiP" with a lowercase 'i' for the battery chemistry type, but only all-uppercase "LIP" was being recognized. Add the CamelCase variant to the check to fix the "Unknown battery technology" warning.

Fixes 202ac22b8e2e ("power: supply: qcom_battmgr: Add lithium-polymer entry")
---
 drivers/power/supply/qcom_battmgr.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/power/supply/qcom_battmgr.c +0 -0
index c8028606bba0..80e701c66434 100644

drivers/power/supply/qcom_battmgr.c static unsigned int qcom_battmgr_sc8280xp_parse_technology(const char *chemistry · line 1244

Quoted 6 lines
drivers/power/supply/qcom_battmgr.c +2 -1
@@ -1240,7 +1240,8 @@ static unsigned int qcom_battmgr_sc8280xp_parse_technology(const char *chemistry
 	if ((!strncmp(chemistry, "LIO", BATTMGR_CHEMISTRY_LEN)) ||
 	    (!strncmp(chemistry, "OOI", BATTMGR_CHEMISTRY_LEN)))
 		return POWER_SUPPLY_TECHNOLOGY_LION;
-	if (!strncmp(chemistry, "LIP", BATTMGR_CHEMISTRY_LEN))
+	if (!strncmp(chemistry, "LIP", BATTMGR_CHEMISTRY_LEN) ||
+	    (!strncmp(chemistry, "LiP", BATTMGR_CHEMISTRY_LEN)))

Why do you have extra brackets around the second strncmp?

Quoted 6 lines
drivers/power/supply/qcom_battmgr.c +0 -0
 		return POWER_SUPPLY_TECHNOLOGY_LIPO;
 
 	pr_err("Unknown battery technology '%s'\n", chemistry);
Signature · 1 line
2.51.2
Signature · 2 lines
With best wishes
Dmitry
#2 lore raw
Quoted 12 lines · Dmitry Baryshkov
Quoted 11 lines · Val Packett

On the Dell Latitude 7455, the firmware uses "LiP" with a lowercase 'i' for the battery chemistry type, but only all-uppercase "LIP" was being recognized. Add the CamelCase variant to the check to fix the "Unknown battery technology" warning.

Fixes 202ac22b8e2e ("power: supply: qcom_battmgr: Add lithium-polymer entry")
---
  drivers/power/supply/qcom_battmgr.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 12 lines

drivers/power/supply/qcom_battmgr.c static unsigned int qcom_battmgr_sc8280xp_parse_technology(const char *chemistry · line 1244

Quoted 11 lines
drivers/power/supply/qcom_battmgr.c +2 -1
index c8028606bba0..80e701c66434 100644
@@ -1240,7 +1240,8 @@ static unsigned int qcom_battmgr_sc8280xp_parse_technology(const char *chemistry
  	if ((!strncmp(chemistry, "LIO", BATTMGR_CHEMISTRY_LEN)) ||
  	    (!strncmp(chemistry, "OOI", BATTMGR_CHEMISTRY_LEN)))
  		return POWER_SUPPLY_TECHNOLOGY_LION;
-	if (!strncmp(chemistry, "LIP", BATTMGR_CHEMISTRY_LEN))
+	if (!strncmp(chemistry, "LIP", BATTMGR_CHEMISTRY_LEN) ||
+	    (!strncmp(chemistry, "LiP", BATTMGR_CHEMISTRY_LEN)))

Why do you have extra brackets around the second strncmp?

Copy-pasted from the line above (the "OOI" one) :) Didn't see that the first one in this expression doesn't have them.

Feel free to edit this when applying

~val

#3 lore raw
Quoted 27 lines · Val Packett
Quoted 12 lines · Dmitry Baryshkov
Quoted 11 lines · Val Packett

On the Dell Latitude 7455, the firmware uses "LiP" with a lowercase 'i' for the battery chemistry type, but only all-uppercase "LIP" was being recognized. Add the CamelCase variant to the check to fix the "Unknown battery technology" warning.

Fixes 202ac22b8e2e ("power: supply: qcom_battmgr: Add lithium-polymer entry")
---
  drivers/power/supply/qcom_battmgr.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 12 lines

drivers/power/supply/qcom_battmgr.c static unsigned int qcom_battmgr_sc8280xp_parse_technology(const char *chemistry · line 1244

Quoted 11 lines
drivers/power/supply/qcom_battmgr.c +2 -1
index c8028606bba0..80e701c66434 100644
@@ -1240,7 +1240,8 @@ static unsigned int qcom_battmgr_sc8280xp_parse_technology(const char *chemistry
  	if ((!strncmp(chemistry, "LIO", BATTMGR_CHEMISTRY_LEN)) ||
  	    (!strncmp(chemistry, "OOI", BATTMGR_CHEMISTRY_LEN)))
  		return POWER_SUPPLY_TECHNOLOGY_LION;
-	if (!strncmp(chemistry, "LIP", BATTMGR_CHEMISTRY_LEN))
+	if (!strncmp(chemistry, "LIP", BATTMGR_CHEMISTRY_LEN) ||
+	    (!strncmp(chemistry, "LiP", BATTMGR_CHEMISTRY_LEN)))

Why do you have extra brackets around the second strncmp?

Quoted 4 lines

Copy-pasted from the line above (the "OOI" one) :) Didn't see that the first one in this expression doesn't have them.

Feel free to edit this when applying

It depends on Sebastian, but I'd kindly suggest sending v2.

Signature · 2 lines
With best wishes
Dmitry