power: supply: core: add POWER_SUPPLY_HEALTH_NO_BATTERY
authorLuca Ceresoli <luca@lucaceresoli.net>
Mon, 8 Nov 2021 16:27:05 +0000 (17:27 +0100)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Tue, 16 Nov 2021 15:10:07 +0000 (16:10 +0100)
Some chargers can keep the system powered from the mains even when no
battery is present. It this case none of the currently defined health
statuses applies. Add a new status to report that no battery is present.

Suggested-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Documentation/ABI/testing/sysfs-class-power
drivers/power/supply/power_supply_sysfs.c
include/linux/power_supply.h

index f7904ef..a0b2a42 100644 (file)
@@ -413,7 +413,7 @@ Description:
                              "Over voltage", "Unspecified failure", "Cold",
                              "Watchdog timer expire", "Safety timer expire",
                              "Over current", "Calibration required", "Warm",
-                             "Cool", "Hot"
+                             "Cool", "Hot", "No battery"
 
 What:          /sys/class/power_supply/<supply_name>/precharge_current
 Date:          June 2017
index c3d7cbc..6ac88fb 100644 (file)
@@ -106,6 +106,7 @@ static const char * const POWER_SUPPLY_HEALTH_TEXT[] = {
        [POWER_SUPPLY_HEALTH_WARM]                  = "Warm",
        [POWER_SUPPLY_HEALTH_COOL]                  = "Cool",
        [POWER_SUPPLY_HEALTH_HOT]                   = "Hot",
+       [POWER_SUPPLY_HEALTH_NO_BATTERY]            = "No battery",
 };
 
 static const char * const POWER_SUPPLY_TECHNOLOGY_TEXT[] = {
index 9ca1f12..2d1318f 100644 (file)
@@ -66,6 +66,7 @@ enum {
        POWER_SUPPLY_HEALTH_WARM,
        POWER_SUPPLY_HEALTH_COOL,
        POWER_SUPPLY_HEALTH_HOT,
+       POWER_SUPPLY_HEALTH_NO_BATTERY,
 };
 
 enum {