thinkad_acpi: Support the battery wear control
Subsystems (3)
PATCH 1/1 thinkad_acpi: Support the battery wear control
Add support for the ACPI batteries on newer thinkpad models (>Sandy Bridge) that support the setting of start and stop thresholds.
The actual interface to the driver is a extension for the existing ACPI battery driver. This was done so that users can write transparently to the interface of the ACPI battery driver and dont have to use some private interface (for ex. /sys/devices/platform/thinkpad_acpi/).
Two new interfaces are created:
/sys/class/power_supply/BAT{0,1}/charge_start_threshold /sys/class/power_supply/BAT{0,1}/charge_stop_threshold
The ACPI battery driver won't expose the interface unless DMI says that the machine is a Lenovo ThinkPad. This was done so that distributions that distribute thinkpad_acpi don't expose the API on non-ThinkPad laptops.
--- Documentation/laptops/thinkpad-acpi.txt | 16 ++ drivers/acpi/battery.c | 227 +++++++++++++++++++ drivers/platform/x86/Kconfig | 11 + drivers/platform/x86/thinkpad_acpi.c | 376 ++++++++++++++++++++++++++++++++ include/linux/thinkpad_acpi.h | 16 ++ 5 files changed, 646 insertions(+)
Documentation/laptops/thinkpad-acpi.txt +16 -0
@@ -46,6 +46,7 @@ detailed description): - Fan control and monitoring: fan speed, fan enable/disable - WAN enable and disable - UWB enable and disable + - Battery Wear Control (BWC) A compatibility table by model and feature is maintained on the web site, http://ibm-acpi.sf.net/. I appreciate any success or failure
@@ -1376,6 +1377,21 @@ For more details about which buttons will appear depending on the mode, please review the laptop's user guide: http://www.lenovo.com/shop/americas/content/user_guides/x1carbon_2_ug_en.pdf +Battey Wear Control (BWC) +------------------------- + +The driver supports control for the embedded controller ACPI battery configuration. +This means that you can set start and stop charge thresholds for batteries in +ThinkPads that have a processor newer than Sandy Bridge. + +The actual sysfs interface is an extension of the standard ACPI battery interface. +The interface is usually in: + +Start thresholds: /sys/class/power_supply/BATN/charge_start_threshold +Stop threshold: /sys/class/power_supply/BATN/charge_stop_threshold + +These attributes support reading and writing. + Multiple Commands, Module Parameters ------------------------------------
drivers/acpi/battery.c +227 -0
269 lines not on this page · raw message
drivers/platform/x86/Kconfig +11 -0
@@ -532,6 +532,17 @@ config THINKPAD_ACPI_HOTKEY_POLL If you are not sure, say Y here. The driver enables polling only if it is strictly necessary to do so. +config THINKPAD_ACPI_BWC + bool "Support for the ThinkPad Battery Wear Control (BWC)" + depends on THINKPAD_ACPI + depends on ACPI_BATTERY + default y + ---help--- + Most ThinkPad models have support for the wear leveling system + designed by Lenovo. This system enables battery recalibration + and setting of the start and stop charge thresholds. This add + attributes under /sys/class/power_supply/BAT*. + config SENSORS_HDAPS tristate "Thinkpad Hard Drive Active Protection System (hdaps)" depends on INPUT
drivers/platform/x86/thinkpad_acpi.c +376 -0
394 lines not on this page · raw message
include/linux/thinkpad_acpi.h +16 -0
@@ -11,6 +11,22 @@ enum { TPACPI_LED_MAX, }; +#ifdef CONFIG_THINKPAD_ACPI_BWC + +enum { +TPACPI_BATTERY_ANY =0 , +TPACPI_BATTERY_PRIMARY =1 , +TPACPI_BATTERY_SECONDARY =2 +}; + +int tpacpi_battery_get_functionality (void ); +int tpacpi_get_start_threshold (int battery,int * res); +int tpacpi_get_stop_threshold (int battery,int * res); +int tpacpi_set_start_threshold (int battery,int value); +int tpacpi_set_stop_threshold (int battery,int value); + +#endif +int tpacpi_led_set (int whichled,bool on);#endif
Signature · 1 line
2.7.4