[PATCH 01/10] power: supply: Add sysfs entry for system load control
From: Waqar Hameed
Date: Mon Jun 29 2026 - 11:52:28 EST
There are devices that can control the connection from power to system
load. For example, with a field-effect transistor between a battery and
the system load (BATFET). Drivers for these devices are currently
enrolling their own custom `sysfs` property to control this.
In order to unify this, add a new `sysfs` entry for controlling such
switch and corresponding `power_supply_property` with `enum` values. The
obvious states are "on" and "off", i.e. there is a connection or not,
respectively. However, many devices can also enter special modes such as
"low-power", "shipping" or "deep sleep".
Signed-off-by: Waqar Hameed <waqar.hameed@xxxxxxxx>
---
Documentation/ABI/testing/sysfs-class-power | 24 +++++++++++++++++++++
drivers/power/supply/power_supply_sysfs.c | 9 ++++++++
include/linux/power_supply.h | 9 ++++++++
3 files changed, 42 insertions(+)
diff --git a/Documentation/ABI/testing/sysfs-class-power b/Documentation/ABI/testing/sysfs-class-power
index 32697b926cc8c..2287b207311cd 100644
--- a/Documentation/ABI/testing/sysfs-class-power
+++ b/Documentation/ABI/testing/sysfs-class-power
@@ -590,6 +590,30 @@ Description:
Valid values: 0 - 100 (percent)
+What: /sys/class/power_supply/<supply_name>/load_switch
+Date: June 2026
+Contact: linux-pm@xxxxxxxxxxxxxxx
+Description:
+ Devices can control the connection from power to system load.
+ For example, with a field-effect transistor between a battery
+ and the system load (BATFET). This entry controls such switch.
+ The obvious states are "on" and "off", i.e. there is a
+ connection or not, respectively. However, many devices can also
+ enter special modes such as "low-power", "shipping" or "deep
+ sleep". In these modes the switch is usually off and the
+ quiescent current quite low.
+
+ Access: Read, Write
+
+ Valid values:
+
+ ============= ==================================
+ "On" (1) Power is connected to the load.
+ "Off" (2) Power is disconnected to the load.
+ "Standby" (3) Low-power mode.
+ "Ship" (4) Ship mode.
+ ============= ==================================
+
**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 f30a7b9ccd5e9..243d6e57704f6 100644
--- a/drivers/power/supply/power_supply_sysfs.c
+++ b/drivers/power/supply/power_supply_sysfs.c
@@ -148,6 +148,14 @@ static const char * const POWER_SUPPLY_CHARGE_BEHAVIOUR_TEXT[] = {
[POWER_SUPPLY_CHARGE_BEHAVIOUR_FORCE_DISCHARGE] = "force-discharge",
};
+static const char *const POWER_SUPPLY_LOAD_SWITCH_TEXT[] = {
+ [POWER_SUPPLY_LOAD_SWITCH_UNKNOWN] = "Unknown",
+ [POWER_SUPPLY_LOAD_SWITCH_ON] = "On",
+ [POWER_SUPPLY_LOAD_SWITCH_OFF] = "Off",
+ [POWER_SUPPLY_LOAD_SWITCH_STANDBY] = "Standby",
+ [POWER_SUPPLY_LOAD_SWITCH_SHIP] = "Ship",
+};
+
static struct power_supply_attr power_supply_attrs[] __ro_after_init = {
/* Properties of type `int' */
POWER_SUPPLY_ENUM_ATTR(STATUS),
@@ -227,6 +235,7 @@ static struct power_supply_attr power_supply_attrs[] __ro_after_init = {
POWER_SUPPLY_ATTR(MANUFACTURE_DAY),
POWER_SUPPLY_ATTR(INTERNAL_RESISTANCE),
POWER_SUPPLY_ATTR(STATE_OF_HEALTH),
+ POWER_SUPPLY_ENUM_ATTR(LOAD_SWITCH),
/* 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 7a5e4c3242a01..eff5de03fd2ab 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -100,6 +100,14 @@ enum {
POWER_SUPPLY_SCOPE_DEVICE,
};
+enum {
+ POWER_SUPPLY_LOAD_SWITCH_UNKNOWN = 0,
+ POWER_SUPPLY_LOAD_SWITCH_ON,
+ POWER_SUPPLY_LOAD_SWITCH_OFF,
+ POWER_SUPPLY_LOAD_SWITCH_STANDBY,
+ POWER_SUPPLY_LOAD_SWITCH_SHIP,
+};
+
enum power_supply_property {
/* Properties of type `int' */
POWER_SUPPLY_PROP_STATUS = 0,
@@ -178,6 +186,7 @@ enum power_supply_property {
POWER_SUPPLY_PROP_MANUFACTURE_DAY,
POWER_SUPPLY_PROP_INTERNAL_RESISTANCE,
POWER_SUPPLY_PROP_STATE_OF_HEALTH,
+ POWER_SUPPLY_PROP_LOAD_SWITCH,
/* Properties of type `const char *' */
POWER_SUPPLY_PROP_MODEL_NAME,
POWER_SUPPLY_PROP_MANUFACTURER,
--
2.43.0