0009-surface-battery.patch 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. From 731a5eb141f0f579b74a9b0fe23b4af987c77a0b Mon Sep 17 00:00:00 2001
  2. From: Werner Sembach <wse@tuxedocomputers.com>
  3. Date: Wed, 27 Apr 2022 17:40:53 +0200
  4. Subject: [PATCH] ACPI: battery: Make "not-charging" the default on no charging
  5. or full info
  6. When the battery is neither charging or discharging and is not full,
  7. "not-charging" is a useful status description for the case in general.
  8. Currently this state is set as "unknown" by default, expect when this is
  9. explicitly replaced with "not-charging" on a per device or per vendor
  10. basis.
  11. A lot of devices have this state without a BIOS specification available
  12. explicitly describing it. e.g. some current Clevo barebones have a BIOS
  13. setting to stop charging at a user defined battery level.
  14. Signed-off-by: Werner Sembach <wse@tuxedocomputers.com>
  15. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  16. Patchset: surface-battery
  17. ---
  18. drivers/acpi/battery.c | 24 +-----------------------
  19. 1 file changed, 1 insertion(+), 23 deletions(-)
  20. diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
  21. index dc208f5f5a1f..306513fec1e1 100644
  22. --- a/drivers/acpi/battery.c
  23. +++ b/drivers/acpi/battery.c
  24. @@ -52,7 +52,6 @@ static bool battery_driver_registered;
  25. static int battery_bix_broken_package;
  26. static int battery_notification_delay_ms;
  27. static int battery_ac_is_broken;
  28. -static int battery_quirk_notcharging;
  29. static unsigned int cache_time = 1000;
  30. module_param(cache_time, uint, 0644);
  31. MODULE_PARM_DESC(cache_time, "cache time in milliseconds");
  32. @@ -216,10 +215,8 @@ static int acpi_battery_get_property(struct power_supply *psy,
  33. val->intval = POWER_SUPPLY_STATUS_CHARGING;
  34. else if (acpi_battery_is_charged(battery))
  35. val->intval = POWER_SUPPLY_STATUS_FULL;
  36. - else if (battery_quirk_notcharging)
  37. - val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING;
  38. else
  39. - val->intval = POWER_SUPPLY_STATUS_UNKNOWN;
  40. + val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING;
  41. break;
  42. case POWER_SUPPLY_PROP_PRESENT:
  43. val->intval = acpi_battery_present(battery);
  44. @@ -1105,12 +1102,6 @@ battery_ac_is_broken_quirk(const struct dmi_system_id *d)
  45. return 0;
  46. }
  47. -static int __init battery_quirk_not_charging(const struct dmi_system_id *d)
  48. -{
  49. - battery_quirk_notcharging = 1;
  50. - return 0;
  51. -}
  52. -
  53. static const struct dmi_system_id bat_dmi_table[] __initconst = {
  54. {
  55. /* NEC LZ750/LS */
  56. @@ -1139,19 +1130,6 @@ static const struct dmi_system_id bat_dmi_table[] __initconst = {
  57. DMI_MATCH(DMI_BIOS_DATE, "08/22/2014"),
  58. },
  59. },
  60. - {
  61. - /*
  62. - * On Lenovo ThinkPads the BIOS specification defines
  63. - * a state when the bits for charging and discharging
  64. - * are both set to 0. That state is "Not Charging".
  65. - */
  66. - .callback = battery_quirk_not_charging,
  67. - .ident = "Lenovo ThinkPad",
  68. - .matches = {
  69. - DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
  70. - DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad"),
  71. - },
  72. - },
  73. {
  74. /* Microsoft Surface Go 3 */
  75. .callback = battery_notification_delay_quirk,
  76. --
  77. 2.37.2