[ltp] Re: Generic battery interface

Henrique de Moraes Holschuh linux-thinkpad@linux-thinkpad.org
Thu, 27 Jul 2006 12:23:14 -0300


On Thu, 27 Jul 2006, Shem Multinymous wrote:
> On 7/27/06, Matthew Garrett <mjg59@srcf.ucam.org> wrote:
> >This would also be useful for the OLPC project - it's unlikely that
> >it'll use ACPI, but a more feature-rich interface than /proc/apm would
> >be massively helpful. This is just a matter of speccing out what
> >information is needed and what format it should be presented in, and
> >then adding a new device class, right?
> 
> Can we really assume there's one driver providing all battery-related
> attributes?

No, we cannot.  This is not true on ThinkPads, for example.  We *can* make
it true, but AFAIK that means overriding the entire generic ACPI battery
driver, and greating a "glue" thinkpad_battery one that does:

	1. generic ACPI battery access when ACPI is available
	2. thinkpad specific ACPI battery access when ACPI is available
	3. thinkpad specific EC firmware battery access (not ACPI).

That requires the new driver to use functions from ibm_acpi and tp_smapi,
plus the stuff in the generic acpi battery access driver.

It might be the best way to go for ThinkPads, actually.  Some rework on
ibm_acpi ain't that bad, and tp_smapi is already undergoing major surgery.

> In this particular case we could split the ACPI module into two, one
> module for events and one module for the sysfs interface, and load
> only the first one on ThinkPads. But that's only because tp_smapi
> happens to reproduce all of ACPI's attributes; there are probably
> other cases whether neither method dominates the other.

Yes.

> So, if we insist on a standard battery device class name, how do we
> cope with multiple sources of information and control functions?

Good question.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh