From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Rafael J. Wysocki" Subject: Re: [PATCH v13 1/4] battery: Add the battery hooking API Date: Thu, 8 Feb 2018 16:18:55 +0100 Message-ID: References: <20180207145813.icmv6rwemyejhxbk@thinkpad> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Return-path: Received: from mail-ot0-f195.google.com ([74.125.82.195]:47015 "EHLO mail-ot0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750847AbeBHPS4 (ORCPT ); Thu, 8 Feb 2018 10:18:56 -0500 In-Reply-To: <20180207145813.icmv6rwemyejhxbk@thinkpad> Sender: linux-acpi-owner@vger.kernel.org List-Id: linux-acpi@vger.kernel.org To: Ognjen Galic Cc: Andy Shevchenko , "Rafael J. Wysocki" , "Rafael J. Wysocki" , Len Brown , Robert Moore , Lv Zheng , ACPI Devel Maling List , devel@acpica.org, Darren Hart , Andy Shevchenko , Henrique de Moraes Holschuh , Sebastian Reichel , Platform Driver , ibm-acpi-devel@lists.sourceforge.net, Linux PM , =?UTF-8?Q?Christoph_B=C3=B6hmwalder?= , Kevin Locke On Wed, Feb 7, 2018 at 3:58 PM, Ognjen Galic wrote: > 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 ThinkPads. > > Lenovo ThinkPads have a ACPI extension that allows the setting of > start and stop charge thresholds in the EC and battery firmware > via ACPI. The thinkpad_acpi module can use this API to expose > sysfs attributes that it controls inside the ACPI battery driver > sysfs tree, under /sys/class/power_supply/BATN/. > > The file drivers/acpi/battery.h has been moved to > include/acpi/battery.h and the includes inside ac.c, sbs.c, and > battery.c have been adjusted to reflect that. > > When drivers hooks into the API, the API calls add_battery() for > each battery in the system that passes it a acpi_battery > struct. Then, the drivers can use device_create_file() to create > new sysfs attributes with that struct and identify the batteries > for per-battery attributes. > > Signed-off-by: Ognjen Galic This is a major update and for timing reasons I'd rather not try to rush it into 4.16-rc. If that's not a big issue, I'll queue it up for 4.17. Thanks, Rafael