Skip to content

Commit 1b0b6cc

Browse files
t-8chjwrdegoede
authored andcommitted
power: supply: add charge_behaviour attributes
This a revised version of "[RFC] add standardized attributes for force_discharge and inhibit_charge" [0], incorporating discussion results. The biggest change is the switch from two boolean attributes to a single enum attribute. [0] https://lore.kernel.org/platform-driver-x86/[email protected]/ Signed-off-by: Thomas Weißschuh <[email protected]> Acked-by: Sebastian Reichel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]>
1 parent ee0d44f commit 1b0b6cc

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

Documentation/ABI/testing/sysfs-class-power

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,20 @@ Description:
455455
"Unknown", "Charging", "Discharging",
456456
"Not charging", "Full"
457457

458+
What: /sys/class/power_supply/<supply_name>/charge_behaviour
459+
Date: November 2021
460+
461+
Description:
462+
Represents the charging behaviour.
463+
464+
Access: Read, Write
465+
466+
Valid values:
467+
================ ====================================
468+
auto: Charge normally, respect thresholds
469+
inhibit-charge: Do not charge while AC is attached
470+
force-discharge: Force discharge while AC is attached
471+
458472
What: /sys/class/power_supply/<supply_name>/technology
459473
Date: May 2007
460474

include/linux/power_supply.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ enum power_supply_property {
132132
POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT_MAX,
133133
POWER_SUPPLY_PROP_CHARGE_CONTROL_START_THRESHOLD, /* in percents! */
134134
POWER_SUPPLY_PROP_CHARGE_CONTROL_END_THRESHOLD, /* in percents! */
135+
POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR,
135136
POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT,
136137
POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT,
137138
POWER_SUPPLY_PROP_INPUT_POWER_LIMIT,
@@ -202,6 +203,12 @@ enum power_supply_usb_type {
202203
POWER_SUPPLY_USB_TYPE_APPLE_BRICK_ID, /* Apple Charging Method */
203204
};
204205

206+
enum power_supply_charge_behaviour {
207+
POWER_SUPPLY_CHARGE_BEHAVIOUR_AUTO = 0,
208+
POWER_SUPPLY_CHARGE_BEHAVIOUR_INHIBIT_CHARGE,
209+
POWER_SUPPLY_CHARGE_BEHAVIOUR_FORCE_DISCHARGE,
210+
};
211+
205212
enum power_supply_notifier_events {
206213
PSY_EVENT_PROP_CHANGED,
207214
};

0 commit comments

Comments
 (0)