Message ID | 20220427154053.499203-1-wse@tuxedocomputers.com |
---|---|
State | Accepted |
Commit | 185d20694a8aceb4eda9fc1314cbaad0df0aab07 |
Headers | show |
Series | acpi/battery: Make "not-charging" the default on no charging or full info | expand |
On Wed, Apr 27, 2022 at 5:41 PM Werner Sembach <wse@tuxedocomputers.com> wrote: > > 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 <wse@tuxedocomputers.com> > --- > 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, > -- Applied as 5.19 material, thanks!
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,
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 <wse@tuxedocomputers.com> --- drivers/acpi/battery.c | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-)