linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 6.16-6.6] power: supply: qcom_battmgr: Add lithium-polymer entry
       [not found] <20250805130945.471732-1-sashal@kernel.org>
@ 2025-08-05 13:09 ` Sasha Levin
  0 siblings, 0 replies; only message in thread
From: Sasha Levin @ 2025-08-05 13:09 UTC (permalink / raw)
  To: patches, stable
  Cc: Abel Vesa, Dmitry Baryshkov, Sebastian Reichel, Sasha Levin, sre,
	linux-arm-msm, linux-pm

From: Abel Vesa <abel.vesa@linaro.org>

[ Upstream commit 202ac22b8e2e015e6c196fd8113f3d2a62dd1afc ]

On some Dell XPS 13 (9345) variants, the battery used is lithium-polymer
based. Currently, this is reported as unknown technology due to the entry
missing.

[ 4083.135325] Unknown battery technology 'LIP'

Add another check for lithium-polymer in the technology parsing callback
and return that instead of unknown.

Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20250523-psy-qcom-battmgr-add-lipo-entry-v1-1-938c20a43a25@linaro.org
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---

LLM Generated explanations, may be completely bogus:

Based on my analysis, here is my determination:

**Backport Status: YES**

This commit should be backported to stable kernel trees for the
following reasons:

1. **Fixes a real user-visible bug**: The commit addresses a specific
   bug where lithium-polymer batteries are incorrectly reported as
   "Unknown battery technology" with the error message `Unknown battery
   technology 'LIP'`. This affects real hardware (Dell XPS 13 9345
   variants) and causes incorrect battery technology reporting to
   userspace.

2. **Small and contained fix**: The change is minimal - it adds just 2
   lines of code:
  ```c
  if (!strncmp(chemistry, "LIP", BATTMGR_CHEMISTRY_LEN))
  return POWER_SUPPLY_TECHNOLOGY_LIPO;
  ```
  This is well within the 100-line limit for stable patches.

3. **Obviously correct**: The fix is straightforward and follows the
   existing pattern in the code. It simply adds recognition for "LIP"
   chemistry strings, similar to how "LIO" is already handled for
   lithium-ion batteries. The `POWER_SUPPLY_TECHNOLOGY_LIPO` constant
   already exists in the kernel's power supply framework.

4. **No architectural changes or new features**: This is purely a bug
   fix that enables proper recognition of an existing battery technology
   type. It doesn't introduce new functionality or change any APIs.

5. **Low regression risk**: The change only affects systems that report
   "LIP" battery chemistry. Systems with other battery chemistries
   remain unaffected. The fix follows the exact same pattern as the
   existing lithium-ion handling.

6. **Affects supported hardware**: The qcom_battmgr driver has been in
   the kernel since v6.3, and this fix is needed for proper battery
   reporting on Dell XPS 13 9345 devices using Qualcomm platforms with
   lithium-polymer batteries.

7. **Meets stable kernel rules**: According to
   Documentation/process/stable-kernel-rules.rst, this qualifies as it
   "fixes a real bug that bothers people" - specifically incorrect
   battery technology reporting that could affect power management
   decisions and user-facing battery information.

The commit is an ideal candidate for stable backporting as it fixes a
clear bug with minimal code changes and virtually no risk of regression.

 drivers/power/supply/qcom_battmgr.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/power/supply/qcom_battmgr.c b/drivers/power/supply/qcom_battmgr.c
index fe27676fbc7c..2d50830610e9 100644
--- a/drivers/power/supply/qcom_battmgr.c
+++ b/drivers/power/supply/qcom_battmgr.c
@@ -981,6 +981,8 @@ static unsigned int qcom_battmgr_sc8280xp_parse_technology(const char *chemistry
 {
 	if (!strncmp(chemistry, "LIO", BATTMGR_CHEMISTRY_LEN))
 		return POWER_SUPPLY_TECHNOLOGY_LION;
+	if (!strncmp(chemistry, "LIP", BATTMGR_CHEMISTRY_LEN))
+		return POWER_SUPPLY_TECHNOLOGY_LIPO;
 
 	pr_err("Unknown battery technology '%s'\n", chemistry);
 	return POWER_SUPPLY_TECHNOLOGY_UNKNOWN;
-- 
2.39.5


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2025-08-05 13:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20250805130945.471732-1-sashal@kernel.org>
2025-08-05 13:09 ` [PATCH AUTOSEL 6.16-6.6] power: supply: qcom_battmgr: Add lithium-polymer entry Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).