[ltp] [ANN] tp_smapi - a new Linux SMAPI driver

Shem Multinymous linux-thinkpad@linux-thinkpad.org
Sun, 4 Dec 2005 14:56:57 +0200


------=_Part_19143_12847411.1133701017210
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

ThinkPad laptops include a proprietary interface called SMAPI BIOS
(System Management Application Program Interface) which provides some
hardware control functionality that is not accessible by other means.
The "thinkpad" module from the "tpctl" package used to provide
access to SMAPI functions, but does not work on recent models due to
drastic changes in the interface (and is mostly superceded by ACPI
functions anyway).

Attached is an initial release of a new driver which exposes features
of the SMAPI BIOS via a sysfs interface. Currently, the only
implemented functionality is setting the battery charge start and
stop thresholds.

Usage:

# tar xzvf tp_smapi-0.01.tgz
# cd tp_smapi-0.01
# less README
# make load
# echo 40 > /sys/devices/platform/smapi/start_charge_thresh
# echo 70 > /sys/devices/platform/smapi/stop_charge_thresh
# cat /sys/devices/platform/smapi/*_charge_thresh

The driver has only been tested on a ThinkPad T43, but the built-in
whitelist includes all recent ThinkPad models in order to facilitate testin=
g.
Please report your experience.

Other things that can be controlled through SMAPI, but are not supported
in this version of the driver, include forcing battery discharge, disallowi=
ng
battery charging, PCI bus power saving, CPU power saving control, extended
smart battery information and fan control. See the exported symbols in
PWRMGRIF.DLL for more hints. I don't plain to implement all those features,
but the current framework should be a good start for contributors.

WARNING:
This driver uses undocumented features and direct hardware access.
It thus cannot be guaranteed to work, and may cause arbitrary damage
(especially on models it wasn't tested on).

------=_Part_19143_12847411.1133701017210
Content-Type: application/x-gzip; name=tp_smapi-0.01.tgz
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="tp_smapi-0.01.tgz"

H4sIAF7nkkMAA+08+3vaxrL5Ff0VE27sgisw4Fdih5yLASec2sYf4Ca5p736hLQY1XpQSfhx0vzv
d2Z39UTYTpu29343+lIjdmdm5z2z0tJwoQWOvrBqjXqjuf3sT7kaeB3s7YnP/eynvJ41Gzu7u3v7
O3vN3WeNZvOg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