Linux USB
 help / color / mirror / Atom feed
From: Fenglin Wu via B4 Relay <devnull+fenglin.wu.oss.qualcomm.com@kernel.org>
To: Sebastian Reichel <sre@kernel.org>,
	 Bjorn Andersson <andersson@kernel.org>,
	 Konrad Dybcio <konradybcio@kernel.org>,
	Rob Herring <robh@kernel.org>,
	 Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	 Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	 Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,
	 Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
	 Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Cc: "Subbaraman Narayanamurthy"
	<subbaraman.narayanamurthy@oss.qualcomm.com>,
	"David Collins" <david.collins@oss.qualcomm.com>,
	"György Kurucz" <me@kuruczgy.com>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, kernel@oss.qualcomm.com,
	devicetree@vger.kernel.org, linux-usb@vger.kernel.org,
	"Fenglin Wu" <fenglin.wu@oss.qualcomm.com>
Subject: [PATCH v5 2/9] power: supply: core: Add state_of_health power supply property
Date: Wed, 17 Sep 2025 18:15:15 +0800	[thread overview]
Message-ID: <20250917-qcom_battmgr_update-v5-2-270ade9ffe13@oss.qualcomm.com> (raw)
In-Reply-To: <20250917-qcom_battmgr_update-v5-0-270ade9ffe13@oss.qualcomm.com>

From: Fenglin Wu <fenglin.wu@oss.qualcomm.com>

Add state_of_health power supply property to represent battery
health percentage.

Signed-off-by: Fenglin Wu <fenglin.wu@oss.qualcomm.com>
---
 Documentation/ABI/testing/sysfs-class-power | 21 +++++++++++++++++++++
 drivers/power/supply/power_supply_sysfs.c   |  1 +
 include/linux/power_supply.h                |  1 +
 3 files changed, 23 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-class-power b/Documentation/ABI/testing/sysfs-class-power
index cea1a38f5a8fb754d4e6323967ef6cf2e20a68ce..d9e1ad7646f14892bb7ed55ac72d0de7569f104e 100644
--- a/Documentation/ABI/testing/sysfs-class-power
+++ b/Documentation/ABI/testing/sysfs-class-power
@@ -568,6 +568,27 @@ Description:
 
 		Valid values: Represented in microohms
 
+What:		/sys/class/power_supply/<supply_name>/state_of_health
+Date:		August 2025
+Contact:	linux-arm-msm@vger.kernel.org
+Description:
+		The state_of_health parameter quantifies the overall condition
+		of a battery as a percentage, reflecting its ability to deliver
+		rated performance relative to its original specifications. It is
+		dynamically computed using a combination of learned capacity
+		and impedance-based degradation indicators, both of which evolve
+		over the battery's lifecycle.
+		Note that the exact algorithms are kept secret by most battery
+		vendors and the value from different battery vendors cannot be
+		compared with each other as there is no vendor-agnostic definition
+		of "performance". Also this usually cannot be used for any
+		calculations (i.e. this is not the factor between charge_full and
+		charge_full_design).
+
+		Access: Read
+
+		Valid values: 0 - 100 (percent)
+
 **USB Properties**
 
 What:		/sys/class/power_supply/<supply_name>/input_current_limit
diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c
index cfa8f90a88ebc8fc1c7447198f138e5d2e699e5a..d96a8578308e3af60cc1a352845662aa922c29b3 100644
--- a/drivers/power/supply/power_supply_sysfs.c
+++ b/drivers/power/supply/power_supply_sysfs.c
@@ -221,6 +221,7 @@ static struct power_supply_attr power_supply_attrs[] __ro_after_init = {
 	POWER_SUPPLY_ATTR(MANUFACTURE_MONTH),
 	POWER_SUPPLY_ATTR(MANUFACTURE_DAY),
 	POWER_SUPPLY_ATTR(INTERNAL_RESISTANCE),
+	POWER_SUPPLY_ATTR(STATE_OF_HEALTH),
 	/* Properties of type `const char *' */
 	POWER_SUPPLY_ATTR(MODEL_NAME),
 	POWER_SUPPLY_ATTR(MANUFACTURER),
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 8bc3b7a67eb5693a16db9b7d123e7881711c6bf4..ccb43fe44381965069dc3bd9505d45050b9b1bd8 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -175,6 +175,7 @@ enum power_supply_property {
 	POWER_SUPPLY_PROP_MANUFACTURE_MONTH,
 	POWER_SUPPLY_PROP_MANUFACTURE_DAY,
 	POWER_SUPPLY_PROP_INTERNAL_RESISTANCE,
+	POWER_SUPPLY_PROP_STATE_OF_HEALTH,
 	/* Properties of type `const char *' */
 	POWER_SUPPLY_PROP_MODEL_NAME,
 	POWER_SUPPLY_PROP_MANUFACTURER,

-- 
2.34.1



  parent reply	other threads:[~2025-09-17 10:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-17 10:15 [PATCH v5 0/9] power: supply: Add several features support in qcom-battmgr driver Fenglin Wu via B4 Relay
2025-09-17 10:15 ` [PATCH v5 1/9] power: supply: core: Add resistance power supply property Fenglin Wu via B4 Relay
2025-09-17 10:15 ` Fenglin Wu via B4 Relay [this message]
2025-09-17 10:15 ` [PATCH v5 3/9] power: supply: qcom_battmgr: " Fenglin Wu via B4 Relay
2025-09-17 10:15 ` [PATCH v5 4/9] power: supply: qcom_battmgr: Add state_of_health property Fenglin Wu via B4 Relay
2025-09-17 10:15 ` [PATCH v5 5/9] power: supply: qcom_battmgr: update compats for SM8550 and X1E80100 Fenglin Wu via B4 Relay
2025-09-17 10:15 ` [PATCH v5 6/9] dt-bindings: soc: qcom,pmic-glink: Add charge limit nvmem properties Fenglin Wu via B4 Relay
2025-09-17 10:15 ` [PATCH v5 7/9] power: supply: qcom_battmgr: Add charge control support Fenglin Wu via B4 Relay
2025-09-17 10:15 ` [PATCH v5 8/9] arm64: dts: qcom: x1e80100-crd: Add charge limit nvmem Fenglin Wu via B4 Relay
2025-09-17 10:15 ` [PATCH v5 9/9] power: supply: qcom_battmgr: handle charging state change notifications Fenglin Wu via B4 Relay
2025-09-17 11:14   ` Konrad Dybcio
2025-09-18  2:01     ` Fenglin Wu
2025-09-18 23:17       ` Sebastian Reichel
2025-09-17 23:03 ` (subset) [PATCH v5 0/9] power: supply: Add several features support in qcom-battmgr driver Sebastian Reichel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250917-qcom_battmgr_update-v5-2-270ade9ffe13@oss.qualcomm.com \
    --to=devnull+fenglin.wu.oss.qualcomm.com@kernel.org \
    --cc=andersson@kernel.org \
    --cc=bryan.odonoghue@linaro.org \
    --cc=conor+dt@kernel.org \
    --cc=david.collins@oss.qualcomm.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=fenglin.wu@oss.qualcomm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=kernel@oss.qualcomm.com \
    --cc=konrad.dybcio@oss.qualcomm.com \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=me@kuruczgy.com \
    --cc=robh@kernel.org \
    --cc=sre@kernel.org \
    --cc=subbaraman.narayanamurthy@oss.qualcomm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox