SMAPI support for Linux

From ThinkWiki
Revision as of 20:33, 4 December 2005 by Thinker (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

ThinkPad laptops include a proprietary interface called SMAPI BIOS (System Management Application Program Interface) which provides some hardware control functionality that is not exposed by any other interface (e.g., ACPI).

The SMAPI interfaces changes a lot between models, and is poorly documented, so Linux support is not exhaustive for most models. There currently two SMAPI interfaces available: tpctl for older ThinkPads, and tp_smapi for newer ones.

These driver uses undocumented features and direct hardware access. They thus cannot be guaranteed to work, and may cause arbitrary damage (especially on models they weren't tested on).

Using tpctl and thinkpad

This solution consists of a module, called thinkpad, and a user-space tool caled tpctl. It provides very rich functionality for older ThinkPads, but on newer ThinkPads much of this functionality is exposed and supported through an ACPI interface and the SMAPI access does not work anymore. For details, see the README and list of supported models.

Project page:

Using tp_smapi

The tp_smapi kernel module uses the current SMAPI interface to expose some features of the SMAPI BIOS via a sysfs interface. Currently, the only implemented functionality is setting the battery charge start and stop thresholds. It has been posted here.


# wget -O - | \
  perl -ne '$a=!$a if m/^---/; next if !$a; $a++ if m/^$/; print if $a>1' | mmencode -u > tp_smapi-0.01.tgz


# tar xzvf tp_smapi-0.01.tgz
# cd tp_smapi-0.01
# make load

To install permanently (optional):

# make install
# modprobe tp_smapi


# 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
40 70

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

Other things that can be controlled through SMAPI, but are not supported in this version of the driver, include forcing battery discharge, disallowing 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.