[ibm-acpi-devel] [PATCH v13 4/4] battery: Add the ThinkPad "Not Charging" quirk

2018-02-07 Thread Ognjen Galic
The EC/ACPI firmware on Lenovo ThinkPads used to report a status of "Unknown" when the battery is between the charge start and charge stop thresholds. On Windows, it reports "Not Charging" so the quirk has been added to also report correctly. Now the "status" attribute returns "Not Charging" when

[ibm-acpi-devel] [PATCH v13 2/4] pm: add to_power_supply macro to the API

2018-02-07 Thread Ognjen Galic
This patch adds the to_power_supply macro to upcast a device to a power_supply struct. This is needed because the same piece of code using container_of is used in various other places, so we abstract away such low-level operations via a macro. Suggested-by: Andy Shevchenko Reviewed-by: Andy Shev

[ibm-acpi-devel] [PATCH v13 3/4] thinkpad_acpi: Add support for battery thresholds

2018-02-07 Thread Ognjen Galic
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 sto

[ibm-acpi-devel] [PATCH v13 1/4] battery: Add the battery hooking API

2018-02-07 Thread Ognjen Galic
This is a patch that implements a generic hooking API for the generic ACPI battery driver. With this new generic API, drivers can expose platform specific behaviour via sysfs attributes in /sys/class/power_supply/BATn/ in a generic way. A perfect example of the need for this API are Lenovo ThinkP

Re: [ibm-acpi-devel] [PATCH v12 1/4] battery: Add the battery hooking API

2018-02-07 Thread Rafael J. Wysocki
On Sun, Feb 4, 2018 at 10:11 AM, Ognjen Galić wrote: > On Sun, Feb 04, 2018 at 09:52:33AM +0100, Rafael J. Wysocki wrote: >> On Wednesday, January 3, 2018 12:58:47 PM CET Ognjen Galic wrote: >> > This is a patch that implements a generic hooking API for the >> > generic ACPI battery driver. >> > >