From 731a5eb141f0f579b74a9b0fe23b4af987c77a0b Mon Sep 17 00:00:00 2001 From: Werner Sembach Date: Wed, 27 Apr 2022 17:40:53 +0200 Subject: [PATCH] ACPI: battery: Make "not-charging" the default on no charging or full info When the battery is neither charging or discharging and is not full, "not-charging" is a useful status description for the case in general. Currently this state is set as "unknown" by default, expect when this is explicitly replaced with "not-charging" on a per device or per vendor basis. A lot of devices have this state without a BIOS specification available explicitly describing it. e.g. some current Clevo barebones have a BIOS setting to stop charging at a user defined battery level. Signed-off-by: Werner Sembach Signed-off-by: Rafael J. Wysocki Patchset: surface-battery --- drivers/acpi/battery.c | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index dc208f5f5a1f..306513fec1e1 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c @@ -52,7 +52,6 @@ static bool battery_driver_registered; static int battery_bix_broken_package; static int battery_notification_delay_ms; static int battery_ac_is_broken; -static int battery_quirk_notcharging; static unsigned int cache_time = 1000; module_param(cache_time, uint, 0644); MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); @@ -216,10 +215,8 @@ static int acpi_battery_get_property(struct power_supply *psy, val->intval = POWER_SUPPLY_STATUS_CHARGING; else if (acpi_battery_is_charged(battery)) val->intval = POWER_SUPPLY_STATUS_FULL; - else if (battery_quirk_notcharging) - val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING; else - val->intval = POWER_SUPPLY_STATUS_UNKNOWN; + val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING; break; case POWER_SUPPLY_PROP_PRESENT: val->intval = acpi_battery_present(battery); @@ -1105,12 +1102,6 @@ battery_ac_is_broken_quirk(const struct dmi_system_id *d) return 0; } -static int __init battery_quirk_not_charging(const struct dmi_system_id *d) -{ - battery_quirk_notcharging = 1; - return 0; -} - static const struct dmi_system_id bat_dmi_table[] __initconst = { { /* NEC LZ750/LS */ @@ -1139,19 +1130,6 @@ static const struct dmi_system_id bat_dmi_table[] __initconst = { DMI_MATCH(DMI_BIOS_DATE, "08/22/2014"), }, }, - { - /* - * On Lenovo ThinkPads the BIOS specification defines - * a state when the bits for charging and discharging - * are both set to 0. That state is "Not Charging". - */ - .callback = battery_quirk_not_charging, - .ident = "Lenovo ThinkPad", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), - DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad"), - }, - }, { /* Microsoft Surface Go 3 */ .callback = battery_notification_delay_quirk, -- 2.37.2