Skip to contentSkip to conversation

thinkpad_acpi: Add support for battery thresholds

PATCH Superseded Ognjen Galic 1 participant 1 message Dec 23, 2017

Subsystems (2)

v10 of 13 Superseded Latest is v13 →

lore
Share & tools
lore
#0 lore raw

PATCH v10 3/4 thinkpad_acpi: Add support for battery thresholds

thinkpad_acpi registers two new attributes for each battery:

1) Charge start threshold /sys/class/power_supply/BATN/charge_start_threshold

Valid values are [0, 99]. A value of 0 turns off the start threshold wear control.

2) Charge stop threshold /sys/class/power_supply/BATN/charge_stop_threshold

Valid values are [1, 100]. A value of 100 turns off the stop threshold wear control. This must be configured first.

This patch depends on the following patches:

"battery: Add the battery hooking API"
---

v2:
* Re-write the patch to make the changes in
battery.c generic as suggested by Rafael

v3:
* Fixed a bug where you could not set the stop threshold to 100% when the start threshold is 0%
* Fixed the "Not Charging" quirk to match Lenovo's BIOS Firmware specification

v4:
* Fixed a bug where you could not set the start
threshold to >stop if stop was 100%

v5:
* Migrated from symbol_get to native linking,
to fix module dependencies
* Fixed a bug where unloading the module would
cause a BUG inside battery
* Fixed a bug where you could unload battery
before unloading thinkpad_acpi

v6:
* Fixed all the style and naming issues pointed
out by Andy Shevchenko

v7:
* No changes in this patch in v7

v8:
* No changes in this patch in v8

v9:
* Use DEVICE_ATTR_RW instead of DEVICE_ATTR
* Use bitopts.h instead of raw operators
* Remove redundant whitespaces
* Remove redundant comments
* Move the power_supply changes to separate patch
* Fix other various styling issues pointed out by
Andy Shevchenko

v10:
* Fix a pasting error from v6 that prevents the setting of the start threshold with EINVAL

---
 drivers/platform/x86/Kconfig         |   1 +
 drivers/platform/x86/thinkpad_acpi.c | 440 ++++++++++++++++++++++++++++++++++-
 2 files changed, 440 insertions(+), 1 deletion(-)
drivers/platform/x86/Kconfig +1 -0
index 2c745e8..d705c62 100644
@@ -399,6 +399,7 @@ config SURFACE3_WMI
 config THINKPAD_ACPI
 	tristate "ThinkPad ACPI Laptop Extras"
 	depends on ACPI
+	depends on ACPI_BATTERY
 	depends on INPUT
 	depends on RFKILL || RFKILL = n
 	depends on ACPI_VIDEO || ACPI_VIDEO = n
drivers/platform/x86/thinkpad_acpi.c +439 -1

481 lines not on this page · raw message

Signature · 1 line
2.7.4